What is required for a scope in an injection framework?

Working with libraries like Seam, Guice and Spring I have become accustomed to dealing with variables within a scope. These libraries give you a handful of scopes and allow you to define your own. This is a very handy pattern for dealing with variable lifecycles and dependency injection. I have been trying to identify where scoping is the proper solution, or where another solution is more appropriate (context variable, singleton, etc). I have found that if the scope lifecycle is not well defined it is very difficult and often failure prone to manage injections in this way. I have searched on this topic but have found little discussion on the pattern. Is there some good articles discussing where to use scoping and what are required/suggested prerequisites for scoping? I interested in both reference discussion or your view on what is required or suggested for a proper scope implementation. Keep in mind that I am referring to scoping as a general idea, this includes things like globally scoped singletons, request or session scoped web variable, conversation scopes, and others. **Edit:** Some simple background on custom scopes: Google Guice custom scope Some definitions relevant to above: _“scoping”_ \- A set of requirements that define what objects get injected at what time. A simple example of this is Thread scope, based on a ThreadLocal. This scope would inject a variable based on what thread instantiated the class. Here's an example of this: _“context variable”_ \- A repository passed from one object to another holding relevant variables. Much like scoping this is a more brute force way of accessing variables based on the calling code. Example:               methodOne(Context context){         methodTwo(context);     }          methodTwo(Context context){         ...         //same context as method one, if called from method one     }      _“globally scoped singleton”_ \- Following the singleton pattern, there is one object per application instance. This applies to scopes because there is a basic lifecycle to this object: there is only one of these objects instantiated. Here's an example of a JSR330 Singleton scoped object:               @Singleton     public void SingletonExample{     ...     }      usage:               public class One {          @Inject          SingeltonExample example1;     }          public class Two {          @Inject          SingeltonExample example2;     }      After instantiation:               one.example1 == two.example2 //true;


What to legitimately charge clients for

I'm not talking about fixed price jobs, they're _fairly_ straightforward. But i'm on about an hourly rate project, my question specifically relates to what to charge for. If i have an IE/CSS issue that takes me an hour of scouring CSS to fix, is that chargeable? If i decide to use a really cool jQuery animation on their site but i need to get to grips with using it, do i charge them for the experimenting i do with the animation. Do you charge customers for something that they ask for, that you dont know about and therefore need to spend time learning? Its a grey area as far as i'm concerned and not clearly outlined in quotes (probably because not many clients would be happy to pay for your screw- up/learning) Whats the concensus on this?


OS equivalent of cookies

I am playing a MMORPG where I have to start a game client executable, and login through that game client. Somehow this game client manages to save my Username after I login with one. At first I thought that kind of information was saved in one of the game files, but after reinstalling the game my username was still there after I started the game client, meaning that username information is stored elsewhere. And so that leads to my question. Where does an executable, in this case a game client, store user information? This is analagous to how a browser uses cookies to store user info.


What are good reasons to use explicit interface implementation for the sole purpose of hiding members?

During one of my studies into the intricacies of C#, I came across an interesting passage concerning explicit interface implementation. `While this syntax is quite helpful when you need to resolve name clashes, you can use explicit interface implementation simply to hide more "advanced" members from the object level.` The difference between allowing the use of `object.method()` or requiring the casting of `((Interface)object).method()` seems like mean-spirited obfuscation to my inexperienced eyes. The text noted that this will hide the method from Intellisense at the object level, but why would you _want_ to do that if it was not necessary to avoid name conflicts?


Which classes should be autowired by Spring (when to use dependency injection)?

I have been using Dependency Injection in Spring for some time now, and I understand how it works and what are some pros and cons of using it. However, when I'm creating a new class I often wonder - Should this class be managed by Spring IOC Container? And I don't want to talk about differences between @Autowired annotation, XML configuration, setter injection, constructor injection, etc. My question is a general one. Let's say we have a Service with a Converter:               @Service     public class Service {              @Autowired         private Repository repository;              @Autowired         private Converter converter;              public List<CarDto> getAllCars() {             List<Car> cars = repository.findAll();             return converter.mapToDto(cars);         }     }          @Component     public class Converter {              public CarDto mapToDto(List<Car> cars) {             return new ArrayList<CarDto>(); // do the mapping here         }     }      Clearly, the converter doesn't have any dependencies, so it's not necessary for it to be autowired. But for me it seems better as autowired. Code is cleaner and easy to test. If I write this code without DI, the service will look like that:               @Service     public class Service {              @Autowired         private Repository repository;              public List<CarDto> getAllCars() {             List<Car> cars = repository.findAll();             Converter converter = new Converter();             return converter.mapToDto(cars);         }     }      Now it's much more difficult to test it. Moreover, new converter will be created for every convert operation, even though it's always in the same state, which seems like an overhead. There are some well known patterns in Spring MVC: Controllers using Services and Services using Repositories. Then, if Repository is autowired (which it usually is), then Service has to be autowired too. And this is quite clear. But when do we use @Component annotation? If you have some static util classes (like converters, mappers) - do you autowire them? Do you try to make all classes autowired? Then all the class dependencies are easy to inject (once again, easy to understand and easy to test). Or do you try to autowire only when it's absolutely necessary? I've spent some time looking for some general rules on when to use autowiring, but I couldn't find any specific tips. Usually, people talk about "do you use DI? (yes/no)" or "what type of dependency injection do you prefer", which doesn't answer my question. I would be grateful for any tips concerning this topic!


Do functional programming languages have more opportunity to do compile time optimization?

I was reading the book "Functional Programming for the Real World". It started with comparison between imperative and functional programming languages. And it stated how 'values' and 'expressions' in functional programming is different from 'variables' and 'functions' of imperative programming. From the discussion I sort of developed an idea that - > Functional programming languages have more opportunity to do compile time > optimization than their imperative counterparts. Is it true?


Is it necessary to have an Android device to learn programming for the Android? Currently, Java is my primary programming language.


Single Responsibility Principle: Responsibility unknown

I store sessions in a `SessionManager`. The session manager has a dependency to `ISessionPersister`. **SessionManager**               private readonly ISessionPersister sessionPersister;     public SessionManager(ISessionPersister sessionPersister)     {         this.sessionPersister = sessionPersister;     }         **ISessionPersister**               public interface ISessionPersister : IDisposable     {         void PersistSessions(Dictionary<string, ISession> sessions);     }      **Q: If my application shuts down how / where do I call`PersistSessions`? Who is responsible?** First Approach: Use Dispose in SessionManager                 protected virtual void Dispose(bool disposing)     {         if (disposing)         {            if (this.sessionPersister != null && this.sessionMap != null && this.sessionMap.Count > 0)            {                this.sessionPersister.PersistSessions(this.sessionMap);             }         }     }      Is that the way to go or are there any better solutions?


How should I handle logging when I create libraries for others?

All. I am creating some libraries for other teams in my company. They all have different logging mechanisms. I want to provide trace information of what my libraries are doing. What should I to achieve this? Thanks


What's the idiomatic name for a throwaway variable?

Velocity Template Language's set directive requires a variable on the left hand side. This doesn't work.               #set ( $entries.add("d") )      Even though I have no use for the return value of `add("d")`, I have to assign it to a variable.               #set ( $x = $entries.add("d") )       I want to communicate that the variable is necessary, but I have no intention of using it later. Is there a convention for naming variables that only exist to appease the compiler?


using flat file vs sqlite db for frequent data grabbing in a cron job

I have some automated task to be done using certain types of logs generated on the server end of each day. Log files contains specific machine identification "MAC" that is to be re-written in to another text file converted into machine's name. **SAMEPE LOG DATA FILES EACH CONTAINING ~2 MILLIONS LINES IN BINARY FORMAT** * * *               -----------|--------|-----------------|----|----------|---------     DATE       |TIME    |MAC_ADDRESS      |PORT|IP_ADDRESS|BLA BLAA     -----------|--------|-----------------|----|----------|----------     19-01-2014 |18:16:42|A3:43:31:11:02:1A|22  |     19-01-2014 |18:16:43|A3:43:31:11:12:1A|22  |     19-01-2014 |18:16:43|A3:43:31:11:12:1A|21  |     19-01-2014 |18:16:44|A3:43:31:11:12:22|80  |     19-01-2014 |18:16:44|A3:43:31:11:12:00|443 |     19-01-2014 |18:16:45|A3:43:31:AA:12:AA|5800|     19-01-2014 |18:16:46|A3:43:31:AA:30:1A|21  |      The above records I need them to be converted to text format, the MAC address replaced with machine name from my machine name database. My current program, read each line from the above file and find the machine name from machine name db matching the MAC_ADDRESS of read data and write each of them to text file. * * * This is my question. My program is written in `C` language. I have two option to manage the machine names DB, first is to have a sqlite db or else second option is to have a flat binary file. I consider the performance. I am afraid, using db for this would be less performance compare to file as it takes times for the connect/disconnect on processing of each line of log. even though, I am not clear on my point still. Please consider the number of records and suggest me whether is it better to use flat file for sqlite db for storing machine names records.


DDD: Service or Repository

I am developing an app in DDD manner. And I have a little problem with it. I have a Fare (airline fare) and FareRepository objects. And at some point I should load additional fare information (from a server, call server api) and setup this information to existing Fare. I guess that I need to create an Application Service (FareAdditionalInformationService) that will deal with obtaining data from the server and than update existing Fare or put the business logic in Fare object. However, some people said me that it is necessary to use FareRepository for this problem. I don't know wich place is better for my problem Service or Repository. **UPDATE:** After researching, I came to the conclusion, that the better place for fetching additional Fare information is a service like (AdditionalFareService). The code would look something like this:               //create service for fetching fare information     AdditionalFareService service = new AdditionalFareService();     //get a fare by Id     Fare fare = fareRepository.GetById(myFareId);     //Obtain information from service     var fareInformation=service.getAdditionalInformation(fare)     //Add it to the fare.     fare.AddInformation(fareInformation);     //save it to the repository.     fareRepository.Save(fare);


Is it considered 'reasonable' to implement a major part of a program largely by subclassing a library class?

I'm planning to implement a word processor using Java, and Swing for the GUI. I was thinking how I can implement the text area where the user types the text. My idea was to subclass `JTextArea`. It already has a lot of functionality for setting text, changing font size, etc. I will than add all the additional functionality, such as the ability to be affected by button presses on the UI, etc. This seems reasonable to me, however I have a question regarding this: **Is it considered reasonable in a 'serious' program, to implement a major part of the program by subclassing an existing class of a common library?** Is it a 'serious' and 'professional' thing to do? Of course professional developers use and subclass existing code all the time, no point in reinventing the wheel. But here I'm talking about **implementing a major part of the application** , probably the largest part, **largely by subclassing an existing library class.** I am not a professional, and I know I don't have to work 'as professionals do'. But I am interested in how professionals view this. **1-** Is something like this considered reasonable in a 'professional' application? **2-** Have you ever seen this in practice in a 'professional' application?


Does the "one assertion per test" rule apply for checking initial conditions?

I've been thinking about unit testing best practices and have come across the **one assertion per unit test** rule. I can see where this idea would help to isolate pieces of complex operations or verification when you have code like so:               private Place place;          @Test     public void test_whiteHouse(){        place = new place(KnownPlaces.WHITEHOUSE);        assertEquals("1600 Pennsylvania Avenue", place.getAddress());        assertEquals("Washington", place.getCity());        assertEquals("DC", place.getState());     }      I see where you would generally want to break it into smaller tests like this:               private Place place;          @Before     public void setUp(){        place = new place(KnownPlaces.WHITEHOUSE);     }          @Test     public void test_whiteHouse_street(){        assertEquals("1600 Pennsylvania Avenue", place.getAddress());     }          @Test     public void test_whiteHouse_city(){        assertEquals("Washington", place.getCity());     }          @Test     public void test_whiteHouse_state(){        assertEquals("DC", place.getState());     }      However, if I'm testing a setter, the code might look like this:               @Test     public void test_place_setCity(){        String newCity = "timbuktu";        Place place = new Place();        place.setCity(newCity);        assertEquals(newCity, place.getCity());     }      The test will run properly, but if there's a shared setup, I'm making assumptions about the initial state. What would be the downside on running a check on the initial state something like:               @Test     public void test_place_setCity(){        String newCity = "timbuktu";        Place place = new Place();        assertFalse(place.getCity().equals(newCity));        place.setCity(newCity);        assertEquals(newCity, place.getCity());     }      This check would verify that the setter method actually **_changed_** something by verifying the initial state was different than the final state. Otherwise, a change or malfunction in a constructor or setup method could cause the test to become ineffective. Are there any downsides to violating the one assert per constraint rule in this way?


Writing a company-wide developer's handbook

I work for a small company. The software development arm of the company before I was hired consisted of one self-taught overworked guy. Now that I've been writing software for the company for a few years, I have been tasked with establishing formal company-wide software development practices. We currently have no guidelines, other than > Write code, test it, put it in a .zip file and send it to the client. Bonus > points for TDD and version control. My boss wants me to write a software developer's handbook which defines the general processes, protocols, tools, and guidelines we use to get things done. In other words, he wants a "This is what we do here" book to make it easier to get a new employee familiar with the way we do things, as well as to help my boss understand what his minions are doing and how they do it. The way I see it, I'm laying a foundation and it needs to be done right. **How would you go about choosing topics for such a handbook?** Can you provide some example topics? Side Note: If it matters, we are primarily a Microsoft .NET shop. And we are looking at agile practices such as XP and Scrum, but we may have to heavily modify them to make them work in our company.


Economy simulation software

I am looking for a software that can simulate simple economics behaviour. For example, I would like to create 100 households, with different utility functions, then run the simulation and see how demands, supplies and prices develop over time. This can be an interesting way to see the formulas in action.


Need some advice and feedback on my code's design

I am looking for feedback on the design of my program. I have a shell script call function.sh that defines a lot of helper functions. My intent is to use those bash functions defined in functions.sh in a C program. I am doing this so that I don't have to rewrite the bash functionality (in functions.sh) again in C. I want to use one common library for functions I need (which is functions.sh). Here is my C code and functions.sh   C code:               #include <stdlib.h>     #include <sys/wait.h>     #include <stdio.h>          void shellCall(char * command)     {         int status, commandexitcode=0;         if(command == NULL)         {             printf("NULL command string sent\n");             exit(1);         }              status = system(command);              if(status == -1)         {             printf("Error during call, value %d\n", status);             exit(1);            }              if (WIFEXITED(status))          {             commandexitcode =  WEXITSTATUS(status);             if (commandexitcode != 0)             {                 printf("non zero exit code: %d\n", commandexitcode);                 exit(1);             }         }               else             if (WIFSIGNALED(status))         ...     }               int main(int argc,char **argv)     {         char  command[100]; //command         int i = 0;              for (i = 1 ; i <= 10 ; i++)         {             sprintf( command, "source $PWD/functions.sh ; i=%d ; myfunc %d", i,i );             shellCall(command);               }     }      functions.sh:               #!/bin/sh     # functions.sh          myfunc()     {         echo "I received $1"     }      Please note that I have only shown a very simple example of the way I am using functions in functions.sh. In reality functions.sh has many functions, some of which implement decent logic. * * * My Questions - I need feedback on the following aspects.   1. Is it a bad programming practice ( something that will make experienced and senior developers mad when they see this) to use system() calls to call functions in functions.sh as I have done?   2. If it is a bad practice, what are the reasons (technical and other) for which it is considered a bad programming practice?   3. What changes should I make to my C code so that experienced and senior developers will find it acceptable?


Can methods in an OOP language be considered as some kind of closure?

Consider a method _m_ of a class A in an object-oriented language like Java or C++. In the body of the method _m_ it is possible to reference the member variables of the object on which the method is invoked. These variables are not defined in the method itself but are bound in the moment in which the method is invoked. Is this the same mechanism used for closures (binding non-local names using the context) or, if not, what are the differences? In other words, would it be possible to view an object with its methods as a collection of closures (the methods) that are closed over some common data (the object's member variables)?


How are interrupts implemented in practice?

Consider an USB device that is receiving data over a wireless network and an application running on the PC is reading this data. Now, on many languages (consider C# DataReceived), we have event handling mechanisms to detect if Data has arrived or not. My question is, how is this event detecting mechanism implemented? Is it like, a running timer which periodically checks to inspect arrival of data, or is this something the hardware has to support? In general, how are these changes in hardware state events implemented?


Is there a way to set up a more comfortable, app-store-like install-page for build results from Xcode continuous integration?

I successfully setup a xcoderserver to do ci builds. On every bot's page there is an installation-link-button, which works well for developers. However, for our qa department, i'd like to provide a more app-store-like webpage showing all bot's build results with app name and icon from where they can install the **very same** archives as provided on the "normal" bot page. Is there an easy, or even apple-documented way to do so? Has anyone any ideas how to do that manually? I already found where builds are stored on disk, I also found out that a product-install-link looks like `http://<SERVER_NAME>/xcs/install/<PRODUCT_GUID>` . The productGUID is dynamically generated during the bot's run. The Xcode server webpage retrieves the productGUID via requests to the Xcode webapp which responses with json structures containing a lot of information about the bot run. I hoped for having access to the productGUID on that way too, but it turned out, that these requests need a (also dynamically generated) bot-run-ID...


Binary Tree Address Conflictions

I wrote a post on a similar topic yesterday about my destructor for my Huffman tree class program. I have since isolated an issue with how my tree is being built that has me pretty baffled at the moment. I'll share the code below, along with what exactly the program is spitting out into memory. It's my current theory concerning my weird memory location issue (which is discussed further below), that there is something funky going on with the list I'm using. Memory locations are being swapped around. For instance, when a parent node is created, this parent node should show up again when it's popped out of the list, but it's coming out with a different memory location. Could this be the source of my issue? But why is it doing that?               Huffman :: Huffman (list <BTree> nodes)     {         nodes.sort(); //Get it into ascending order         BTree *one, *two, *temp;              while (nodes.size() > 1)         {             one = &nodes.front();             nodes.pop_front();             two = &nodes.front();             nodes.pop_front();                  temp = insert(one, two);                  nodes.push_back(*temp);             nodes.sort();                  //reset(temp);             //reset(one);             //reset(two);         }              root = temp;              //createCodes();         nodes.pop_front();     }          BTree* Huffman :: reset(BTree *in)     {         in->setData(0);         in->setLeft(0);         in->setRight(0);              return in;     }          BTree* Huffman :: insert(BTree *lower, BTree *higher)     {         BTree *tree = new BTree;         tree->setLeft(lower);         tree->setRight(higher);              tree->setData(lower->getData() + higher->getData());              return tree;     }      Oh, and here is the main which is putting the nodes onto the list:               int main()      {         ifstream fin("assign15.in");         list <BTree> nodes;         int frequency;         char letter;              if (fin.fail())         {             cout << "Error opening 'assign15.in'... Terminating...\n";             exit(1);         }              for (int i = 0; i < 26; i++)         {             fin >> frequency;             letter = 'a' + i;             BTree *temp = new BTree;             temp->setData(frequency);             temp->setLetter(letter);             nodes.push_front(*temp);         }              fin.close();              Huffman tree(nodes);              return 0;     }      Below is the detailed step by step function. The loop loads two nodes from the linked list onto the temp variables 'one' and 'two'. The addresses to each of these nodes is given. Then, a new temp node is created with 'one' and 'two' as children. The temp node is then pushed onto the list. **Notes:** The address of all the 'temp' nodes are unique. However, it doesn't seem like this address is being saved to the list. Many addresses are recurring within the output, showing the issues, but why is it doing this?               One set to 9(0xdb7650)         Two set to 10(0xdb7a50)     pushing parent node with values:     (0xdb6a40)P: 19 - L: 9 - R: 10          One set to 19(0xdb7a50)         Two set to 20(0xdb76d0)     pushing parent node with values:     (0xdb6a70)P: 39 - L: 19 - R: 20          One set to 20(0xdb7890)         Two set to 39(0xdb76d0)     pushing parent node with values:     (0xdb6aa0)P: 59 - L: 20 - R: 39          One set to 52(0xdb7a10)         Two set to 59(0xdb76d0)     pushing parent node with values:     (0xdb6ad0)P: 111 - L: 52 - R: 59          One set to 93(0xdb7750)         Two set to 111(0xdb76d0)     pushing parent node with values:     (0xdb6b00)P: 204 - L: 93 - R: 111          One set to 161(0xdb7b10)         Two set to 162(0xdb7c50)     pushing parent node with values:     (0xdb6b30)P: 323 - L: 161 - R: 162          One set to 188(0xdb7690)         Two set to 203(0xdb7710)     pushing parent node with values:     (0xdb6b60)P: 391 - L: 188 - R: 203          One set to 204(0xdb76d0)         Two set to 225(0xdb7990)     pushing parent node with values:     (0xdb6b90)P: 429 - L: 204 - R: 225          One set to 228(0xdb7b50)         Two set to 229(0xdb78d0)     pushing parent node with values:     (0xdb6bc0)P: 457 - L: 228 - R: 229          One set to 310(0xdb7790)         Two set to 320(0xdb7c10)     pushing parent node with values:     (0xdb6bf0)P: 630 - L: 310 - R: 320          One set to 323(0xdb7c50)         Two set to 365(0xdb7bd0)     pushing parent node with values:     (0xdb6c20)P: 688 - L: 323 - R: 365          One set to 391(0xdb7710)         Two set to 403(0xdb79d0)     pushing parent node with values:     (0xdb6c50)P: 794 - L: 391 - R: 403          One set to 429(0xdb7990)         Two set to 457(0xdb78d0)     pushing parent node with values:     (0xdb6c80)P: 886 - L: 429 - R: 457          One set to 514(0xdb7ad0)         Two set to 603(0xdb7850)     pushing parent node with values:     (0xdb6cb0)P: 1117 - L: 514 - R: 603          One set to 630(0xdb7c10)         Two set to 659(0xdb7810)     pushing parent node with values:     (0xdb6ce0)P: 1289 - L: 630 - R: 659          One set to 688(0xdb7bd0)         Two set to 718(0xdb7a90)     pushing parent node with values:     (0xdb6d10)P: 1406 - L: 688 - R: 718          One set to 719(0xdb7950)         Two set to 794(0xdb79d0)     pushing parent node with values:     (0xdb6d40)P: 1513 - L: 719 - R: 794          One set to 794(0xdb7910)         Two set to 805(0xdb7c90)     pushing parent node with values:     (0xdb6d70)P: 1599 - L: 794 - R: 805          One set to 886(0xdb78d0)         Two set to 959(0xdb77d0)     pushing parent node with values:     (0xdb6da0)P: 1845 - L: 886 - R: 959          One set to 1117(0xdb7850)         Two set to 1231(0xdb7b90)     pushing parent node with values:     (0xdb6dd0)P: 2348 - L: 1117 - R: 1231          One set to 1289(0xdb7810)         Two set to 1406(0xdb7a90)     pushing parent node with values:     (0xdb6e00)P: 2695 - L: 1289 - R: 1406          One set to 1513(0xdb79d0)         Two set to 1599(0xdb7c90)     pushing parent node with values:     (0xdb6e30)P: 3112 - L: 1513 - R: 1599          One set to 1845(0xdb77d0)         Two set to 2348(0xdb7b90)     pushing parent node with values:     (0xdb6e60)P: 4193 - L: 1845 - R: 2348          One set to 2695(0xdb7a90)         Two set to 3112(0xdb7c90)     pushing parent node with values:     (0xdb6e90)P: 5807 - L: 2695 - R: 3112          One set to 4193(0xdb7b90)         Two set to 5807(0xdb7c90)     pushing parent node with values:     (0xdb6ec0)P: 10000 - L: 4193 - R: 5807


Suggested method for extracting a standalone C library from an existing R package?

My group has been developing an R package to simulate plant growth (see GitHub repository). The R package uses `.Call` to interface with C. We have decided that it would be worthwhile to create a standalone C library. The two key reasons are 1) to use familiar C debugging tools and 2) a large portion of the developer / user community is familiar with compiled languages (mostly models in the class are written in C or Fortran). However, the R package is accessible to many outside this community, so we want to maintain its functionality. I have reviewed some related questions, e.g. http://stackoverflow.com/q/12328156/199217, that discuss R packages with C library dependencies, but have not found one that deals specifically with decoupling an existing R package. ### A proposed approach (what we have come up with so far ... a strawman)   1. Write tests for existing functionality   2. keep the C library inside the `src/` folder   3. Place R-specific C code (e.g. `SEXP`, loading R libraries, etc) into 'R wrapper' files prepended with `R_*`   4. create separate functions for reading configuration files in C   5. create a 'main' C function to replace functionality in R   6. write a makefile for the C library that ignores R wrapper files   7. Once the C library works independently and equivalently to the R package, we could consider moving the C functions to a separate repository, that would be a dependency for the R package ### Questions:   1. Is this effort misguided?   2. Are we overlooking any potential pitfalls?   3. Is there a better way to develop both the R and C libraries in parallel?   4. Are there any examples of C libraries that have been decoupled from R packages?   5. How might we write tests to compare equivalent functions in R and C?


Use of AGPL software on server with closed-source software

I need to use some software under the AGPL to populate a database with some data. This software has a web interface, which I shall disable. Then the data will be used "at arms length" with closed-source software by reading the database. I may also use some IPC, like datagram sockets to provide a bridge between the AGPL software and the other software. This closed sourced software will provide a web interface to the user. Am I right that it is not breaking the AGPL to have this software as closed source? If I modify the AGPL software, am I able to hide these modifications, so long that the software doesn't provide any network interface to other users?


Add an ID in every table even if it's not needed?

Is this good or bad design to add, by default, ID field in every table in a database, even when you don't see currently to usage of this ID (For instance in a MxN table) ?


UML Class Diagram: How can I represent "orthogonal" generalizations (or multi-inheritence)?

I try to represent in a UML Class Diagram the following object and features:   * The Object: A System (e.g. an electronic device) that can be of Type A, B or C   * If the System is of type A, it has a specific extra attribute (let say "sub-type", which values can be A1 or A2) I created a Class named "System" and:   1. Created a class "System_TypeA" that holds an extra attribute named "subSystem" that can take any value within A1 and A2.    2. Created a generalization relationship beteween the two classes ("System_TypeA" _is a_ "System") So far, so good. Now, each System can be the backup system of other Systems. If this is the case, the System should hold a collection of references of the systems it is backing-up So for this feature, I also created a Class named "Backup_System" and created generalization between the two classes, since a "Backup_System" _is a_ "System". So how to represent in the Class Diagram the fact that there can be Systems of Type A that are Backup systems (i.e. the problem of multiple inheritance)?? (For info, the implementation should be done in java, so the same problem of multi-inheritance will be faced at implementation.)


Why is implementing copy-paste in a touch screen based smartphone such a big deal?

When Apple didn't implement copy-pasting on the iPhone since version 1, I had just assumed it was a UI issue (Eg. they were waiting until they figured out a good UI for it). Now however the idea is out there and Microsoft still released Windows Phone 7 without copy-paste functionality, promising it will be ready in a _few months_. My question is: Why does this takes a few months to implement? Are there some technological challenges that are unique to programming for a touch screen that I'm not familiar with? For that matter, what are the unique challenges in doing X in a touch screen app?


What is the relationship between the time it takes to develop N lines of code and 4N lines of code?

It took me time T to develop program A, which is measured at 1000 lines of code (SLOC), in certain a language and domain and of a certain complexity. Is there a method to determine how much time it will take to develop program B, which is estimated to be 4000 lines, that has the same level of complexity, is in the same domain, and is developed in the same programming language? I expect that the time it takes me will be grater than 4T. Is there a formula to estimate how T grows as SLOC count grows?


Completion time on a company where the supervisors don't know programming

We are in a small company with around 10 developers. I am the team leader and responsible for the development process. Supervisors and salesmen are close to us since we are a small team, but have no clue on how software is developed. When they ask me how much time I want for a change (bugfixes/features) in a product, my response is 'let me calculate it'. After giving them the schedule, they start by saying OK you can do it in XX time which differs a lot from my plan. We are using a model close to Agile basic principles and have circles per week or per three days. Of course I argue and say that this cannot be done. They seem to have no idea on the effort we are doing. They do not want to see `WHY` my schedule is for that amount of time. I know this behavior is stupid, but how can I make them see the problem?


Branching Strategy for Test Environment

We will be starting a new project this month. The project will be 1 year and production deployment will only occur towards the end of the project. We will be doing iterative development (1 month per iteration), so this means we will drop features to Test environment at the end of each iteration for QA testing. Our branching strategy is:   1. Trunk - All development will happen on trunk.   2. Feature Branch - Branches off trunk will be created on a per need basis for development of large features which could potentially be breaking if done on trunk   3. QA Release Branches - At the end of each iteration, a branch of trunk will be created. This branch (which includes a version number) will be released to Test environment. All critical and blocking bugs found in this version will be fixed on this branch and fixes will have to be merged to trunk. Non-critical/trivial bugs will not be addressed on the QA release branch and will only be fixed in trunk since the QA release branch will be thrown away after the end of the next iteration where a new release branch will be created off trunk.   4. Production Branch - this will be the latest QA release branch at the end of the project. This will be tagged and all production bug fixes will be on this branch and merged to trunk. Is this a correct branching strategy? Is there anything else that we've missed to consider? We're using SVN.


General tips on writing specs for Java programmers

I found myself in a pickle after writing some specs for freelance programmers that I hire. It seems that I'm missing some basic structure and I'm not placing the points in clear enough view for the programmer to understand. Any advice that would help me convey the specs better to an average Java developer would be very helpful. **For example:** * * * I have spring project that is very complex at this point. And I'm hiring people to integrated all sorts of payment, social and authentication APIs. (it is the site in my profile if you want to have visual example) As far as they are concerned they will be working only with small segment of the project so no need for the big picture. I require first sample application that will perform what I need outside of the spring container. Than I have the developer integrate the logic into existing system. In specs I usually traverse the input from UI to the the database, with little examples here and there. What I found is helpful to just make draft of the specs and have the developer put his input in it and then adjust the specs after. * * *


feature request in language design?

How do language designers decide when a _`feature`_ should go in a library as an extension or when it needs to have support from the core language?


I don't understand the definition of side effects

> **Possible Duplicate:**   >  What is a “side effect?” I don't understand the wikipedia article on Side Effects: > In computer science, a function or expression is said to have a side effect > if, in addition to returning a value, it also 1.) Modifies some state or 2.) > Has an observable interaction with calling functions or the outside world. I know an example of the first thing that causes a function or expression to have side effects - **modifying a state** Function and Expression **modifying a state** : 1.)               foo(int X)     {     return x = x % x;     }          a = a + 1;      What does 2.) - **Has an observable interaction with calling functions or the outside world," mean?** \- Please give an example. The article continues on to say, "For example, a function might modify a global or static variable, modify one of its arguments, raise an exception, write data to a display or file, read data, or call other side-effecting functions...." Are all these examples, examples of 1.) - **Modifiying some state** , or are they also part of 2.) - **Has an observable interaction with calling functions or the outside world?**


MapReduce explained with diagrams?

I'm searching for an explanation of how MapReduce works with visuals. Specifically, a flow chart of actions and pictures of how it deals with information on the stack/memory in parallel to return. Does anyone have source for this?


The Inglish parser (for The Hobbit 1982)

Was fascinated to read about the text adventure game The Hobbit which featured an incredibly robust parser called "Inglish": > ...Inglish allowed one to type advanced sentences such as "ask Gandalf about > the curious map then take sword and kill troll with it". The parser was > complex and intuitive, introducing pronouns, adverbs ("viciously attack the > goblin"), punctuation and prepositions and allowing the player to interact > with the game world in ways not previously possible. I'm wondering if anyone knows about the history and/or legacy of the Inglish parser engine and the programmer(s) who developed it.


Coded ui to measure performance

I have been tasked with using coded UI to measure performance on a proprietary windows desktop application. The need is to measure how long it takes for the next page/screen to display after a user clicks on a control. For example - a user enters their ID and PW and clicks sign-in. The need is to measure how long it takes for the next screen to display when the user clicks the sign-in button. I understand the need to define what indicates the screen is loaded and ready for use. One approach is to use control.WaitForControlReady and use BeginTimer/EndTimer. Is coded ui a dependable and accurate way of measuring time?   Is WaitForControlReady the best method to determine when a control is ready for use?


Is there a way to created nested computation expressions?

In F#, I want to build a hierarchical data structure in a way with a minimum amount of language noise. The actual problem is trying to build an RSpec inspired framework using F#. RSpec allows the construction of tests in a nested way. For example.               describe Order do       context "with no items" do         it "behaves one way" do           # ...         end       end            context "with one item" do         it "behaves another way" do           # ...         end       end     end      I have something working here, but there are some potential problems with the current solution. In particular general setup/teardown code can become somewhat ugly. My primary concern is to write an API that allows the user to write tests/specifications in a way, where the language gets as little in the way as possible. I think that using computation expressions could allow my to create a better API, but I am struggling with implementing nested contexts. Currently I do have a builder that allows me to write:               let specs =         describe "Some feature" {             it "has some behavior" (fun () ->                  // Test code goes here             )         }      But in order to have nested contexts I need to be able to write something like this:               let specs =         describe "Some feature" {             describe "in some context" {                 it "has some behavior" (fun () ->                      // Test code goes here                 )             }             describe "in some other context" {                 it "has some behavior" (fun () ->                      // Test code goes here                 )             }         }      I have no idea how to implement the nested context. Or even if it is possible to bend F# in a way to allow me to create such a builder. I did make an experiment, that allowed me to write this:               let specs =         desribe "Some feature" {             child (describe "in some other" {                 it "has some behavior" (fun () ->                      // Test code goes here                 )             })             child (describe "in some context" {                 it "has some behavior" (fun () ->                      // Test code goes here                 )             })         }      But the added parenthesis and explicit builder construction is exactly what I want to avoid in the first place.               type DescribeBuilder(name : string) =         [<CustomOperation("it")>]         member __.It (x, name, test : unit -> unit) =             let t = TestContext.createTest name test             x |> TestContext.addTest t         [<CustomOperation("child")>]         member __.Child(x, child :TestContext.T) =             x |> TestContext.addChildContext child         member __.Yield y =             TestContext.create name         member __.Delay (x) =             x()     let describe name = new DescribeBuilder(name)


How would Functional Programming proponents answer this statement in Code Complete?

On page 839 of the second edition, Steve McConnell is discussing all the ways that programmers can "conquer complexity" in big programs. His tips culminate with this statement: "Object-oriented programming provides a level of abstraction that applies to **algorithms and data at the same time** , a kind of abstraction that functional decomposition alone didn't provide." Coupled with his conclusion that "reducing complexity is arguably the most important key to being an effective programmer" (same page), this seems to pretty much a challenge to functional programming. The debate between FP and OO is often framed by FP proponents around the issues of complexity that derives specifically from the challenges of concurrency or parallelization. But concurrency is certainly not the only kind of complexity software programmers need to conquer. Perhaps focusing on reducing one sort of complexity increases it greatly in other dimensions, such that for many cases, the gain is not worth the cost. If we shifted the terms of the comparison between FP and OO from particular issues like concurrency or reusability to the management of global complexity, how would that debate look? **EDIT** The contrast I wanted to highlight is that OO seems to encapsulate and abstract away from the complexity of both data and algorithms, whereas functional programming seems encourage leaving the implementation details of data structures more "exposed" throughout the program. See, e.g., Stuart Halloway (a Clojure FP proponent) here saying that "the over-specification of data types" is "negative consequence of idiomatic OO style" and favoring conceptualizing an AddressBook as a simple vector or map instead of a richer OO object with additional (non-vectorish & non-maplike) properties and methods. (Also, OO and Domain-Driven Design proponents may say that exposing an AddressBook as a vector or map overexposes the encapsulated data to methods that are irrelevant or even dangerous from the standpoint of the domain).


What is good programming practice for structuring java project?

I have a Java project that is getting to be relatively large (a few thousand lines in all, I'd say). It's definitely a lot larger than what I've dealt with before, being that I am still a relatively new programmer. I have a class structure with my swing components and other classes I have made that, more and more, is becoming confusing. Even as a beginner, I can tell this wouldn't be considered "good programming practice". It's somewhat difficult to explain, and I cannot simply copy/paste code, as this is really dealing with the whole program. But I will do my best to explain... As an example, I have a "Minion" class, and Minion objects will sometimes do something that needs to update a "levelGUI", an extended JPanel. How do they access this levelGUI? I will tell them something like "Game.getLevelGUI().someMethod()" and that just looks sloppy. Am I wrong? The problem is that I have gotten ahead of myself in actual programming, relative to my understand of how the structure of said program works. I think what I will end up with, if I continue down this path, is a program that works as I intended, but with poor readability and great difficulty in altering down the road. If this seems a difficult question to answer, links to articles which could explain how a large hierarchy of objects effectively "interact" or something to that effect... would be VERY helpful (I'm not being lazy, I have looked and looked, trying to find something).


What is the recommended way to go about porting large code bases?

I am currently porting a large library (150+ files, 15k+ LOC) from Javascript to Java. Fortunately, the original library is already very object-oriented, so this has largely been a matter of reformulating the existing code into classes. Truth be told, I'm a bit of a novice and this is one of my first large scale projects. In the past, I've written, tested, and debugged projects incrementally - get something running, add a feature, test that it still runs, and repeat. In this case, I can't compile the entire library until it's nearly completed, which makes checking calls between classes difficult and time- consuming. After importing the project into Intellij, I was able to perform some static code analysis to check for straightforward errors in syntax and style, but this is often insufficient and does not catch many of the errors the compiler would, especially those outside of the scope of a single file. What is the best plan of attack here? I've attempted to break it down into smaller, compilable pieces, but the code is tightly coupled for the most part, so this may not reduce the problem much.


Scale an image with unscalable parts

Brief description of problem: imagine having some vector picture(s) and text annotations on the sides outside of the picture(s). ![enter image description here](http://i.stack.imgur.com/KwO9Z.png) Now the task is to scale the whole composition while preserving the aspect ratio in order to fit some view-port. The tricky part is that the text is not scalable only the picture(s). The distance between text and the image is still relative to the whole image, but the text size is always a constant. Example: let's assume that our total composition is two times larger than a view-port. Then we can just scale it by `1/2`. But because the text parts are a fixed font size, they will become larger than we expect and won't fit in the view-port. One option I can think of is an iterative process where we repeatedly scale our composition until the delta between it and the view-port satisfies some precision. But this algorithm is quite costly as it involves working with the graphics and the image may be composed of a lot of components which will lead to a lot of matrix computations. What's more, this solution seems to be hard to debug, extend, etc. Are there any other approaches to solving this scaling problem?


what is a language specification?

Either I am being a total n00b or just not with it today but I have been reading a few blogs lately and they talk about language specs. What actually is a language spec? Is php.net a language spec? The best article so far I have read is Grokbase on the PHP Language Specification.


How many developers actually have private offices?

So I know everyone here is all about private offices, how many developers actually have them. I am sort of half skeptical. I can believe that lead developers have them, but thats normally just one person in your average office. If it would not be to much to ask:   * Do you work in a totally awesome office or a nasty old cube? (or somewhere in between)   * What's your relative rank in the office? (junior, programmer II, senior, lead, etc.)   * are you doing internal software, or are you in a software-centric environment? (the general thought seems to be that internal developers get cubes while others live in "Joel-Spolsky-Programmer-Candyland")


What factors to consider when choosing runtime/language for Windows desktop applications?

My users all have Windows. Some of them use Linux or a Mac, but if they do they're generally capable of using something like Mono, Wine, Parallels or dual-boot. My development team (including myself) has extensive experience both in writing Swing applications in Java as well as Windows Forms in C#. "Extensive" means we've developed and shipped over three applications on both runtimes. The applications are technical analysis applications, so mild on database interaction, but heavy on custom UI and data set sizes. We're coming to the point where we really want to make a decision as to which platform to focus on from now on, since it's becoming a burden to support both (if you're working in Swing for half a year it's too much hassle to get used to Windows Forms again and the other way around) and we want everyone in our team to be capable of working on all of our applications.   * Windows Forms generally takes less work to make recognizable Windows applications. No amount of skinning and custom controls in Java has solved that over the years. At the same time, we've never had a customer that couldn't use the Swing applications.   * Java used to have a much richer ecosystem in terms of libraries and automated build tools, but that's changing rapidly (Java is not going down, it's more that .NET is catching up).   * For the rare case that multiplatform is preferred, Java beats .NET hands down. Mono is wonderful, but it's still more work than Java. If we choose .NET we can start to focus on WPF, but also start using F#. If we choose Java, we can start to focus on RCP, but also start using Scala. Has anyone had to make a similar decision? If so, what was it and what influenced you the most? Any top concerns I'm missing? (Please note: there are some similar questions on Programmers.SE already, but they're either unconstructive or from a different angle.)


Why don't browsers have the ability to differentiate between events triggered via input devices and scripts ex: element.onEvent()? Wouldn't this be a very simple way counter attack web spam bots? Or am I way off on this?


Is there an explicit word for non-abstract class?

I got mainly abstract classes in my project and there are a few other class which are using/inheriting them. When I'm writing the documentation I would like to specify that a part of it is just about the behavior of these non- abstract classes, but I found using this word silly. I could just say it's a class, however an abstract class is a class as well. So I was wondering **_is there an explicit word/synonym for non-abstract class?_** SEO update: What is the general name of non-abstract classes?


What are the drawbacks of Python?

Python seems all the rage these days, and not undeservingly - for it is truly a language with which one almost enjoys being given a new problem to solve. But, as a _wise man_ once said (calling him a _wise man_ only because I've no idea as to who actually said it; not sure whether he was that wise at all), to really know a language one does not only know its syntax, design, etc., advantages but also its drawbacks. No language is perfect, some are just better than others. So, what would be in your opinion, objective drawbacks of Python. _Note: I'm not asking for a language comparison here (i.e. C# is better than Python because ... yadda yadda yadda) - more of an objective (to some level) opinion which language features are badly designed, whether, what are maybe some you're missing in it and so on. If must use another language as a comparison, but only to illustrate a point which would be hard to elaborate on otherwise (i.e. for ease of understanding)_


Are closures sufficient to characterize functional programming?

All functional programming languages that I know of (e.g. Haskell, Scala, Scheme, Clojure, SML, OCaml, ...) support a notion of closures. Also, I often read that a language X can be considered functional because it supports closures. On the other hand there are programming languages that do have closures but are **not** considered functional. The best example I know of is Smalltalk: Smalltalk has blocks (which in most implementations behave like closures, see e.g. here) but it is considered a pure object-oriented language. So, while closures are a very common (or even essential) construct in functional programming, are they really sufficient to characterize functional programming? If the support of closures is sufficient for considering a language functional, why isn't Smalltalk considered functional too? Or is the notion of a closure orthogonal to both functional and object- oriented programming?


Does anyone make money with turnkey software versions of costly software?

For example, Say I make a business software product. I sell it for $100. The competitors charge thousands for their version. Does that kind of model work? Do company's ever buy software turnkey like that? No support. No nothing. They just spend $100. Sure there are continuing efforts to improve the product but no guarantees, etc. I do not want it to be open source. I do not want to offer support other than very minor things like support forums. I don't want to make junk. I can't quit my full time job to travel around the country supporting software. edit: They can even see the code, tweak it, etc. They can't sell it though. Close to some CC licenses I've seen, but you get the drift I hope.


What to do when all solutions are equally bad?

Sometimes, after having done a very thorough analysis/research, you can think of a number of solutions to a problem, but they all have considerable downsides. What do you do in such a situation? For example, I can think of a number of options:   * Randomly choose one of the solutions.   * Postpone the issue, do something else in the meanwhile, and revisit the problem a few months later.   * Find someone who is willing to take the decision (and therefore also the responsibility) for you?   * Obstinately keep on looking for alternative solutions.   * Find people to discuss it with, and hope for a moment of clarity.   * Leave the current situation unchanged; that is: don't solve the problem at all.


Why is it that MS Data Access story is so fractured ? Is it the nature of Data Access or is just MS?

This StackOverflow question asks "where can I get Microsoft.Data.Objects" It turns out the answer was probably that its in the CTP4 (code first) release of Entity Framework 4 However there where a lot of guesses. Including   * System.Data   * Entity Framework   * Microsoft.ApplicationBlocks.Data    * Microsoft.Practices.EnterpriseLibrary.Data 10 years ago if someone asked a similar question for they might have gotten DAO, RDO, ADO. Is this just the nature of the beast or is it MS. Does this pattern happen with other vendors? Where the base data access strategy is either wrapped or changed?


A good analogy for computer memory?

So, I'm a computer science major and I'm also a huge fan of the no-longer-on- TV show, Numb3rs. Now, whenever I talk with my friends they also ask me quite a few questions about programming and computers (and how they work). Now, on Numb3rs, they (Charlie, and occasionally Amita or Larry) often went on short, but well explained and well spoken summaries of the mathematical topic. While they had the benefits of graphics, often their voices alone were plenty to explain. Basically, they took complex concepts and presented them in laymens terms. It was short, concise, easy to understand, and very interesting. Basically, I'm looking for something like that. Just a really great, short, interesting analogy for computer memory. So, thanks to whoever can come up with a brief, interesting, engaging, enjoyable, but educational and correct analogy/summary for computer memory!


Is there an established convention for separating Windows file names in a string?

I have a function which needs to output a string containing a list of file paths. I can choose the separation character but I cannot change the data type (e.g. I cannot return a `List<string>` or something like that). Wanting to use some well-established convention, my first intuition was to use the semicolon, similar to what Windows's `PATH` and Java's `CLASSPATH` (on Windows) environment variables do:               C:\somedir\somefile.txt;C:\someotherdir\someotherfile.txt      However, I was surprised to notice that `;` is a _valid character_ in an NTFS file name. So, is the established best practice to   * just ignore this fact (i.e. "no sane person should use `;` in a file name and if they do, it's their own fault") or   * is there some other _established_ character for separating Windows paths or files? (The pipe (`|`) might be a good choice, but I have not seen it used anywhere yet for this purpose.)


Entity Framework and "ViewModel"

Earlier I asked a question about "Entity Framework and layer seperation" and found out that some people use a ViewModel to show their data in the UI. For example if we got a "Person" table and an "Address" table and I want to show a combination of the two tables. I would then create a ViewModel, lets call it PersonAddress, and show it on the UI. I have a few questions regarding this:   1. How do you best save the "PersonAddress" object to the database since it does not exist in my EF context?   2. If I only wanted to show the "Person" object, would I still create an identical "ViewModel" object to the one EF creates for me (without the EF specific properties ofcourse)   3. Do people use the "EntityState" property and dosent it become useless if you only interact with the "ViewModel"?


how does record placement affect sequential reading time, in the following cases

When I study from lecture slides from the web in (File Structures lesson), I stacked at the below question, I coudn't understand it. In the slide and at the web, I searched about the topic but I cannot find any explanatory solution about the question. Could somebody please explain the answer with the details? > Given a file of 30000 records, 1600 bytes each, and block size 2400 bytes, > how does record placement affect sequential reading time, in the following > cases? Discuss: > >   1. Empty space in blocks-internal fragmentation. >   2. Records overlap block boundaries. > The slide can be accessed from the link : http://tr.scribd.com/doc/14991462/24/Fast-Sequential-Reading


Can a scrum master reprimand his team?

Scrum master is a facilitator for the delivery team and acts as a bridge between Project Management and the team. In course of time if he realizes that his team is not delivering the deliverables perfectly possible w.r.t competency of his team, can he question his team members why it is not happening? It is more like a show-cause notice to them. He knows why it is not happening eg:- spending time on social sites or wasting time on less important issues. Is it okay for him to say "reprimand" the delivery team on their style of working? Or should it be escalated and left for the functional managers to deal with it? Important thing to note is that usually in an Org, the scrum master is a good friend with his team and so it makes all the more awkward to react to such a situation.


How to extend Constructor Injection?

Suppose I have `MyClass` with a very simple dependency. It uses constructor injection.               public class MyClass : IMyClass     {         private IA A;              public MyClass(IA a)         {             A = a;         }     }      This code get shipped and some other developers are using it.   At some point in the future I need to add in a second dependency, on IB. **How should I add this dependency on IB?** Some options, and why I disapprove:   * Just add it to the constructor      * Braking change.   * Inheritance or the decorator pattern.      * Extra classes and code bloat.     * New class will have boilerplate code passing around the IA.     * I have no guarantee that other developers will switch to using the new class.   * Use a service locator to populate the new IB field.      * I'm now using two different types of injection for extra confusion. It seems to me that constructor injection is just not easily extensible.


How does strengthening of pre conditions and weakening of post conditions violate Liskov Substitution principle?

I read that Liskov substitution principle is violated if :   1. Pre conditions are strengthened .   2. Post conditions are eased out. But I don't get fully yet how these two points would violate Liskov Substitution principle . Can some one please explain with an example. Specifically how would any one of the above conditions cause a situation where a subclass object can not be substituted for a superclass object ?


How to handle situation of programmer stealing credit for your project

There is a coworker who has stolen credit for my work. I created a system that will show live statuses of printing machines throughout the plant. There was one glitch in it so the coworker made an improvement and then re-wrote the entire system (copying 90% of my code, yet he added a new piece of hardware then took over the project). Now he asks me programming questions from time to time. I don't mind teaching coworkers how to program, but since he has stolen my ideas and credit in the past I am reluctant to teach him all I know. Today he asks me for a particularly challenging algorithm for this system. His code now looks exactly like the way I would program! How would you handle the situation? How can I decline helping him without appearing to not being a team player?


How to deal tasks that are probably not user stories but still need to get done?

We have a number of tasks that need to be completed, but are probably not real user stories, or if they are, they are very developer-centric user stories which will never be visible to the end-users. The problem is that because they do not get estimated as a part of a sprint and very little gets done on them. Eventually, it becomes enough of a problem that someone takes time out of a sprint to deal with them, but that affects progress on "official" sprint work, which makes some people a wee bit unhappy. I've been pushing for making these tasks into official user stories, but no one else seems to like this. How else could I request official recognition for these tasks, so I can allocate full days on them without feeling like I'm affecting the rest of the sprint? Some examples of the tasks, just to give you an idea:   * Write small, custom maven plugins to simplify specific (and widely used, within the organization) build configurations.   * Refactor old project(s) to build with Maven and newer tool set.   * Refactor redundant (across multiple projects) code into independent libraries - could potentially be used by _many_ projects.


What does the 'R' in x64 register names stand for?

I know the 32 bit registers were named like the 16 bit registers with an 'E' prefix to mean extended. I've always assumed that meant extended from 16 to 32 bits although I've never seen that explicitly stated. I was trying to find out what the 'R' stands for but my google skills have failed me. Anyone know?


What are some characteristics of Python that makes it unique as its own language? I'm looking for any sort of characteristics ranging from good to bad, useful to hindrance, syntax to real-world usage, but non-obscure observations would be the most useful for the average developer. I'm a newb here, so intuitive things may need to be explained.....


Python: What is the point of using "import"?

I am not very clear on this aspect. Let's say you have a bunch of .py files that are their own separate modules. Why does each .py file need to import the others when they use that class? Or do they? Because I was pretty sure that other languages (Java, for instance), did not require import when referring to classes/files in the same directory. I might be wrong.


DAL Exception handling in a MVP application

In a MVP win forms application I'm handling exceptions as follows in DAL. Since the user messaging is not a responsibility of DAL, I want to move it in to my Presentation class. Could you show me a standard way to do that?                   public bool InsertAccount(IBankAccount ba)         {             string selectStatement = @"IF NOT EXISTS (SELECT ac_no FROM BankAccount WHERE ac_no=@ac_no) BEGIN INSERT INTO BankAccount ...";                  using (SqlConnection sqlConnection = new SqlConnection(db.ConnectionString))             {                 using (SqlCommand sqlCommand = new SqlCommand(selectStatement, sqlConnection))                 {                     try                     {                         sqlConnection.Open();                         sqlCommand.Parameters.Add("@ac_no", SqlDbType.Char).Value = ba.AccountNumber;                         //                         //                                   sqlCommand.ExecuteNonQuery();                         return true;                     }                     catch (Exception e) { MessageBox.Show(("Error: " + e.Message)); }                     if (sqlConnection.State == System.Data.ConnectionState.Open) sqlConnection.Close();                     return false;                 }                  }         }      **EDIT2 :** So based on the answers I re edited the post and now my exception handling code looks like this... **DAL**               public bool InsertAccount(IBankAccount ba)     {         try         {             sqlConnection.Open();             //            }         catch (SqlException)         {             throw new Exception("DataBase related Exception occurred");         }         catch (Exception)         {             throw new Exception("Exception occurred");         }     }      **BankAccountPresenter**                   private void SaveBankAccount()         {             try             {                _DataService.InsertAccount(_model);             }             catch (Exception e) { MessagingService.ShowErrorMessage(e.Message); }         }      Why I've caught exceptions in DAL is that even at the moment I'm not logging errors, I may have to do it in future. And also this way I can differentiate the error massages in DAL, whether it's sql related or general. I've used messaging service in my presenter when showing error messages. Does this meaning full? Can this be simplified?


Flaws in my PHP development setup - sharing sources causing lags

I have following development setup for my PHP projects:   * Working station running on Windows 7 with PhpStorm IDE.   * GIT for version controlling.   * CentOS on virtual machine (VirtualBox) with Apache and MySQL (copy of production server). So far, I've been sharing project's source folders between host and guest systems and it was working quite well only really slow. The reason behind this is that Apache was reading files from remote folder (mounted locally). After doing some research, I found out that this set up can be improved by using disk mapping (Samba) instead of folder sharing. So I did that change. I configured my PhpStorm to automatically deploy files to mapped drive. Everything works like a charm now, except for one problem - when I change branches I need to synchronize project's local folder with the one on mapped drive and that takes time, a lot of time (like branching in SVN). Is there another way to handle this than just working on files directly on mapped drive?


MVC data binding

I'm using MVC but I've read that MVVM is sort of about data binding and having pure markup in your views that data bind back to the backend via the data-* attributes. I've looked at knockout but it looks pretty low level and I feel like I can make a library that does this and is much easier to use where basically you only need to call 1 javascript function that will data bind your entire page because of the data-* attributes you assign to html elements. The benefits of this (that I see) is that your view is 100% decoupled from your back-end so that a given view never has to be changed if your back-end changes (ie for asp.net people no more razor in your view that makes your view specific to MS). My question would be, I know there is knockout out there but are there any others that provide this data binding functionality for MVC type applications? I don't want to recreate something that may already exist but I want to make something "better" and easier to use than knockout. To give an example of what I mean here is all the code one would need to get data binding in my library. This isn't final but just showing the idea that all you have to do is call 1 javascript function and set some data-* attribute values and everything ties together. Is this worth seeing through?                   <script>             $(function () {                      // this is all you have to call to make databinding for POST or GET to work                 DataBind();             });         </script>               <form id="addCustomer" data-bind="Customer" data-controller="Home" data-action="CreateCustomer">         Name: <input type="text" data-bind="Name" data-bind-type="text" />         Birthday: <input type="text" data-bind="Birthday" data-bind-type="text" />         Address: <input type="text" data-bind="Address" data-bind-type="text" />         <input type="submit" value="Save" id="btnSave" />     </form>          =================================================          // controller action     [HttpPost]             public string CreateCustomer(Customer customer)             {                 if(customer.Name == "Rick")                     return "success";                      return "failure";             }          // model     public class Customer         {             public string Name { get; set; }             public DateTime Birthday { get; set; }             public string Address { get; set; }         }


Public versus private inheritance when some of the parent's methods need to be exposed?

Public inheritance means that all fields from the base class retain their declared visibility, while private means that they are forced to 'private' within the derived class's scope. _What should be done if some of the parent's members (say, methods) need to be publicly exposed?_ I can think of two solution. Public inheritance somewhat breaks encapsulation. Furthermore, when you need to find out where is the method foo() defined, one needs to look at a chain of base classes. Private inheritance solves these problems, but introduces burden to write wrappers (more text). Which might be a good thing in the line of verbosity, but makes changes of interfaces incredibly cumbersome. What considerations am I missing? What constraints on the type of project are important? How to choose between the two (I am not even mentioning 'protected')? Note that I am targeting non-virtual methods. There isn't such a discussion for virtual methods (or is there).


How do I find the JavaScript that is invoked when I click on a button or a link in a web-page (part of a data mining project)?

I tried to use the 'inspect element' of the firebug addon for Firefox but it doesn't give me any link to the javascript. For example I got this from the firebug add-on:               <a href="javascript:">         text of the link     </a>      But there is no link to the actual javascript or anything that I can use to directly go to the said link. How do I accomplish this? I need this as part of a personal data mining project that I am doing.


How does browsing speed differ in native apps, web apps, and websites?

I read an article online which I give the reference to below which compare between Native apps and web apps, in addition to standard website. It seems from that article that native apps are faster than web apps and websites. However, that was not clear for me. > ![enter image description here](http://i.stack.imgur.com/Pym4H.png) Could a native app be built to be used exactly as a website? meaning could the functions in a social website, for example, be programmed as a native app? In this case isn't that going to use a server-side language? Then what make it faster if even the website and the web app use the same thing? http://www.mobi-cart.com/native-vs-web.jsp


How did JavaScript become popular?

In ancient history, Brendan Eich had a language design, and in today's world, JavaScript is a popular language implemented and used in many different places. What caused the language to become popular? Was it the C-like syntax familiar to previous programmers? Did Netscape have enough control of the market to force it to be used? Or is there some deeper reason that JavaScript is popular and other languages are not? Particularly, if you had to make a language as popular as JavaScript, what initial conditions would you need to recreate its growth in popularity?


Implementing multiple generic Interfaces in java

I've need an interface that assures me a certain method, including specific signature, is available. So far his is what I have:               public interface Mappable<M> {         M mapTo(M mappableEntity);     }      The problem arises when a class should be mappable to multiple other entities. The ideal case would be this (not java):               public class Something implements Mappable<A>, Mappable<B> {         public A mapTo(A someObject) {...}         public B mapTo(B someOtherObject) {...}     }      What would be the best way to achieve this remaining as "generic" as possible?


Are design patterns independent of programming languages?

I have been recently working on Objective C and came across use of Delegate pattern. I had seen all the patterns theoretically in Java, thanks to the Head First book. But at times looking at differences in Dynamic and scripting languages I get confused about need of certain design patterns. For example lets take example of Adapter pattern. It already has two implementations : Object adapter[java] and Class Adapter[C++]. depending on whether the language has supports for Multiple inheritance or not. But with dynamic languages like Objective-C, duck-typing is possible and also we have methods like respondsToSelector to check if an object actually supports a method or not. So why do we have protocols here even if we need to use a delegate pattern ? If we can assume anything to be anything.in a dynamic language, do we need concept of abstract class or interface at all to implement few patterns ? they more look like tools for statically typed languages to give dynamic behavior.   specially I dont understand the need for abstract keyword in PHP. Can anyone point out some important details, I am relatively new to this.


Why doesn't Python just establish a format for declaring tab widths?

I've read the flame wars over the use of spaces and tabs. When working with any markup language (when scope isn't very important and _when_ pressing space 4 times is a PITA), I tend to minimize the tab width to just a space or two but I fluidly change to four full tabs for my other programming work. It is a matter of convenience most of the time and it only translates into real errors when sharing or mixing code. So why they don't just declare a format for optional overrides such as `#tab = 2` at the beginning of a file? There would be no scoping issues and it could be handled with 2 lines of code. # Update Whoa, I didn't explain myself very clearly: I only use editors that handle the tab/space conversion automatically. The only **cogent** point I can understand in the criticisms I have read regarding Pythons use of white space is how borked the space/tab convention becomes when sharing code. Perhaps my confusion about using "4 spaces" is because of my prior life in the publishing industry and our use of tabs not as a unit of white space but an abstract element used to describe a document's structure, not the display. Substituting it with 4 spaces has more to do with Unix's shitty 8-space convention than it does with elegance. If Python standardized on using tabs by default we would eliminate the layer of abstraction (literal visual _spaces_ -> abstract _tab_ ) that is getting lost when we leave IDE land and go to Usenet/chat/email land. I thought that `#tab=2` would be a nice way to ensure that any differences originating due to convenience formatting wouldn't muck things up elsewhere.


Project (that contains reverse engineering) hosting + license

**I made multiple tools for extracting file formats that are found in (commercial) games. Where should I host the code? (e.g. Google Code, Sourceforge,....)** Normally it would be considered 'illegal' everywhere, but most of the time they are ignored. Where should I host it and what license should I choose for the project to be 'on the safe side'. _[I asked this question on SO and it got closed, meta suggested that it would fit here a bit more, if it doesn't even fit here please help me at least rephrase it]_ Edit: An example: A game has glued together GZip compressed files with binary metadata slaped on them. (let's call them .archive files) I KNOW that I'm not allowed to use that data for anything else then playing the game, but I'm interested in modding said files so I wrote a packer/unpacker for that .archive . Now I want to make it public on a project page, which one should I choose? All the modding tools I saw till now have that 'ONLY FOR NON-PROFIT EDUCATIONAL USE' and they normally don't get taken down. But I want to be sure to choose an actual license for the sourcecode.


Is there a data structure for this type of list/map?

Perhaps there's a name for what I want, but I'm not aware of it. I need something similar to a `LinkedHashMap` in Java, but where it returns the 'previous' value if there's no value at the specified key. That is, I have a list of objects stored by an integer key (which is in units of time in my case):               ; key->value     10->A     15->B     20->C      So, if I were to query for a value for key 0-9, it would return `null`. The special part is if I queried for something 10 <= i <= 14 it would return A. Or, for i >= 20, it would return C. Is there a data structure for this?


Naming convention for array, plural or singular?

Let's say we have a class that represents a Sudoku grid. In that grid we have a collection of _cells_. Now, if I simply made a collection of these cells accessible through the class the naming it would be pretty straight forward. I would use the plural:               Public List<CellClass> Cells      But what if I wanted to use a square array so that I can easily get a cell at a certain coordinate. Will it be:               Public CellClass[,] Cells      or               Public CellClass[,] Cell      Using a plural _sounds_ intuitive enough since it's a collection, but then you access it like this:               x = myBoard.Cells[2,3]      Which doesn't look nearly as nice (and grammatically correct) as:               x = myBoard.Cell[2,3]      So what do you think would be better? Plural or singular?


Maths needed to understand theory behind Haskell's type system?

Recently, I've become deeply interested in Haskell. While attempting to learn new concepts (e.g. the forall keyword and ST monad) and Haskell's type system in general, I continually run into concepts from category theory and lambda calculus. So, I wonder:   1. What other branches of mathematics are important to a strong understanding of Haskell's type system?   2. Can I forego a rigorous study of these maths and instead focus on certain pertinent concepts? (e.g. quantifiers in lambda calculus.) If so, which concepts are essential? I'm hoping to pick up Types and Programming Languages soon, however, please suggest any alternative reading resources you feel appropriate.


Designing an email system to guarantee delivery

We are looking to expand our use of email for notification purposes. We understand it will generate more inbox volume, but we are being selective about which events we fire notification on in order to keep the signal-to- noise ratio high. The big question we are struggling with is designing a system that guarantees that the email was delivered. If an email isn't delivered, we will consider that an exception event that needs to be investigated. In reality, I say _almost_ guarantees because there aren't any true guarantees with email. We're just looking for a practical solution to making sure the email got there and experiences others have had with the various approaches to guaranteeing delivery. For the **TL;DR** crowd - how do we go about designing a system to guarantee delivery of emails? What techniques should we consider so we know the emails were delivered? Our biggest area of concern is what techniques to use so that we know when a message is sent out that it either lands in an inbox or it failed and we need to do something else. Additional requirements:   * We're not at the stage of including an escalation response, but we'll want that in the future or so we think.    * Most notifications will be internal to our enterprise, but we will have some notifications being sent to external clients.    * Some of our application is in a hosted environment. We haven't determined if those servers can access our corporate email servers for relaying or if they'll be acting as their own mail servers. Base design / modules (at the moment):   A module to assign tracking identification   A module to send out emails   A module to receive delivery notification (perhaps this is the same as the email module)   A module that checks sent messages against delivery notification and alerts on undelivered email. Some references:   Atwood: Send some email   Email Tracking Some approaches:   * Request a response (aka read-receipt or Message Disposition Notification).   Seems prone to failure since we have cross-compatibility issues due to differing mail servers and software.   * Return receipt (aka Delivery Status Notification).   Not sure if all mail servers honor this request or not   * Require an action and therefore prove reply.   Seems burdensome to force the recipients to perform an additional task not related to resolving the issue. And no, we haven't come up with a way of linking getting the issue fixed to whether or not the email was received.   * Force a click-through / Other site sign-in.   Similar to requiring some sort of action, this seems like an additional burden and will annoy the users. On the other hand, it seems the most likely to guarantee someone received the notification.   * Hidden image tracking.   Not all email providers automatically load the image, and how would we associate the image(s) with the email tracking ID?   * Outsource delivery.   This gets us out of the email business, but goes back to how to guarantee the out-sourcer's receipt and subsequent delivery to the end recipient. As a related concern, there will be an n:n relationship between issue notification and recipients.   The 1 issue : n recipients subset isn't as much of a concern although if we had a delivery failure we would want to investigate and fix the core issue.   Of bigger concern is n issues : 1 recipient, and we're specifically concerned in making sure that all n issues were received by the recipient. How does forum software or issue tracking software handle this requirement? If a tracking identifier is used, Where is it placed in the email? In the Subject, or the Body?


How much logic can be put into an object-pooling factory class before it does more harm than good?

The main language I'm interested in doing object pooling in is AS3, which is known to need it in many cases. In the past I've always made a brand new factory class for every type I was going to try to pool, the parameters of its "object-producing" function being the same as those of that type's constructor. Essentially:               static public function produce(<list of paramaters>):<type>     {         if (m_arryPool.length)         {             var obj:<type> = m_arryPool.pop();             // do something with the arguments passed to produce()             return obj;         }         return new obj(<arguments passed to produce()>);     }      But recently I've been trying to think of a way to avoid re-writing this sort of boiler-plate code for every single type I want to pool, but probably without forfeiting the idea of passing arguments around to the returned objects as in the above example, and definitely without putting so much dynamic functionality and stuff in there that it just winds up slowing stuff down too much. I'm still a little green at object-pooling. I know a one-size-fits-all pooling factory will probably not work out in all cases (AS3's `Function.apply()`, for instance, doesn't support constructors), but when does it get to the point that you're just passing in so many arguments to the `produce()` function, using so many untyped variables, going through so many dictionaries and lists, etc., that it just isn't hardly worth it anymore? I know this question may be slightly subjective, but I do believe there are largely objective answers to it. I'm mainly interested in how this would apply to AS3, but I'm also interested in (and asking for) a general answer. Is the best way to handle it generally just to go ahead and write boilerplate code for every type you plan to pool or something like that? Thanks!


Small assembly language project for practice

I am learning assembly language for x86 architecture. But, i am unable to find any practice problems so that i can test my skills. Can you suggest me some practice problems or some small assembly language project to improve my skills.?? thanks in advance


Release roadmap with scrum

I need to prepare an internal product release road-map for product being built via scrum methodology, and have some difficulty correlating sprints to the road-map. The main problem is that as I don't have effort estimations for every story, because these prepared immediately before each sprint, so I don't know what will make into which sprint. I'm fine with changing the road-map as the development goes on, but need it to give at least some indication when things planned to be released. So what would be the best way to do this, other then guestimating the whole backlog? Thanks for any idea.


Why was Android's ContentProvider created?

The title sums up my question, but to elaborate basically what I want to understand is why the Android designers want apps that need to work with shared data to use a Content Provider rather than just accessing the SQLite database directly? The only reason I can think of is security because certain files can by accessed only be certain processes and in that way the Content Provider is the gatekeeper that ensures each app has the proper privileges before allowing read and/or write access to the database file. Is that the primary reason why ContentProvider was created?


How should I implement a command processing application?

I want to make a simple, proof-of-concept application (REPL) that takes a number and then processes commands on that number. Example: I start with 1. Then I write "`add 2`", it gives me 3. Then I write "`multiply 7`", it gives me 21. Then I want to know if it is prime, so I write "`is prime`" (on the current number - 21), it gives me false. "`is odd`" would give me true. And so on. Now, for a simple application with few commands, even a simple `switch` would do for processing the commands. But if I want extensibility, how would I need to implement the functionality? Do I use the command pattern? Do I build a simple parser/interpreter for the language? What if I want more complex commands, like "`multiply 5 until >200`" ? What would be an easy way to extend it (add new commands) without recompiling? Edit: to clarify a few things, my end goal would not be to make something similar to WolframAlpha, but rather a list (of numbers) processor. But I want to start slowly at first (on single numbers). I'm having in mind something similar to the way one would use Haskell to process lists, but a very simple version. I'm wondering if something like the command pattern (or equivalent) would suffice, or if I have to make a new mini-language and a parser for it to achieve my goals? Edit2: Thanks for all the responses, all have been very helpful to me, but Emmad Kareem's helped me the most, so I'll chose it as the answer. Thanks again!


What's the utility of encouraging users to learn SQL and possibly the ability to execute it?

Facing a situation where I can't possibly get all the features that are requested into each version of the LOB I support, I've evolved a number SQL query templates that users have and send to me, which I then execute. This then led to a password protected SQL execution dialog which users with write access can execute for themselves with an understanding that if they make the wrong typo they could do damage. While this makes me nervous, the upside of having the functionality outweighs the risk in this situation. Then there is the change in how people view the functionality. It seems less magical when they understand more about how the database works. On the other side of this, however, new users can potentially walk into a culture where the lingo includes something totally foreign to them. Any advice on weather this direction has relative utility?


SQL Server Management Studio Show last executed query

I am looking for a way for SQL Server Management studio to show me the last SQL query that was run. For example, when I make modifications to a table in the designer mode, I will eventually want to make the same changes to the production DB without recreating the entire table. I'm looking for functionality similar to PHPMyAdmin for MySQL which tells you the last query ran and the results of the query at the top of the page after the modifications are complete.


Composite-like pattern and SRP violation

Recently I've noticed myself implementing pattern similar to the one described below. Starting with interface:               public interface IUserProvider     {         User GetUser(UserData data);     }      `GetUser` method's pure job is to somehow return user (that would be an _operation_ speaking in composite terms). There might be many implementations of `IUserProvider`, which all do the same thing - return user basing on input data. It doesn't really matter, as they are only _leaves_ in composite terms and that's fairly simple. Now, my _leaves_ are used by one _own them all_ composite class, which at the moment follows this implementation:               public interface IUserProviderComposite : IUserProvider     {         void RegisterProvider(Predicate<UserData> predicate, IUserProvider provider);     }          public class UserProviderComposite : IUserProviderComposite      {         public User GetUser(SomeUserData data) ...         public void RegisterProvider(Predicate<UserData> predicate, IUserProvider provider) ...     }      Idea behind `UserProviderComposite` is simple. You register providers, and this class acts as a reusable entry-point. When calling `GetUser`, it will use whatever registered provider matches predicate for requested user data (if that helps, it stores key-value map of predicates and providers internally). Now, what confuses me is whether `RegisterProvider` method (brings to mind composite's _add_ operation) should be a part of that class. It kind of expands its responsibilities from providing user to also managing providers collection. As far as my understanding goes, this violates Single Responsibility Principle... or am I wrong here? I thought about extracting register part into separate entity and inject it to the composite. As long as it looks decent on paper (in terms of SRP), it feels bit awkward because:   * I would be essentially injecting Dictionary (or other key-value map)   * ...or silly wrapper around it, doing nothing more than adding entires   * This won't be following composite anymore (as _add_ won't be part of composite) What exactly is the presented pattern called? Composite felt natural to compare it with, but I realize it's not exactly the one however nothing else rings any bells. Which approach would you take - stick with SRP or stick with "composite"/pattern? Or is the design here flawed and given the problem this can be done in a better way?


What are the most popular revision control systems?

There are a lot of choices available with respect to revision control (SVN, CVS, GitHub, etc.). What are the major options out there? What are the most popular ones right now (although I'm not sure if new revision control systems would be rolled out in the near future)? Thanks in advance for the feedback, although I'm not sure if this is an appropriate place to ask.


Do you leverage the benefits of the open-closed principle?

The open-closed principle (OCP) states that an object should be open for extension but closed for modification. I believe I understand it and use it in conjunction with SRP to create classes that do only one thing. And, I try to create many small methods that make it possible to extract out all the behavior controls into methods that may be extended or overridden in some subclass. Thus, I end up with classes that have many extension points, be it through: dependency injection and composition, events, delegation, etc. Consider the following a simple, extendable class:               class PaycheckCalculator {         // ...         protected decimal GetOvertimeFactor() { return 2.0M; }     }      Now say, for example, that the `OvertimeFactor` changes to 1.5. Since the above class was designed to be extended, I can easily subclass and return a different `OvertimeFactor`. **But**... despite the class being designed for extension and adhering to OCP, I'll modify the single method in question, rather than subclassing and overridding the method in question and then re-wiring my objects in my IoC container. As a result I've violated part of what OCP attempts to accomplish. It feels like I'm just being lazy because the above is a bit easier. Am I misunderstanding OCP? Should I really be doing something different? Do you leverage the benefits of OCP differently? **Update** : based on the answers it looks like this contrived example is a poor one for a number of different reasons. The main intent of the example was to demonstrate that the class was designed to be extended by providing methods that when overridden would alter the behavior of _public_ methods without the need for changing _internal_ or private code. Still, I definitely misunderstood OCP.


Should we create a story for vacation?

We have had a situation with a scrum sprint where a team member went on vacation for a few days at the beginning of the sprint. This led to us being behind the ideal trend on the burndown chart at the beginning of the sprint, although we caught up later since we knew we had slightly less resource and as a result had committed to deliver slightly less. In our retrospective it was suggested by the Product Owner that we create a vacation story. The time remaining would be reduced down as the vacation was completed. As a result the burndown chart would be corrected for the "hole" that would appear in effort when the team resource was lower, which would otherwise falsely indicate a problem. Is this a good idea?