How Add/Create* commands should be handled in CQRS + Event Sourcing architecture

I want to implement my first application using CQRS pattern along with Event Sourcing. I am wondering how creation of aggregate roots should be handled properly. Let's say someone sends CreateItem command. How it should be handled? Where the event ItemCreated should be stored? As first event of a new Item? Or should I have some kind of ItemList entity that aggregates all items and its event list consists only of ItemCreated events? Udi Dahan suggests not to create aggregate roots and always use instead some kind of fetch method. But how I can fetch something that is new and certainly does not have any ID assigned. I understand the idea behind and it is pretty reasonable to think that a new object is an object that has its state composed of zero events replied on it. But how should I use it? Should I have a distinct method in my Repository like `getNewItem()` or make my `get(id)` method accepting `Optional<ItemId>` instead? Edit: After some time of digging I found really interesting implementation of the aforementioned patterns using actors. The author instead of creating the aggregate, retrieves it from some kind of repository with newly created UUID. The drawback of this approach is he allows for a temporary inconsistency state. I am also wondering how I can implement `delete` method with such approach. Simply add Deleted event to the event list of the aggregate?


How do I know if I'm violating MVVM with WPF?

I was recently grabbing an auto generated TreeViewItem from a nested TreeView node in WPF, and I was using ItemContainerGenerator to get it in code behind. Then I thought to myself I'm certainly violating MVVM right now. What are some other signs that someone is violating MVVM ?


.NET - refactoring code

I have inherited and now further develop a large application consisting of an ASP.NET application, VB6 and VB.NET application. The software was poorly written. I am trying to refactor the code as I go along. The changes I am making are not live (they are contained in a folder on my development machine). This is proving to be time consuming and I am doing this along side other work which is the prioritiy. My question is: is this a practical approach or is there a better methodology for refactoring code? I don't have any experience with version control software or source control software and I am wandering if this is what I am missing. I am a sole developer.


Dependently typed language best suited to “real world” programming?

Which _dependently typed_ programming languages could be used for real world _application development_? I will mostly be writing toy applications at first, after that maybe web development or a simple DBMS. These are some points, that I think are important:   * documentation   * example programs   * a good/big standard library   * an easy to use foreign function interface   * a community of people using the language for real world tasks   * tool support I am aware that there is currently no language that meets all these requirements. I'd like to know which one comes closest.


Building presentation layer directly on data layer

My application is currently quite a mess and I'm trying to untangle it all. My current idea is that I should have 3 separate layers:   * data layer that knows how to keep stuff in database (and handle data schema changes, so it's not really that trivial)   * domain layer (is that correct name?) that does all the magic changing the objects and processing events triggered by user requests   * presentation layer that knows how to show to user only what that user is allowed to know (some data is hidden from user just because) My initial idea was that having a data object I can build domain object from it, then build a view object from that one and then serve it to user. However I'm now thinking about building view object directly from data object.   * If the user just queries some information, I fetch the data from database, get the nice presentation of it, then serve it to user. Not touching the domain layer at all.   * If user performs an action, I fetch the data, build models from it, do the magic object interaction, save it all back to data layer, then wrap it into presentation and serve. How bad is such design? Unfortunately I am not well-versed in software architecture/design terminology thus I might be failing to find the answer just because I don't know how to name things. Edit: I don't mean to discard the Model part completely. I just mean that I will have Model sitting on Data and View sitting on Data too.


If you got to rebuild Pandora from scratch, what technology stack would you choose?

Requirements:   * many different user experiences: website, mobile, etc.   * user management, registration, roles   * large amount of music metadata   * genome search that finds closest music   * public and private RESTful API for all functions   * massive server-side service scale


How do you find time to work on Open Source Projects?

A bit of background: I've got a small open source project that I've started on, a basic framework which provides an object oriented means of generating HTML code (since I don't really like HTML, and I do like PHP). It has some released source, and a few downloads, but primarily, the project is for me, with the Open Source portion just being a side benefit. The original project which caused me to be able to develop on this project has mostly gone into hibernation for the time being, which means that all the development I get to sink into it at this point is personal time only. Unfortunately, I'm currently working toward my bachelor's degree, studying for certifications, and I have a three month old baby at home. In short, by the time I get around to "me time", I rarely feel like doing work, but rather usually feel like just chilling out. So, if there's anyone else out there who feels like they're in a similar position, what strategies have you used to keep yourself motivated toward working on the project? I would really like to at least be able to work on this until I have 100% spec coverage, but I haven't committed source in months. Anyone out there who can help?


What's in a name? Revision vs Timestamp

Apparently naming things is one of the hardest things in programming..! I have a synchronisation implementation which uses timestamps (number of seconds since unix epoch) to sync. Currently, the timestamps have simply replaced an older revision field. My question is, does it make sense to name it "Revision" or is "Timestamp" better? Revision makes sense to me since that's what's used to version an entity - to know what's created, updated, deleted. But if I needed to increase the granularity of the revision field in the future (ie. to become a decimal, to include fractions of a second), I wouldn't be sure that a decimal revision would make sense. On the other hand, perhaps I want to move away from timestamps in the future (ie. to sequence numbers) in which case revision would make sense.


When to use DAG (Directed Acyclic Graph) in programming?

I recently found a framework named ecto. In this framework, a basic component named "plasm", which is the ecto Directed Acyclic Graph.In ecto, plasm can be operated by ecto scheduler. I am wondering what's the advantage of this mechanism, and in what other situations can we exploit the concept of DAG?


Should functions be prepared for overlapping buffers?

So I have a function in C like this:               void crunch(const char *in, char *out, size_t inLen, size_t outLen)     {         //...     }      If the two buffers overlap, the function may mess up the input buffer as well, while generating output.   * What's the general practice?    * Should I always consider overlapping buffers when implementing functions like this?    * Should I assume that the user won't pass overlapping buffers?    * Should I always document whether the function works well or not with overlapping buffers?


Are there guidelines for SOA events and file transfers in a SOA context?

We are part of a SOA implementation. We publish events via the enterprise bus for certain changes in our system. The architects here have advised, however, that some bulk changes to data should go via a flat file (generated by our system) and handled (moved between servers) by middleware, because they want to avoid overloading the bus with data. (It would be possible for us to publish a single event containing all the changes as opposed to many single events, which would perform much better, but for some reason they do not want this). More recently, a contention has arisen over a price list that we produce. The original requirement for us was to produce a flat file on a daily basis (which would be a lot simpler than communicating real-time pricing changes). In this scenario, we fought off requirements from the consumer system to tailor the data a specific way. Our argument is that in a SOA context, our output should be consumer-agnostic, so as long as it contains the necessary data, it can be transformed by middleware into the required target format. Now, however, architecture has again intervened, saying that publishing a price list is an event that could/should go via the bus. We are not sure we agree with this, and why, in the case of bulk changes mentioned above, a file transfer is acceptable which effectively bypasses the bus. I guess my question is manifold:   * Are there guidelines around what data should be contained in an event in the SOA context?   * Is there place for file transfers in an event-driven architecture? If so, is my assumption correct that we could be exporting a file containing pricing information in our own format, and leave it to middleware to transform?


Understanding algorithms for numeric constraint solving

As an educational exercise, I am looking to implement a constraint solver from scratch. However, since the field is entirely new to me, I am at a loss of where to begin with background research. The problems I aim to address are mostly sets of inequalities, such as `a < b && b < c`, where `a`, `b`, `c` are integers. (While it is possibly not relevant to the question at this stage, I do aim to address problems with other numeric types later on). The algorithms I have looked at so far are in the _branch-and-bound_ and _branch-and-cut_ categories mostly. However, if I am looking for a generic, efficient algorithm, is this what I want to be looking at? It would be very helpful to receive some guidelines here.


Scrum: Baseline story for point estimation

To estimate PBIs you need to choose an average story and assign it a number of points (for example 5). Then you compare all other stories to that story and assign points accordingly. My question is, are you really supposed to compare every single story to that original story from the beginning of the project? If not, then how do you make sure your scale remains more or less consistent throughout the project? Thanks.


As a C# developer, how much "advanced" Java do I need for Android development?

I'm a professional .NET -C#- developer who's interested in doing development for Android. I'd like to know if it's really necessary for me to first read a book or two on Java (like Java For Programmers 2nd), or if I should just be able to pick up an Android book (like Pro Android 3) and be able to -mostly- work my way around it without much fuzz. **Note 1** : Java is not 100% new to me. For testing purposes, I've previously done a few -very basic- console applications and web applications. **Note 2** : I'm not trying to shift from .NET to Java / Android anytime soon. I just wat to develop applications for myself and this wonderful community. :)


Algorithm for detection of overlapping between vectors

I am currently developing a math-physics program and I need to calculate if two vectors overlap one another, the one is vertical and the other is horizontral. Is there any fast algorithm to do this because what I came up so far, has a lot of repeats. Eg lets say we have vector V1((0,1),(2,1)) and a V2((1,0),(1,2)) where the first parenthesis is the coordinates starting and the second coordinates that the vector reaches. I want as a result to take that they overlap at (1,1) So far the only idea I came up is to ''expand'' each vector to a list of points and then compare the lists e.g for V1 its list would be (0,1) (1,1) (2,1)


Why is Moore's Law seen as an absolute truth?

Often times I read things like: "Intel stated that either the next generation or generation after that will likely fail Moore's Law." Why don't they just say Moore's Law will fail instead? I don't know why it's held as some sort of standard that must be upheld? Why not aim for the highest progress instead of limiting yourself with arbitrary expections?


Are problem-solving programming questions useful for improving one's general programming ability?

For example, like: * * * The inaugural International Olympiad in Frogleaping is being held in Australia in 2013 and you are determined to win. While you want nothing to do with such slimy, jumpy creatures, you plan to enter a frog-like robot that you know will be faster than all the other organic entrants. The IOF takes place in a large pond in which there is a sequence of lily pads arranged in a long line. The rules of the race are simple: your frog will be placed on the first lily pad, then it must jump to the second lily pad, then the third and so forth until it reaches the last lily pad in the course. Note that you can not `skip' lily pads--every lily pad must be jumped on exactly once. The first frog to reach the last lily pad will win the race. Since your robotic frog has super-frog speed, you are confident in your victory. However, your frog has one minor incorrectable flaw--it is only able to jump one fixed distance. Specifically, it can only jump exactly K metres forward from its current location, even if this lands the frog in the water (where it will promptly short-circuit). Since the initial lily pad positions may make it impossible for your frog to reach the last lily pad, you plan to create a distraction and move the lily pads so that they are spaced exactly K metres apart, enabling your frog to jump from the first to the last without falling in the water. Shifting a lily pad by one metre will take you one second, and the longer you spend stealthily moving lily pads, the more likely that the IOF judges will notice and disqualify you from the competition. Given the initial distances between the lily pads in the course, you must write a program to compute the minimum time you will have to spend shifting lily pads such that all pairs of consecutive lily pads are exactly K metres apart. You can assume that the pond is sufficiently long so that the first lily pad can be moved any distance back, and the last lily pad can be moved any distance forward. # Input Your program should read from the file frogin.txt. The first line of this file will consist of two space-separated integers N and K. The following N-1 lines will contain the initial distances between consecutive pairs of lily pads. Specifically, the ith line will contain one integer representing the distance between the ith and (i+1)th lily pad. # Output Your program should write to the file frogout.txt. Your output file should consist of one line containing one integer: the minimum total time spent shifting lily pads so as to ensure your victory. * * * This is a sample problem from the Australian Informatics Olympiad, which I happened to come across searching on the internet. But I do not believe that any programming-related problems which do not directly connect with real-life situations will have any helpful effects upon one's real-world programming ability. Will they?


What are and how do (data-) types work?

1. What is a "variable"/data type?   2. How does a compiler / interpreter handle types? My specific concern has to do with the different types in lower and higher level languages. For instance in Python, as `list` is really flexible. You can just define it and put in at runtime whatever you want.   * `int`s   * `float`s   * `str`ings   * `set`s   * even other `list`s Basically objects of any type (if I'm not mistaken). So I imagine `list` to be a class written in C with really a lot of stuff in there, dynamic memory allocation and so on and so forth, to handle all this.   * Is that right?   * ..and does that mean all those e. g. Python types are C classes?   * Then what are types in C?   * Are they "classes"?   * ..or somehow related to assembler code? PS: I'm not looking for some precise illustrative hints and answers rather than for a wide exhaustive explanation. And: This questions are not related to "There are no variables in Python, but identifiers".


Password insanity! Recommended approaches to password management on multiple client systems?

A software development company I work with has a web based product they are successfully selling to clients. All of these clients have a support agreement with us that generally requires us to access their servers, databases and application data. As the number of clients grows, (and the number of different people supporting those clients grows), we are seeing a need to better manage in particular **passwords** , but more generally all the information one would need to fully support client systems ie. URLs, application login details, IP addresses, any client-specific weird stuff etc etc. This data is changing on an increasingly rapid basis, as systems get moved around to different machines, IP addresses. The worst problem is superuser passwords for the applications. These are constantly changing and occasionally we find ourselves in a situation where nobody seems to know who made the most recent change. This is clearly an unsatisfactory situation. There are **procedures** in place which say that password changes etc need to be documented in a central secure place. But of course, people being humans, sometimes forget to document these things. The danger is that when people get so fed up of password chaos, that you can end up with a situation where everyone's password is " _password123_ " as they can't be bothered any more. Apart from enforcing the procedures, what other approaches could we take? One suggestion I heard was to have a "hidden" application superuser whose password is easily remembered/derived, which only support personnel would know about it. Personally I think that solution is a scary security hole, especially when you have multiple clients using your software. So how would you handle this situation if you were supporting multiple clients? More strict procedure enforcement, or a technical approach to make life easier for everyone?


What should I learn to be backend web developer?

I want to be a web developer and because I don't want to get into designing (and stuff like that) so I thought I should become a backend developer (also more suited because of my course i.e. b.tech in computer science). So I have been searching the internet for a lot of things. But I am confused as what should I choose?   1. Python (attended a workshop on django looked easy but I think is a dying language as adoption of Python 3 is very slow)   2. Ruby   3. node.js   4. Java (Play framework)   5. .Net I am currently in my second year which means I have a whole 3 years to learn a language till I apply for a job. I want to learn something which helps me to build things on my own (to fulfill my creative mind's appetite) and something which gets a me good job also. So please guide. I am ready to do the hard work so it doesn't matter if the language is not very easy :)


Is it correct/useful to define Computational Complexity in this way?

I analyzed my algorithm and I deduced that in the best case it requires n^3 iterations while in the worst case it requires n^4 iterations. Then I asserted that my algorithm is in \Omega(n^3) and in \BigO(n^4). Is this assertion correct and useful? (sorry for the format but I'm not able to add LaTeX text, so if you can please tell me how to format this I will edit soon, thanks)


Does being a Senior Developer using one language qualify you to be a Senior Developer using another language?

If I work as a Developer in one language (e.g. Java) and work my way up to Senior Developer, would that qualify me to be a Senior Developer for a position using another language (e.g. Ruby)?


How can I compare and contrast open source licenses?

My company has given permission for me to open source some internal tools I've built. The first step is to choose an open source license. How do I do this? I know about the GPL, the Apache license, and others. Are there any resources out there that compare and contrast the different licenses? I'd rather not have to read every single candidate until I've narrowed the field.


How should a non-IT manager secure the long-term maintenance and development of essential legacy software?

We are a small, very specialized, benefits administration firm with an extremely useful, robust collection of software, some written in COBOL but most in BASIC. Two full-time consultants have ably maintained and improved this system over more than 30 years. Needless to say they will soon retire. (One of them has been desperate to retire for several years but is loyal to a fault and so hangs on despite her husband's insistence that golf should take priority.) We started down the path of converting to a system developed by one of only three firms in the country that offer the type of software we use. We now feel that although this this firm is theoretically capable of completing the conversion process, they don't have the resources to do so timely, and we have come to believe that they will be unable to offer the kind of service we need to run our business. (There's nothing like being able to set one's own priorities and having the authority to allocate one's resources as one sees fit.) Hardware is not a problem--we are able to emulate very effectively on modern servers. If COBOL and BASIC were modern languages, we'd be willing to take the risk that we could find replacements for our current consultants going forward. It seems like there ought to be a business model for an IT support firm that concentrates on legacy platforms like this and provides the programming and software development talent to support a system like ours, removing from our backs the risks of finding the right programming talent and the job of convincing younger programmers that they can have a productive, rewarding career, in part in an old, non-sexy language like BASIC. **In short, as non-IT managers, how can we best manage this transition?**


Why are strong names optional?

Why the c# allows project not to be strongly signed when they are build? They may be signed by some automatic name file if programmer do not choose his(hers) own sign file. Where is the advantage of not signed .dll file? What the strong names are? I am working on project which uses C# .dll files in Microsoft Dynamics AX. If the .dll file has the strong name it is easy to use. If not the fun begin. If the .dll do not have strong name   1. You can not easy install it to gacutil    2. You can not use it as a reference when you build a project with strong name.   3. It can leads to DLL Hell I see only disadvantages of project without strong names so I want to know if I miss see something or there is some tricky historical consequences why they are still allowed. I want to know if there is some advantage of using them. It should be possible to add strong name to .dll file without compiling but I was not able to use this because I end after I try to use ILASM.exe with "The program can't start because fusion.dll is missing from your computer, Try reinstalling the program to fix this problem." even if the fusion.dll is in the system (We decided to use different approach so I don't have time for more tries on this solution.)


Are there any benefits to checking in commented out code into version control?

I've found, what I personally believe to be a bad habit that a lot of developers seem to have adopted. Code in various places in the applications I have seen are commented out (lots of it) and checked into the mainline. Now, I don't have a problem with people doing this with their own branches, but is it a good idea to comment out 60 or so lines of code and check it into trunk? A colleague of mines has unearthed a lot of this and had spend half a day removing the commented out code just to tidy things up. Is there any benefit in checking in commented out code and leaving it for another developer to have to tidy up after you? After all, version control does have a history, so you can easy pull back any code that's been removed.


Can commented-out code be valuable documentation?

I wrote the following code:               if (boutique == null) {         boutique = new Boutique();              boutique.setSite(site);         boutique.setUrlLogo(CmsProperties.URL_FLUX_BOUTIQUE+fluxBoutique.getLogo());         boutique.setUrlBoutique(CmsProperties.URL_FLUX_BOUTIQUE+fluxBoutique.getUrl());         boutique.setNom(fluxBoutique.getNom());         boutique.setSelected(false);         boutique.setIdWebSC(fluxBoutique.getId());         boutique.setDateModification(new Date());              boutiqueDao.persist(boutique);     } else {         boutique.setSite(site);         boutique.setUrlLogo(CmsProperties.URL_FLUX_BOUTIQUE+fluxBoutique.getLogo());         boutique.setUrlBoutique(CmsProperties.URL_FLUX_BOUTIQUE+fluxBoutique.getUrl());         boutique.setNom(fluxBoutique.getNom());         //boutique.setSelected(false);         boutique.setIdWebSC(fluxBoutique.getId());         boutique.setDateModification(new Date());              boutiqueDao.merge(boutique);     }      There is a commented-out line here. But I think it makes the code clearer, by making obvious what the difference is between `if` and `else`. The difference is even more noticeable with color highlighting . Can commenting out code like this ever be a good idea?


good replacement for commenting out code?

It bothers me to see commented out code and it seems often-times a symptom of developers not being proficient in advanced source control features, but on the other hand source control does not really go all the way in solving the problem that commenting out is intended for. I've occasionally seen requirements flip-flop in such a way that code that would have been deleted suddenly is needed again. If the code is really deleted, there doesn't seem to be a clear procedure for locating exactly where to find that deleted code in source control. Is there a better way out there to save developer work that may be needed again besides the tried-and-true "commenting out"?


Organizations that encourage kids to program

Since my son started going to school, I've been noticing a very serious lack of organizations to encourage kids to program or at least letting them know how to get involved in programming. Are there any groups that you know of to help kids out this area?? And I'm not referring to tools to help kids learn, I'm referring to groups that will help in getting kids interested in programming. Here are a few that I know of:   * Dreamspark   * Lego First Robotics   * Imagine Cup Are there anymore out there? And are there any that work at the elementary - high school levels?? Also are there any other parents that have noticed the same thing, or is this local to my area?? Edit: Also I'm looking for groups that encourage kids who don't have programmers for parents. I've got no problem teaching my own son, I'm more worried about the other kids.


Finding the balance between the important and the interesting

Sometimes I go for what I find interesting instead of what is considered important. Having this attitude has been educational and it has let me produce work that I'm exceptionally proud of but it has also made me miss deadlines and disappoint people. Sometimes I think that I do this because I don't want to _break_ my curiosity. I'm afraid that if I ignore it I may gradually lose it. Do you have any advice? * * * Meta: How can I make this a community wiki?


Is Flash really superior to Java applets?

I'm still a student, without much real life experience in programming. I've never written anything bigger than ~5k lines of code. I've written code in both Flash and Java, and I just can't understand why people are writing web applications like video players (YouTube etc.) in Flash, and not as Java applets. So I want to ask you, programmers with hands on experience, for some wise words on the subject. I see no real benefit of Flash over applets, while on the other hand, at least to me, it seems buggy as hell. I understand it is faster to make something in Flash, and I can see why it would be a good thing for fast prototyping, but in general, is it worth it? Every time a YouTube goes berserk, i curse the developers for writing it in Flash. And if you are using Linux with Opera, this happens all the time. So, basically, why are people using flash, and not applets?


I been reading a few things about using libraries and stuff but they all talk about not using it for commercial purposes. Does commercial mean when you earn money by putting a ad to support you or is it something else like for a big company?


Is hierarchical product backlog a good idea in TFS 2012-2013?

I'd like to validate I'm not in the wrong way. My team project is using Visual Studio Scrum 2.x. Since each area/product has a lot of kind of requirements (security, user interface, HTTP/REST services...), I tried to manage this creating "parent backlogs" which are "open forever" and they contain generic requirements. Those parent backlogs have other "open forever" backlogs, and/or sprint backlogs. For example:   * HTTP/REST Services (forever)      * Profiles API (forever) *POST profile (forever)        * We need a basic HTTP/REST profiles' API to register new user profiles (sprint backlog) **Is it the right way of organizing the product backlog?** _Note: I know there're different points of view and that would be right for some and wrong for others. I'm looking for validation about if this is a possible good practice on TFS with Visual Studio Scrum._


Is there any logical relation between different types of UML diagrams?

I'm trying to find out ,that is there any relation between different types of UML diagrams, for example, once you developed a use case, should it be an event for each of them in a sequence diagram, or is there any exact relation between the use case and class diagrams. By the way my main focus is on the below diagrams:   * Use case    * class diagram   * activity   * sequence   * event if you think I need any extra diagram to be included so it can be used to connecting the above diagrams to each other, please mention it too. Thanks In Advance


HG: fork web app project to separate API code from app code

I have a web app thats been in active development for about 8 months now and its becoming apparent that the project has a need to maintain a separation between app specific code and our OO Javascript API. What I would like to do is have another repository with the following general structure of the js API code.               repo_name        |        +---build        |        +---build_tools        |        +---doc        |        +---src             |             +---js      Of course this structure is different from the original web app directory structure. If I make changes to this new repository how could I pull in those changes to the web app repository without unintentionally removing files or modifying the directory structure of the web app repository?


Factors to be Considered for Software Risk Management

What are the risk factors that we need to consider while planning for a software project.


Do some interpreted languages only load the scripts once?

The benefit of a compiled application was that all the libraries and classes are loaded one time and sit waiting for input right? I come from a background working with PHP and the resources/classes that used are loaded each page request which puts an bad load on the server memory. For example, given the PHP core uses 1MB of memory, and a wordpress loads another 7MB of objects - you end up with 8MB being loaded _every request_. I assumed this was the same process for other scripting languages like Python and Ruby also. However, I have started looking at node.js (because JavaScript is so beautiful) and it seems that it is loaded _once_ (and whatever memory needed is only taken once) and then sits around waiting for requests sharing the classes it has loaded among any new threads (is that the right term?) so they don't have to re-load them. So PHP would take `8MB process * 10 requests = 80MB` for ten concurrent requests to wordpress. This sounds like node.js would take `8MB process + 10 requests = ~14MB`. **Is this really true? Are there any other scripting languages that do this?**


IIS for beginner

I have a problem understanding some functionalities in IIS. Per example I want to know when do I use "Add application", "add virtual directory" or "add website". Currently I have around 10 websites which are located in my wwwroot/websitename directory and they automatically appear under sites in IIS. What is the best approach?


Why learn git when there are GUI apps for GitHub?

Given that GitHub provides GUI apps for both Mac and Windows, what are the benefits of learning to use git from the command line? Currently I'm using their mac app to update my repositories, and so far it seems to cover my needs. What might I be missing out on?


What are the key terms rvalue and lvalue?

Many of the times my compiler shows errors like Lvalue or Rvalue Required. What are the **Lvalues** and **Rvalues** in **C or any programming languages**? Is a pointer constant a rvalue?


Sending exactly one notification n seconds after the event

I have a system that checks the status of a number of systems, such as, is http up, does the system respond to ping, that sort of thing. I check all of these systems every 5 minutes. If something is broken, I send out an e-mail with a notice. If the problem is cleared I send out an "all clear, problem resolved" notice too. I want to send out a notice 30 minutes after a problem is detected and the problem is still ongoing and then at failure +1h, +2h, +4h, etc. I do not want to flood the user with messages every time the event "problem still ongoing" occurs which is every 5 minutes. I could store a "last notification sent at" somewhere and just work with that but I would rather just solve it in the code itself. Am I missing something very obvious or is this the only feasible way?


Under what conditions should I rebase rather than merge?

Here is, roughly, our structure of work using git, for web development. We have a master branch, and individual or groups of work are done seperately in branches, then merged in.   1. A ticket (or several) comes in.   2. We create a branch on our local development repository, and push it to origin.   3. We fix the tickets in code, commit the work and push to origin.   4. Once we're happy with our work, we pull the branch down to a repository on our UAT / Staging server and check it out for the client to review.   5. The client approves the work.   6. We go back to our local development repository, we check out master, merge the branch, and push to origin.   7. We create a tag from master afterwards.   8. We then go on the live server, pull master and move/update the tag to the new one. There are 7 of us, working on about 15 projects or so throughout the year. Generally, one person is sufficient to work on a project at any one time, but sometimes two people might work in separate branches with a view to merging into the master branch around the same time. Generally we think merging is best because it, as I understand, preserves a development history with regard to what was merged and when. Whereas rebase seems to completely destroy this and linearize the master log. Why would, if this assumption is correct, someone want to use rebase? Is it only for extremely busy projects that are constantly being branched and merged and there needs to be a guarantee that merges are successful - so developers can test out adding master to their work and resolve conflicts before merging back in?


Rewriting software using Agile methodologies

Suppose you have to rewrite an entire application using Agile methodologies, how would you do it? I guess you could write a big bunch of user stories based in the behavior of your current system. And then implement them in small iterations. But this wouldn't mean that we have the requirements **UP FRONT**?? Also, when would you start releasing? Agile says we should release early and often, but it doesn't make much sense to release before the complete rewrite has been completed.


what receives an ajax call?

I'm making a site which should (a) take information from the user in the form of files and forms, (b) take that data to the server to be run on a C application, and (c) take the result back and show it to the user. I was told to look for AJAX for the communication with the server. BTW, I'm using rails. I'm trying to understand how AJAX works. From what I understand so far, with rails is pretty easy to make the call. What I can't figure out is, what waits for that call? what process the call? If I understand correctly, with rails I could make a function in ruby and make it so it's called through AJAX, which means -or so I understand- that it gets executed on the server. If I were using PHP, would I need to make an http server to wait for the AJAX calls? I just don't find information about what waits for the call, and that information is processed. Any links, comments or books are welcome!


Making subclass more type-specific with accessors

I have a super class: `TriggerManager` with a subclass `TimedTriggerManager`. NOTE: I'm working in java `TimedTriggerManager` only deals with `TimedTrigger` s, a subclass of `Trigger`. `TriggerManager` references all `Trigger` objects. To modify the subclass (`TimedTriggerManager`) to only accept `TimedTriggers` into its accessors and mutators (getters and setters) I have the following questions: 1) I have in `TriggerManager` the following `public void addTrigger(Trigger t)`. In `TimedTriggerManager` should I just override the method to throw an error if the argument (`t`) is not a `TimedTrigger`. If so, What error should I throw? If not, what should I do? 2) Should I add another method `getTimedTrigger` to work alongside the supper class's `getTrigger` so that I don't have to keep type casting? (Since the latter would return a `Trigger` object) 3) Is there anything else I'm forgetting, or some common practice that I'm not doing?


Pattern to use for different Stages in a software

I am developing a software for a laboratory to test some devices. To test each device there are multi subtests which should be done to reach to the final result.To perform a complete test, the software must pass Stage1 then automatically goes to Stage2 then Stage3 and so on until the whole test is finished. meanwhile the user can select to just have the Stage3 or Stage2 or any other Stages independently to be performed (which she selects that at runtime). this is the thing I have done so far: ![enter image description here](http://i.stack.imgur.com/UTpiF.png)               public class IronTestWorkFlow:ITestWorkFlow         {             private readonly List<ITestStages> _testStageses;                  public IronTestWorkFlow(List<ITestStages> testStageses )             {                 if (testStageses == null)                 {                     throw new ArgumentNullException("testStageses");                 }                 _testStageses = testStageses;             }         }      I am useing a DI container. But I don't know how to change the list of Stages in `ITestWorkFlow` at runtime. **Questions:** 1- Am I designing this right? 2- If yes which pattern shall I follow to obey the principles and change the stages at runtime? and how can I do that?


Capitalization convention for C# protected fields

What is the capitalization conventions for protected field names in C#? Is it _myVar (like private field) or MyVar (like properties)?


I am trying to figure out the best way to understand how to cache domain objects

I've always done this wrong, I'm sure a lot of others have too, hold a reference via a map and write through to DB etc.. I need to do this right, and I just don't know how to go about it. I know how I want my objects to be cached but not sure on how to achieve it. What complicates things is that I need to do this for a legacy system where the DB can change without notice to my application. So in the context of a web application, let's say I have a `WidgetService` which has several methods:               Widget getWidget();     Collection<Widget> getAllWidgets();     Collection<Widget> getWidgetsByCategory(String categoryCode);     Collection<Widget> getWidgetsByContainer(Integer parentContainer);     Collection<Widget> getWidgetsByStatus(String status);      Given this, I could decide to cache by method signature, i.e. `getWidgetsByCategory("AA")` would have a single cache entry, or I could cache widgets individually, which would be difficult I believe; OR, a call to any method would then first cache ALL widgets with a call to `getAllWidgets()` but `getAllWidgets()` would produce caches that match all the keys for the other method invocations. For example, take the following untested theoretical code.               Collection<Widget> getAllWidgets() {         Entity entity = cache.get("ALL_WIDGETS");         Collection<Widget> res;         if (entity == null) {             res = loadCache();         } else {             res = (Collection<Widget>) entity.getValue();         }         return res     }          Collection<Widget> loadCache() {         // Get widgets from underlying DB         Collection<Widget> res = db.getAllWidgets();         cache.put("ALL_WIDGETS", res);         Map<String, List<Widget>> byCat = new HashMap<>();         for (Widget w : res) {             // cache by different types of method calls, i.e. by category             if (!byCat.containsKey(widget.getCategory()) {                 byCat.put(widget.getCategory(), new ArrayList<Widget>);             }             byCat.get(widget.getCatgory(), widget);         }         cacheCategories(byCat);         return res;     }          Collection<Widget> getWidgetsByCategory(String categoryCode) {         CategoryCacheKey key = new CategoryCacheKey(categoryCode);         Entity ent = cache.get(key);         if (entity == null) {             loadCache();         }         ent = cache.get(key);         return ent == null ? Collections.emptyList() : (Collection<Widget>)ent.getValue();     }      _NOTE_ : I have not worked with a cache manager, the above code illustrates `cache` as some object that may hold caches by key/value pairs, though it's not modelled on any specific implementation. Using this I have the benefit of being able to cache all objects in the different ways they will be called with only single objects on the heap, whereas if I were to cache the method call invocation via say Spring It would (I believe) cache multiple copies of the objects. I really wish to try and understand the best ways to cache domain objects before I go down the wrong path and make it harder for myself later. I have read the documentation on the Ehcache website and found various articles of interest, but nothing to give a good solid technique. Since I'm working with an ERP system, some DB calls are very complicated, not that the DB is slow, but the business representation of the domain objects makes it very clumsy, coupled with the fact that there are actually 11 different DB's where information can be contained that this application is consolidating in a single view, this makes caching quite important.


Is Clojure, Scala and other restrained by the JVM vs CLR

The Java implementors seem slow to adopt language improvements, for example compare C# with full closures, expression trees, LINQ etc.. to Java, and even the push back of some stuff to Java 8 will still leave it behind the current implementation of C#. However since I dont intend to use either Java or C# that particular language war isnt of interest too much, im more concerned with the JVM vs CLR. Is this lagging-behind also applicable to the JVM? Will Scala, Clojure etc.. will they be able to continue to innovate or score optimal performance in the face of slowly progressing underlying VM such as JVM? Is Clojure/Scala restrained at present by JVM limitations?


What's the difference between SocketAddress and ServerSocket in Java?

Learning how to develop a small embedded HTTP server for a class assignment, and the examples given on how to use `com.sun.net.httpserver.HttpServer` use an `InetSocketAddress` which extends `SocketAddress` as the link between client and server. However, all of my previous network programming assignments used `Socket` and `ServerSocket` to create raw connections between a server and client to send custom protocols back and forth. Clearly these two classes are different as they don't share any common ancestor other than `java.lang.Object`. What is inherently special about each that makes them fundamentally different?


Data Model for selling groups of products as one product

Say I have an e-commerce with a data model like the following, which allows a `Sale` to describe how a single `Product` is sold. This division allows a product to be sold multiple times in different ways (different pricing, or offered at a different point in time). This works great when a sale is selling a single product. **Sale**   * product_id (sale belongs to product)   * other offer details like price, sale expiry date, marketing content, etc **Product**   * product has many sales   * factual product details like name, photo, manufacturers description, etc * * * **The problem:** How can this data model be improved to allow a sale to have many products? For example, to create a bundle of 1 of product A, and 1 of product B. So if a customer wants quantity=3 of those bundles, they would receive a total of 3 A's and 3 B's. Or a sale could be for multiples of a single product. In this case the sale would be for 5 of product C. So if a customer wants quantity=3 of those bundles, they would receive 15 product C's. * * * The best idea I have so far is add a new table. This would allow a sale to reference many orderables, which describe what's in the bundle. **Orderables**   * belongs to product   * belongs to sale   * qty in the bundle But a refactoring of this magnitude is a monumental task. The number times `sale.product` appears in the codebase for a variety of reasons is enormous. And every single case need to be fixed in code, and probably presentation as well. So before we commit too heavily to this approach, I'm wondering if there is a glimmer of hope I've not yet seen, or if my future is fraught with the pain and peril of this epic refactoring.


Does CTRL+C works in the whole world

I would like to know if CTRL+C (copy) keyboard shortcut works on all Windows versions above '98, all Non-English Windows and on all keyboards (English, German, Chinese...)?


Algorithm for defragmenting cross-pipe issues in a network for routing signals through?

I have a network I'm responsible for routing signals through. You can think of the network as a directed graph of nodes (hardware) but each edge is really a pipe capable of fitting a specific bandwidth, I can route signals to any index on that pipe and may have multiple signals of different 'size' going across the pipe. For what it's worth the signals are predetermined sizes and will not always be simple multiple of twos. I know how to defragment a single 'pipe' easily enough. However, it's theoretically possible that I could have to move signals around across multiple pipes to create enough room to fit a new signal. In a trivial example I could have two edges from A to B with enough space to fit a signal of size '4' available, and a signal of size '8'. To fit the signal across I would have to move some signals from pipe 2 to 1 so that 1 is completely freed, living a full '8' slots available for my new signal to routed in. **How to detect and properly defragment these sort of cross-pipe issues?** Of course in the real world I may have to route signals through completely different devices, perhaps having signals take less-direct routes, to free up enough space for my new signal on any given pipe. So in short across an entire system of these networks I want to   1. find a method to get a signal from input to destination in a crowded environment where I may have to move multiple signals to take a different path to their destination in order to free up sufficient space on a given pipe   2. figure out how to do the above with the minimum number of signals physically moved   3. have an approach that minimizes the need of running the above steps by minimizing fragmentation as much as possible. This is a complicated series of requirements on their own, and I'm not looking for an answer on how to do it all, though such an answer is welcome.


How do you find the most optimized way to write code?

In my programming career, I have written Java and PHP, Javascript and a little Ruby. I am not a CS major but got into web development from a more broad Internet Professional associates degree, which focused on Design, User Experience, and Development. I started out as Front-end Developer and quickly got great jobs working on complex applications which once I mastered the front-end world, I had the opportunity to become a Software Engineer on the projects because I understood the system and could figure out how to engineer it to do what I want. Obviously I work with most other who have CS degrees and while I may be faster at figuring out how to make the application we are working on do something, they usually understand basic concepts better than I. That being said, there are obviously language docs out there for Java and PHP but what resources are out there that tell you the best practices of writing good optimized code. Reading those docs aren't good enough to be able to write code and then show people like some of you and not get a bunch of "why didn't you do this" or "I can't believe he didn't do that. " There are a lot of blogs out there but you only find an article here and there by a person that focuses on explaining how to write better code. Or maybe I am wrong, I don't even think I am explaining this question all that clear. My main problem is, I can write code get it to work, think that it is written well but I'm not really sure. Besides just getting your code to work how do you know you have written it the preferred way that when others look at it, they say to themselve, this guy knows what he is doing :). If anyone has any specific language resources right now I would prefer PHP ones, since that is what I am working on.


Project Management Techniques (high level)

Our software dev team is currently using kanban for our development lifecycles, and, from the reasonably short experience of a few months, I think it's going quite well (certainly compared to a few months ago when we didn't really have a methodology). Our team, however, is directed to do work defined by project managers (not software project managers, just general business), and they're using the PMBOK methodology. Question is, how does a traditional methodology like PMBOK, Prince2 etc fit with a lean software development methodology like kanban or scrum? Is it just wasting everyone's time as all the requirements are effectively drawn up to start with (although inevitably changed along the way)?


Save database changes in service layer or controller mvc .net

I have recently been using a service layer to abstract away alot of the business logic of my application. However I've come into an issue where I'm not sure what is best practice on doing the actual persist of any changes I may make to my models. 1) Is it best to implement a SaveChanges() on my Service layer and so inject the IUnitOfWork into each one I use.                   public class BaseService : IService         {            private readonly IUnitOfWork _unitOfWork;                 protected BaseService(IUnitOfWork unitOfWork)            {               _unitOfWork = unitOfWork;            }                 public void SaveChanges()             {                 _dbContext.SaveChanges();            }         }      Hence my controllers would only ever be injected with my various services and I would call SaveChanges on these. 2) Or, is it best to let my controller, or service user contain the IUnitOfWork reference and let it call the save directly.                   public class MyController         {            private readonly IUnitOfWork _unitOfWork;            private readonly IMyService _myService;                 protected MyController(               IUnitOfWork unitOfWork,               IMyService myService)            {               _unitOfWork = unitOfWork;               _myService = myService;            }                 public void MyAction()             {               // do stuff with service layer                    _unitOfWork.SaveChanges();            }          }      **Note** : I would use a DI framework like Autofac, Ninject, Unity etc to manage the UnitOfWork creation via a InstancePerHttpRequest lifetime. 3) Or could I leverage action filters and persist the changes on ActionExecuted.                   public class UnitOfWorkActionAttribute : ActionFilterAttribute         {             public IUnitOfWork UnitOfWork { get; set; }                  public override void OnActionExecuted(ActionExecutedContext filterContext)             {                 UnitOfWork.SaveChangesAsync().WaitAndUnwrapException();             }         }


Measuring performance of a network simulator?

I have written a python program to test a new network routing algorithm, that uses a Content Centric Network Approach for handling requests (CCN), where the CCN router keeps 3 data structures:   * A PIT or Pending Interest Table, that holds requests for which a router has not yet received a response.    * A FIB or Forwarding Interest Base, which maps requests to the next router to which the request can be forwarded.    * A Content store to which the router can cache content from previous requests. The Simulator is simple: \- It follows the Event-Based design where 'Dummy Packets' are sent from server object to other server objects containing data of what content is being requested and the destination of where the content object is. **Specifically** , how could I design my simulator or tests to get a birds eye view of how my new algorithm matches up against standard IP routing? My hunch is that I will need to test speed, which I believe can be done by timing the round trip time for a request. But I don't know how I would test other aspects of this algorithm. I have little to no networking experience so any advice or direction is appreciated.


API providing function to be run in a thread vs. thread that runs this function

I'm writing a Python library which exposes a certain event listener interface. The user can register callbacks to handle different types of events. There is also a function which handles the actual events. This function does something like this:               def get_event():         while(1):             event = wait_for_event() # blocking call             process_event(event)      This function is meant to be run in its own thread. So really, the way to use it is               def start_listening():         thread = threading.Thread(target=get_event)         thread.start()      For simplicity I'm ignoring locking mechanisms and such. In the module API, I can either expose `get_event` or `start_listening`. What are the pros and cons of doing one versus the other? Is there a "pythonic" way of doing this?


Is it bad to use the same class or idiom names as in a third-party API that you're using?

FlashPunk is a third-party graphics API for simple game development in AS3, and they take what are effectively sprites or display objects of some sort and refer to them as "Entities". `Entity` is the actual class name, and it's the predominant class to use to animate something such as a character moving on the screen. There's a bit of a convention right now in which you refer to things like barriers, enemies, characters, etc. as "entities". So that being said, if you're using FlashPunk for your graphics, is it bad to create a base class to represent such things and name it `Entity` as well? (In particular, does this violate a widely-held coding convention?) Obviously it would be in a different package, and most people would probably separate the graphics from the game's actual state, so there's not a lot of overlap there. It's just using the same title. What about scenarios like this in general with programming? _Is there a particular convention?_


Implement RPC via SIP

Look at the following use case. I have a client (Java) application, which wants to get/set the state of another, remote application (C). The communication between them is done via SIP, which is run in another thread. The SIP interface can do the following: sendMessage onRequest I have two ideas for the architecture: **RPC (JSON-RPC)** Define a class which does the marshalling/unmarshalling for JSONRPCRequests and JSONRPCResponse (http://software.dzhuvinov.com/json-rpc-2.0-base.html) Define a Invoker class, which has something like a **call(server, name, arguments)** method. In the Invoker class, the name and arguments are put into a JSONRPCRequest and sent via the SIP layer sendMessage Now comes my problem. How do i actually get the right back to the caller? The control flow is now: The onRequest method is called, but I do now know whether it is the answer to my previous call. What i do is putting all responses reaching my server into a Map, and just poll that list in the Invoker. A rough sketch might be; **Invoker (provides API to client)**               class Invoker {              private Channel channel;              public Invoker(Channel channel) { this.channel = channel; }              public Object call(String server, String name, Object .. args) {             JSONRPCRequest req = ...;             channel.sendMessage(server, req.toString());             while( ! channel.hasResponse(req.id()) {                 Thread.sleep(42);             }             return channel.getResponse(req.id()).result();                 }          }      **Channel (interface to messenger):**               class Channel {              private Map<Object, JSONRPCResponse> responses = new //;              private Sip sip = new Sip() {             public void onRequest(String msg) {                 JSONRPCResponse response = JSONRPCResponse.parse(msg);                 responses.put(msg.id(), response);             }         };              public void sendMessage(String server, String message) {             sip.sendMessage();         }              public boolean hasResponse onRequest(Object id) {             responses.hasKey(id);         }              public JSONRPCResponse getResponse(Object id) {             responses.get(id);             responses.delete(id);         }          }      **SIP (messenger itself):**               abstract class Sip {              public void sendMessage(String msg) {             // SIP magic         }              public abstract void onRequest(String msg);         }      Is there a better way to do that? My biggest problems/code smells are:   * the blocking in Invoker    * the protocol is in Invoker, maybe I want to switch marshalling to something else   * the map as mean to get the correct response for a request   * the SIP abstract method looks strange   * No error handling   * No timeout **Message Passing** Is there an easy way to get rid of RPC, and implement something like RPC with just message passing? Any hints for pattern are welcome. I do not need the code itself, I am totally fine with just architecture. I tried to google for message passing implementations, and how they actually change state with it, but I did not find anything useful. How to implement timeout/ error handling? Any good books/literature on that topic is also welcome, as I never programmed such distributed stuff. Any other ideas on which protocol to use inside SIP to change state is welcome, too, as RPC was my initial thought, and I did not find anything other useful. The code will not compile, I guess, it was just to visualize my idea.


JavaScript...what to unit test

I would like to hear other people's opinion on what to unit test in JavaScript. I've been thinking about it and experimenting and let me present what seems to me the right thing. First of all, in order to be able to unit test your production code you need to divide the productin code into three layers: (1) DOM/jQuery, (2) Logic, and (3) AJAX. Refer to the attached image. ![enter image description here](http://i.stack.imgur.com/XkqwX.png) The Logic layer sits between the DOM/jQuery layer and the AJAX layer, that is, the DOM/jQuery layer is not tied to the AJAX layer. So, in my opinion the only layer that should be unit tested is the Logic. Writing unit tests should be easy, otherwise programmers will not write them. What is the use of writing unit tests for the DOM/jQuery layer - ok, you've added an li element to an ul element, why do I need to assert that, there should be no if statements there. About the AJAX layer, what's there to assert...the URL that was used was "blah", I know it was "blah". Whatever the data that was obtained in the AJAX layer should be given to the Logic layer. Now, the Logic layer is a different story, for example, in a unit test it can be given data that suppossedly came from an AJAX call, and use a mock DOM/jQuery layer to verify that the data was displayed correctly. Let me know what you think.


Where should libraries be placed, in windows?

I have just moved from Linux to Windows, and I have to use the Zend Framework library. Where should the library be placed?   * Directly on C drive   * Create a lib folder like C:/lib/    * Create a lib folder in my user folder I am wondering if there is a classic folder where these kind of libraries are placed. **Update** :I am asking about the location on my own standpoint. The Zend Framework library is a PHP framework.


What's the difference between MariaDB and MySQL? I'm not very familiar with both. I'm primarily a front end developer for the most part. Are they syntactically similar? Where do these two query languages differ? Wikipedia only mentions the difference between licensing: > MariaDB is a community-developed branch of the MySQL database, the impetus > being the community maintenance of its free status under GPL, as opposed to > any uncertainty of MySQL license status under its current ownership by > Oracle.


Open sourcing an internal project that has confidential information in the old revisions.

> **Possible Duplicate:**   >  How to open-source a project whose git repository has copyrighted media in > the history? Our company has spent a year working on an internal web application and has decided to open source the project and host on github. The application was originally versioned with Bazaar and we are going to preserve the commit history when converting it to git. There is some confidential information within the commit history, such as internal database information. **Question:**   Is there a way to preserve the commit history while removing or hiding all traces of confidential information? The big reason being that we have had employees that have worked on the project that have moved on to ~~higher-paying~~ other jobs and we want to maintain recognition of their hard work.


Best practice for organizing third-party integration code in ruby

I have a rails app. I'm writing code to integrate it with a third-party service, "Foo Bar". The integration affects many parts of the system -- models, controllers, and an API wrapper. Thus far I've been putting the integration stuff into the modules of each model and controller. So inside **app/models/user/foo_bar.rb** is `User::FooBar`, which I then include into my user model. I have the API wrapper inside **lib/foo_bar_api.rb**. It occurred to me today that perhaps I should have all my integration code in **lib**. So **lib/foo_bar/user.rb** would contain `FooBar::User`, which I then include in my user model. Is there a particularly standard way of doing this, or is it 6 of one, half- dozen of another? (p.s., this is my first programmers.stackexchange.com question -- it's appropriate for here, right?)


Basic Database Relationship Advice?

I am finding it difficult to get together in a single place the different types of relationships used for different things and would like to find out which I have correct and incorrect and the proper "technical" terms for the different types of relationships. An example:               In database we have:     One to One     One to Many     Many to Many      I beleive (although I may be wrong hense the question) that these types of relationships are collectively termed "Multiplicity" relationships. Is this correct, and if so, are there other names for it.               In programming we have:     Ihneritance     Encapulslation     Polymorphism      I beleive (and may be very wrong here) that these are different types of "Compound" relationships. If they are all the same type of compound relationship then is there other names for it. If they are different, how are they named. I would also like to know if there are other relationship types in general database / programming world that would be used to some degree without going into obscurity like some sort of unused sci-fi "molocular mumbo jumbo bumbo" relationship. Just keeping to what would be generally useful in the real world. I think I have a good understanding of the different relationship types, its more the terms used to describe them, and comming up with a brief 2 or 3 line description that really sums it up (assuming someone has allready got a fair understaiding). Knowing the technical terms properly and clearly will help me should I need to advise others on what to look for elsewhere. Can anyone offer suggestions on this for me without getting overly technical. Thanks in advance.


Why (not) segmentation?

I am studying operating systems and the x86 architecture, and while I was reading about segmentation and paging I naturally was curious how modern OSes handle memory management. From what I found Linux and most other operating systems essentially shun segmentation in favor of paging. A few of the reasons for this that I found were simplicity and portability. What practical uses are there for segmentation (x86 or otherwise) and will we ever see robust operating systems using it or will they continue to favor a paging based system. Now I know this is a loaded question but I am curious how segmentation would be handled with newly developed operating systems. Does it make so much sense to favor paging that no one will consider a more 'segmented' approach? If so, why? * * * And when I say 'shun' segmentation I am implying that Linux only uses it as far as it has to. Only 4 segments for user and kernel code/data segments. While reading the Intel documentation I just got the feeling that segmentation was designed with more robust solutions in mind. Then again I was told on many occasions how over complicated the x86 can be. * * * I found this interesting anecdote after being linked to Linux Torvald's original 'announcement' for Linux. He said this a few posts later: > Simply, I'd say that porting is impossible. It's mostly in C, but most > people wouldn't call what I write C. It uses every conceivable feature of > the 386 I could find, as it was also a project to teach me about the 386\. > As already mentioned, it uses a MMU, for both paging (not to disk yet) and > segmentation. It's the segmentation that makes it REALLY 386 dependent > (every task has a 64Mb segment for code & data - max 64 tasks in 4Gb. > Anybody who needs more than 64Mb/task - tough cookies). I guess my own experimentation with x86 led me to ask this question. Linus didn't have StackOverflow, so he just implemented it to try it out.


where do you track team Decisions

I have been on many development teams and as the team matures decisions about direction are made. These decisions often come back up over and over. Like why don't we fill in this field why didn't we use memcache over a custom solutions. These decisions add up over time and become a significant part of style guides coding standards and unit tests. My question is I have never run into a good way of tracking these decisions or the discovery that went into making them. Does anyone have a best practice.


What technology is used to build "Visual Studio 11"?

A preview of the new "Visual Studio 11" was recently shown at Microsoft's BUILD conference. Out of interest, what technology is being used to create it? I assume it's not WinRT (which I've been led to believe is only for Metro style apps in the new Windows 8 touch-first environment) Is it still using WPF (like 2010)? Is it built on .NET 4.5? Are there any new technologies going into it? Do we know?


Ensuring non conflicting components in a modular system

So lets say we are creating a simple "modular system" framework. The bare bones might be the user management. But we want things like the Page Manager, the Blog, the Image Gallery to all be "optional" components. So a developer could install the Page Manager to allow their client to add a static home page and about page with content they can easily edit with a wysiwyg editor. The developer could then also install the Blog component to allow the client to add blog entries. The developer could then also install the Gallery component to allow the client to show off a bunch of images. The thing is, all these components are designed to be independent, so how do we go about ensuring they don't clash? E.g. ensuring the client doesn't create a /gallery page with the Page Manager and then wonder why the gallery stopped working, or the same issue with the Blog component, assuming we allow the users to customize the URL structure of the blog (because remember, the Page Manager doesn't necessarily have to be there, so we might not wan't our blog posts to be Date/Title formatted), likewise our clients aren't always going to be happy to have their pages under pages/title formatting. My core question here is, when building a modular system how to we ensure that the modules don't conflict without restricting functionality? Do we just leave it up to the clients/developer using the modules to ensure they get setup in a way that does not conflict?


How do you identify a problem as being suitable for dynamic programming?

I have been reading up on dynamic programming lately. Would like to hear from someone who started from scratch and now is pretty good at identifying and solving DP problems. I am struggling in identifying these problems as DP and framing a concise solution. I have gone through most of the beginner DP problems and MIT resources etc


Unit test DAO code using SQL Lite when the application database is Oracle

We have an application with Oracle backend. The DAO layer is written in C# and uses nHibernet to perform the data operations. To unit test our DAO code, we use SQL Lite which creates the database based on our existing mapping in the project. Some of our nHibernate queries that go to oracle use (+) for outer joins. Now SQL Lite doesn't understand (+). There can be some more syntax from Oracle that SQL Lite doesn't understand. How do we fix problems like these? What are the other database systems that can be used for unit testing the application code.


Using a closure to avoid code duplication in Python

Sometimes I find myself wanting to run the same code from a few different spots in the same function. Say I have some function func1, and I want to do the same thing from a few different spots in func1. Normally the way to do this would be to write another function, call it "func2", and call func2 from several different places in func1. But what about when it's convenient to have func2 access variables that are local to func1? I find myself writing a closure. Here's a contrived example:               import random     import string          def func1 (param1, param2):         def func2(foo, bar):             print "{0} {1} {2:0.2f} {3} {4} {0}".format('*'*a, b, c, foo, bar)              a = random.randrange(10)         b = ''.join(random.choice(string.letters) for i in xrange(10))         c = random.gauss(0, 1)         if param1:             func2(a*c, param1)         else:             if param2 > 0:                 func2(param2, param2)      Is this the Pythonic way to handle this problem? A closure feels like pretty heavy machinery to be rolling out here, especially given that I have to construct a new function every time func1 is called, even though that function is going to be basically the same every time. But it does avoid the duplicated code and in practice the overhead of repeatedly creating func2 doesn't matter to me.


What do I benchmark before updating a web site?

I am volunteering my time to update a website for a local business. The current website they have is not up to date and it fails quite a few "web tests". For example, the pages are too large, the images are not compressed, and the site is not mobile friendly. All of these things are measurable - eg. the time taken to load (in seconds), bandwidth (in kb), and a list of the devices the site displays correctly on. It is my intention to note these benchmarks before starting the project, and upon completion. My question is: what benchmarks do web developers present to their clients?


Help me with random access file without using a database in vb6.0

I'm an IT student and we have to make a project about random access file without using a database, using only text files. So I was wondering if anybody here that could help me with it. I want to have an example so I can study it. A simple random access file program will do. An example of it is a phonebook in which you can save a name and a phonenumber. And you can edit it and delete. And also search names or phonenumbers and also can browse all the files randomly. If you know how it's done or if you have any samples that I can study, please answer. Your help is really appreciated. And I'll give you credits if I make my program. I'll thank you in advance....


Software developer interview questions: is speed everything?

Maybe I'm just less smart than other people but for once I'd like to say that all the puzzles, riddles, code questions and code-on-paper exercises seem just a bit hard to me. I've always thought of myself as a above-average smart guy, but in an interview when they ask me to solve something or write code on paper in order to ask something, I think I'm just not suited to that. Maybe I'm not as productive as someone who is totally reactive and a fast- thinker, but I repute myself a creative thinker, someone who is able to solve every problem if he's given enough time (which is not EONS, just some time more than a fast'n'furious minded applicant). In my opinion is not guaranteed that a fast thinker is smarter than a less-fast thinker (not slow, just LESS fast). Is speed everything in face-to-face-with-paper interviews?


Obtaining the best of both worlds: MVC and WebForms

Rather than asking a general question about WebForms vs MVC (such as in ASP.NET v/s ASP.NET MVC), I have a specific quesiton. It appears the main differences between the two approaches are   1. WebForms is Event Driven and uses pre built components   2. MVC has a built in layer that WebForms does not: the Model   3. MVC has the Controllers in a separate folder than the Views while the WebForms Controller is the CodeBehind One could easily add a folder to a WebForm project called "Model" that stores all the business logic which used in the Code Behind (decoupling the two). The main argument against WebForms is that it's "easy" to write business logic in the CodeBehind. But you could easily add business logic in your MVC controller completely violating the separation of concerns. Now for the question: Isn't it the case that you could write a WebForms project in such a way that the business logic is separate from the Controller/Code Behind which would have all the benefits of MVC (separation of concerns) while keeping the benefits of WebForms: rich controls, Event driven (if you like events)?


Can someone explain the behind-the-scenes process of connecting an app account to a Facebook account?

I am developing an app that will use the Twitter and Facebook login APIs exclusively. Suppose a new user downloads the apps and is presented with the option to log in through Facebook or Twitter. The user chooses Facebook. I think the procedure at this point is to a) create an auto-generated user ID in my Users table   b) store the Facebook credentials against the auto-generated user ID I am confused about part b. Does Facebook return a unique ID when their API is called that I can store against my user ID or is there some alternate process? In other words, what exactly does it mean to store the Facebook credentials?


Are security exploits a fatality?

_I'm asking this here and not on the security related site because this one is a question about "software architecture" and "development methodologies", which are both covered by the FAQ._ **EDIT** : I'm talking about purely remote root / admin software exploits. Not about insider physically breaking into labs / companies / houses / networks / machines. Everytime there's a blog entry or article about a new security exploit there are lots and lots of people basically writing that: _"No software shall ever be secure, every single software out there can be exploited. Give any pirate sufficient time and he'll eventually exploit any high-target software."_ This is a constant. These type of comments always get modded like crazy and most people seems to accept it as a fact. And it really gets me wondering: can any software architecture and development methodologies be used to ever come up with secure software or is there something technical that prevents us from writing secure systems/programs/OSes/servers? The more I think about it, the more I don't understand why we couldn't, technically, build 100% secure software. All the way down from the OS and then up: browsers, plugins... Note that I'm not interested in a discussion here: I want to know if technically there is something or not that can prevent, say, an OS, to be written in a 100% secure way and why it's that way. Now if there's nothing technically that prevents us from writing a 100% secure OS and from then writing a 100% secure server, why hasn't it been done? Does it means our architecture and development methodologies (and tools?) are deeply flawed?


CUDA Loop Question - Worthy of Unwinding?

It's a known fact that branching is bad for CUDA. The question I have is a little more specific. I have a (static) loop. Static here means that it follows the exact same path every time, and executes the same number of times. Inside the loop are branches, but in a given iteration, the same branch is followed every time. So, if we unwind/unroll this loop, and flatten out obvious branches, it will be plain-old sequential code. Is it worth it to unwind this loop for execution on a CUDA device, or will branch prediction work well enough and execute only one branch per thread? Because otherwise, there are about 34 paths through the code that can be taken, and I'm trying to avoid each thread taking each path. Example loop:               for (int i = 0; i < 33; i++)     {         if (i % 3 == 0)             ...         if (i % 3 == 1)             ...         if (i % 3 == 2)             ...     }


Story points for bug fixing tasks: Is it suitable for Scrum?

I'm just wondering if we should assign story points to bug fixing tasks or not. JIRA, our issues-tracking software, does not have story point field for _Bug_ type issues (it's only for _Story_ s and _Epic_ s). Should we add the _Bug_ issue type to the applicable issue types of the _Story Points_ field? What are the pros and cons? Would it be suitable for Scrum?


Why don't relational databases support returning information in a nested format?

Suppose I'm building a blog that I want to have posts and comments. So I create two tables, a 'posts' table with an autoincrementing integer 'id' column, and a 'comments' table that has a foreign key 'post_id'. Then I want to run what will probably be my most common query, which is to retrieve a post and all of its comments. Being rather new to relational databases, the approach that appears most obvious to me is to write a query that would look something like:               SELECT id, content, (SELECT * FROM comments WHERE post_id = 7) AS comments     FROM posts     WHERE id = 7      Which would give me the id and content of the post that I want, along with all the relevant comment rows packaged neatly in an array (a nested representation like you'd use in JSON). Of course, SQL and relational databases don't work like this, and the closest they can get is to do a join between 'posts' and 'comments' that will return a lot of unnecessary duplication of data (with the same post information repeated in every row), which means processing time is spent both on the database to put it all together and on my ORM to parse and undo it all. Even if I instruct my ORM to eagerly load the post's comments, the best it'll do is to dispatch one query for the post, and then a second query to retrieve all of the comments, and then put them together client-side, which is also inefficient. I understand that relational databases are proven technology (hell, they're older than I am), and that there's been a ton of research put into them over the decades, and I'm sure there's a really good reason why they (and the SQL standard) are designed to function the way they do, but I'm not sure why the approach I outlined above isn't possible. It seems to me to be the most simple and obvious way to implement one of the most basic relationships between records. Why don't relational databases offer something like this? (Disclaimer: I mostly write webapps using Rails and NoSQL datastores, but recently I've been trying out Postgres, and I actually like it a lot. I don't mean to attack relational databases, I'm just perplexed.) **EDIT:** Since a few people seem to be confused, I'm not asking how to optimize a Rails app, or how to hack my way around this problem in a particular database. I'm asking why the SQL standard works this way when it seems counterintuitive and wasteful to me. There must be some historical reason why the original designers of SQL wanted their results to look like this. I also think that the people saying "just run two queries" are missing the point too - I may not know the post's id when I'm making a query. I may not have to eager load one relationship, but dozens. I used a concrete example not because it's a particular problem I'm trying to solve, but because it illustrates my point. For the people below who say that it's not the database's job to return data ready for display, it seems to me that joins and database views perform basically the same functionality - they make the denormalized data in your db easier to put together and use (not necessarily display, but use). I think that what I proposed above is basically equivalent to a join, just simpler for the developer to parse and make use of.


WPF, MVVM, EF, POCO guidance required on simple architecture

(sorry for my poor english) I am developing a application using WPF, EF Code First using MVVM (Caliburn.Micro). It should be used mostly to CRUD work. I created a `BaseViewModel<T>` class from wich all other ViewModels inherit and exposed a `T Selected` property to bind to the View. I know it is not recomended to expose a Model to the View but it just make things simple to get the app running. Problem is I do not want to pollute my Models (EF POCO classes) with `INotifyPropertyChanged`, `IDataErrorInfo`, `IEditableObject`, etc... So, there is something that I can do here or do I have to really duplicate all Model properties to the ViewModel and give up trying to bind the model directly? I would like to use the attribute validation too, since all models have them already. I used this approach on the past with Silverlight/RIA but in this case RIA Services generated the classes for me, with all the plumbing code. I can get the validation errros using Validator class but I also need to indicate the component that has the error no the UI and I think I need to implement `IDataErrorInfo` on my model for this to happen, right? For `INotifyPropertyChanged` I can use something like NotifyPropertyWeaver but my problem is `IEditableObject` and something to be able to use the attribute validation. It would be nice something like `MagicBusinessBaseClassThatImplementAllThoseInterfaces<Model>` to encapsulate the model so I can just bind it and move on. I know I can make this work implementing manually the interfaces on each VM - but just think on all the "duplicated" code make me cringe :( How WPF developers are doing those kind of things today? There some secret ninja technique that I am not aware of?


Best way to approach a partner business to understand the need for B2B web-services

We currently work with a company that has a fairly simplistic web system for processing warranty information. The only way to get data out of it is through excel exporting. Compilation of this data and correlation with our systems has to be manual and makes us be reactive in our response. The ideal situation would be setting up a web service on their side and automatically mash it up with our data so that we can have good and timely information without human overhead or the weekly bottleneck. However, when we mentioned this same argument to them, their IT department creeped out from us wanting to access their systems "directly", since they have other information for other vendors which are our competition. **In other words, they seem to think it is something weird and insecure**. My question is: how would you make them understand the need to modernize their systems?, have you had any experience convincing the company you want the web- service from?, and, would you go convince them yourselves as a company with the need, or hire a consultant to assess this and speak with them instead? Edit: We supply custom made electronic devices for our clients which then sell it to end users. End users deal with our clients and, depending on the case, then the client deals with us if they require software/hardware fixes for the next revision.


Semantic versioning for desktop applications

I can easily follow the Semantic Versioning recommendations if I develop a library or API, but what if the developed product is a website or a desktop application? When would you increment a `major` component in that case? In case of a complete UI redesign? Or something else? Thoughts?


How important is an SSL certificate for a internal website?

I know many people have asked the same question but I think it really depends on the type of the website. So that's why I am asking the question about my website. I am developing a PHP web application for an insurance company. the application contains all information about the customers but this app is only used by the admins and salesman of the company. The admin creates a user then that user can add customers or renew their insurance. the address will be something like example.com/manage/ and the login is only for the users that admin person has created. Of course I will be using validation, salt, encryption, etc. But do I need SSL certificate?


What can Go chan do that a list cannot?

I want to know in which situation Go chan makes code much simpler than using list or queue or array that is usually available in all languages. As it was stated by Rob Pike in one of his speeches about Go lexer, Go channels help to organize data flow between structures that are not homomorphic. I am interested in a simple Go code sample with chan that becomes MUCH more complicated in another language (for example C#) where chan is not available. I am not interested in samples that use chan just to increase performance by avoiding waiting of data between generating list and consuming the list (which can be solved by chunking) or as a way to organize thread safe queue or thread-safe communication (which can be easily solved by locking primitives). I am interested in a sample that makes code simpler structurally disregarding size of data. If such sample does not exist then sample where size of data matters. I guess desired sample would contain bi-directional communication between generator and consumer. Also if someone could add tag [channel] to the list of available tags, that would be great.


Which one of these implementations is more appropriate for my REST api?

### Background So I have a REST API that allows for client applications to access and manipulate users' data. I'm in the process of writing an Objective-C class for simple utilization of this REST API, but I'm stuck between two methods of implementation. ### Method 1               class MYClient         string username         string password         methods for using GET, PUT, POST, DELETE on questions         // questions are dictionaries with 'title' and 'body' strings      ### Method 2               class MYUser         string username         string password         array  tokens     class MYToken         string title         string body          // classes inherently sync themselves to the server in their initializers, setters, and getters      ### Questions   * Is there one that is more appropriate for use in (for example) iOS apps?   * Is there one that is more appropriate in general?   * What are the distinct benefits of Method 1 over Method 2 and vice versa?


Ways to modularize blocks of code in ASP Classic

I have one huge file.asp with all my reports. I have modularized the page using querystring, so this creates a lot of "virtual pages" with Report #1, Report #2, and so on. I have some blocks of code I use more than once in the page. Actually I am repeating the code, but I already started to use Function to, for example format the date. But the block of codes are like panels with some selects in databases, tables, and so on... I mean, one panel can have more than 200 lines of code. I would like to create some kind of function to reuse the code, instead of replicate it everytime. With classic asp, how many options I have? One that I have discarted is create one asp file per panel and in a master file include the panel where is necessary. I am really out of this approach. Is the Function the best approach?


Best practice/Patterns for two way data synchronisation

Quite often in my work the idea of 2-way data synchronisation between database systems crops up. The classic example is two slightly different CRM systems (say, Raiser's Edge and Salesforce) and the need to have a two-way sync of Contact data between them. API considerations aside, assuming you have a shared key to sync on, and purely thinking of the algorithm/pattern to be employed, this is a task that is often underestimated by non-techies. For example, you have to watch out for:   * Can you easily detect which records have changed in both systems (or will you have to compare all records between the systems to detect changes)   * If you're going for a once-every-N-hours sync, how to deal with conflicts where the same record changes at more-or-less the same time in both systems   * If you're going for a real-time sync (ie an update in one system immediately triggers an update to the other system) how to handle divergence over time due to bugs or system crashes Personally I can think of ways to tackle all this but I'm wondering if there are any well known patterns, literature or best practices that I could refer to.


Learning Zend Framework 1 or 2?

I have programmed for a few years in php and now I'm going to learn zend framwork. Zend is very popular and there are a lot of tutorials, books and documentation out there. But I saw in the last months that there is a second version of Zend, but it's not so used and popular, not yet. I think it is better to start with a new version, but I don't know what to do now, as when I see job offers many people require the first version. Which version do you suggest me?


What was the first server-side language

I was thinking about different server-side languages and this question immediately cropped up in my mind. What was the first server-side programming language using which websites were being created? Was it java or some other language? Note: I think some languages became prime server-side because they provided or rather aimed to provide better tools and libraries for easy development. I agree Java was not primarly server-side but it provided better tools and hence was and is used a lot.


How do I assess tradeoff between robustness and "lazy" code in API design?

Postel's law: > Be conservative in what you do, be liberal in what you accept from others. "Lazy" code (per The Pragmatic Programmer): > Be strict in what you will accept before you begin, and promise as little as > possible in return. I'm developing a finance (asset pricing, etc.) framework for Python. Question: when designing the API for the framework, what factors should I consider when I assess the tradeoff between being strict and being liberal re: inputs? Example: I have the following method that downloads stock prices from Yahoo.               def historical_prices(ticker, start=None, end=None, data='d', convert=True):     # Do stuff      For the date arguments (`start` & `end`), I could:   * Be strict, and only allow a string of ISO format YYYY-mm-dd, or   * Be liberal and accept datetime objects, strings (of specified formats), etc.


Can I save & store a user's submission in a way that proves that the data has not been altered, and that the timestamp is accurate?

There are many situations where the validity of the timestamp attached to a certain post (submission of information) might be invaluable for the post owner's legal usage. I'm not looking for a service to achieve this, as requested in this great question, but rather a method for the achievement of such a service. For the legal (in most any law system) authentication of text content and its submission time, the owner of the content would need to prove:   * that the timestamp itself has not been altered and was accurate to begin with.   * that the text content linked to the timestamp had not been altered I'd like to know how to achieve this via programming (not a language-specific solution, but rather the methodology behind the solution). * * *   1. **Can a timestamp be validated to being accurate to the time that the content was really submitted?**   2. **Can data be stored in a form that it can be read, but not written to, in a proven way?** In other words, can I save & store a user's submission in a way that proves that the data has not been altered, and that the timestamp is accurate? I can't think of any programming method that would make this possible, but I am not the most experienced programmer out there. Based on MidnightLightning's answer to the question I cited, this sort of thing is being done. * * * **Clarification:** I'm looking for a method (hashing, encryption, etc) that would allow an average guy like me to achieve the desired effect through programming. I'm interested in this subject for the purpose of Defensive Publication. I'd like to learn a method that allows an every-day programmer to pick up his computer, write a program, pass information through it, and say: > I created this text at this moment in time, and I can prove it. This means the information should be protected from the programmer who writes the code as well. Perhaps a 3rd party API would be required. I'm ok with that.


Getting unicode characters in gVim on Windows

What I'm trying to do? I'm using gVim on Windows, and am trying to get something that looks like this. ![alt text](http://i.stack.imgur.com/IqEuN.png) See the indent lines and tab characters? _(check out the link for the big picture if this one is too small)_ I tried a lot of things already, some of them having to do with fonts, some of them having to do with encodings, some of them having to do (it seems) with the current air pressure, and wind speed. But none of them worked.


What is the meaning of the sentence "we wanted it to be compiled so it’s not burning CPU doing the wrong stuff."

I was reading this article. It has the following paragraph. > And did Scala turn out to be fast? Well, what’s your definition of fast? > About as fast as Java. It doesn’t have to be as fast as C or Assembly. > Python is not significantly faster than Ruby. We wanted to do more with > fewer machines, taking better advantage of concurrency; we wanted it to be > compiled so it’s not burning CPU doing the wrong stuff. I am looking for the meaning of the last sentence. How will interpreted language make the CPU do "wrong" stuff ?


What is an exit option in an IT career

In management consulting, iBanking...there is a popular term called Exit option. What exactly does this refer to in layman's terms?   Also in an IT career, is the term relevant? For a programmer/ project manager for example?


Which Linux distro to pick for volunteering?

The number of Linux distributions is large. Someone wanting to volunteer with one of them might have a hard time picking between them, because it's hard to sense the culture, environment, and level of community and esprit de corp. Also, some might be very strict with long processes before you are trusted, or else much looser with a smaller community with more trust. It's hard to tell where to look for information. Maybe one is in great need, and others are well-established with less need. How would I find out who is in greatest need? Joining a Linux distribution's team of writers, developers, testers, coordinators, and administrators is a big decision. This is an extremely sensitive question, and I hope nobody is slighted by either the question or responses.


How to convert an html page to pdf using javascript?

I am developing a project, In that I have a receipt page (this is the html page that I want to convert it into pdf) and I've to print it. While printing that page alignments are not coming properly. If I convert it into pdf, then pdf only will take care of that alignments thus my work will become easy and effective. I was restricted to use either JavaScript or js libraries only to complete this task. Could any of you please help me?