MVC: view/sidebar.php can load model?

I have a Route that activates a Controller which returns to me a page through a View. Let's call it **master page**. > route -> controller -> view [master page] The master page is divided into header, sidebar, body and footer. And as the sidebar can be loaded to other pages, and not only the master page, it has its own View file. However, the sidebar should receive the data from user, which would be obtained through a Model. And in theory, the Model could only be called by a Controller, who call the View, however, this View is the master page, not the sidebar. > [...] -> view [master page] -> view [sidebar] So I thought the possibilities were as follows, and the idea is to know whether it is right or wrong, or perhaps it is another way that I could not imagine.   1. **The Controller will load the data from the Model and apply the sidebar which, in turn, be applied to the master page.** The problem here is, in a "deeper" case, it would be extremely laborious and difficult to understand.   2. **The Controller run the Model, but send to the master page, which would be responsible for loading the View sidebar and pass the information of the Model to it.** In this case, the work would be passing on information between the layers, so far as was necessary to take the information.   3. **The Controller will only load the View master page, which will load the sidebar, which will be responsible for executing the Model (inside View).** The problem here is that a View theoretically should not run a Model, just print your information already processed in the Controller. What would be the most appropriate way to make this process run correctly?


Separate servers vs local machine for builds, issue tracking etc on solo project

For solo projects, do you keep your build / management tools on your local machine, or on a separate server? If the server is not guaranteed to be safer or more reliable than my own machine I struggle to see the point, but maybe I'm missing some things. Note that I'm not debating the value of continuous integration or having a staging environment etc.. just the question of whether it exists on separate hardware.


Class design for calling "the same method" on different classes from one place

Let me introduce my situation: I have Java EE application and in one package, I want to have classes which will act primarily as cache for some data from database, for example:   * class that will hold all articles for our website   * class that will hold all categories   * etc. Every class should have some `update()` method, which will update data for that class from database and also some other methods for data manipulation specific for that data type. Now, I would like to call `update()` method for all class instances (there will be exactly one class instance for every class) from one place. What is the best design?


Do employers hiring for software jobs care about the classes you took in a Computer Science Masters program?

I'm torn between two classes right now for next semester (Software Design and Advanced Computer Graphics). I would enjoy Advanced Computer Graphics more, but I feel the software design class would help me when approaching anything I ever build for the rest of my career. I feel though I could just buy the book (I already have both books actually) of the Software Design class and go through it, if I wanted. But think it would be a bit tougher to pick up the Advanced Computer Graphics class on my own. So do employers look at the graduate classes you've taken to decide if you would be a good fit or not? I think, more importantly, what I'm wanting to know is if I wanted to work for a high-end software company like Apple or Google would a company like that be more impressed by someone that took software engineering classes or hardcore CS classes?


Best place to write SQL queries

I've been working on this project for my company. Currently I am embedding my SQL statements inside the program itself as and when they are needed. I do have two seperate classes -   1. QueryBuilder Class (Contains all the queries)   2. DbConnection Class (Executes the queries against the database, takes care of connectivity and such) What this does, is whenever I need to make the smallest adjustment in the query, I have to rebuild the entire application. I'm hoping there are better ways to deal with this. Somewhere I can store these queries, get them, pass the parameters **as command parameters** , then execute them and if I have to, change them without having to rebuild my application. There are a couple of ideas in my head.   1. Resource files.   2. Seperate DLL/Class files - Disadvantage is that, I'll have to rebuild that class if I make a change to that code. But the seperation does have it's advantage.   3. Text files, May get unmanageable when queries increase. I'd like to know if there is a better way to deal with this issue and if others have any way of circumventing this.


ViewController in programming

ViewController is a term for classes that handle views in a framework. This is especially used in MVC frameworks. I go through various projects, written by various programmers, who implement MVC in different ways. Especially, i get confused, about the relation between the MainView ( parent view ) and some CustomView ( widget etc) in the framework. **I personally pass reference of the MainView into the ViewController to be instantiated. All the subviews of ViewController are added to that reference of MainView. Additionally, ViewController itself is added as a child of MainView.** Like this : ![main-view and view-controller relation](http://i.stack.imgur.com/VkkVz.jpg) Want to know, if this is the right way to relate each other ?


Where to place the R code for R+Sweave+LaTeX workflow

I spent the last week learning 3 new tools: R, Sweave, and LaTeX. One question that came to my mind when working through my first project: Where do I place the majority of the R code? The tutorials that I read online placed the majority of the R code in the LaTeX .Rnw file. However, I find having a bunch of R calculations in the LaTeX file distracting. What I do find extremely helpful (of course) is to call out to R code in the LaTeX file and embed the result. So the workflow I've been using is to place 99% of my R code in my .R file. I run that file first, save a bunch of calculations as objects, and output the .Rout file once finished (to save the work). Then when running Sweave, _I load up that .Rout file_ , so that I have the majority of my calculations already completed and in the Sweave R session. Then my LaTeX callouts to R are quite simple: Just give me the XTable stored in 'res.table', or give me the result of an already-computed calculation stored in the variable 'res'. So I push towards the minimal amount of R code in the LaTex file possible, to achieve the desired result (embedding stats results in the LaTeX writeup). Does anyone have any experience with this approach? I'm just worried I might run into trouble further down the line, when I start really trying to load up and leverage this workflow.


Why don't testers and programmers like each other?

During my career as a programmer I've seen various programmers and testers, and many of them didn't/don't like each other. I mean, programmers think that the job of a tester is not a "real" job, and testers think that programmers are too "proud". Is this the right decision made by me, why is it, and what can we do to avoid these kind problems?


How to model hashtags with nodejs and mongodb

Existing architecture: nodejs server with mongodb backend. I have strings coming in describing images that can have #hashtags in them. I wish to extract the hashtags from the strings, store the hashtags and associate the image with that hashtag. So e.g. an image is uploaded with 'having fun at #bandcamp #nyc' `#bandcamp` and `#nyc` are extracted.   * If they don't exist as hashtags already, they're created and the image is associated with them both.   * If they do exist, that's recognised and the image is associated with both. So it will be possible to build a mongo find query that gets all images for a hashtag or multiple hashtags. I'm new to nosql, I understand that in relational I'd have:   * table hashtags   * table images   * table imageshashtags with a many to many relationship. An image can have many hash tags, and a hashtag can have many images. What sort of approach is suitable with mongo? From reading q&a like this: http://stackoverflow.com/questions/8455685/how-to-implement-post-tags-in-mongo I see that I can implement a sub document in the image document with the tags. Is that efficient for searching and retrieving? I could then use http://cookbook.mongodb.org/patterns/count_tags/ \- map reduce? So end up with: images collection withwith tags subdocument tags collection   * images document with tags subdocument with tags extracted and added to it when the image is created, and new tag added to the collection if it's not already present (i.e. tags must be unique) also create the tag in the tags collection, and run map reduce. Is that sound? Am I understanding things correctly and is my approach sensible?


Teaching: How can you motivate students to comment?

I remember when I was taught, "comments are the most important part of code." Or rather, when I was _told_ that comments are the most important part of the code. I don't think I was convinced, and I still see common cases where programmers are not convinced of the necessity of good & thorough comments. I am certainly convinced myself at this point - trying to read, in particular, complex formulae that call functions that call other functions that I don't understand - but I don't know how to convey this to students.


How do I convince manager to move me from services/support team to development?

I joined a company a few months ago as a Java developer. I like doing coding and it makes me happy. After my Java training I was put into services/support project. There is no coding in this team. When I ask my manager to move me into development project or roll me off from this project he questioned my "Why do you want to do coding?" This is the point where I am speechless to objectify why I want to do coding. How can I convince him to move me to development project? I want to keep gaining knowledge in Java and experience in development.


Charging for chrome extension?

I have a chrome extension that I think is fairly useful. It's already been posted and is free. How can I start charging for it with the Chrome webstore? $.99 or some such.


Is it possible to find a four-digit Username / Password by chance?

Imagine you have a login-form and it has two field :   * Username (Maximum length : 4 - digits only)   * Password (Maximum length : 4 - digits only) Is it possible to write a program to find the username and password? As I know in the worst case, we will have 100,000,000 checks. and it's crazy because it takes a very long time. So, what is your solution?


Algorithm for recursive evaluation of postfix expressions

I'm reading Sedgewick's book on algorithms in C and I'm looking for an algorithm to evaluate postfix expressions (addition and multiplication only) without using a stack. I tried to implement one but I always get nowhere. I have a simple C implementation for **prefix** evaluation               int eval()     {       int x = 0;            while (a[i] == ' ')         i++;       if (a[i] == '+')         {           i++;           return eval() + eval();         }       if (a[i] == '*')         {           i++;           return eval() * eval();         }       while ( (a[i] >= '0') && (a[i] <= '9'))         x = 10*x + (a[i++]-'0');       return x;      }      and I was wondering if it's possible to do something as elegant as this but for postfix evaluation.


How to store the file names, start offset and length while avoiding the issue of self imposed limits (lookup table) or having to scan the entire file?

I am attempting to learn more about C and it's descendants(C++ mainly). I have decided that I would like to create a "file system" of sorts. Not a particularly advanced one mind you but something to play with. I have no intentions of making it mountable, securable or even recoverable. At the moment I am stuck in concept land with trying to decide how to implement the MFT/FAT. At first I thought that I would just use the first X number of bytes to store a lookup table, when I realized that there would then be a limitation to the number of files I could store I thought maybe use some type of metadata with each file but then I would have to scan the entire filesystem to locate a file. I have read through this and this although the z80 link seems like it is more up my alley. From a high level I want to be able to issue a command like:               ./myfs funnycat.jpg mystorage.mfs      Essentially appending binary data to the end of mystorage.mfs How can I store the information that would contain the file names, start offset and length while avoiding the issue of self imposed limits (lookup table length) or having to scan the entire file (metadata with binary data)? **Concise Explanation** I am looking for a way to label binary data stored in a single contiguous file so that I can pull data from a given offset range or by string.               ./myfs mystorage.mfs funnycat.jpg      Likely in order to accomplish this I will add some logic to myfs to check the first argument for signs that it is a blob containing other files or not.


Constructor parameter validation in C# - Best practices

What is the best practice for constructor parameter validation? Suppose a simple bit of C#:               public class MyClass     {         public MyClass(string text)         {             if (String.IsNullOrEmpty(text))                 throw new ArgumentException("Text cannot be empty");                  // continue with normal construction         }     }      Would it be acceptable to throw an exception? The alternative I encountered was pre-validation, before instantiating:               public class CallingClass     {         public MyClass MakeMyClass(string text)         {             if (String.IsNullOrEmpty(text))             {                 MessageBox.Show("Text cannot be empty");                 return null;             }             else             {                 return new MyClass(text);             }         }     }


How many hours can you be really productive per day? How?

I find that I'm having a great deal of trouble staying alert 8 hours per day. I've heard of people who've negotiated work contracts of just 4 hours/day, arguing that they won't be able to do much more in eight hours. I am often overwhelmed with drowsiness, boredom, distraction. Some days, I seem to blaze through eight hours in a furious explosion of productivity; other days, I hardly get anything done at all. Most days, it's somewhere in between, and I feel bad for wasting a lot of time because I can't muster the concentration to be my best throughout much of the day. I'd like to hear your experiences (tell me I'm not alone!), and, if found, your solutions to this dilemma. Are you productive 8 hours/day almost every day? How?


When is it preferred to combine Add/Edit functionality, and when to keep them separate?

I regularly come across situations where I need to Add or Edit an item, and sometimes I use separate methods for Add and Edit, and other times I combine them into a single method. Is one method preferred over the other? If so, why?               public void AddItem()     {         ShowEditingPopup(new Item(), "Add Item");     }          public void EditItem(Item item)     {         ShowEditingPopup(item, "Edit Item");     }      OR               public void EditItem(Item item)     {         ShowEditingPopup(             (item ?? new Item()),              string.format("{0} Item", (item == null ? "Add " : "Edit "))         );     }      where `ShowEditingPopup` is defined as               public void ShowEditingPopup(object popupDataContext, string popupTitle)     {         PopupDataContext = popupDataContext;         PopupTitle = popupTitle;         IsPopupVisible = true;     }      **Edit:** Just to clarify, I am not Saving the item, I am opening it for Editing. I almost always implement a generic Save method for saving to the database **Edit #2:** Edited code samples so they more accurately reflect the sort of situation I am referring to


Writing a method to 'transform' an immutable object: how should I approach this?

(While this question has to do with a concrete coding dilemma, it's mostly about what's the best way to design a function.) I'm writing a method that should take two Color objects, and gradually transform the first Color into the second one, creating an animation. The method will be in a utility class. My problem is that Color is an immutable object. That means that I can't do `color.setRGB` or `color.setBlue` inside a loop in the method. What I _can_ do, is instantiate a new Color and return it from the method. But then I won't be able to _gradually_ change the color. So I thought of three possible solutions: * * * 1- The client code includes the method call inside a loop. For example:               int duration = 1500; // duration of the animation in milliseconds     int steps = 20; // how many 'cycles' the animation will take     for(int i=0; i<steps; i++) color = transformColor(color, targetColor, duration, steps);      And the method would look like this:               Color transformColor(Color original, Color target, int duration, int steps){         int redDiff = target.getRed() - original.getRed();         int redAddition = redDiff / steps;         int newRed = original.getRed() + redAddition;              // same for green and blue ..              Thread.sleep(duration / STEPS); // exception handling omitted         return new Color(newRed, newGreen, newBlue);     }      The disadvantage of this approach is that the client code has to "do part of the method's job" and include a `for` loop. The method doesn't do it's work entirely on it's own, which I don't like. * * * 2- Make a mutable `Color` subclass with methods such as `setRed`, and pass objects of this class into `transformColor`. Then it could look something like this:               void transformColor(MutableColor original, Color target, int duration){         final int STEPS = 20;              int redDiff = target.getRed() - original.getRed();         int redAddition = redDiff / steps;         int newRed = original.getRed() + redAddition;              // same for green and blue ..              for(int i=0; i<STEPS; i++){             original.setRed(original.getRed() + redAddition);             // same for green and blue ..             Thread.sleep(duration / STEPS); // exception handling omitted         }     }      Then the calling code would usually look something like this:               // The method will usually transform colors of JComponents     JComponent someComponent = ... ;     // setting the Color in JComponent to be a MutableColor     Color mutableColor = new MutableColor(someComponent.getForeground());     someComponent.setForeground(mutableColor);     // later, transforming the Color in the JComponent     transformColor((MutableColor)someComponent.getForeground(), new Color(200,100,150), 2000);      The disadvantage is - the need to create a new class `MutableColor`, and also the need to do casting. * * * 3- Pass into the method the actual mutable object that holds the color. Then the method could do `object.setColor` or similar every iteration of the loop. Two disadvantages: A- Not so elegant. Passing in the object that holds the color just to transform the color feels unnatural. B- While most of the time this method will be used to transform colors inside `JComponent` objects, other kinds of objects may have colors too. So the method would need to be overloaded to receive other types, or receive `Object`s and have `instanceof` checks inside.. Not optimal. * * * Right now I think I like solution #2 the most, than solution #1 and solution #3 the least. However I'd like to hear your opinions and suggestions regarding this.


CI - How long is continous?

We currently are using CCNet as our continous integration server. Most projects check for changes every 30 seconds (the default) and if needed perform a build (unit tests, stylecop, fxcop, etc). We've gotten quite a few projects now, and the server spends most of its time near 100% cpu utilization. This has alarmed some of the development team, even though the server is responsive and builds are still about the same length of time they've always been. Its been suggested that we lower the check interval to about five minutes. To me that seems too long, and we risk people committing code and then going home for the weekend and now there's a broken build possibly holding up others. In response, the suggestion is that if someone needs to know the results they can force the build. But that seems to defeat the purpose of CI, as I thought it was supposed to be automated. My proposed solution is just to get another build server and split the builds amongst the servers. Am I thinking about this the wrong way, or is there a point where if integration isn't often enough you're not really doing CI anymore?


To Domain or not to Domain

The SQL92 and SQL99 standards define `CREATE DOMAIN` DDL constructs. Not all databases support this, or have a different name for it (SQL Server has User Defined Types, for example). These allow one to define a constrained data-type to be used in their database, to simplify and enforce rules pertaining to the allowed values. Such a data-type could be used in column declarations, in inputs and outputs to stored procedures and functions etc... I would like to know:   * Do people actually use domains in their database designs?   * If so to what extent?   * How useful are they?    * What pitfalls have you encountered? I am trying to asses the viability of using these in future database development.


Can I use Linux/Mono instead of Windows/Visual Studio without any problem?

I have more than 6 years of experience with .Net (C#/ASP.NET) and Visual Studio. But recently I'm tempted to switch to Linux/Mono. It comes up with some questions:   1. Can I run my old Visual Studio projects and source codes in Mono correctly?   2. My clients use IIS for ASP.NET and MS Windows for Winform and Console projects. Does my migration affect them? In other words does my Mono projects runs in Windows/IIS without any change or problem?   3. Does Mono is dependable considering recent changes of Mono, Novell, Xamarin and Attachme?   4. Can I continue using my favorite open source and none open source projects like NHibernate, Castle, Cuyahoga, log4net, Microsoft Enterprise Library and DNN?   5. Can I host Mono ASP.NET web projects in Apache without any problem?   6. Can I use my skills in ASP.NET webforms and MVC in Mono exactly?


Does W3C membership help future career?

Having international certificates from giant companies like Microsoft, Cisco, etc. can be a great help to your career. Also if you have a decent amount of experience, you're fine getting a job. How about free, but active membership of W3C? They don't give you certificates. You just become a member, think about recommendations and proposals, participate in decision-making process and that's all. Does W3C membership help future career?


What has been your experience with SQL CLR for complex business logic?

So I thought I had a perfect use-case for a CLR SQL Procedure. I've search the Net for perhaps a similar example where data is retrieved, records added and updated. I have not looked at a SQL CLR procedure for awhile, but since it was released in 2005 (some 6 years ago!) I would have hoped there were plenty of examples! I'm considering it because I have to look at some data, run it through a bunch of procedural logic, update, and then get it back to the client. My thinking here is to get as close to the DB metal as possible, and use that hardware to make it happen quickly. Is anybody using SQL CLR? If you have, what has been your experience with it? p.s. originally posted on stackoverflow and moved here based on a comment.


In Scrum, what to do when story points and task hours don't roughly correlate?

Our development team is pretty new to the scrum process, so I would like to help refine our methods to make better use of it. In particular, I noticed that the correlation between story points and task hours is not very good. That is, we often have stories of lesser points decomposed into a total task hours greater than stories of higher points. Now, I am aware that these are two separate estimation processes and that we should use the hours to estimate only the remaining work for a sprint while using the story points to compute a velocity and be able to predict the length of the release cycle or the amount of features we will be able to address. However, it seems to me that if sprint points and task hours don't correlate well, then we must be doing a bad job at estimating either one or both of these. Since we only adjust the remaining work hours as opposed to recording the time spent, I can't easily tell if the problem is the initial task hour break-down or the story point estimates. So, my question is whether we should deal with this and how? I can think of several ways to start dealing with this:   * Record time spent in a task and use this information as feedback to help refine our estimation process by retrospectively identifying user stories which we under/over estimated. **_But I am not convinced that we want to record this information and I anticipate resistance to it._**   * At the planning phase, identify outliers after the task hour break-down process and look at these further. This way we could try to identify whether we misjudged the complexity of the story or if the task breakdown is missing some efforts or over-estimating the length of simple tasks. **_However, I'm afraid this would couple the two estimation efforts, which doesn't seem as the right thing to do either... This also assumes we would have decomposed all stories in the planning phase, otherwise we won't be able do much about stories which were misjudged._**   * Another method to approach this would be to try to independently incorporate methods to enhance the estimation process and raise the team consciousness about the importance of estimation. Then just keep monitoring the correlation between story points and initial task hour break-down as an indicator of how we are doing and whether we need to keep working at it. **_I'm inclined to think that this is the best approach, but less pro-active._** What is the best way to approach this issue and/or what other suggestions are there for enhancing the estimation process in this context?


What are ways of drafting a workflow document that maps elements in the design close to their counterparts in code?

We're starting a medium sized PHP web app, written in MVC fashion, using CodeIgniter. Most of the functional specifications have been written, and there are a few features that will definitely be replaced with improved behaviour in later stages of the project. I'm tasked with writing a workflow document from a technical point of view and here's what I want to cover, ideally:   * The document should preferably be a diagram of some sort,   * A close mapping of elements in the document with with models/views/controllers/js functions/other important blocks in the code; let's call these modules That will suffice since I will be able to derive from that a way to test different modules independently and assign different modules to different programmers. The aspect of rewriting parts of the document when I discover that parts of the code need to be replaced isn't an issue, I'll make the rewrites to keep code and diagram in sync if/when I have to. My attempts so far with Petri nets and UML interaction diagrams have failed upon the realization that I have to expose too much of the decision making logic inside controllers. I'm looking for advice and I'm curious if anyone has done this before.


7 drived classes with one common base class

i have written the following code,                  //main.cpp          #include<iostream>          #include<string>          #include"human.h"          #include"computer.h"          #include"referee.h"          #include"RandomComputer.h"          #include"Avalanche.h"          #include"Bureaucrat.h"          #include"Toolbox.h"          #include"Crescendo.h"          #include"PaperDoll.h"          #include"FistfullODollors.h"          using namespace std;          int main()          {          Avalanche pla1;     Avalanche pla2;          referee f;     pla1.disp();     for (int i=0;i<5;i++)     {                   cout<<pla2.mov[i];         }          return 0;          }      in this program all included classes except referee.h and human.h are drived from computer.h. each drived calls has a char array variable which is initialized when a member of a drived class is declared. the problem is that when i declare tow diffrent drived class memebers lets say Avalache and ToolBox. upon printing the char array for one of them using for loop it prints nothing. However if i declare only one of them in main.cpp the it works properly. and the file for computer.h is as such:                   #ifndef COMPUTER_H     #define COMPUTER_H     class computer     {         public:         int nump;         char mov[];         void disp();     };     #endif      ToolBox.h is like this:                   #ifndef TOOLBOX_H          #define TOOLBOX_H          #include"computer.h"          class Toolbox: public computer          {              public:              Toolbox();          };          #endif      finally Avalanche.h is as following:               #ifndef AVALANCHE_H          #define AVALANCHE_H          #include"computer.h"          class Avalanche: public computer          {              public:              Avalanche();          };          #endif


Is hashing of just "username + password" as safe as salted hashing

I want to hash "user + password". [EDIT: prehashing "user" would be an improvement, so my question is also for hashing "hash(user) + password". If cross-site same user is a problem then the hashing changed to hashing `"hash(serviceName + user) + password"`] From what I read about salted hash, using "user + password" as input to hash function will help us avoid problem with reverse hash table hacking. The same thing can be said about rainbow table. Any reason why this is not as good as salted hashing?


How do you remember where in your code you want to continue next time?

When you interrupt the work on some code (be it because you have to work on something else or go on vacation or simply because it is the end of the day), once you close that Visual Studio project, what is your preferred way to remember what you want to do next when you start working on that code again. Do you set a Visual Studio bookmark or do write down something like `// TODO: continue here next time`? Maybe you have a special tag like `// NEXT:`? Do you put a sticky note on your monitor? Do you use a cool tool or Visual Studio plugin I should know? Do you have any personal trick that helps you find the place in your code where you left off the last time you worked on your code?


What is the difference between a great programmer and a financially successful programmer?

What is the difference between people like Zukerberg, Page and Brin who are programmers and also extraordinarily successful financially, and the other wise great programmer who are not very much financially successful (like most of the employees at facebook and google).


Is there a language out there in which parameters are placed inside method name?

in JavaScript:               function getTopCustomersOfTheYear(howManyCustomers, whichYear) {        // Some code here.     }     getTopCustomersOfTheYear(50, 2010);      in C#:               public List<Customer> GetTopCustomersOfTheYear(int howManyCustomers,       int whichYear)     {        // Some code here     }     List<Customer> customers = GetTopCustomersOfTheYear(50, 2010);      in PHP:               public function getTopCustomersOfTheYear($howManyCustomers, $whichYear)     {        // Some code here     }     $customers = getTopCustomersOfTheYear(50, 2010);      Is there any language out there which support this syntax:               function GetTop(x)CustomersOfTheYear(y)     {         // Some code here     }     returnValue = GetTop(50)CustomersOfTheYear(2010);      Isn't it more semantic, more readable form of writing a function? **Update:** The reason I'm asking this question is that, I'm writing an article about a new syntax for a new language. However, I thought that having such syntax for declaring methods could be nicer and more friendly to developers and would decrease learning-curve of the language, because of being more closer to natural language. I just wanted to know if this feature has already been contemplated upon or not.


Search for the (slowly moving) number with penalty for too high test value

You task is to design a search algorithm that will find my secret number, which is between 0 and 2^64. If your test value is too low you can test again in 1 second. If your test value is too high you are not allowed to test again the next 300 seconds. Every second I will add 1 to or subtract 1 from the number. I will not tell you what I have done, and while it may be random it also might not be random. How can you find the approximate number fast? The obvious answer is to use a binary search, but since the penalty is high for guessing too high, I would think it needs some adjustment. **Background** I need to find the speed of a system. The speed changes slowly. It takes 1 second to do a guess. If my guess is too low: no problem. If it is too high, then system reboots, causing a 5 minute delay. My goal is to get a decent estimate of the speed relatively fast.


Sprint Backlog Task Estimates - What Are the Hours Made Of?

For the sprint backlog, I read that the stories are broken into tasks, and estimated. Are these estimates typically development hours only, or development + QA? What are these hours typically consisting of? Thanks.


Should we avoid using design patterns in constantly changing projects?

A friend of mine is working for a small company on a project every developer would hate: he's pressured to release as quickly as possible, he's the only one who seem to care about technical debt, the customer has no technical background, etc. He told me a story which made me think about the appropriateness of design patterns in projects like this one. Here's the story. > We had to display products at different places on the website. For example, > content managers could view the products, but also the end users or the > partners through the API. > > Sometimes, information was missing from the products: for example, a bunch > of them didn't have any price when the product was just created, but the > price wasn't specified yet. Some didn't have a description (the description > being a complex object with modification histories, localized content, > etc.). Some were lacking shipment information. > > Inspired by my recent readings about design patterns, I thought this was an > excellent opportunity to use the magical Null Object pattern. So I did it, > and everything was smooth and clean. One just had to call > `product.Price.ToString("c")` to display the price, or > `product.Description.Current` to show the description; no conditional stuff > required. Until, one day, the stakeholder asked to display it differently in > the API, by having a `null` in JSON. And also differently for content > managers by showing "Price unspecified [Change]". And I had to murder my > beloved Null Object pattern, because there was no need for it any longer. > > In the same way, I had to remove a few abstract factories and a few > builders, I ended up replacing my beautiful Facade pattern by direct and > ugly calls, because the underlying interfaces changed twice per day for > three months, and even the Singleton left me when the requirements told that > the concerned object had to be different depending on the context. > > More than three weeks of work consisted of adding design patterns, then > tearing them apart one month later, and my code finally became spaghetti > enough to be impossible to maintain by anyone, including myself. Wouldn't it > be better to never use those patterns in the first place? Indeed, I had to work myself on those types of projects where the requirements are changing constantly, and are _dictated_ by persons who don't really have in mind the cohesion or the coherence of the product. In this context, it doesn't matter how agile you are, you'll come with an elegant solution to a problem, and when you finally implement it, you learn that the requirements changed so drastically, that your elegant solution doesn't fit any longer. What would be the solution in this case?   * Not using any design patterns, stop thinking, and write code directly? It would be interesting to do an experience where a team is writing code directly, while another one is thinking twice before typing, taking the risk of having to throw away the original design a few days later: who knows, maybe both teams would have the same technical debt. In the absence of such data, I would only assert that it doesn't _feel right_ to type code without prior thinking when working on a 20 man-month project.   * Keep the design pattern which doesn't make sense any longer, and try to add more patterns for the newly created situation? This doesn't seem right neither. Patterns are used to simplify the understanding of the code; put too much patterns, and the code will become a mess.   * Start thinking of a new design which encompasses the new requirements, then slowly refactor the old design into the new one? As a theoretician and the one who favors Agile, I'm totally into it. In practice, when you know that you'll have to get back to the whiteboard every week and _redo the large part of the previous design_ and that the customer just doesn't have enough funds to pay you for that, nor enough time to wait, this probably won't work. So, any suggestions?


Are Components ideal for packaging and reusing find() requests?

I find myself loading several models over and over again throughout my application. Instead of typing the code to load the model, run a find, would it be reasonable to put that code in a method and just call it from the controller. For example: **Instead of**               public function view() {         $this->loadModel('Foo');         $this->Foo->find('list');     }      **Could I use**               public function view() {         $this->ComponentName->fooLoad();     }


How do you deal with being behind on a task?

I have a question for you guys. Say, you're given a task as an item in a product backlog. Say, you have a deliverable that's due the following day. If you're behind on the task compared to when you made your estimates, what do you do about it? Does it make you anxious knowing your behind schedule? How do you deal with this? Do you tell the scrum master or the product owner?


Which Java based web ui framework to use?

* Wicket   * Click   * GWT   * Vaadin As I understand them, these frameworks all enable gui components to be created using java (with all its benefits) without having to do lots of html/javascript. As well as considering the technical factors, I am also interested to hear if any are gaining popularity fast. Is a particular framework is becoming the _leader of the pack_ , this will also effect the decision.


How do programming languages define functions?

How do programming languages define and save functions/methods? I am creating an interpreted programming language in Ruby, and I am trying to figure out how to implement function declaration. My first idea is to save the content of the declaration in a map. For example, if I did something like               def a() {         callSomething();         x += 5;     }      Then I would add an entry into my map:               {         'a' => 'callSomething(); x += 5;'     }      The problem with this is that it would become recursive, because I would have to call my `parse` method on the string, which would then call `parse` again when it encountered `doSomething`, and then I would run out of stack space eventually. So, how do interpreted languages handle this?


I recently read about unit of work and repository design patterns; working with EF wondering if this is a good design pattern

I found myself creating child records that require a master record to exist, first, so that they can reference it by the master record's primary key (if that's the right term). To accomplish this using EF 6 I tried to call `SaveChanges()` twice - once to create the master record so that its identity key gets generated and once after the children have been created. The problem I ran into was that EF doesn't like multiple calls to `SaveChanges()` so I had to use a transaction. I don't like using a transaction because it feels messy for some reason I can't articulate. It's a somewhat common problem for me to have to do this so instead of a `using`, `try/catch` and `commit/rollback` I figured it'd be easier to have this each time:               this._dbContextWrapper.CommitIfTrue(() =>     {         // Multiple calls to SaveChanges() here              return true;     });      While also having `BeginTransaction()` exposed on my `_dbContextWrapper` so that if passing a `Func<bool>` isn't desirable.               public interface IRepository     {         IQueryable<TModel> Query<TModel>()             where TModel : class;              TModel Find<TModel>(params object[] key)             where TModel : class;              void Add<TModel>(TModel model)             where TModel : class;              void Update<TModel>(TModel updated, params object[] key)              where TModel : class;              IDataResult SaveChanges();              void Delete<TModel>(params object[] key)             where TModel : class;              IRepositoryTransaction BeginTransaction();              IRepositoryTransaction BeginTransaction(IsolationLevel isolationLevel);              IDataResult CommitIfTrue(Func<bool> transaction);              IDataResult CommitIfTrue(Func<bool> transaction, IsolationLevel isolationLevel);     }          public interface IRepositoryTransaction : IDisposable     {           void Commit();              void Rollback();     }          public interface IDataResult     {         bool IsSuccess { get; }              string ErrorMessage { get; }     }      I realize that this "`IRepository`" only a thin wrapper around `DbContext` \- I'm doing it so that my classes can have a `Mock` implementation provided to them instead of having to mess with `Fakes` to get around the non-virtual aspect of `DbContext`'s methods. My question is: **Is my`CommitIfTrue` method reasonable? Is there a way to do something similar that's also more testable/involves no `Action`s or `Func`s?**


What's The Difference Between Imperative, Procedural and Structured Programming?

By researching around (books, Wikipedia, similar questions on SE, etc) I came to understand that Imperative programming is one of the major programming paradigms, where you describe a series of commands (or statements) for the computer to execute (so you pretty much order it to take specific actions, hence the name "imperative"). So far so good. Procedural programming, on the other hand, is a specific type (or subset) of Imperative programming, where you use procedures (i.e., functions) to describe the commands the computer should perform. **First question** : Is there an Imperative programming language which is not procedural? In other words, can you have Imperative programming without procedures? **Update** : This first question seems to be answered. A language CAN be imperative without being procedural or structured. An example is pure Assembly language. Then you also have Structured programming, which seems to be another type (or subset) of Imperative programming, which emerged to remove the reliance on the GOTO statement. **Second question** : What is the difference between procedural and structured programming? Can you have one without the other, and vice-versa? Can we say procedural programming is a subset of structured programming, as in the image? ![enter image description here](http://i.stack.imgur.com/Ip5eR.jpg)


Getting paid through Ltd or Umbrella company?

I am working for a company as a web dev consultant at the moment, and they asked me whether I want to get payed through the Umbrella company or through my Ltd. Which is better for me and why? The @David Thornley made a good point in comments. Don't forget that we are talking about web developing here. I am not sure how is it in UK, but in the country I am from, you get taxed differently for the stuff you do.


Lean/Kanban *Inside* Software (i.e. WIP-Limits, Reducing Queues and Pull as Programming Techniques)

Thinking about Kanban, I realized that the queuing-theory behind the SW- development-methodology obviously also applies to concurrent software. Now I'm looking for whether this kind of thinking is explicitly applied in some area. A simple example: We usually want to limit the number of threads to avoid cache-thrashing (WIP-Limits). In the paper about the disruptor pattern[1], one statement that I found interesting was that producer/consumers are rarely balanced so when using queues, either consumers wait (queues are empty), or producers produce more than is consumed, resulting in either a full capacity-constrained queue or an unconstrained one blowing up and eating away memory. Both, in lean-speak, is waste, and increases lead-time. Does anybody have examples of WIP-Limits, reducing/eliminating queues, pull or single piece flow being applied in programming? http://disruptor.googlecode.com/files/Disruptor-1.0.pdf


Performance overhead of standard containers and boost

Adap.TV has chosen C++ to develop their software. However, they've decided not to use the standard containers1 and boost for performance reasons, as they've blogged about it in the following article:   * Why we use C++ (without using STL or boost) It says (emphasis mine), > There are several rules that we are obeying **in order to keep the > performance high** ;   >  **Avoid malloc(), calloc() or new**   >  **No free() or delete** (and no need for tcmalloc)   >  **No STL, boost etc.**   >  Avoid locking as much as possible   >  # threads = # CPU cores (hyperthread is a trade-off between latency and > throughput) As we know, the standard containers use allocators which uses `new` and `delete` internally which are _expensive_ operations. So to avoid them, AdapTv has avoided using standard containers altogether. Instead of using `new` and `delete` (repeatedly), they _reuse_ memory (which implies they use a memory pool). I'm wondering what's stopping them from using custom allocators for the standard containers! The custom allocator could use a memory pool internally which means _memory reuse_. So I don't see how standard containers would hurt performance. Or am I missing something? Can't we avoid using `new` and `delete` with standard containers? Is there any other reason why would anyone avoid using standard containers? Or is it simply a lack of knowledge on their part which led to this decision? And how about boost? * * * 1) I suppose by _STL_ they meant _C++ standard containers_ , not SGI's STL.


Is it possible to integrate MS Project Server with SVN

We have been using Hosted SVN + Fogbugz for our source control and task/issue tracking. Our developers are very comfortable with SVN and we are hesitant to switch source control (e.g. TFS) providers at this point. However, Management extensively uses Microsoft Project for project management and are considering setting up MS Project Server. **EDIT** With SVN + Fogbugz (or several other task tracking tools), we can create a post-commit hook to update tasks (close/reopen/specify time) from commit messages. Does anyone know of a way to intergrate MS Project Server with SVN? Is it even possible? I searched online but could not find anything. Maybe I did not search correctly?


Possible to Comment on a storyboard?

I recently started working for a company that has me making mockups for an app they'd like to see converted to an iPhone app. I have not been informed as to how all the boards fit together, but I do have a general idea on what they should look like. I would like to write notes or comments on each individual board about how things should be done once I have more information. Is it possible to comment on a board or is there some place close to the boards where I can leave notes on what to do next?


How can I estimate the lifespan of a line of code?

I'm trying to figure out a way to analyze code longevity in open source projects: that is, how long a specific line of code is active and in use. My current thinking is that a line of code's lifespan begins when it is first committed, and ends when one of the following occurs:   * It's edited or deleted,    * Excluded from builds,   * No code within its build is maintained for some period of time (say, a year). NOTE: As clarification on why an "edit" is being counted as "death", edited lines would be counted as a "new" generation, or line of code. Also, unless there's an easy way to do this, there would be no accounting for the longevity of a lineage, or descent from an ancestor. What else would determine a line of code's lifespan?


How to use the clients webcam for recording through a website?

I am building a site and idealy I would like to record the users interaction via their webcam. How do I intergrate webcam recording into my site. I have seen It done with flash. But Im trying to avoid using this. My site is being built using c#, javascript and designed for IE 7 and older. * * * I want to record the videos for later. They are not going to be used for chat e.t.c.


Choosing between Single or multiple projects in a git repository?

In a **`git`** environment, where we have modularized most projects, we're facing the _one project per repository_ or _multiple projects per repository_ design issue. Let's consider a modularized project:               myProject/        +-- gui        +-- core        +-- api        +-- implA        +-- implB      Today we're having _one project per repository_. It gives freedom to   * `release` individual components   * `tag` individual components But it's also cumbersome to **`branch`** components as often branching `api` requires equivalent branches in `core`, and perhaps other components. Given we want to `release` individual components can we still get the similar flexibility by utilizing a _multiple projects per repository_ design. What experiences are there and how/why did you address these issues?


Best way to present a small application

I'm giving a presentation on a small Timeline Application I made over the past few weeks. How might I make this small application into a much larger speech, about 3 minutes long. **Should I focus on how it was made or should I just focus on why people should use it?**


Finding a way to simplify complex queries on legacy application

I am working with an existing application built on Rails 3.1/MySql with much of the work taking place in a JavaScript interface, although the actual platforms are not tremendously relevant here, except in that they give context. The application is powerful, handles a reasonable amount of data and works well. As the number of customers using it and the complexity of the projects they create increases, however, we are starting to run into a few performance problems. As far as I can tell, the source of these problems is that the data represents a tree and it is very hard for ActiveRecord to deterministically know what data it should be retrieving. My model has many relationships like this:               Project        has_many Nodes        has_many GlobalConditions          Node         has_one Parent        has_many Nodes        has_many WeightingFactors through NodeFactors        has_many Tags through NodeTags          GlobalCondition        has_many Nodes ( referenced by Id, rather than replicating tree )          WeightingFactor        has_many Nodes through NodeFactors          Tag        has_many Nodes through NodeTags      ![enter image description here](http://i.stack.imgur.com/4L3Rn.png) The whole system has something in the region of thirty types which optionally hang off one or many nodes in the tree. My question is: What can I do to retrieve and construct this data faster? Having worked a lot with .Net, if I was in a similar situation there, I would look at building up a Stored Procedure to pull everything out of the database in one go but I would prefer to keep my logic in the application and from what I can tell it would be hard to take the queried data and build ActiveRecord objects from it without losing their integrity, which would cause more problems than it solves. It has also occurred to me that I could bunch the data up and send some of it across asynchronously, which would not improve performance but would improve the user perception of performance. However if sections of the data appeared after page load that could also be quite confusing. I am wondering whether it would be a useful strategy to make everything aware of it's parent project, so that one could pull all the records for that project and then build up the relationships later, but given the ubiquity of complex trees in day to day programming life I wouldn't be surprised if there were some better design patterns or standard approaches to this type of situation that I am not well versed in.


Is there a Standard Visual Cue to Indicate the presence of a Tool Tip (Hover Text)?

A widely recognized cue that text is clickable is to underline it, set it in a different color, and change the cursor to a hand symbol when hovering over it. I have a situation where a column in a report may contain a tool tip -- hover- text that appears when the cursor is placed over it. I'm trying to come up with an obvious cue to the user for this. When I use a cue similar to a hyperlink, users instinctively click on it and wonder why nothing happens. Can you refer me to any real-world examples of an effective cue? Or, what cue have you successfully used in the past to accomplish this?


Why learn hexadecimal?

I've taken quite a few intro programming classes in my day, mostly just to get my feet wet in every different kind of programming I find. Not surprisingly, just about every class runs through the same format : intro to hardware, intro to software, and then you get into the actual programming. While understanding how the hardware and software works is very important, I've always been confused by one topic that has been in every single course. In the intro to software section I've found, without fail, they always put large emphasis on being literate in binary, hexadecimal, and sometimes even octal number systems. I understand that it's good to understand what these things are, and how a computer would interpret them, but I've never found myself actually needing to know how to read and write any of those number systems. Really, the only time I've seen something other than base 10 is for colors in CSS, which is even easier if you use something like www.colorpicker.com Have I just been ignorant of the wonderful uses of these non-base-10 number systems in the programming world, or is just an old tradition to include these sections in all programming textbooks? Does anyone have a good example of where the average programmer would actually use an octal number?


Cross browser client side storage

I am developing an angularjs app. The app has to run in current FF, IE, Chrome and on iOS/Android via Phonegap. I am looking for a solution to store data in the client. Phonegap offers a web sql api, that is also supported by Chrome. FF however does not support it, since it is abbandoned by w3c. Cookies and localStorage do not work reliable in iOS. How can i store data in all those browsers?


VB.NET: Two tiers for three layers or three tiers for three layers

I asked a question on StackOverflow in November about separating a very large application into layers and tiers: http://stackoverflow.com/questions/13342626/net-divorcing-layers. The previous developer included data logic and business logic in the business logic layer My question is about the tiers element. I researched on here and concluded that it is better to separate layers into tiers contained in separate DLLs i.e. the presentation layer, business logic layer and data access layer all have separate DLLs as described here: http://stackoverflow.com/questions/13342626/net-divorcing-layers. This seems to be consistent with what I lEarnt at university. However, since then all the examples I am finding online suggest having two tiers (One for the presentation layer and one tier for the BLL and DAL). Is there any specific criteria that developers use to decide whether or not to use three tiers? I am using ADO.NET and have a shared SQL Helper class in the data access layer. The SQLHelper class is similar to this but for VB.NET: http://www.sharpdeveloper.net/source/SqlHelper-Source-Code-cs.html


The Meaning of Unified in UML

UML and other related modelling languages are exists in most of the system engineering fields to represent the system, flow, relations in a structured way. UML also is one of the modelling language used in computer science like other industries to represent the systems in obeject oriented way by using different types of diagrams. Does 'Unified' UML has a special (or real) meaning here?


SmartHeap crashes in _shi_removeFromFreeList

We have a multithreaded application in C++ which uses SmartHeap-10 on Linux. new, new[], delete and delete [] are overloaded. there is _inconsistent_ occurrence of SIGSEGV, only in delete[]. the backtrace shows -               #0  0x08b068bc in _shi_removeFromFreeList ()     #1  0x08b070d7 in _shi_freeVar ()     #2  0x08b086a7 in MemFreePtr ()     #3  0x081e91ea in operator delete(void*) ()      where MemFreePtr () is library function by SmartHeap. Any pointers to think of ?


Explanation of Object-parameter-coupling as mentioned in Code Complete book

I have been reading up on the seminal and excellent book _Code Complete_. It discusses about the various kinds of couplings that can happen between modules(which may be classes as well as methods):   1. _Simple-data-parameter-coupling_   2. _Simple-object-coupling_   3. _Object-parameter-coupling_   4. _Semantic coupling_ The book has to say this about _object-parameter coupling_ : > Two modules are object -parameter coupled to each other if `Object1` > requires `Object2` to pass it an `Object3`. This kind of coupling is tighter > than `Object1` requiring `Object2` to pass it only primitive data types > because it requires `Object2` to know about `Object3`. What is the author trying to mean here?


How to count hits in an HTTP API without bogging down the DB

I'm building an API and want to count hits for each user. It's a HTTP API implemented in Python. I could keep the count in a database (using PostGreSQL) but it'll be a very busy API, so I don't want the overhead in the DB. I'm looking at Redis or just writing plain text logs. But is there a better approach? It's a map tile service, so bursts of hundreds of hits per sec. I want to report usage per month to the user--not keep total count of hits.


About Artificial Intelligence

I am interested in starting a career in artificial intelligence. Can anyone suggest how I could prepare for this? What languages should I study that would be best for this career choice?


Few big libraries or many small libraries?

Over the course of some months I've created a little framework for game development that I currently include in all of my projects. The framework depends on SFML, LUA, JSONcpp, and other libraries. It deals with audio, graphics, networking, threading; it has some useful file system utilities and LUA wrapping capabilities. Also, it has many useful "random" utility methods, such as string parsing helpers and math utils. Most of my projects use all of these features, but not all of them:   * I have an automatic updater that only makes use of the file system and networking features   * I have a game with no networking capabilities   * I have a project that doesn't need JSONcpp   * I have a project that only needs those string/math utils This means that I have to include the SFML/LUA/JSON shared libraries in every project, even if they aren't used. The projects (uncompressed) have a minimum of 10MB in size this way, most of which is unused. The alternative would be splitting the framework in many smaller libraries, which I think would be much more effective and elegant, but would also have the cost of having to maintain more DLL files and projects. I would have to split my framework in a lot of smaller libraries:   * Graphics   * Threading   * Networking   * File system   * Smaller utils   * JSONcpp utils   * LUA utils Is this the best solution?


Good design for delegates in a service oriented architecture

My problem is quite complex to explain and my English is not excellent, so I hope you can understand my question. In a service oriented architecture there are some modules that own data used by all the others applications end these modules expose the data via Remote Method Invocation and Web Services. We the developers of the module have seen that the code that invokes these modules is repeated in all the other modules, so we decided to put in common the code and created a new module named _Common Delegates_. The responsabilities of this new module are:   * keep informations about the hostname, port and JNDI and/or web service names;   * instantiate and use the service locator;   * instantiate and call the stubs to the remote modules. But the methods exposed by the _Common Delegates_ modules use the same Request and Response classes that are defined in the called modules. This means that this module does not act as a layer of decoupling. In some cases this module created problems of circular dependencies during maven builds. Is it a good thing to split the _Common Delegates_ module into many different Maven artifacts to avoid circular dependencies, one for the called module? For example if I need to call via RMI the module A, I will have to use the _Module A delegate_. Is it a good thing to make this delegates to be also a decoupling layer, meaning that they will expose their own Request and Response beans and transform them into the beans used by the called methods?


Static functions vs classes

Let's say that I want to build some utility functions to do some basic maths with de `BigDecimal`s, for example I want to have a function that computes the average of a `List<BigDecimal>`. What is the best approach? A static function or a utility class?               public static BigDecimal computeAverage(List<BigDecimal> numbers)      or               public class BigDecimalUtil          public computeAverage(List<BigDecimal> numbers)


Prerequisite math skill for Introduction to Algorithms (CLRS) book

I already have knowledge about basic algorithms. Now I plan to study more advance algorithms and I decide to go with Introduction to Algorithms. I'm not sure, do I need to refresh my math's skill before read this book or not? (I forget almost math that I learn in high school and college) If this book need strong math knowledge, please suggest subjects that benefit. **Update**   **P.S.** I want to learn about implementation, design and analysis of algorithms.


Does any well-known license require to make modifications available when only derived *output* is published?

Is there a way to make sure that modifications to free software are released even when no binaries of modified code are _conveyed_? Though it may sound odd and from what I understand, e.g., GPL requires to distribute source only if binary is _conveyed_ to other parties thus making it possible for unlimited private use as it does not fall into _propagation_. I would like to make sure that if someone publishes a final finding in a scientific literature derived with the aim of a modified code, then those modifications are made available. Does any well-known license have these provisions? If not, why would it be bad? From what I understand if I add those provisions explicitly, it would limit the freedom, e.g., rendering result non-GPLish. From one of the answers that disappeared, I guess I can add an _Additional Term_ but would not it be a _further restriction_ that can be simply ignored > If the Program as you received it, or any part of it, contains a notice > stating that it is governed by this License along with a term that is a > further restriction, you may remove that term. From what I understand it looks like it depends on how I state it. If I require to make private modification used to derived a result that was published to make available, then it would be okay, otherwise it would be a _further restriction_ if I prohibit from privately using and not making modified code available. **Example** _A_ implements a super duper algorithm but they is bad with BLAS and it takes a long time for the simulation. _B_ claims that they refined the code using CUDA or whatever and can easily get results within second. Based on their work they found this and that from simulations and got it published. And that is it. No GPL violation and no better code for community. **Another example** Imagine if some animation studio took Blender, implemented an improved version of Cycles that allows them to render things way faster and with less problems. So now they have an advantage as they can deliver animations to clients faster. No software conveyance, no GPL violation, no improvements sharing.


Labeling algorithm for points

I need an algorithm to place horizontal text labels for multiple series of points on the screen (basically I need to show timestamps and other information for a history of moving objects on a map; in general there are multiple data points per object). The text labels should appear close to their points--above, below, or on the right side--but should not overlap other points or text labels. Does anyone know an algorithm/heuristic for this?


Alternatives to time tracking methodologies

**Question first:** What are some feasible alternatives to time tracking for employees in a web/software development company, and why are they better options **Explanation:** I work at a company where we work like this. Everybody is paid salary. We have 3 types of work, Contract, Adhoc and Internal (Non billable). Adhoc is just small changes that take a few hours and we just bill the client at the end of the month. Contracts are signed and we have this big long process, the usual. We figure out how much to charge by getting an estimation of the time involved (From the design and the developers), multiplying it by our hourly rate and that's it. So say we estimate 50 hours for a website. We have time tracking software and have to record the time in 15 we spend on it (7:00 to 7:15 for example), the project name, and give it some comments. Now if we go over the 50 hours, we are both losing money and are inefficient. **Now** that I've explained how the system works, my question is how else can it be done if a better method exists (Which I'm sure one must). Nobody here likes the current system, we just can't find an alternative. I'd be more than willing to work after hours longer hours on a project to get it done in time, but I'm much inclined to do so with the current system. I'd love to be able to sum up (Or link) to this post for my manager to show them why we should use abc system instead of this system.


What does C++ do better than D?

I have recently been learning D and am starting to get some sort of familiarity with the language. I know what it offers, I don't yet know how to use everything, and I don't know much about D idioms and so on, but I am learning. I like D. It is a nice language, being, in some sort of ways, a _huge_ update to C, and done nicely. None of the features seem that "bolted on", but actually quite well thought-out and well-designed. You will often hear that D is what C++ _should_ have been (I leave the question whether or not that is true to each and everyone to decide themselves in order to avoid unnecessary flame wars). I have also heard from several C++ programmers that they enjoy D much more than C++. Myself, while I know C, I can not say that I know C++. I would like to hear from someone knowing both C++ and D if they think there is something that C++ does better than D _as a language_ (meaning not the usual "it has more third- party libraries" or "there are more resources" or "more jobs requiring C++ than D exists"). D was designed by some very skilled C++ programmers (Walter Bright and Andrei Alexandrescu, with the help of the D community) to fix many of the issues that C++ had, but was there something that actually didn't get better after all? Something he missed? Something you think wasn't a better solution? Also, note that I am talking about D 2.0, not D 1.0.


How can you prove an acyclic graph has n-1 edges?

I'm not so hot on the maths for this but for what I understand... A graph g exists with v vertices and edges. g = (V,E); The spanning graph for this is an acyclic copy of this where all the vertices are present, and all the edges are a subset of the graph with the condition that each connection is distinct. Apparently the MST should have n-1 nodes. How can this be proven ? **Sources:** http://youtu.be/zFbq8vOZ_0k?t=25m1s http://www.gtkesh.com/minimum-spanning-tree/


How to handle many arguments in an API wrapper?

I'm writing a PHP API wrapper for a third party API. I want to make all the methods consistent, but I'm not sure how to handle the number of arguments some API routes accept. One API request accepts up to 30 arguments. Obviously, it would be unwieldy to list each argument as a parameter on the method. Currently, I'm writing it to accept the required arguments as method paramaters, while all the optional ones are accepted in a final "additionalOptions" array.               public function sampleApiMethod($reqVal1, $reqVal2, $additionalOptions) {         //Method Code     }      Unfortunately, there are API requests that have only optional arguments. In this case, either the only parameter is the array of options, or the method has individual parameters for optional arguments. When only passing an array, the method is consistent with the other methods, but it's not the most intuitive. With the latter option, I lose the consistent structure. Is there any sort of best practice or structure for an API wrapper that I should follow to try to have a consistent developer usage experience?


Best strategy in SQL

Recently, a colleague told me that it wasn't advisable to make conditions in the **join clauses**. Instead he suggested to make conditions in the **where clause**. He told me that the SQL engine was optimized for this way. Here is a simple example to illustrate my question. In this case, I think it would make any difference. What strategy is the best? And why? Assume we have a parameter nammed `@user_id`. ## First strategy               SELECT      role.name     FROM        user_role     INNER JOIN  user ON user_role.user_id = user.id AND                         user_role.user_id = @user_id     INNER JOIN  role ON user_role.role_id = role.id      ## Second strategy               SELECT      role.name     FROM        user_role     INNER JOIN  user ON user_role.user_id = user.id     INNER JOIN  role ON user_role.role_id = role.id     WHERE       user.id = @user_id


Who should determine team size?

Developers, managers, or customers? I was recently involved in a situation where I felt like the customers were arbitrarily demanding for more developers on a team which already had too many developers. They were scared the project was going to be late (and it probably will be). Personally, I was scared we were going to fulfill Brook's Law. The group of programmers already lacked in-depth business knowledge, and some were even new to the technology (.NET), yet the customer wanted to add more developers who had even **less** business knowledge. The impression was that this would make the project get done quicker. I started wondering if the customer, who is extremely bright, but presumably knows little about IT project management, should really be the one determining team size.


How can I ensure our SolidWorks files are covered by the GPLv3?

I am in charge of a project on github that has files that are and are not code based. Specifically, I am worried about our SolidWorks files. How do I ensure these files are covered by the GPLv3 license?


Handling ground-breaking changes in a production system - Insert intermediate level Management object

As our client request, we are proceeding to change the base of our system. We already have the following structure: > A class has many students. (simple typical one - to - many) Now we must change it to: > A class has many groups. Each group has many students. (Intermediate Object > "Group" is inserted). That seems to be a "simple" change, but it breaks all of the management interface, from both mobile client to web views. And in database structure also. Our system is a data-management program where we have about 50 - 60 domain objects which are parts of a hierarchy model of around 5 levels. And the intermediate object is inserted in around the 2nd-stage. My question includes 2 aspects: 1) How to estimate the efforts needed. I'm making a new code branch, then insert the new domain object, after that break the relation of the class- student to insert the new "group" in. Then look in the error-report of Eclipse to locate the troubled code. However, it makes the whole project red, and I'm having troubles giving accurate time-estimation for the task. 2) How to avoid/prevent this situation to happen in the future. It happens once before, and at that time I have spent a week to write database conversion script, as well as making the changes. But at that time the system is still small. Now it has grown big.


Learning to program on punchcards

I'd like to try programming with punch cards once in my life. How can I do this? I'm in my 30s, and grew up entirely in the PC era, programming on computers with screens and keyboards. I want to experience the way my father and grandfather used to work. I imagine the hardware (and probably the cards themselves) are no longer manufactured. Are there any universities or museums with functioning punch card readers anymore? I'm in Boston, but I'm willing to travel to do this. I asked MetaFilter, and I got some mixed answers (along with a lot of "no, don't do this" nay-saying). I did get a pointer to the Retro-Computing Society Of Rhode Island, but I haven't received a response to my email to them yet.


Addition vs multiplication on algorithm performance

I am studying about optimizing alogrithms.(Prof. Skiena's Algorithm Guide book) One of the exercises asks us to optimize an algorithm:               Suppose the following algorithm is used to evaluate the polynomial     p(x) = a^(xn) + a^n−1(xn−1) + . . . + a(x) + a     p := a0;     xpower := 1;     for i := 1 to n do     xpower := x ∗ xpower;     p := p + ai ∗ xpower     end      (Here xn, xn-1... are the names given to distinct constants.) After giving this some thought, the only way I found to possibly improve that algorithm is as follows               p := a0;     xpower := 1;     for i := 1 to n do       xpower := x ∗ xpower;          for j := 1 to ai              p := p + xpower          next j     next i     end      With this solution I have converted the second multiplication to addition in a for loop. My questions:   1. Do you find any other way to optimize this algorithm?   2. _Is the alternative I have suggested better than the original?_ (Edit: As suggested in the comments, this question though related to the problem deserves another question of its own. Please ignore.)


Re-engineering an ASP.NET AJAX project as ASP MVC

I have been asked to investigate the possibility of re-engineering an existing ASP.NET AJAX Web Application as under MVC. The project, as it stands ATM, is very heavily relient on Telerik's ASP.NET AJAX controls. I've yet to have to opportunity to interview the person responsible for this request, so I'm unsure of the drivers for this, but I believe that as well as looking for a more structured solution (the original was developed in a very organic way) I believe that one of the goals is to _also_ get a lot of the code running client-side and to use a structured form for the development there also. So, My question is, is there a defined set of considerations for something like this? Or, if people do this kind of thing at all, do they just wing it?


Is it a good idea to include Installer Project within single solution?

I have pretty large code base for the client product I am working on. I am using Visual Studio 2010 for my development and it's hectically slow. I can get rid off this by disabling the installer project within the solution file.   * Is it a good idea to include setup projects within the same solution?    * How can I increase the performance of Visual Studio when working with large projects (including installer?)   * How about a different build configuration separately for installer? Will that help?


Licensing for a commercial Blackberry app

I want to develop an app for a website (let's say stackoverflow.com in this case). Will I violate the Blackberry terms of service if I list an (paid) app for a website which I do not own? What about the website I'm going to use?


Writing Clean, Elegant Procedural Code (BASIC): Is There Such a Thing?

I learned to code in OO languages. I've always been interested in design patterns, clean code, etc., etc. - you know the type. Now at work I'm using a BASIC dialect. Given modern programming values, should we try to carry over these same principles to new procedural code? I'm pondering the following issues, and I wondering if I'm on the right lines. * * * **Variable Names** Variables are not strongly typed (nightmare!), they're given short names and written in ALL CAPS (why?!) - basically I find them hard to read and they could be _anything_. Once upon a time, I'm sure `XCNT = 1` would have offered performance gains over `int_EXISTINGCUSTOMERCOUNT = 1`, but we're past that now - surely? I choose the verbose name here. **GOSUB** I want to break down long blocks of code down into multiple smaller blocks. Internally, `GOSUB` is used (over a `FUNCTION`) if the helper is not re-usable by other programs / functions. Given its ability to add / modify variables without the safety of scoping (as we know it in the OO world) `GOSUB` scares me. This is typical:               GOSUB GET_BEST_CUSTOMER     IF RC = 0 THEN CRT CNAME      But I would write:               rc_GETBESTCUSTOMER = 1 ; !Default exception     str_CUSTOMERNAME = ""     GOSUB GET_BEST_CUSTOMER ; !set rc_GETBESTCUSTOMER, populate str_CUSTOMERNAME     IF(rc_GETBESTCUSTOMER = 0) THEN         CRT str_CUSTOMERNAME     END      With the caveat that `GET_BEST_CUSTOMER` would only modify `rc_GETBESTCUSTOMER` and `str_CUSTOMERNAME` in 'global' scope. * * * There's more, but it's all along the same lines. Given the editor of choice (Notepad++), I'd say my coding style makes the code easier to read and understand - therefore easier to maintain. But I'm sure some BASIC die-hard would readily tell me I'm doing it all wrong.


How do I alter my solution / project when the spec changes

I have a question about the best practice in this situation. At one point, my small application allowed the client to upload a file to a server, and download a file from the server (it would also compress / decompress as well). This was created in 1 solution which consisted of 4 projects:   1. FTP   2. CompressDecompress   3. UI   4. Tests Now, the spec has changed and there will 2 end users, one who only wants to upload, the other who only wants to download and they should never have access to anything else (ie downloading people cannot upload and vice versa). So, I have a few choices here. I could either   1. Keep it as 1 solution, and ask users to login, based upon the credentials will display a different UI    2. Alter my UI so it only shows tools to download, create a new solution which consists of just a UI project and reference my .dll accordingly.   3. Delete my UI, create 2 new solutions, each solution being created for either download or upload (and each solution probably only consisting of just 1 project, the UI) and again, referencing the .dll Does any one have any suggestions? Would any guidelines have allowed me to have not gotten into this situation in the first place (or at least made me more aware of the potential disasters)?


Bringing my genius brain back

Well... I was hired because I did not take a comp-sci or engineering course, however I was really good at coding. My job is doing the heterodox stuff when needed... You know, the guy that sometimes has to use a goto, or invent some bizarre technology. When I started my job, I blasted though stuff I needed to do, then I got slower and slower until I almost got fired. Now I am more or less stable, but I am noticing I am slowing down again. I plainly open my source code, look at it, and have no idea what I have to do, sometimes I do not know even what I was doing. I think this is related to my lifestyle. My work is a two hour commute (meaning I lose 4 hours daily), and I have not completed university yet (so I need to do some university work at home), and on weekends I spend time with my significant other. Does anyone know what to do in a situation like this? I am depressed that I cannot write code like I could when I started, or when someone would throw some oddball problem at me and I would spit out a solution instantly. Now I am having trouble typing even 10 lines of code in a day, because I spend the entire day trying to figure what to do. In fact, I can't even procrastinate when I **want** to procrastinate, I open the browser, and I have no idea of what web page to open. It is really annoying :( I feel like my IQ dropped from its measured levels to something like 80...


How do you do ASP.Net performance testing?

Our team is in need of a performance testing process. We use ASP.Net (both web forms and MVC) and performance testing is not currently built into our projects. We occasionally do some ad-hoc analysis, such as checking the load on the server or SQL Server Profiler, but we don't have a true beginning to end, built into the project performance testing methodology. Where is a good place to start? I'm interested in both:   1. Process - General knowledge, including best practices.   2. Essential list of tools. I'm aware of a few tools, such as what's built into the pricier versions of VS 2010 and JetBrains products, though I haven't used them.


What is a domain of automatic testing tools such as ScalaCheck?

I've seen not so many examples of testing with automatic tools, i.e. serializing/deserializing of JSON (which was paired in the following way: `val actual = deserialize(serialize(string))`), checking that appending symbols to string was done properly (and that's imho silly, cause it extremely hard to made a mistake in such plain operations). Can you provide really useful examples/use cases for automatic testing with ScalaCheck that will unveil it advantages? Does it meant to be used mostly in paired style (straight/inverse functions like in JSON example above)?


At a higher level description, how is DLMALLOC supposed work?

There doesn't seem to be that many good descriptions that go into the specifics about how dlmalloc works. The sources I have come across so far _mention_ dlmalloc, but then only goes on to explain what malloc() and free() are, rather than describing dlmalloc. The Wikipedia description, on the other hand, was a bit hard for me to understand. http://en.wikipedia.org/wiki/Malloc#dlmalloc_and_its_derivatives Can anyone explain the workings of dlmalloc, how to implement it, and any additional sources that could help?


Is it worth becoming a programmer?

I'm a first year student in CS and I absolutely love programming. Many people have told me it isn't so good once you start working due to bringing your work home (thinking about how to solve problems throughout the day), working many hours when the deadline is near, and so on. I've heard being a system administrator is a less stressful job, since you don't have to worry about it at home. So my questions are (for experienced programmers):   * Is it worth becoming a programmer?   * Does your job satisfy you enough to overcome these problems? Thanks in advance.


Besides the IDE, libraries, and language, what are the main differences between iOS and Android development?

I'm coming from the iOS side. I'm particularly interested in knowing if there are similar hurdles on the Android side on these points:   * developer fee -- do you have to pay $99 a year to build for android?   * provisioning devices - do you have to go through a complex provisioning/digital certificate/device-id routine to get the app you're developing on a device for testing?   * marketplace distribution - do you have to go through an approval process to get your app to users?   * payment - is it easy to get paid for your app? What is Amazon's cut? Thanks. I know I could probably find these answers scattered on the web, but it would sure save me time to just hear from an experienced Android dev.


How can I "get in the know"?

My company posted a job listing to get me a helper. A recruiter called me today and all he kept saying was "MVC this Entity Framework that..." - He sounded shocked when I said the project uses DataSets and Linq2Sql over WinForms and ASP.NET WebForms. Then I was looking at options for automated website testing and I come upon this here: and I began to get agitated. > Most folks "in the know" are using presentation layers to make ASP.NET so > thin that a tool like NUnitAsp isn't helpful. This person is in the know, and his friends are apparently in the know. I want to be in the know too, because being out of the know makes me feel insecure and a little sad. In my efforts this past year to get with the times, I realized great benefits from Linq2Sql and the Unity container. They both were nothing but good for me - filling gaps that have been apparent to me for ages. Then I moved on to Model-View-Preseneter for WinForms GUIs and was again very happy with it for the same reason - I had been asking myself for a long time how to separate things out so that I could have a thick client and a web client share their common logic in a common code base. Yet, I am stuggling with the following. And I know a zillion people can't be wrong and I'm not smarter than the masses, but I need help to see:   * MVC as the evolution of WebForms   * WPF as the evolution of WinForms   * Entity Framework as the evolution of Linq2Sql (and, for that matter   the deprecation of Datasets) (I suspect it all stems from my, to date, lack of obtaining Test Fahrvergnügen) Thus, I have been asking myself, and not hearing an answer to:   * What do I gain using MVC in a web application? I know I gain additional source code artifacts and a new DSL to learn. What else?   * What would happen if I used WPF objects without the MVVM pattern? Would I be hurting my chances to get a job somewhere else?   * For that matter, is WinForms really broken? Is it me or does Visual Studio have noticable visual lag on my dual core 2.8 GHZ machine with 8 Gigs of RAM? I like snappy. I want end users to experience snappy all the time without fail.   * Why are Datasets "the old way"? They seem quick efficient and succinct for many small to medium sized problems I have to solve (yet they are not even in Silverlight). I feel like big pile of complexity is on the plate and spreading it around won't make it go away. The intrinsic amount of complexity needs to be confronted head on, and maybe software engineering should become more like electrical engineering or mechanical engineering, or brain surgery.


Level of detail of a user story

I am about to start User story sessions in my team. It's quite new for them and I am also wrestling with certain things. For the current project we have some well worked out wireframes. I read a lot about the way of writing user stories. What the template should be like and about different aids like Invest The plan is to turn them around in user stories. Lets say I have a screen where a user could edit an order. There is a lot of detail on that screen. Now when creating a user story of this story. Will it suffice to say: > As an Admin I can edit a purchase order so that mistakes typed by the user > can be enhanced. Or should i specify each detail like: > As an Admin I can resend an invoice to the customer, so he can get a copy of > his lost one. > > As an Admin I can review the customer order so he has detailed information > about each purchase > > As an admin I can remove items forma on order so that in case the customer > made a mistake I can remove Items. * * * And how about the acceptance criteria. How should the be defined for a user story as such. Where do I define which fields need to be shown on an order detail page? Can this be part of the acceptance criteria?


Why can static methods only use static data?

I don't understand why a static method can't use non-static data. Can anybody explain what the problems are and why we can't do it?


github tools - is there a way not to copyright your app and stay its author

I am wondering... Recently I have observed github; I saw many Java projects' codes which don't have copyright at their headers... I mean, as I may guess, in this case the only thing which can prove the code author is - it is author's github account; So my question is... is it safe to protect open source code with github account only or there is a more optimal way to do so? Please share your experience; Thanks


Mobile PC Remote

If I buy a symbian(S60, nokia E51) mobile, and I want to write a program to control the PC(launch programs, control mouse/keyboard):   1. Is it possible to make a mobile app and a windows app which communicates via WiFi, or its easier/faster via bluetooth?   2. Which framework should I choose? (symbian/java)   3. (other info that I might need)


System Communication: Avoiding Including a Large "HAS-A" Hierarchy Which Isn't Used

The situation: **System A** Huge, complicated system. Uses an important Message object with many other Message objects attached, many of which have further Message objects attached. In total, this is about twenty different objects. Due to awkward timing with releases and introduction of code churn, System A cannot have its Message object hierarchy touched. **System B** Needs to use the same important Message object to communicate with System A to make use of one of its services. However, since the messages it will send off are going to be invariable, it only uses a very small portion of the Message object hierarchy. The Question: How could I allow System B to make use of the important Message object without (a) touching System A, or (b) including a hierarchy of nearly twenty objects, almost none of which are used at all? Is there a more advanced Design Pattern which could be put to use in this scenario?


how and should I 'unit test' an entire package?

I'm still learning to be good about doing _unit_ level testing, as I've always been a little sloppy about only doing functional testing in the past, so I want to double check I'm doing this 'right'. I have a package which is responsible for auto-magically updating a particular configuration which is expected to change regularly during runtime. Provide a list of objects to monitor to the constructor of my main package class. Then at some point call update it will go to all the multiple places that define configuration, detect change, update the appropriate state for the objects it's monitoring, and provide a report of what was changed. This is all automatic and otherwise transparent to all other packages. My inclination is to test this as a unit, but it is a pretty 'big' unit, 5-6 classes and fetching from multiple files and a restful interface. It feels like testing any smaller units would take much longer, be less flexible to refactoring and only provide a slightly higher chance of detecting a defect, but that could just be my laziness talking. Would it be considered 'better' to test at a lower level? Assuming it is 'right' to test the package as a unit what is considered appropriate for mocking something like this? There are methods of classes which are instantiated by my main class (ie, not something I pass in directly so I can't just pass my own mock) that have methods I want to control. I believe I can use powerMock in the two cases I can think of (or could, after I research PowerMock some more), but I'm not sure if doing so is transparent enough. Is configuring PowerMock to detect and return a mock file object any time my package tries to open a configuration file, even if it's buried deep in my package logic, acceptable, or is this considered to be abusing my knowledge of implementation specific details? Would it be 'cleaner' to actually modify configuration files on the file system and let them be read normally without further mocking? I would need to modify the files regularly for testing... Edit: To clarify the question of coupling asked in one of the questions, I don't think that my classes are overly coupled. Effectively I have three classes that fetch state from A, B, and C, and then a 'main' class which takes the state from the three and decides how to combine it correctly (ie, if A and B don't match use A unless C). I could easily test A B and C separately and then mock them to test my 'main' class. However, it seems like the testing of my 'main' class would effectively test the comparatively simple interfaces for A, B, and C anyways if I didn't mock them. Thus it feels like duplicate work to test them individually. I may get some slightly better code coverage, maybe, with individual testing, and it's always nice to have one test test only one thing. But I don't know if it's worth all the overhead for minor benefits.


How do you manage minor changes that you want to keep local in mercurial?

I'm considering migrating a 14 year old cvs repository (history intact) to mercurial. I think I've got all the technical conversion bits down, but I still have some questions about working effectively in mercurial. One of the things I see a lot in individual developers' cvs sandboxes (including my own) is local uncommitted changes that aren't ready to be pushed to the mainline. My understanding is that this is a bad thing. Most of my experiments with hg suggest that uncommitted changes are a bad thing to have. The inability to merge with them is enough for that. So what I want to know is how other people who use mercurial in day to day coding deal with it. How do you deal with incomplete changes to code when it comes time to update your repository? How do you deal with local changes that you don't (yet) want to share with other developers?


How to port this architecture to .net?

My team is currently locked into using a tool we dislike that takes the form of a Eclipse plugin and a .jar; the plugin gives us a button to quickly run a single file's code (via invoking the main .jar and passing to it the current file). We want to move to C#.net. Is there any way to get Visual Studio to replicate this behavior? Obviously we could put each runnable class into its own project in our solution, but that requires checking a lot of project files into source control. Ideally we'd have a main() method in each file and could tell visual studio to run just that file for development purposes, while the finished software would be run from a single entry point using command-line parameters. (I don't want to give too much information here regarding the purpose of the software, so please just accept that the current setup makes a lot of sense for what we're doing and changing it too much would be rejected by management.)


How to disseminate Scala?

With the announcement of Ceylon, and after observing the slides describing its intent and feature list, I reckoned this language to be a Scala competitor. Furthermore, as a Scala programmer, I can see several points (as depicted in here) that state that Scala goes further in providing a quantum leap over Java, that is interoperable nevertheless. However, this language may be a symptom of failed comprehension over Scala features and/or lack of knowledge of the language itself, which may not be only their fault. Many great ideas have failed due to bad/insufficient marketing. Beta was, in some aspects, better than VHS but it lost its marketshare because of marketing. So my question is: Are we doing enough to explain/disseminate/evolve Scala? How can Scala professionals/enthusiasts propel the language forward in terms of acknowledge from their colleagues (i.e. Marketing)? How can we make natural selection work and prevent it from failing? Are sponsorships the way to go? Should there be already prepared presentations (e.g. like jrebel has on its page) to ease propagation?