title: The Observer pattern using the pulling mechanism

text: I was wondering about the following implementation of               public void update(Observable obs, Object arg)      while i want to send to all of my observer and update using `notifyObserver()` i and passing a references to `this` the observer can use the `getters` from the subject to pull the information he wants. what is the `arg` argument on the update method meant for?


title: Use controller in view in MVC

text: I have a problem convincing my team mates why we shouldn't use (directly reference) the controller in the view when developing components in the spirit of MVC. I have invoked decoupling and natural intuition, but still those arguments didn't get through. They say, in their defense, that this is a normal compromise. What arguments are convincing? Or they are right? How can the practice of using the controller in the view could affect a project on the long run?


title: Does a project typically get built or designed (graphically) first?

text: Say you are going to build a fairly large website. Would all the pages be designed before they are built, or would all the pages be built and functional before they are graphically designed? I am a programmer and a graphic designer. When build a new website I usually have a rough outline of all the pages I am going to need and how they are going to work. I then usually start to build the pages, as I build the pages I tend to design the graphical interface at the same time. I am starting to think this is bad because each page ends up looking good, but not uniform. Or even if they _appear_ uniform they really aren't. For example, on **page A** and **page B** the heading looks the same but on **page A** it has a `50px margin` while on **page B** it has a `50px padding`. The styling for the heading on **page A** is defined in one `CSS` file and the styling for the heading on **page B** is defined in another. Over time it can become a giant mess. I need a new approach. There are many ways I have learned to keep this kind of thing from happening in code (DRY). I don't really know how to apply them in this area though. Or maybe I just don't currently have the discipline. One idea is, after the project outline is complete, create graphical designs of how all the pages will look before I build any. Then I should be able to design the styles before building the pages so I won't be introducing duplicate style definitions as I build. The problem is, before I design a page with HTML/CSS, I design it in Photoshop. However, they don't always workout exactly the way I designed them in Photoshop. Sometimes I have to make adjustments to get it to look right on the page. Sometimes the adjustments needed differ from page to page. I don't see how I can plan this ahead of time. What's the normal workflow for something like this?


title: Dealing with class optional dependencies

text: I am wondering how are you guys handling an optional class properties. Let's say I have a product that can bud doesn't have to have a `color` property. Is that really the best way of doing that? Should I use null object pattern? Should I use strategy pattern maybe? Should I maybe use a decorator pattern here so I'll have `Product` and `ProductWithColor`? What if another property will be added and become optional?               <?php          class Product     {         private $id;         private $title;              /**          * @var string|null          */         private $color;              function __construct($id, $title, array $color = null)         {             $this->id              = $id;             $this->title           = $title;             $this->color           = $color;         }     }


title: OpenGL FrameBufferExternal Two Different Target

text: Im trying to use framebuffer objects to render into textures. In my code below, I have a framebufferobject with 2 textures and one depth buffer attached to it. My aim is to render a colored cube with front and back face culled for two textures. Later I will use these as inputs into fragment shader program named in my code "shaderProgramFinal". However I could not been able to render both back culled and front culled version at the two textures. They either become back culled or front face culled version simultaneously. I want frontTex contain back culled and backTex contain front culled version. Can anyone help me where Im wrong in my code below?               #include <GL/glew.h>     #include <GLFW/glfw3.h>     #include <stdlib.h>     #include <stdio.h>     #include "Shader.hpp"     #include "ShaderProgram.hpp"     #include <math.h>     #include <glm/glm.hpp>     #include <glm/gtc/matrix_transform.hpp>     #include <glm/gtc/type_ptr.hpp>     #include <glm/gtx/euler_angles.hpp>          #define screenSizeX 500     #define screenSizeY 500          GLFWwindow* window;          static void error_callback(int error, const char* description){fputs(description, stderr);}          void glSetup(){     glfwInit();     glfwSetErrorCallback(error_callback);     glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,4);     glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,0);     glfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);     glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);     window = glfwCreateWindow(screenSizeX, screenSizeY, "Graphics World", NULL, NULL);     glfwMakeContextCurrent(window);     glewExperimental = GL_TRUE;     glewInit();     printf ("Renderer: %s\n", glGetString (GL_RENDERER));     printf ("OpenGL version supported %s\n", glGetString (GL_VERSION));     glEnable (GL_DEPTH_TEST);     glDepthFunc (GL_LESS);     }          void shaderSetup(Shader* vertexShader, Shader* fragmentShader, ShaderProgram* shaderProgram){     vertexShader->loadFromFile("myVert.S");     vertexShader->compile();     fragmentShader->loadFromFile("myFrag.S");     fragmentShader->compile();     shaderProgram->attachShader(*vertexShader);     shaderProgram->attachShader(*fragmentShader);     shaderProgram->linkProgram();     shaderProgram->addAttribute("Position");     shaderProgram->addAttribute("ColorC");     shaderProgram->addUniform("rotateMatrixX");     shaderProgram->addUniform("rotateMatrixY");     shaderProgram->addUniform("rotateMatrixZ");     }          void shaderSetupFinal(Shader* vertexShader, Shader* fragmentShader, ShaderProgram* shaderProgram){     vertexShader->loadFromFile("myVertFinal.S");     vertexShader->compile();     fragmentShader->loadFromFile("myFragFinal.S");     fragmentShader->compile();     shaderProgram->attachShader(*vertexShader);     shaderProgram->attachShader(*fragmentShader);     shaderProgram->linkProgram();     shaderProgram->addAttribute("Position");     }          int main(void)     {     glSetup();          Shader vertexShader(GL_VERTEX_SHADER);     Shader fragmentShader(GL_FRAGMENT_SHADER);     ShaderProgram* shaderProgram = new ShaderProgram();     shaderSetup(&vertexShader, &fragmentShader, shaderProgram);          Shader vertexShaderFinal(GL_VERTEX_SHADER);     Shader fragmentShaderFinal(GL_FRAGMENT_SHADER);     ShaderProgram* shaderProgramFinal = new ShaderProgram();     shaderSetupFinal(&vertexShaderFinal, &fragmentShaderFinal, shaderProgramFinal);          float vertices[] = {     -0.5f,  0.5f, -0.5f, 0.0f, 1.0f, 0.0f, //Green0     -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, //Black1      0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, //Red2      0.5f,  0.5f, -0.5f, 1.0f, 1.0f, 0.0f, //Yellow3     -0.5f,  0.5f, 0.5f, 0.0f, 1.0f, 1.0f, //Cyan4     -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, //Blue5      0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 1.0f, //Magenta6      0.5f,  0.5f, 0.5f, 1.0f, 1.0f, 1.0f //White7     };          GLuint elements[] = {     2,0,3,     2,1,0,     6,4,5,     6,7,4,     3,4,7,     3,0,4,     2,6,5,     2,5,1,     2,3,7,     2,7,6,     1,5,4,     1,4,0     };          float verticesFinal[] = {     -1.0f, -1.0f, 0.0f,      1.0f, -1.0f, 0.0f,      1.0f,  1.0f, 0.0f,     -1.0f,  1.0f, 0.0f     };          GLuint elementsFinal[] = {     0,1,3,     1,2,3     };          GLuint VAO, VBO, EBO, backTex, frontTex, frameBuffer, renderBuffer, VAOFinal, VBOFinal, EBOFinal;          glGenVertexArrays(1, &VAO);     glBindVertexArray(VAO);          glGenBuffers(1, &VBO);     glBindBuffer(GL_ARRAY_BUFFER, VBO);     glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);     glEnableVertexAttribArray(shaderProgram->attribute("Position"));     glVertexAttribPointer (shaderProgram->attribute("Position"), 3, GL_FLOAT, GL_FALSE, 6*sizeof(GLfloat), NULL);     glEnableVertexAttribArray(shaderProgram->attribute("ColorC"));     glVertexAttribPointer (shaderProgram->attribute("ColorC"), 3, GL_FLOAT, GL_FALSE, 6*sizeof(GLfloat),  (void*)(3 * sizeof(GLfloat)));          glGenBuffers(1, &EBO);     glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);     glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elements), elements, GL_STATIC_DRAW);          glGenTextures(1, &backTex);     glBindTexture(GL_TEXTURE_2D, backTex);     glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, screenSizeX, screenSizeY, 0, GL_RGBA, GL_FLOAT, NULL);     glBindTexture(GL_TEXTURE_2D, 0);          glGenTextures(1, &frontTex);     glBindTexture(GL_TEXTURE_2D, frontTex);     glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, screenSizeX, screenSizeY, 0, GL_RGBA, GL_FLOAT, NULL);     glBindTexture(GL_TEXTURE_2D, 0);          glGenFramebuffersEXT(1, &frameBuffer);     glGenRenderbuffersEXT(1, &renderBuffer);     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffer);     glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, backTex, 0);     glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_2D, frontTex, 0);          glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, renderBuffer);     glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, screenSizeX, screenSizeY);     glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, renderBuffer);     GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);     if(status != GL_FRAMEBUFFER_COMPLETE) cout << "Frame buffer yokki!\n";     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);          glGenVertexArrays(1, &VAOFinal);     glBindVertexArray(VAOFinal);          glGenBuffers(1, &VBOFinal);     glBindBuffer(GL_ARRAY_BUFFER, VBOFinal);     glBufferData(GL_ARRAY_BUFFER, sizeof(verticesFinal), verticesFinal, GL_STATIC_DRAW);     glEnableVertexAttribArray(shaderProgramFinal->attribute("Position"));     glVertexAttribPointer(shaderProgramFinal->attribute("Position"), 3, GL_FLOAT, GL_FALSE, 3*sizeof(GLfloat), NULL);          glGenBuffers(1, &EBOFinal);     glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBOFinal);     glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elementsFinal), elementsFinal, GL_STATIC_DRAW);          while (!glfwWindowShouldClose(window))     {         double mouseX, mouseY;         glfwGetCursorPos(window, &mouseX, &mouseY);         mouseX -= screenSizeX/2;         mouseY -= screenSizeY/2;              shaderProgram->use();         glBindVertexArray(VAO);         glUniformMatrix4fv(shaderProgram->uniform("rotateMatrixX"), 1, GL_FALSE,       glm::value_ptr(glm::eulerAngleX((float)(mouseY/25.0))));         glUniformMatrix4fv(shaderProgram->uniform("rotateMatrixY"), 1, GL_FALSE, glm::value_ptr(glm::eulerAngleY((float)(-mouseX/25.0))));         glUniformMatrix4fv(shaderProgram->uniform("rotateMatrixZ"), 1, GL_FALSE, glm::value_ptr(glm::eulerAngleY((float)(0.0/50.0))));              glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffer);         glBindTexture(GL_TEXTURE_2D, backTex);         glBindTexture(GL_TEXTURE_2D, frontTex);              glActiveTexture(GL_TEXTURE0);         glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );         glEnable(GL_CULL_FACE);         glCullFace(GL_FRONT);         glDrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_INT, 0);         glDisable(GL_CULL_FACE);              glActiveTexture(GL_TEXTURE1);         glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );         glEnable(GL_CULL_FACE);         glCullFace(GL_BACK);         glDrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_INT, 0);         glDisable(GL_CULL_FACE);              glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);              shaderProgram->disable();              shaderProgramFinal->use();         glBindVertexArray(VAOFinal);         glEnable(GL_CULL_FACE);         glCullFace(GL_BACK);         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );         glDrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);         glDisable(GL_CULL_FACE);         shaderProgramFinal->disable();              glfwSwapBuffers(window);         glfwPollEvents();     }          glfwDestroyWindow(window);     glfwTerminate();     exit(EXIT_SUCCESS);     }


title: Any good resources for a non-technical guy to learn software project management?

text: There are many resources on general project management, but are there any specifically for non-technical people for software project management, covering topics such as requirements gathering, use cases and general architecture?


title: Are some languages or language features better for testing?

text: I am, and like being, a VB.net coder. I have a couple of largish programs in c# that I must maintain and I don't really like writing C# code while developing. It isn't horrible but I much prefer the VB.net environment for development. However recently I have started writing all my tests in C#. I started doing this so I could use all the great tools, such as the mock libraries, available in C#. But even after I found Teleriks extremely capable justmock free edition for VB.net I have found I still write almost all my tests in C# (now using the C# version of JustMock BTW). Even when I don't need these testing tools I find that I just like C# better for writing tests. I think I like VB.net for general coding while solving problems as I write because: 1\. Like the sugary sweetness of things like XML Literals. Plus LINQ just seem easier and more expressive in VB. 2\. Don't need worry about the syntax nearly as much (casing, line terminators etc.) I can focus on my ideas. (The extra verbosity is handled by #3 below and coderush and other IDE tools) 3\. Think the tight integration with IDE of Visual Studio and VB.net (background compiling for example) is just the bees knees. (Though C# is getting much better.) But for tests I am not thinking about the big picture or really solving problems. Each test method is independent and the succinctness of C# just reinforces and aids this fact. I initially found this surprising because I always thought a scripting type language would be better for writing tests. But after actually writing many thousands of them I don't see any benefits in using a scripting language. In fact I find Option Strict and Explicit being true (which turns of the scripty nature of vb) even more helpful in the test projects. But maybe I am wrong and there are languages even more suited to writing tests? Would something like IronPython be good for writing test? Maybe BOO with its macros? I wouldn't think so but might a functional language bring anything to the table? More simply, are there language features that aid in writing good tests? And if so what language has the greatest numbers of these desirable features?


title: Why do I have to choose between "management" and "technical" tracks in my career?

text: I was recently laid off, and although I found a new gig I'm a bit frustrated with how career tracks work in the land of software development. I really love doing a bit of everything: coding, testing, architect(ing), leadership/management, customer contact, requirements gathering, staff development, etc. Software companies, however, want me to fit into a niche: I'm either a coder, a tester, or a manager. When I try to explain to them that I'm best when I'm doing all of those at once, they seem very confused. I'm sympathetic to their interests, but at the same time frustrated that the industry works this way. Any advice? Do I just need to get with the program, so to speak?


title: Getting Organizational Support in a 'Non-Programming' Position

text: I've been in my current position in a non-IT unit for about a year. I was hired mostly to do content management and simple web master type tasks. Due to a mix of diminishing IT support and expanded unit/productivity expectations, as well as my own motivation to acquire new skills, I have slowly taken on what I would describe as a front-end web developer role. Nothing I would describe as 'mission critical', but certainly things you wouldn't hire a non- programmer to do. I only took a few CS classes in college and although I do some freelance web designing and developing, I'm growing concerned about getting in over my head without the appropriate grounding. I would like to ideally have IT support, guidance, code review, programmer-level pay, etc. Unfortunately, I'm finding that organizational and semantic divisions really won't allow me to be a 'programmer', since I don't work for an IT-related unit. Management is roughly aware of the issue, but I don't feel they are taking it seriously, so I'm planning on addressing it with them. When I do, I want them to hear the: "I'm a motivated employee looking to take on more responsibility" instead of "I have limited and untrustworthy skills, I need IT's help!" What suggestions do you have for me to address (to management) the issue and articulate a solution?


title: C Language - K&R 1st vs 2nd Edition?

text: I'm planning to buy a book to learn C Language. Many say K&R is a must-have book for C programmers so I chose it. I see that there are two editions. What are the differences between them?


title: Typed search over complex model. Possible CQRS / NoSQL solution

text: Given the following relational model: ![database model](http://i.stack.imgur.com/Xl8nl.jpg) I need to implement a typed search for hotels, which should be able to query on name, city, country, category, hoteltype, roomprice, customtype, room custom type and roomtype or any combination of these criteria. At the moment I'm doing this though Entity Framework, dynamically constructing a query over the Hotel-entity (IQueryable). This is fine as currently there is very little data. However, this isn't very scalable and when there is a lot of data this will become very slow as it's a query over 10 tables. Note that I only need to load the hotel-data, not the entire graph. I'm thinking of ways to improve the scalability of this part. I have been looking into CQRS and maybe NoSQL solutions. One approach I had in mind is having this model on the write side (to enforce consistency) and having a different model on the read side. On write, I would then update the read-model (viewmodel). However, since this is already a more or less complex model in terms of relations, I see a few problems with that:   * Updating metadata (such as category, roomtype, hoteltype) would require me to update all of the hotels or rooms in the read-model. This could be quite slow or impossible once there's a lot of data.   * Suppose I use a document database such as MongoDB and save a hotel with all the related items denormalized, won't the query over that table still be slow as it has to search inside each document, or is still still quite fast in NoSQL? To summarize a few questions:   * Is denormalizing this model the right approach and what would be the best way?   * Will NoSQL be faster?   * Are there any better approaches I can follow or ways to break up the relationship and flatten the hierarchy while still being able to do a typed search?   * Ideally some fields should also support fuzzy search, what would be the best way to achieve that?


title: How are I/O port addresses and data sent?

text: First of all, I'd like to say this is a hardware-level question, which is very closely related to the "in" and "out" command in x86 assembly. I have searched for quite some time, but I still haven't found how they send the addresses and the data. Does the 8086 first send the address, then the data? If so, how does the receiver know if the 8086 is sending a 16-bit address or an 8-bit address? Aside from that, I'd also like to learn how the 8255 works, and how it accepts specific ports such as "port 60H". Thanks for reading! :D


title: How to refactor out static members of basic classes

text: Currently I am working on C++ project, which can be classified as "legacy" project. A lot of poor written code was committed because of lack of experience and under the pressure of deadlines. When I try to fix bugs I eventually make the new one. Recently I got some more free time and I want to make this project better. To be exact I want to begin using TDD. However, it turned out not so easy. I faced the problem that I can't write test for any class. Singletons are everywhere. Even basic classes uses static members. For instance, in project we widely use "Numeric" class (which is wrapper for decNumber C library for decimal computation). This class has static member to keep a context (precision, rounding mode, etc.). It is obvious that I need to refactor this class to avoid static fields. Immediately I thought about dependency injection and a factory pattern. The factory will keep the single context, every user class should create Numeric instances only using that factory. But the code is going to be messy because the factory should be injected in every class which wants to construct "Numeric" instance. Which pattern I can use for this case? Which one makes me sure that every instance of "Numeric" class uses single shared state? P.S.: There are significant parallels with this question - Dependency injection ; good practices to reduce boilerplate code.


title: Which revision control system to use for 2 semester capstone course?

text: For CS undergraduate students working on a 2-semester capstone course without any prior exposure to revision control systems, what would be a good one to use? Desirable qualities would be easy to use (ie this should be a tool they can use rather than spend a lot of time fighting it) and still be relevant for subsequent professional work once they graduate (doesn't have to mean it has to be the same tool later on as long as the concepts survive). Easy to install and maintain for the person who does this. Not sure if I am missing anything else important. I am aware of subversion (centralized), git (distributed) and mercurial(also distributed?) - but don't know enough about any of them to have an informed opinion. Are there others I should consider? This will be on a predominantly Windows environment. EDIT: I am really interested in the **pedagocial** aspect of teaching/learning these systems, not so much from the perspective of an already experienced software developer.


title: How can an amateur programmer get past their boundaries when formal educational resources are not available?

text: I have been programming for 5 years since middle school. I have learnt pretty much all the basics of programming and went through C/C++ and Java language. However, the college in my country is not really offering me the knowledge that will help me improve on in my programming career. Therefore, I have to self-educate myself. Lately, I have been picking up native windows api and give it a try on making window application according to what I have in mind. However, I failed constantly and found myself lacking knowledge in all directions: Low-level machine (system, arch, asm, etc.), Windows internals (kernel, system, etc.), Networking (TCP/IP etc.), Designing skills, Graphics programming, and many more of those advance topics. Therefore, right now I'm at the edge of deciding whether to continue with windows development, or to dig deep into low-level machine structure, or to dropout all of that and go for internet-oriented programming, or to do any other available options. Ideally, I would want to know all of them (I really love all of the topics in programming) and would want to deeply understand every one of them. However, I don't know where to start. So any guideline from professional programmer of how should I continue my learning path? And what would be the best resources?


title: what are callback frameworks?

text: I am reading Effective Java and it has the following sentence. > The disadvantages of wrapper classes are few. One caveat is that wrapper > classes are not suited for use in callback frameworks, wherein objects pass > selfreferences to other objects for subsequent invocations (“callbacks”). Now what is a callback framework ? Can you point me to an example of call back framework ?


title: Clarification about Event Producer in StreamInsight

text: I need a small clarification about streamInsight, I know by doc's that StreamInsight can handle multiple concurrent Events. But will the event producer be a separate function, for ex: I need to watch a folder for new Files becoz all my sensors il write readings every day in a new file in particular drive. **Method 1: FileSystemWatcher:** These is the traditional approach where we write a service using FileSystemWatcher to watch a folder for new files,etc.. Upon receiving event from FileSystemWatcher il perform some operations on these files. **How to do these using streamInsight???** I came know that using IObservable i can push events to StreamInsight. But is there anything to watch folder is sreamInsight like FileSystemWatcher. OR In order to raise events to streamInsight do we need to use FileSystemWacther? Any suggestion regarding these is highly appreciated. Thank in Advance


title: Is there a way to visualize an ASP.NET MVC project, ie class diagram but with the web pages too?

text: Maybe I'm looking for a dependency visualizer/matrix. I'm not sure. I'm just trying to wrap my head around an existing and large web app, and I like pretty pictures. I know of Autodiagrammer but I don't think it would show the master page/subpage relationships. Is such a thing even possible?


title: Question about Visual C++ Properties

text: Could someone explain this line: > In more complicated contexts, such as "+=", a **rewrite** is performed by > doing both get and put. Taken from: MSDN - Property What do they mean by rewrite?Is it a compile-time rewrite or does it induce run-time overhead?As far as I know in release mode properties are compiled to the same thing, so they must have the same performance as getters/setters, right?


title: Scrum Board for a distributed team

text: I am looking for recommendations on a digital Scrum Board which can be shared over the internet. I imagine something like a big tablet on which you can draw and which remote users can access, too. I dislike Scrum software because I think one major benefit of a Scrum Board is its physical presence. It should be hard to ignore. The best solution would be two big tablets on which you can draw and which can be synchronized. Has anyone got product recommendations for something like this? Or would you rather use a software? Kind regards, Falcon


title: What makes a series of machine instructions an actual process/thread in memory?

text: Every instruction comes from main memory/RAM. In a bootloader, at least on Intel and IBM PC firmware and designations, you have BIOS jump to a memory address to begin fetching instructions for whatever purpose, usually to load a kernel, when or where does the instance of a process begin? The hardware stacks are limited, but does using them constitute for a process or thread? My point simply is what makes something a "thread" or "process", as to opposed to just more bytes from memory? Where is the line drawn in this situation?


title: Return values for CRUD methods?

text: I'm writing a basic web API in Java that does what almost all others do: take input, validate it, then do CRUD operations on the DB. I've written several APIs before, and I've pretty much already figured out what constitutes a good response back to the client. However, like most APIs, there are several layers of objects invoked between the front-door client API object and the code that actually executes queries against the database. I've always struggled to know what those database interaction objects should return back to the functions calling them. I imagine that on errors I'll be throwing exceptions and catching them farther up the call stack. However, what do I return on successes? Here's what I've used before:   1. Create - Return a boolean telling whether the create was successful or not   2. Read - Return the object requested   3. Update - Return a boolean telling whether the update was successful or not   4. Delete - Return a boolean telling whether the delete was successful or not I feel comfortable with the Read and Delete returns, because I can't think of what else you'd return in those situations. However, I have no idea what the best practice would be for return values from create and update functions. Should I return a new object with the updated values? Should I modify the object that was passed in? Should I just return a boolean value denoting success or failure?


title: Index independent character comparison within text blocks

text: I have the following task: developing a program where there is a block of sample text which should be typed by user. Any typos the user does during the test are registered. Basically, I can compare each typed char with the sample char based on caret index position of the input, but there is one significant flaw in such a "naive" approach. If the user typed mistakenly more letters than a whole string has, or inserted more white spaces between the string than should be, then the rest of the comparisons will be wrong because of the index offsets added by the additional wrong insertions. I have thought of designing some kind of parser where each string (or even a char ) is tokenized and the comparisons are made "char-wise" and not "index- wise," but that seems to me like an overkill for such a task. I would like to get a reference to possibly existing algorithms which can be helpful in solving this kind of problem.


title: Framework in which views are defined in the database - design flaw or reasonable?

text: I'm working with a framework where the fields displayed on each web page are defined in the application database. Administrators can add new fields to pages or hide/completely delete old fields. The logic for each page is in a Java class - sometimes there's a one-to-one relationship between a page and a class, sometimes several pages use the same class. **The issue** This framework design creates a hidden dependency between the page data in the database and the logic in the Java class. If a new field is added to a page, the matching Java class must provide that field - or the page will break. The Java code has no compile-time knowledge of how the page is configured in the database (each customer database may have different configurations), which increases brittleness. A typical solution has been to SELECT * from one or more database tables, allowing a degree of configuration as to which fields can be displayed. This leads to database-centric Java code with plenty of embedded SQL and little object-oriented design or domain models. **Solution plans** We've introduced a three-tier MVC-like architecture (controller -> service -> repository) with object-oriented models to the framework. It limits the ability to add fields to the pages without changing the underlying code. However, the change makes it possible to program in an object-oriented way and create domain models. Next up, we're planning to do something about the dependency between the database and code. My long-term plan would be to move the page definitions from the database into the code (your standard HTML&JS views), limiting configurability but reducing brittleness. Any incompatibilities between the pages and Java would then become compiler errors when building the application instead of runtime errors. **Question(s)**   1. Do you consider the framework practice of defining the view in the database and the controller in the code as sound design or something that should be addressed?   2. If you think the situation should be addressed, does my long-term plan seem reasonable? **Edit:** In addition to defining the layout, the view definitions in the database define which fields are expected to exist - "get field 'foobar' from the controller and show it here". The views themselves don't really contain logic. The Java classes backing up the views typically contain thousands of rows of UI and business logic.


title: Technology for C#, Windows, 2D game development?

text: I need a nudge in the right direction from someone more experienced in windows game development. I want to write simple C# 2D windows game for fun (think something like old Sim City or Civilization). I used to write simple windows games before, but I was out of the loop from game development for a long time. What would be good technology to start quickly these days? Quick google search, shows DirectX, Managed DirectX, XNA, but I do not know enough about those to make a choice. To make this question more constructive, can someone explain what options are available, and what would be their strong and weak points?


title: Are classes with only a single method a problem?

text: I am currently working on a software project that performs compression and indexing on video surveillance footage. The compression works by splitting background and foreground objects, then saving the background as a static image, and the foreground as a sprite. Recently, I have embarked on reviewing some of the classes that I have designed for the project. I noticed that there are many classes that only have a single public method. Some of these classes are:   * VideoCompressor (with a `compress` method that takes in an input video of type `RawVideo` and returns an output video of type `CompressedVideo`).   * VideoSplitter (with a `split` method that takes in an input video of type `RawVideo` and returns a vector of 2 output videos, each of type `RawVideo`).   * VideoIndexer (with an `index` method that takes in an input video of type `RawVideo` and returns a video index of type `VideoIndex`). I find myself instantiating each class just to make calls like `VideoCompressor.compress(...)`, `VideoSplitter.split(...)`, `VideoIndexer.index(...)`. On the surface, I do think the class names are sufficiently descriptive of their intended function, and they are actually nouns. Correspondingly, their methods are also verbs. Is this actually a problem?


title: What development tools would you recommend for developing .NET apps in Mono that would give me the same productivity boost as Resharper?

text: Aside from using IDEs such as MonoDevelop, what combination of tools do you use in Mono development to give you the same productivity boost that one would normally gain by using R# in VS2010? EDIT: I'm trying to kick the R# habit and switch to Mono development in Linux, but it's hard to kick the habit of using VS2010 + R#, and I need alternative tools to break that habit.


title: What tools do PHP Developers use?

text: > **Possible Duplicate:**   >  What would you consider best practice workflow tools for web application > (PHP) development? I start my new job next week as a PHP Developer which is my dream job but it's going to be object-orientated which I've only done in Java whilst at university. My question is regarding PHP tools - what are the best IDE's (I use notepad++), what versioning packages work best and bug trackers etc, so I was just wondering what tools the PHP developers out there use in their working lives.


title: Does Sublime's "minimap" improve productivity?

text: I'm a pretty big fan of Sublime. One of my favorite features is the ability to scroll through your file by using the compressed image of your text on the upper right hand corner (minimap). My gut feeling is this does positive things for productivity: ![enter image description here](http://i.stack.imgur.com/SkFIc.png) Does having this minimap to scroll through actually improve productivity? P.S. - Side question: Did Sublime invent this idea, or did they take it from another text editor?


title: If you use MFC how did find it best to learn the concepts?

text: I'm currently working with C++ MFC applications in Visual Studio 2008. I have spent most of my time up to this point working with Java Swing development which seems to be not quite as involved as win32 or MFC are. I've noticed that there seems to be a lot of little parameters and specifications that go into creating even a simple element like a status bar or menu bar. I've spent a bit of time working through the MSDN library on the matter but it doesn't seem to explain why many of these parameters and such are needed to set up these elements. I always find that I'm able to wrap my head around things and remember them if I understand why I'm doing it. If you program using MFC (or a similar framework) what did you find helpful in the learning process? Do you recommend any website, books, or other references? Any and all advice is appreciated!


title: ASP.NET coding style

text: I am trying to improve the speed of my coding and I was wondering what tips the pros have. Currently I tend to code about 5-10 lines of code then test and repeat. Is that typical? Or is it better to code larger blocks of code then test. I am always worried of coding a lot than realizing all the code I wrote was wrong and would have to retype.


title: Vaadin Calendar events not shown if overnight

text: In my vaadin project there is the possibility to create events that are shown by the calendar. It does works, except when the event is overnight, let's say the night from 23th to 24th, and the calendar shows as only day the 24th. In this case the part of the event that belongs to the 24th is supposed to be shown, but it is not. When I switch to weekly view, the event is shown properly. Here is the function where I get the data and use a container for the calendar:               /* Fill Calendar from database */     void updateData() {          final BeanItemContainer<TypeReservationEvent> container =                 new BeanItemContainer<TypeReservationEvent>(TypeReservationEvent.class);         Map<String, Object> parameters = new HashMap<String, Object>();         parameters.put("roomParent",chosenRoom);         String query = "SELECT DISTINCT res FROM EntityReservation res, EntityRoom r, EntityTable rt WHERE res.tableId = rt.id "                 + "AND rt.roomParent =:roomParent";         reservationList = facade.list(query, parameters);         for(EntityReservation rt : reservationList) {                 container.addBean(new TypeReservationEvent(rt));         }         container.sort(new Object[]{"start"}, new boolean[]{true});         cal.setContainerDataSource(container, "caption",                 "description", "start", "end", "styleName");              // Force calendar to refresh         if(selectCalViewType.getValue() == chooseWeeklyView) {             setViewType(calViewType.DAILY);             setViewType(calViewType.WEEKLY);         } else if (selectCalViewType.getValue() == chooseDailyView) {             setViewType(calViewType.WEEKLY);             setViewType(calViewType.DAILY);         }     }      TIA


title: How to improve my loop logic in programming?

text: I know how to do simple loops but I don't know what's going on when many loops are working together. For example:               for (i=0; i <= 9; i++){          document.write(linebreak);            for (m=0; m <= 9; m++){          document.write(i);         }     }      Is there a way I can learn loops inside out?


title: Interface (contract), Generics (universality), and extension methods (ease of use). Is it a right design?

text: I'm trying to design a simple conversion framework based on these requirements:   1. All developers should follow a predefined set of rules to convert from the source entity to the target entity   2. Some overall policies should be able to be applied in a central place, without interference with developers' code   3. Both the creation of converters and usage of converter classes should be easy To solve these problems in C# language, A thought came to my mind. I'm writing it here, though it doesn't compile at all. But let's assume that C# compiles this code: I'll create a generic interface called `IConverter`               public interface IConverter<TSource, TTarget>         where TSource : class, new()         where TTarget : class, new()     {         TTarget Convert(TSource source);              List<TTarget> Convert(List<TSource> sourceItems);     }      Developers would implement this interface to create converters. For example:               public class PhoneToCommunicationChannelConverter : IConverter<Phone, CommunicationChannle>     {         public CommunicationChannel Convert(Phone phone)         {             // conversion logic         }              public List<CommunicationChannel> Convert(List<Phone> phones)         {             // conversion logic         }     }      And to make the usage of this conversion class easier, imagine that we add `static` and `this` keywords to methods to turn them into **Extension Methods** , and use them this way:               List<Phone> phones = GetPhones();     List<CommunicationChannel> channels = phones.Convert();      However, this doesn't even compile. With those requirements, I can think of some other designs, but they each lack an aspect. Either the implementation would become more difficult or chaotic and out of control, or the usage would become truly hard. Is this design right at all? What alternatives I might have to achieve those requirements?


title: Governance models for multi-institution open source projects

text: I'm working on an open source project that has full time professional developers from several universities, plus a couple of other organisations. The product has something like a dozen deployments, various variations, plugins, related components etc. Generally development so far has been driven by institutions "scratching their own itch", but with an effort to merge improvements back to a central code base. As it's starting to mature, I'm interested in possible models of open source governance to follow. (So this question isn't "what are some good things to do", it's specifically "what existing, tested models are worth looking at and possibly following") Specific aspects that such models might cover:   * How decisions about big-impact changes are made (and what happens if someone makes big changes without discussing them first)   * Who manages the product's public image (product marketing, for want of a better term)   * Who represents the product in any comparisons with "competing" products   * Whether enhancements become "core", "plugins", "related products" etc   * Whether and how roadmaps are created and published   * How variations on the product are handled (in this case, versions for different academic disciplines)   * Expectations and obligations of participants in the project   * Expectations and obligations of the institutions for which those developers work We'll be looking for something as lightweight and informal as practical.


title: Should I write an interface API before an implementation?

text: I've been delving into more "organized" programming recently and I've been learning that I should be programming to an interface, not an implementation. With that in mind, would it be better to "sketch" out a project in interfaces before writing the implementation for it where possible? And if this is the case, in the case of using 3rd party libraries (ie Lidgren), should I be wrapping those in interfaces as well and resolve them through IOC containers, or is it OK to expose them to the interfaces?


title: Moving back end from Parse.com to Amazon Web Services

text: I'm looking for insight from someone who has used at least AWS (if not also Parse.com). My iOS app currently uses Parse.com for these purposes: 1) to store user data (by translating between JSON and core data) 2) to run javascript functions to update my database with data from the web 3) for easy Facebook authentication, which is the basis for user accounts I am now eligible for a massive hosting credit from AWS, so I am trying to assess the difficulty of switching (not to mention new concerns about Parse.com's quality). From what I've read, it seems AWS offers a variety of hosting options. However, in reference to (1), I have not seen any specific mention of JSON tables, and that's the only kind of database I'm familiar with. So I'm looking for better understanding of which AWS database options would most closely approximate Parse.com's JSON-based database. And I'm also interested in any comments about (2) and (3)---what AWS features would provide the nearest substitutes. Thank you


title: What is Curiosity's packet structure?

text: For NASA's Interplanetary Network, what does a packet look like? It's obviously a form of redundant protocol, stored at the receiver and with built back up. Is there any documentation on the packet structure or the communication protocol, which has to span 14 minute communications?


title: Application vs middleware development in android

text: I have 1 year and 6 months of experience on Android. All of my experience has been into application development. Recently I have got offers from two companies. One is offering me a profile to work on application layer and other is offering a profile on Android middleware. Can you guide me which would be better? Is middleware development better than application layer development from the career perspective in terms of money and other opportunities? I am really in a big dilemma. Any help would be appreciated. Also if someone can tell me as to who will earn more-a five year application layer guy or a middleware guy? Thanks a lot in advance.


title: How do I introduce clean code?

text: My team has about 18 members and the code is generally good, using TDD and good specifications makes for working code. But I think they abuse comments in favor of writing cleaner, more readable code. I would like to introduce them to the concept and I'm wondering how can I do that on a larger scale without sitting with each and every one of them on their code and explaining how it could be improved. This is different from the suggested duplicate because I believe I already know how to write clean code. What I'm looking for is how do I introduce _my team_ to writing clean code?


title: best way to store data from ajax call

text: I am writing a web-application in which I am retrieving data's from server through `AJAX` requests and the generate `HTML` content dynamically. I have some data to load, generate HTML from it and `append` into my web page. Now I was thinking on two solutions: 1) Do AJAX call, generate HTML from response, set `display: none` to it when I need, and when I'll need it later, set `display: block;` instead and `hide()` other content I don't need to display (always dynamically generated). 2) Save AJAX response into `variables`, remove HTML generated before, re- generate from `variable` when I'll need it later. I don't know if I explained it well, but I would like to know which is best practice in terms of client/server performance.


title: Qt solutions have been re-licensed, can I use the src directly now

text: I have a commercial application that uses a Qt Solutions component. Until recently, this component was licensed under the LGPL license, so I was forced to use the component in the form of a shared library. According to this post http://qt.digia.com/Product/Qt-Add-Ons/Qt-Solutions-Archive/, the Qt solutions have been re-licensed with the BSD license reproduced below. My question is, can I mow use the source code directly in my application or do I still need to create a shared library? (the appropriate copyright notices will be reproduced regardless) BSD lisence: > * * * > > This sofware uses Qt Solutions component which is covered by the following > license: > > Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). > > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions are met: > >   * Redistributions of source code must retain the above copyright notice, > this list of conditions and the following disclaimer. > >   * Redistributions in binary form must reproduce the above copyright > notice, this list of conditions and the following disclaimer in the > documentation and/or other materials provided with the distribution. > >   * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names of > its contributors may be used to endorse or promote products derived from > this software without specific prior written permission. > > > > ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS > IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, > THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR > PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR > CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, > EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, > PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; > OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > * * *


title: Why is there a large discrepancy between the stackoverflow tag frequency and the TIOBE Index?

text: By recently looking at the TIOBE Programming Community Index (Sep 2012) I noticed the following order:   1. C   2. Java   3. Objective-C   4. C++   5. C#   6. PHP When looking at the tag frequencies of stackoverflow however, the situation is as follows:   1. C#   2. Java   3. PHP   4. JS   5. Android   6. jquery (JS)   7. iphone (Objective-C)   8. C++ (Java takes the lead when accounting for Android tagged posts w/o a Java tag). JavaScript also likely has surpassed PHP in total numbers of programmers? I realize the tag-frequencies may not be the best indicator, but it is likely a sufficient measure nonetheless. What am I missing that explains this discrepancy, especially for `ANSI C` and `JavaScript` ( #11 in the TIOBE index)? **Links** :   * Wikipedia TIOBE index   * The Transparent Language Popularity Index   * Jobs Tractor language trends   * Github top languages   * Langpop


title: Can/should the Single Responsibility Principle be applied to new code?

text: The principle is defined as modules having _one reason to change_. My question is, surely these reasons to change are not known until the code actually starts to change?? Pretty much every piece of code has numerous reasons why it _could_ possibly change but surely attempting to anticipate all of these and design your code with this in mind would end up with very poor code. Isn't it a better idea to only really start to apply SRP when requests to change the code start coming in? More specifically, when a piece of code has changed more than once for more than one reason, thus proving it has more than one reason to change. It sounds very anti-Agile to attempt to guess reasons for change. An example would be a piece of code which prints a document. A request comes in to change it to print to PDF and then a second request is made to change it to apply some different formatting to the document. At this point you have proof of more than a single reason to change (and violation of SRP) and should make the appropriate refactoring.


title: Why avoid Java Inheritance "Extends"

text: Good day! Jame Gosling said “You should avoid implementation inheritance whenever possible.” and instead, use interface inheritance. But why? How can we avoid inheriting the structure of an object using the keyword "extends", and at the same time make our code Object Oriented? Could someone please give an Object Oriented example illustrating this concept in a scenario like "ordering a book in a bookstore?" Thank you in advance.


title: Little and Big endian confusion

text: Just to make sure if I understand this correctly. Is this right that little endian processors read the memory addresses from highest to the lowest address and where as a big endian processors suppose to read them from lowest to the highest address? The confusion came when I thought that is it true that little endian processors read the data itself in the reserve order and not just the memory or anyway both? I have read enough about how the data is laid out in the memory and I just want to know how does the data is interpreted by both kinds of processors?


title: Are silly examples bad way to learn OOP?

text: Some tutorials give silly examples to teach OOP, for example: Car _class_ and myCar _object_ , etc. Is that way considered bad in learning OOP assuming that these examples not applied to real programming problems?


title: Is it *ever* okay to catch StackOverflowError in Java?

text: I used to think that it's not, but yesterday I had to do it. It's an application that uses Akka (an actor system implementation for the JVM) to process asynchronous jobs. One of the actors performs some PDF manipulation, and because the library is buggy, it dies with a `StackOverflowError` every now and then. The second aspect is that Akka is configured to shutdown its whole actor system if any JVM fatal error (e.g. StackOverflowError) is caught. The third aspect is that this actor system is embedded inside a web app (for WTF-ish, legacy, reasons), so when the actor system is shut down, the web app is not. The net effect is that on a `StackOverflowError` our job processing application becomes just an empty web app. As a quick fix I had to catch the `StackOverflowError` being thrown, so that the thread pool of the actor system isn't torn down. This lead me to think that maybe it's sometimes okay to catch such errors especially in contexts like this? When there's a thread pool processing arbitrary tasks? Unlike an `OutOfMemoryError` I can't imagine how a `StackOverflowError` can leave an application in an inconsistent state. The stack is cleared after such an error, so computation can go on normally. But maybe I'm missing something important. Also, let it be noted that I'm all for fixing the error in the first place (as a matter of fact I have already fixed an SOE in this same app a few days ago), but I really don't know when this kind of situation might arise. Why would it be better to restart the JVM process instead of catching the `StackOverflowError`, mark that job as failed, and continue with my business? Is there any compelling reason to never catch SOEs? Except "best practices", which is a vague term that tells me nothing.


title: What is an efficient algorithm for randomly assigning a pool of objects to a parent using specific rules

text: I need some expert answers to help me determine the most efficient algorithm in this scenario. Consider the following data structures:               type B { A parent; }          type A {        set<B> children;        integer minimumChildrenAllowed;        integer maximumChildrenAllowed;     }      I have a situation where I need to fetch all the orphan children (there could be hundreds of thousands of these) and assign them RANDOMLY to A type parents based on the following rules.   1. At the end of the job, there _should_ be no orphans left   2. At the end of the job, no object A should have less children than its predesignated minimum.   3. At the end of the job, no object A should have more children than its predesignated maximum.   4. If we run out of A objects then we should create a new A with default values for minimum and maximum and assign remaining orphans to these objects.   5. The distribution of children should be as evenly distributed as possible.   6. There may already be some children assigned to A before the job starts. I was toying with how to do this but I am afraid that I would just end up looping across the parents sorted from smallest to largest, and then grab an orphan for each parent. I was wondering if there is a more efficient way to handle this? **EDIT:**   * Expanding upon the criteria for even distribution of children, we should attempt to avoid a situation where any one A has 2 or more children than any other A unless they started that way. For example, if A1 has 4 children, and A2 and A3 have 1 child each and there are 2 orphans, then A2 and A3 should each be assigned an orphan making an even distribution of 4, 3, and 3 children for each A.   * Yes I understand we could end up where there is one orphan left and an A that has not met its minimum. This exception case will be handled by a separate algorithm that will try to evenly split an A into two objects and assign the remaining orphans amongst them. **EDIT: 2** Ok, I misunderstood the requirements in my situation. The data model for A shows minimum and maximum property but in fact this should be a global setting for every A. In essence it is a missed requirement that requires the data model to be refactored later. All A will have the same minimum and maximum now. This actually changes things significantly! Sorry for the confusion.


title: Repetitive Drawing in Javascript & Canvas

text: Creating an HTML5 page using canvas and javascript to draw a set number of musical staves on the page, spaced a pre-determined amount in between. What I have is re-drawn on top of the canvas 10 times, and what I really need is something that's spaced out apart every time the loop is drawn. I tried to create a JSFiddle, but it doesn't draw anything (which I'm sure is user-error), so here's the js file:               window.onload = function(){          var canvas = document.getElementById('sheetmusic');         c = canvas.getContext('2d');          c.fillStyle = 'white';     c.fillRect(0,0, canvas.width, canvas.height);          //  Draw staves     for (var i=0; i<10; i++){         c.strokeStyle = 'black';         c.beginPath();         c.moveTo(0,10);         c.lineTo(canvas.width,10);         c.stroke();         c.moveTo(0,20);         c.lineTo(canvas.width,20);         c.stroke();         c.moveTo(0,30);         c.lineTo(canvas.width,30);         c.stroke();         c.moveTo(0,40);         c.lineTo(canvas.width,40);         c.stroke();         c.moveTo(0,50);         c.lineTo(canvas.width,50);         c.stroke();         // staff whitespace         c.fillStyle = 'white';         c.fillRect(0,52, canvas.width, 50);         }     };      I'm just not certain how to append `i` from my `loop` into the `height` attribute of my `stroke`.


title: How do I distribute my scientific software with as few dependencies as possible?

text: As part of my research, I write a lot of Python and MATLAB code that never needs to be distributed to anyone else. Even if I need to distribute my software, Python and MATLAB, both being interpreted, make sharing it relatively simple. Now I am writing some software in C++ that I'd like to distribute. I have a handle on how to compile the software on my own machine, but what I don't have an understanding of is what needs to be done in order to give other people the software. First, more about my project: I'm writing some code to compute and display visualizations. The project is graph-based, and so I am using the LEMON graph library. I'm exploring VTK and OpenGL implementations for the purpose of displaying the visualization. I'd like to write Python and MATLAB bindings for users of those environments to be able to use my software, and I'd like to produce Windows and Linux versions (I haven't thought about OS X yet...). So, let's take the LEMON graph library as an example. It is a bunch of headers along with a small shared object. On my development system, I compile the library with CMake and link it with my project. Now say I want to give my software to someone running on Windows. I want them to be able to download an installer, click a button or two, and have everything taken care of. I don't want them to worry about installing the LEMON library, or OpenGL. They shouldn't have to knowingly compile anything. Is this possible? I have a feeling it is, but I come up short when searching for references. I have a vague idea that if I compile a binary on Windows I should be able to distribute that binary to anyone running a Windows OS. But what about the libraries I use? I'm guessing I need to statically link them on Windows, and that will take care of the dependency issue there. But in the back of my mind I have read that statically linking is not good practice (or is this just on Linux?) As you can tell, I'm somewhat lost. I'd appreciate a nudge in the right direction, and some references to read if you happen to know of any!


title: Do you encourage to keep login credential in keystore?

text: When developing login module for a web application, do you suggest to keep the username and password in a keystore? Lets assume the keystore was kept in a very safe place in web server.


title: Algorithm to pick user

text: I need an algorithm for picking a user. Users are identified by letter {A, B, C, ...} and are ranked by number {1, 2, 3, ...}. Rank is the degree of likelihood to be picked, so a rank 2 user is twice as likely to be picked over a rank 1 user, and rank 4 is four times as likely, etc. So let's say four users are {A, B, C, D}, with rank {1, 1, 5, 2} respectively. A user table might store rank:                  USER   RANK           A   1           B   1           C   5           D   2      How do I pick a user based on rank? My first idea for an algorithm is to add up all the ranks 1 + 1 + 5 + 2 to obtain a sum of 9. Then assign subranges from 1 to 9 to each user, where subrange size is user rank. So A has range [1, 1], B has range [2, 2], C has range [3, 7] (5 possibilities due to rank being 5), and D has range [8, 9]. The table becomes this:                  USER   RANK  RANGE           A   1     [1, 1]           B   1     [2, 2]           C   5     [3, 7]           D   2     [8, 9]      Then calculate a random value from 1 to 9, and find the user whose range contains that value. So if the random value is 4, user C is picked because 4 falls within range [3, 7]. This achieves fairness based on rank. If you repeat picking randomly this way, on the average, users will be chosen fairly, and no user will be starved. However, it feels sloppy, because to add or remove users, I have to recalculate all the ranges. Here is removing user C (recalculate range of user D):                  USER   RANK  RANGE           A   1     [1, 1]           B   1     [2, 2]           D   2     [3, 4]      And here is changing user A to have rank 2 (recalculate range of B and D):                  USER   RANK  RANGE           A   2     [1, 2]           B   1     [3, 3]           D   2     [4, 5]      What is the best algorithm to pick a user? Surely recalculating ranges for every user add, delete, or update is suboptimal. Is there a well-known function or algorithm that can help? * * * UPDATE: @rwong got me thinking about grouping people by rank, then picking rank instead of picking user. With **one** person in each rank, you turn the random-shaped ranges into a very linearly-growing ranges (one dot is one chance to be picked):               Rank 1:  *     Rank 2:  * *     Rank 3:  * * *     Rank 4:  * * * *     Rank 5:  * * * * *      Works great for exactly one person per rank, but it falls apart when you have lots of people at rank 1, where their chances should increase by the number of people within that rank, possibly overtaking the chances of higher ranks. Now we're back to an irregular shape, and must pick from it. A friend pointed me to Rejection sampling. This seems to be a great solution where you pick a random x and y coordinate, see if it falls within the shape, and if so, we now picked rank. Then pick a random person within that rank. To show this solution, here is the shape with multiple people inside each rank. For rank 2, there are 5 people, so that's 2 x 5 = 10 chances:               User count   Rank   Chances(graph)       Chances(number)     5            1      * * * * *            5     5            2      * * * * * * * * * *  10     1            3      * * *                3     0            4                           0     1            5      * * * * *            5      The algorithm is to pick a random row (like picking an x coordinate), and pick a random value from 1 to max(chances) (like picking a y coordinate). See if that is less than or equal to the number of chances at that rank. If not repeat until you have a valid rank and chance. This takes care of distribution probability. Now that you have chosen a valid rank, at that point you simply pick a random person within that rank. Done! The beauty is, to add or remove someone, you increment or decrement the user count column, and assign a new Changes(number). Two small very simple updates. The memory complexity and time complexity of add/remove/update user and also complexity to pick a user is nothing, like O(1). We grouped user by rank, and captured user count in each rank, then calculate chances for that rank, and used a simple looping algorithm to pick random rows and chance values until we get a hit, and finally pick a random person at that rank.


title: Java: would you use an EnumSet in this case?

text: I have this weird scenario in which some Java property is used to build and HQL query, and the type of the field is `Boolean`, i.e. it is boxed. I wondered why because I don't really like to think of booleans as having three possible values, `true`, `false`, and `null`. I recently found out the `null` value actually has semantics in this system. The semantics are: `true` means "only unviewed", `false` means "only viewed", and null means "all". So, if null, the field is ignored when building the HQL query, so that the end result contains both unviewed and viewed results. In my opinion this is a case where an enum should be used. Something like this:               enum ViewStatus {       VIEWED, UNVIEWED;     }      My dilemma now is what to use for the third case that should represent the union of these two constants? The two options are:   1. Introduce a third enum constant, `ALL`.              enum ViewStatus {       VIEWED, UNVIEWED, ALL;     }        2. Use an `EnumSet`. `EnumSet` pretty much exists specifically for this purpose, but... it seems like just two much overhead. Especially when reading the values in the part of the code that builds the HQL. So, what are your thoughts? Shall I go with a third enum constant and refactor to `EnumSet` when need arises? Thanks! ### Update I'll go for an `EnumSet` because I want to introduce methods on that enum that wouldn't make sense to be called on `ALL`. For example `ViewStatus.isViewed()`.


title: How do you avoid second-system effect?

text: http://en.wikipedia.org/wiki/Second-system_effect > The second-system effect refers to the tendency of small, elegant, and > successful systems to have elephantine, feature-laden monstrosities as their > successors When starting work on a follow-up project that will share the same codebase as the previous project, how do you control the second system effect? How do you stop yourself going overboard on rewriting flaky systems? How do you restrict "wouldn't it be cool if..." new features? I find one of the biggest factors is complacency from familiarity with the codebase. It can be very easy to add new features by "hacking" together systems that you know inside and out. However the short-term gains are outweighed by the spaghettification of code a few iterations of this approach can produce. How can you coerce programmers to design and implement features properly, when the "quick hack" solution is so tantilising?


title: Are there revision repositories which implement commenting on revisions other than a fixed single commit message?

text: Sangdol asked: Why can’t I edit and SVN commit message? There are good reasons to maintain individual records ‘as is’ for historical purposes. However, there is an arguably objective hazard in not limiting the spread and use of misleading, and dangerous data. Aside: Certainly, sometimes, one should just suck up they’ve made an error. That aside, er aside, it appears clearly beneficial to have some mechanism for recording and sharing the best possible information. It also seems clearly beneficial to have some mechanism for correcting ‘bad data’ and informing others of ‘hazardous data’. In the Sangdol thread l0b0, comments: > You're right. There is a fundamentally flawed design assumption in all VCSes > I've ever seen: A commit has one commit message, which is immutable. As Alex > says, we should "allow multiple versions of the commit message". To keep the question less subjective, your answers should be an objectively better practice than the ‘Moses Principle’ of, “Get it right first time, we’re carving this puppy in stone”, and address the ability to handle one or more problems along the lines of (I’m willing to update and alter this list if there are better suggestions): Suppose I discover that a commit message I entered a month ago is misleading, confusing, and downright wrong. Shouldn't I be able to added a correcting notation that will be seen by everyone who sees the incorrect message? (I agree the original message should be easily available unmodified and the change itself should be tracked and timestamped. But I disagree that this constitutes "changing history".) – David Schwartz comment from the Sangdol question.


title: How to price a programming consulations for IT company?

text: It's not very rare programming question, but it's about a work of a freelance programmer and I think you can help me so maybe it's ok to pust it here? So one dev-company asked me for doing a programming consultation. It's should be like this that the company can call me and ask questions and gets answers how to do this, how to do that and so on. I never did this kind of work and I think what is the best way to deal with this kind of cooperation. Should i charge per hour? It can be short questions, by phone or e-mail and it can be not easy to calcuate and take a grip on the time and cost. Or should I charge per consultation? And if something will be not-worth mentioning and there will be more short questions but plenty of them? Or should i charge montly? Did you do some kind of "programming consultations"? Heck i don't even know what is the right name for this kind of job. Do you know any sites or keywords that could help me get more info on the topic of this kind of cooperation ?


title: is there anything else like WPF can run in Linux and Mac

text: I am looking for anything else has the same `WPF` functionality (animation, 3D,...) but can work in other platforms (Linux, Mac,...) something powerful, fast to develop with, can create my own custom styling on the basic component


title: Number of combinations

text: How to go about getting the number of combination ( C(5,4) ) without using recursion in C? Is there any other method or inbuilt library to do this?


title: How to implement a distributed proxy with quotas?

text: I'm in the process of developing a scalable proxy (Linux/C/C++, Nginx modules or custom HTTP server) handling incoming HTTP requests, and re-routing them to others locations based on parameters included in the incoming request itself (IP, time for example) or external factors (hence the use of an Nginx module able to retrieve the external factors). However, the tricky part is regarding quotas. For example, I wish I could block proxying requests originating from an IP when it's daily allowance quota is over. Implementing quotas is not hard. However, having quotas work in a distributed environment (where ideally everything is shared-nothing) is far from trivial. Indeed, the quota state must be shared to all distributed processes so that they can know whether they should proceed or not. Having a central quota handler means using locks. This makes me think that the performances will drop very quickly. Locking the quotas status every time a proxying request is being handled doesn't look like the solution to me. Any hints ?


title: How to choose the right web development language for my app without much programming experience?

text: I have my own idea for a web application, and I am not a programmer. The application will work similar to Facebook and Twitter, profiles and feeds. I have learned some computer science theory, all the way up to OOP, but have no practical experience. Without any experience, is there a way I can evaluate the different language and platform choices available to me? What kind of things should I be looking at? Ease of setup? How many followers it has? How can I evaluate whether a language will have the capabilities I need?


title: What can I do to help users create self-service reports?

text: I work using Reporting Services 2008 and I'm constantly creating ad-hoc reports. We'd like to use PowerPivot on Sharepoint but we're stuck on Sharepoint 2007. Using easy reporting software like Tableau Server would be fantastic but we can't afford it SSRS Report Builder hasn't proved to be very helpful, unfortunately. I've been trying to think of ways to leverage Excel / PowerPivot or any other (free or inexpensive) tool. We just need to be able to provide more data to users so they can analyze on their own. This is an area our IT team as a whole needs to improve. We use SSRS 2008 and SQL Server 2008. We also don't have a data warehouse, it's in the works...


title: git: having separate folder for development, why?

text: until now I was using dropbox as my main vcs (it is not, but for a single dev does the job pretty decent). However I decided to give git a go and see if it fits my needs. Today I was reading this tutorial and at some point it says: > One of the things you should get used to is doing development in a separate > area, not where you're serving your files from, for obvious reasons I am doing development in django, and I can't find these "obvious reasons". Why can't I just use my project's folder to serve files to github? I would be happy if someone clarified this for me now that I am new to git.


title: Differences in If... Else... statement

text: When I first started to learn programming I remember having an argument with my teacher about If Else statements. I was arguing that:                if {           ...      } else if {           ...      } ...      is basically the same as:                if {           ...      else {           if {                ...           } else {                if {                     ...                } else {                     ...                }           }      }       but he said they were completely different. After a while of arguing I accepted they are different. Now, over the years I have come back to this and looked over them to see the apparent major difference but for the life of me I cannot see it. Can someone please clarify why exactly they are different (apart from the obvious nesting)


title: MS Sql server internals/troubleshooting courses?

text: We have been working with Microsoft on a ticket we opened due to one of our queries being much slower on MS Sql server 2k8 enterprise vs sql 2k5 standard. The engineers we are working with have incredible tools and knowledge of the internals of sql server. Is there any course I could take to get me this knowledge?


title: Any recognized convention for repository changelogs?

text: We use TortoiseSVN, but we have no bug tracking system. I know, lame, but beyond my control. There were times when svn wasn't in daily use. Now I've had succeeded in pressing for using it regularly, with proper merging, branching, tagging etc. As you could expect, the number of revisions increased in result, which makes browsing repository log a bit troublesome now. I thought about utilizing some convention based on keywords ("[bugfix]", "[feature]", "[refactored]", "[minor]", "[merged-from-trunk]"... :) so as to make it more searchable. It feels like reinventing the wheel, though. Is there any established convention for that? Or is my approach wrong from the beginning? Any better, alternative solution?


title: How can I get assembly from an EXE?

text: Pretty much my only question is the title. Other then that I want to see the code behind small EXEs but I know it's hard to get it to convert to something like c or c++ so why not get assembly.


title: Qualifying 'happiness' in software development?

text: It occurred to me today that often the real goal of questions asked on sites such as this one (where the questions tend to be more open-ended than say, SO) is for the OP to become happier upon achieving the result. We often excuse this by saying our desire is to be more productive or release a better product, but if you continue to look down this path you can determine that the OP seeks greater productivity or product-quality because those are important to his/her 'happiness'. With that in-mind I ask **this** : Have their been efforts to study software development from this perspective? In other words, what practises increase happiness in those who develop software as a career, and who, if anyone, has researched this specifically? As I mentioned above, they may include strategies that increase productivity or improve product quality, but by no means should they be limited to just those.


title: Resources for learning common algorithms by Lisp

text: Many books about algorithms and data structures are coded by imperative languages. Is there any book that can show functional programming languages can do the same thing or do them better? In particular I am interested in sorting, searching, data structures and graph.


title: How do I authenticate users from facebook/twitter?

text: I need to build a site for a mobile app that allows users to sign in with facebook/twitter or sign up as a new user (traditional username/password). No matter which method the user chooses, they should remain login until they choose to logout. While signing up as a new user is straight forward, using username/password as authentication, I have no idea how I can authentication users who signs up with facebook/twitter. I think there's an access token returned when user gives access to our app, but is this token permanent? Can we reliably store it in our database for authentication? Any advice is appreciated.


title: Which paradigm to use for writing chess engine?

text: If you were going to write a chess game engine, what programming paradigm would you use (OOP, procedural, etc) and why whould you choose it ? By chess engine, I mean the portion of a program that evaluates the current board and decides the computer's next move. I'm asking because I thought it might be fun to write a chess engine. Then it occured to me that I could use it as a project for learning functional programming. Then it occured to me that some problems aren't well suited to the functional paradigm. Then it occured to me that this might be good discussion fodder.


title: best approach to learning for an undergrad operating systems course?

text: what is the best approach to learning for an undergrad operating systems course in order to understand the concepts and get a good grade in the exam? I know that some courses can be mastered through diligently reading the textbook or attending lectures while for others the concepts can only be understood by doing hands on projects. Is there a general studying approach that should be adopted for this type of a course? I know this may be subjective but I am looking for personal experiences/study methods by those who have taken similar courses to see if there is one particular method that worked well for the majority.


title: Which .NET technology would work as an improvement for this client/server application?

text: I am helping a friend with his rewrite of his .NET application, currently using WinForms + sockets, which is a client/server program that currently has on average ~120 concurrent users (sending messages, using the chat). The client will grow and eventually must be able to handle a several thousand concurrent users. A thread is created per user but this is not scalable due to hardware limitations (the server broke when stress-testing more users), not to mention the research I've done on the topic points to this being a bad practice. Speaking of research, I've gathered the following possibilities for this rewrite:   1. Using asynchronous threads with a thread pool of 8 or so threads (will this be able to handle 8,000 users?) or   2. Using WCF (this seems like the more .NET approach and more intuitive with its callbacks instead of using loops) I'm leaning more towards WCF right now. Before anyone asks, I have mentioned how this could be a web application instead, but he said no. Edit (answers to questions): The threads currently read from the socket (the packet) and parse it (simple string parsing) and depending on the type payload, executes another function. The functions executed are not very resource-intensive.


title: Git: rebasing and keeping current to a remote branch - accepted practices?

text: When developing on a long-running branch (here defined as living longer than one release), what's the most accepted practice(s) to keeping the branch current with its origin while keeping the history relatively clean prior to merging back? As an example, consider the origin branch (`m`) and a (topic) branch (`t`) with the following history graph:                A[1]--------F[2]--H[3]--J[4] (m)       \           \     \        B----C-D-E--G-----I-----K (t)          [1] - Release 1.0     [2] - Release 2.0     [3] - Hotfix 2.1     [4] - Hotfix 2.2      In branch `t` I've been merging from master (`m`) periodically to keep my topic branch up to date, but there are many small commits between `B` and `K` that I'd like to squash with a rebase. I'm concerned if I squash those commits that I will change the hash of the merged commits from master and create problems for others when I merge my branch back into master for Release 3.0. If I `rebase -i` the topic branch, I expect the graph would look like this:                A---------F---H---J (m)       \        B-----------------K (t)      where `K` contains all the squashed commits between `B` and `K` including the merged changes from master (`F` and `H`). If I then merge `t` back to master `m` I'm wondering if there likely be conflicts from `F` and `H`. The graph should look like this then:                A---------F---H---J---L (m)       \                   /        B-----------------K   (t)      `t` can now be deleted because it's no longer used. I'd like to keep the history of where `t` was branched from, so rebasing `B` onto `J` would lose that information and probably solve my problem but the graph would look like:                A---------F---H---J---K' (m)      Is this a valid concern? What is the commonly-accepted practice to keep one's feature branch current with its origin while keeping a relatively clean history? _Note: the example here is simplified, there are actually hundreds of commits from the branch point to HEAD on the topic branch - over 300 - many of which could be squashed out of existence_


title: Is try-finally expensive

text: In case of code where you have to do a resource cleanup before exiting a function, is there a major performance difference between these 2 ways of doing it.   1. Cleaning the resource before every return statement              void func()     {         login();              bool ret = dosomething();         if(ret == false)         {             logout();             return;         }              ret = dosomethingelse();         if(ret == false)         {             logout();             return;         }              dootherstuff();              logout();     }        2. Cleaning the resource in a finally block              void func()     {         login();              try         {             bool ret = dosomething();             if(ret == false)                 return;                  ret = dosomethingelse();             if(ret == false)                 return;                  dootherstuff();              }         finally         {             logout();         }     }      I did some basic tests in sample programs and there doesn't seem to be much of a difference. I so much prefer the `finally` way of doing this - but I was wondering if it will cause any performance hit in a big project.


title: Why is CATALINA_HOME named that way and other interesting program names

text: I work with open source software a lot and keep coming across weird and funny names for executables, variables, constants and etc. Currently I am wondering why CATALINA_HOME environment variable was named that way? I did a quick search on google with but nothing relative came up. My only guess is that it is named after the island of the shore of south California. On the related note, very often I find amusing and clever names used in open source programs. One of my favorites are **slapd** and **slurpd** executables of OpenLDAP suite. What are your favorite/noteworthy variable/executable names that you have seen in your programming career? Do you think it is OK to name your variables/executables this way, or would you rather see boring but clear names? PS. This is not really a programming question but I think it somewhat fits in here, according to faq.


title: General knowledge about building businesses applications for (small) businesses?

text: How can one a software developer learn about how to provide business solution? including but not limited to, implement business applications in decent software architectural style? CRM, ERP, MDM, SOA etc... are they really strictly reserved for _enterprise_? Where to learn about their...   * common features   * software / data architecture of such system in general   * complexity involved   * latest trend   * no silver bullets, then what are the options?   * popular open source projects that one can build on?   * commercial option if money is not an issue? I searched on Safari Books Online and most of the books are manual for how to customize Vendor X's CRM / ERP for your needs, or wordy and boring written for business students (not for software dev's) Any good resource to learn those listed above? Or is working at a software firm that writes that kind of software the only way to learn the in and out's of writing business application? **update:** bold assumption - large enterprises would go with a vendor like SAP without thinking of building one themselves. Thanks.


title: Microsoft Terminology: .NET C++ vs. traditional C++

text: I've recently been working with a team that's using both .NET C++ and pre-.NET C++. I fully understand the technical differences between the two technologies. However, I sometimes feel like I'm floundering when it comes to the terminology used to differentiate the two. Example: Say we have two projects:   **ProjectA** contains "C++" code that builds a .NET assembly DLL.   **ProjectB** contains Visual C++ code that builds a traditional native Windows DLL. What is the best way to succinctly and terminologically draw a distinction between the two projects? Again, I'm not asking for an in-depth technical description of the differences between the two technologies. I'm just looking for names and labels. This is how, today, I might try to make the distinction when talking to someone: _"ProjectA is a managed .NET C++ project"_   and   _"ProjectB is an unmanaged native C++ DLL project."_ However I am not at all certain that this terminology is ideal, or even correct. Please describe what you feel the ideal language to use in this situation (or similar situations) might be. Feel free to motivate your answer.


title: How useful are employment tests when interviewing candidates and predicting success?

text: When pre-screening candidates for a position prior to the first face-to-face interview, how useful are technical tests in filtering out poor candidates and possibly predicting their ability to succeed in the position? While some of the personality based ones might not say much, is there benefit to sending a technical test (e.g. on Java or C#) prior to a face-to-face interview or even a phone screen? Also, do these tests ever falsely identify a strong candidate as one that is likely a poor fit for the position?


title: What is the purpose of whitelisting in Phonegap? Is there a way around it?

text: I am using the new phonegap 1.5.0 (which is confusingly renamed cordova despite no mention of the rename on the phonegap site), and I'm finding that the white-listing feature on iOS is quite restrictive. I understand that having a whitelist is more secure in that it only allows trusted domains, but what if you want to load urls that have been loaded dynamically? You don't know exactly which domain will be loading, so you can't put it on the whitelist. An example use-case would be ad-serving and opening privacy policies. Why is the whitelist mandatory, and is there a way around it?


title: Database design and performance impact

text: I have a database design issue that I'm not quite sure how to approach, nor if the benefits out weigh the costs. I'm hoping some P.SE members can give some feedback on my suggested design, as well as any similar experiences they may have came across. As it goes, I am building an application that has large reporting demands. Speed is an important issue, as there will be peak usages throughout the year. This application/database has a multiple-level, many-to-many relationship. eg               object a     object b     object c     object d          object b has relationship to object a     object c has relationship to object b, a     object d has relationship to object c, b, a      Theoretically, this could go on for unlimited levels, though logic dictates it could only go so far. My idea here, to speed up reporting, would be to create a `syndicate` table that acts as a global many-to-many join table. In this table (with the given example), one might see:               +----------+-----------+---------+     | child_id | parent_id | type_id |     +----------+-----------+---------+     |    b     |     a     |    1    |     |    c     |     b     |    2    |     |    c     |     a     |    3    |     |    d     |     c     |    4    |     |    d     |     b     |    5    |     |    d     |     a     |    6    |     +----------+-----------+---------+      Where a, b, c and d would translate to their respective ID's in their respective tables. So, for ease of reporting all of a which exist on object d, one could query               SELECT * FROM `syndicates` ... JOINS TO child and parent tables ... WHERE parent_id=a and type_id=6;      rather than having a query with a join to each level up the chain. # The Problem This table grows exponentially, and in a given year, could easily grow past 20,000 records for one client. Given multiple clients over multiple years, this table will VERY quickly explode to millions of records and beyond. Now, the database will, in time, be partitioned across multiple servers, but I would like (as most would) to keep the number of servers as low as possible while still offering flexibility. Also writes and updates would be exponentially longer (though possibly not noticeable to the end user) as there would be multiple inserts/updates/scans on this table to keep it in sync. Am I going in the right direction here, or am I way off track. What would you do in a similar situation? This solution seems overly complex, but allows the greatest flexibility and fastest read-operations. _Sidenote 1_ \- This structure allows me to add new levels to the tree easily. _Sidenote 2_ \- The database querying for this database is done through an ORM framework.


title: Should we test the values of objects returned from the methods being unit tested?

text: Being new to unit testing I would like to know if I am supposed to test the values of objects returned from methods when doing unit testing. As an example, consider the following classes:               public class Person     {         public int Id { get; set }         public int Age { get; set; }         public string Name { get; set; }         public Pet Pet { get; set; }     }          public class Pet     {         public int Id { get; set; }         public int Age { get; set; }         public Breed Breed { get; set; }     }      And a method with the following declaration:               public Person GetPerson(int id) { ... }      I am now curious if I am supposed to create a test that checks to see if the various properties of the Person are correct (GetPerson_PersonFound_PersonHasCorrectName() and so on)? I suspect that I, under normal circumstances, should? All depends on the requirements? If those properties should be tested, am I then supposed to dig into Pet and check those properties as well? What about going even further, down into Breed? Can add up to quite a few tests quite quickly.


title: What to expect as a programmer in a bank?

text: After three phone interviews, I got this offer in a large bank as a Java programmer. I have no prior experience in financial institutions (only two years as a regular Java dev), so I'm a little bit scared and concerned about whether my skills are right for this role. The main thing that bothers me is math. During all of those interviews we never touched the topic of mathematics, but I know that this position is related to financial instruments like derivatives. How much math should I expect on the assumption that no trading is involved, but rather, accounting? How can I prepare better for this job? I was searching Google for some Java financial programming tutorials/books but no luck here - maybe you can recommend something? I'm really interested in the stock market but never tried this theoretical approach. Thanks!


title: Making sure users have a modern web browser

text: We have several users running on old hardware and old browsers. What would be the best way to get them to upgrade to a newer web browser, without nagging users with a newer web browser.


title: Can we say that Java or C# have unified inheritance trees?

text: Can we say that Java or C# are OO languages with a unified inheritance tree/unified type system? By unified inheritance tree/unified type system I mean that every class derives implicitly or explicitly from one single type? Are there any object oriented language that do not follow that concept?


title: Creating a online database creator

text: I've been thinking of creating an online database creator (think DabbleDB, Zoho Creator, Intuit Quickbase, etc.). I've been thinking of a couple solutions:   1. Have 4 database tables: **Tables** , **Rows** , **Columns** , **Items**. To create a database as a user, you'd go to the "Add New Table" page, give a name and type to as many columns as you want, then save. Then you'd be taken to a page which displayed a list of rows that had items inside that corresponded with the columns. The problem with this approach is I can't figure out how to link the item with both the row and the column.   2. Create an actual database table for each user, and when they insert a new column ( or field), it would just a database INSERT. Cons: I think this would be slow and expensive (correct?), not to mention would make a feature like how DabbleDB did relationships between tables very hard to implement. So what is the best way to build this? Or is there a better way than even the two I've mentioned.


title: What electronic user-story-mapping tools can you recommend?

text: Agile software development relies heavily on a work item type called **user stories**. For example, you have a backlog full of user stories and you can select a few of them to work on during the next sprint. But where and how do you find user stories to put into the backlog? There is a popular technique for doing that called **story mapping**. Jeff Patton invented it and here is the definitive guide on how to do it. The question is, what electronic tools are out there that support Patton's story-mapping technique? I've done a bit of research, found Pivotal and Rally plug-ins (but I'm not a customer of either) and I'm currently experimenting with SilverStories. What other tools are out there? What have you used? What do you (not) recommend? Why? **UPDATE:** Some people who wrote comments seem to lean towards an answer that applying this technique is simply impossible with an electronic tool and we should just accept that. Can't someone write it up as an answer? **UPDATE** (to clarify the question in light of Alex Feinman's comment): the question is about identifying options for story-mapping. Since Jeff Patton's technique can obviously be done on a white-board with stickies, the question focuses on additional options that might be provided with electronic tools. (Premature) commitment to any particular tool or class of tools is not the point of this question.