title: What's a RESTful url for a linked item?

text: This is going to be a web service that returns a JSON object. Currently, I'm using C# technology and simply using ASP.Net MVC to create the calls. This is not a web page, so SEO is not a concern. I've come across a number of instances where I want to get the "next" or "previous" item in a list. For example, I've got a service that returns a featured photo. http://myservice.com/photos/123 which returns a JSON               {"name": "At_The_Concert", "id": "123", "src": "http://myservice.com/photostore/123.jpg"}      The client (Ajax, Mobile device, etc.) of this service wants to know what the “next” item is going to be. I’m struggling about what the url should be.   * http://myservice.com/photos/123/next   * http://myservice.com/photos/next/123   * http://myservice.com/nextphotos/123 or maybe the id property should just be a parameter http://myservice.com/photos/next?photoId=123 Or maybe this is entirely wrong and it should be like http://myservice.com/photos/?method=getNextPhoto&photoId=123 though with .Net's routing, it might be easier to write it as http://myservice.com/photos/method/getNextPhoto?photoId=123 I’m relatively new to web services and REST. I get the basic CRUD for REST, but I don’t know what is the best practice for creating more custom urls, in this case the “next” photo. Is there an accepted RESTful practice?


title: Leaving "Else" comments

text: Let's say I have a not-so-intuitive `if` statement in my code, but only if you're new to the codebase:               def set_markets(markets=None):         """         Will accept 'all' as markets to set all markets on.         For individual markets, pass in a list of ints.         """         if markets:             if type(markets) == list:                 markets = ','.join(map(str, markets))             self._set_markets(markets)      For those of you wondering: The existing system I'm interacting with (a database) expects a list of integers from the front end interface. This code does it from the backend, so a list of ints was chosen since it best represents what a user might feed in otherwise. The `markets` stuff is handed down from another class, so even though it appears like it's taking place over 5 lines, it's more like ~50 lines. My question is, would you consider this more readable? Why or why not?               def set_markets(markets=None):         """         Will accept 'all' as markets to set all markets on.         For individual markets, pass in a list of ints.         """         if markets:             if type(markets) == list:                 markets = ','.join(map(str, markets))           # else:               # markets are set to "all"             self._set_markets(markets)      EDIT: This code looks worse than it is because I left off a detail: if `None` is fed in for `markets` (the default parameter), then it will not modify the markets settings the database. Here's what I have now:                   if markets is not None:             if isinstance(markets, list):                 markets = ','.join(map(str, markets))             else:                 markets = 'all'             self._set_new_header_markets(markets)


title: Optimizing code generation for expressions in a compiler

text: I don't know if this question has a simple answer or not, but I just have to ask. I'm reading this tutorial (I don't know if this is a well-known series, but it's name is 'Let's build a compiler!' by Jack Crenshaw). It's a nice series where you gradually learn how to construct a compiler (it is a learn-by-doing thing, really). In the second chapter already, I felt the need to optimize some things. In the series, some concessions are made, in order to keep things simple: there is no difference between lexical scanner (although I believe it is introduced later in the series) and the code generation: they are done in one go. Also, the author heavily relies on the stack to create the code to handle expressions. (Also, the output is assembly code, I don't know if this is normal for compilers, so I just thought I'd mention it...) For example, parsing the expression 5 + (7 * 3 - 21 / 3) (and storing the result in eax) results roughly in the following code (I use x86 asm, as opposed to the series, so this is the assembly code my compiler gave):                   push 5   ; These lines is generated by a simple number parser         push 7   ; This parser pushes its result to the stack         push 3   ; (like most other parsing functions)              pop eax  ; Code for multiplication         pop ebx         mul ebx         push eax              push 21  ; Result of parsing these numbers         push 3              pop ebx  ;  Division code         pop eax         div ebx         push eax              pop ebx  ; Subtraction code         pop eax         sub eax, ebx         push eax              pop eax  ; Addition code         pop ebx         add eax, ebx         push eax      As you can see, the code for handling the addition, subtraction, multiplication, etc. can stay the same each time the operation is used. This is very convenient, but of course, the assembly code generated is very slow and esoteric. When writing by hand, one would rather write something like:                   mov eax, 21         div 3         mov ebx, eax         mov eax, 7         mul 3         sub eax, ebx         add 5      My question is if there is any way to optimize the compiler output. Of course there is, but is there any specific way to make my code more like the second, ie: not using the stack so intensively, but instead relying on registers to pass values. I myself have been thinking about parsing the whole expression and representing it internally as a tree-like structure (I supposethis is the kind of thing a lexical parser does) before generating the code, but I'm not entirely sure how to proceed. On the other hand, there is peephole optimization and the possibility to optimize the assembler code after it has been generated, but I have no idea how effective this will be. Generating better code in the first place seems logical and more feasible to me. I know there are many techniques available to optimize my code (for example, constant folding, which would reduce the whole expression to 19. I have deliberately not used this kind of optimization to bring my point across better), I am hoping for a single technique that is well-suited for this kind of stuff.


title: Greenfield vs. brownfield revenue? (attempting to get an idea of measure of effort expended on the two)

text: The big question I have in my mind: how many developers are brownfield ("enterprise") compared to greenfield (all new code, from the ground up). I'm constantly reading breathless articles about the latest technology, only to find out that It Just Won't Work On Our Enterprise Software codebase. People aren't ready for automated testing (because the logic is in the click- handlers and/or database). People aren't ready for ORM tools because we have horrendous amount of logic in stored procs and triggers. People aren't ready for WPF because our existing stuff is all WinForms. We can't get the latest version of Reactive Extensions because existing code used RX 1.0 and there are breaking changes that will require more testing effort than is justified by the return. Etc., etc., etc. Very few articles seem to be oriented toward the brownfield developer, for whatever reason (can't sell ads for articles that start off with "you probably can't use this, but..."?). So, I'm truly wondering: is the software development industry just chock full of greenfield developers, developing new projects for clients which are then released and enjoy a short existence until complete replacement for whatever reason? Or are there hordes of brownfield programmers silently laboring away in the ADO.NET T/SQL VB.NET software mines, looking wistfully up at the sunshine of Entity Framework 5.0 and Haskell, et cetera? How do we even measure that? Salaries (wages??) paid to software engineers* in the two categories? How do we measure THAT? Maybe... revenue generated from selling said software? (There's an assumption that the crappy old software sold by XYZ Corp. actually has maintainers). **My question: Does anybody have any numbers that speaks to how much of the industry is green field vs. brown field?**


title: Is there a proven concept to website reverse certificate authentication?

text: We're looking at exposing some of our internal application data externally via a website. The actual details of the website aren't that interesting, it'll be built using ASP.NET/IIS etc, that might be relevant. With this, I'm essentially I'm looking for a mechanism to authenticate users viewing my website. This sounds trivial, a username/password is typically fine, but I want more. Now I've read plenty about SSL/x.509 to realise that the CA determines that we're alright, and that the user can trust us. But I want to trust the user, I want the _user_ to be rejected if _they_ don't have the correct credentials. I've seen a system for online banking whereby the bank issues a certificate which gets installed on the users' computer (it was actually smartcard based). If the website can't discover/utilise the key-pair then you are immediately rejected! This is brutal, but necessary. Is there a mechanism where I can do the following:   1. Generate a certificate for a user   2. Issue the certificate for them to install, it can be installed on > 1 machine   3. If their certificate is not accessible, they are denied all access   4. A standard username/password scheme is then used after that   5. SSL employed using their certificate once they're "in" This really must already exist, please point me in the right direction! Thanks for your help :)


title: Using MS-PL licensed library for internal company use

text: I want to use a MS-PL licensed library in a proprietary software, but it'll run inside my company, with no external distribution. Does the license allows this kind of usage or it constitutes a violation of the license?


title: Suggestion for setting web application parameters

text: I'm creating a web application on GWT. I'm using MVP pattern with activities and places. I have a xml config file containing some parameters to be used by the application. Content of this xml file is sent to the client using HttpRequest; I'm using a singleton class to hold the information from the xml file. Right now, the application is getting the data when the user starts the application in the home page, that is working well. Now, since I'm using activities and places, a user can bookmark a page and starts the application in any other page (Place). And here comes the problem: Since I'm using some of the information from the xml file to set some ui widgets, I have to check if the xml config file was read and the application already has the parameters (I do this by checking the singleton class). But the xml file is read by using an HttpRequest, so I got errors 'cause the application needs some parameters to initialize some ui widgets, but these parameters aren't ready on time. I was thinking on using an synchronous request to fix the problem, but it seems complicated and not recommendable to do that. So, I'd like to hear some other suggestions. Thanks.


title: Better control on code updates

text: I will briefly explain my situation. I have a website in PHP, this website is powered by a custom framework + some "plug-in" made ad hoc for it. I am the only developer of this. Until now I just test locally any changes than I upload the php files via FTP. I don't feel confortable anymore with this. The code base has grown quite a lot and I need some sort of system that helps to keep track of changes (line by line) and can restore to an old version easly if something goes wrong. Are there any good solution for this? Note: I never used something like version control or subversion because I think they are too much for this situation (I am the only developer and I just need basic feature) Note2: Something with a nice web interface would be perfect, I can pay for a good service too As now I found:   * http://beanstalkapp.com/   * http://github.com/   * http://www.codespaces.com/   * http://codesion.com/   * https://bitbucket.org/


title: Why design pattern is not named as implementation pattern?

text: I find that most of the design patterns are concerned with implementation of a model like mvc, or how to change the implementation with less cost. These are all happened in the implementation phase of a software. So why not call them implementation patterns?


title: exact answer for “what is j2ee?” - job interview

text: I'd like to ask if someone of you knows the exact meaning of JEE. That's because a collegue of mine was asked this question in a job interview, and was "unable to answer properly"... to speak with his interwiewer's words. And when he told me what he said to his interviewer I got really surprised, since it was more or less what I would have answered myself - in a concise form, the first paragraph of this article. > J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for > the mainframe-scale computing typical of large enterprises. Sun Microsystems > (together with industry partners such as IBM) designed J2EE to simplify > application development in a thin client tiered environment. J2EE simplifies > application development and decreases the need for programming and > programmer training by creating standardized, reusable modular components > and by enabling the tier to handle many aspects of programming > automatically. That seems not to be enough, since the interviewer asked for "more precise and less general definition". Is there really a more precise definition for JEE? Or did my colleague just find the fussiest-interviewer-ever? :)


title: How can I unit test a class which requires a web service call?

text: I'm trying to test a class which calls some Hadoop web services. The code is pretty much of the form:               method() {         ...use Jersey client to create WebResource...         ...make request...         ...do something with response...     }      e.g. there is a create directory method, a create folder method etc. Given that the code is dealing with an external web service that I don't have control over, how can I unit test this? I could try and mock the web service client/responses but that breaks the guideline I've seen a lot recently: "Don't mock objects you don't own". I could set up a dummy web service implementation - would that still constitute a "unit test" or would it then be an integration test? Is it just not possible to unit test at this low a level - how would a TDD practitioner go about this?


title: Question about a simple design problem

text: At work I stumbled uppon a method. It made a query, and returned a String based on the result of the query, such as de ID of a customer. If the query didn't return a single customer, it'd return a null. Otherwise, it'd return a String with the ID's of them. It looked like this:               String error = getOwners();     if (error != null) {         throw new Exception("Can't delete, the flat is owned by: " + error);     }     ...      Ignoring the fact that getCustomers() returns a null when it should instead return an empty String, two things are happening here. It checks if the flat is owned by someone, and then returns them.   I think a more readable logic would be to do this:               if (isOwned) {         throw new Exception("Can't delete, the flat is owned by: " + getOwners());     }     ...      The problem is that the first way does with one query what I do with two queries to the database.   What would be a good solution involving good design and efficiency for this?


title: Do I need a database to implement AJAX functionality for my app?

text: I am new to the construction and design of a web app so I'd like some advice please (Django is my framework). I'm trying to code up a "how-to" website instructing users the step-by-step process for doing a certain task. I'd like the navigation of the website to be something like this... http://technet.microsoft.com/en-us/library/aa991542.aspx ...in which there is a tree-like navigation on the left-pane that lists each step (e.g. Step 1, Step 2, etc...) that expands and loads the instructions for each step into the right-pane. I don't want to reload the page each time so that leads me into AJAX. At this point, I'm not sure how to implement this. Do I store the HTML/CSS into a database to be pulled when the user clicks on certain links? Or do I write the HTML/CSS into my template files with `display: hidden` to be changed to `display: block` when corresponding links are clicked?


title: How to deal with the notion of time in UI/Integration tests

text: There are some well-known techniques for dealing with the notion of time in unit tests. These allow you to write unittests that always work with a specific time so the outcome of the test is predictable and can be verified. However, these techniques do not work with integration tests/UI test as the test and the application itself are separated (very much so in web applications where your application under test could be deployed on a separate server). For example, let's assume we are developing an appointment system that needs to implement a 'suggest the first available appointment date'-button. If the button is clicked, it needs to suggest the first available timeslot for the next business day. This means that if the button is clicked on any given day of the week except friday it should suggest a slot in the next day, BUT on friday and saturday it should suggest a slot on monday. How would one go about testing this requirement? _(I know it is possible to work around the issue for this specific example but bear with me - there are always situations where the test cannot supply the data to work from. I didn't want to supply an overly complicated example.)_


title: Cannot explain to the customer that he is taking the project wrong way

text: Being a junior developer in need of some money for new hardware, I have stumbled upon many of the freelancing websites, and really soon, I have gotten my first customer. Complete Project Management, CRM and simple accounting website for small business. As we have been discussing the terms, I have proposed GAE/Python/Bootstrap/NDB as that is something I am really familiar with, as I have been working on GAE projects for the past two years at my internship place. We discuss the pay, terms, non-disclosure and I offer my approach to the project (followed the path of what I learned closely). I propose working on the backend first in three phases:   * Company/User System + Project management    * CRM   * Analytic/Simple Accounting (intuit integration as he later added) I followed up with a 2 week period of the UI developing and testing. At first I have asked him, what are the functions you would like me to develop in all the three phases. His reply was that he doesn't have the time to prepare the document I asked him for, which I found ridiculous, and asked me to prepare one and he will edit it. Of course he never did edit. Okay, first sign of the client that doesn't have a clear picture of what he wants. He bought a template and asked when do we start testing. So I deployed the app with just PM and Company/User login after two weeks, only to be told he cannot test on anything that is not that template. I made a replica of the theme, literally, as we cannot use the stuff that the actual theme does have (fancy inbox, calendar etc) I told to myself whatever. The first approach I took was to create a base.html and base-nav.html and extend them in other templates, in order for the code and other stuff to be tested easily. I did made this via bootstrap. He repeated he cannot test on that. Now I am struggling with an html page that is 4 thousand line long I have to trim to create a base.html I will extend in other templates, with all the ridiculous amounts of static files that are completely unorganized in the template files and with a boss that wants to test. He doesn't even know what he wants to test. I have sent screenshots, deployed the app, chatted daily, but it just isn't enough to convince him we should be focusing on the backend instead of the frontend first. It's like building a car - first he wants to built the outside parts and limit the engine, instead of first building the engine then adjusting the outside to it. Do you have any tips on how to approach this and resolve it? template - http://www.keenthemes.com/preview/index.php?theme=metronic_admin


title: Generic repository unit testing best practice?

text: How can I unit test my generic repository? Unit testing code:               [TestClass]     public class UnitTestLanguage     {         private IUnityContainer _unityContainer;         private IUnitOfWork _uow;         private IGenericRepository<Language> _languageRepository;              [TestInitialize]         public void TestInitialize()         {             _unityContainer = new UnityContainer();             _uow = _unityContainer.Resolve<UnitOfWork>();             _languageRepository = _uow.GetRepository<Language>();         }              [TestCleanup]         public void TestCleanup()         {             _uow = null;             _unityContainer = null;             _languageRepository = null;         }                   [TestMethod]         public void TestMethodInsertLanguage()         {             var newLanguage = new Language { Name = "test_language" };             _languageRepository.Insert(newLanguage);             var insertedRowCount = _uow.SaveChanges();                  var insertedLanguage = _languageRepository.Find(newLanguage.Id);             _languageRepository.Delete(newLanguage);             var deletedRowCount = _uow.SaveChanges();                  Assert.AreEqual(insertedLanguage.Name, newLanguage.Name);             Assert.AreEqual(1, insertedRowCount);             Assert.AreEqual(1, deletedRowCount);         }     }      I use something like above. But I dont know this is the correct way to test repository. I cant find useful tutorial/article. How should be unit testing with generic repository CRUD operations?


title: Should a Parent with Children have a DefaultChild, or should a Child have a Default property?

text: Which of the following two models makes more sense? I'm leaning towards the first one because there can only be one default child. The examples are in C# but I think it can apply to other languages too. Here `DefaultChild` holds one of the items in `Children`.               class Parent     {         int ID { get; set; }              Child DefaultChild { get; set; }              IEnumerable<Child> Children { get; set; }     }          class Child     {         int ID { get; set; }     }      Here one of the items in `Children` has `Default` set to `true` while the others have it set to `false`.               class Parent     {         int ID { get; set; }              IEnumerable<Child> Children { get; set; }     }          class Child     {         int ID { get; set; }              bool Default { get; set; }     }      * * * A concrete situation: a `User` in our system has one or more `Customer`s attached. When logging in, if said `User` has a default `Customer`, they are immediately working under this `Customer`. If they don't, they have to select a `Customer` to work under. While logged in, they can switch between `Customer`s.


title: C# basic window content convention

text: I'm learning C# using visual studio express 2012, and I cannot find a source online that explains window content convention. What I mean by this is, what's the appropriate way to change the context / pass variables from the main window to different contexts? I've been able to change the content of my window by creating and editing new UserControl classes. As for parameter passing, I've experimented with having a static mainwindow with public fields and passing mainwindow field values through action functions (with little success). Is the appropriate way to handle changing the main window's context creating multiple usercontrol classes? If this is the case, should I be creating a tree with the main window as the root and the usercontrol classes as child elements? Most of the questions I find when searching for an answer revolve around forms or new windows, which lead me to question whether usercontrol is the correct item for changing context. If I'm missing a tutorial or simple explanation I apologize in advance :D


title: web spider for facebook

text: I just subscribed to a facebook page which post links to different open source projects or code archives. I'll like to save those links and descriptions to a local db. How can I do that? I heard something about the concept of web spiders and I know some php and java but I don't know how can I solve the problem from above. Thank you!


title: What's wrong with this approach to CSS?

text: I have a static Jekyll website. The website is constructed _once_ , on my computer, and then sent to the server in the form of plain HTML, image, and CSS files, to be served by a regular HTTP server. This construction process involves a template engine that has to glue various components together. For example, this is the template for my posts and pages (the only other template I have is for the main page, which shares quite a lot with this one):               <!DOCTYPE html>     <html>         <head>             {% include head.html %}             <link rel="stylesheet" href="/css/main.css">             {% if page.title == "Tautological Cascade" %}                 <title>Tautological Cascade</title>             {% else %}                 <title>Tautological Cascade: {{ page.title }}</title>             {% endif %}         </head>              <body>             <div class="site" >                 {% include header.html %}                 {{ content }}                 {% include footer.html %}             </div>         </body>     </html>      The most important part to notice here is the `body` section. It basically sandwiches a processed markdown file between two HTML files. Currently, I only have one, main CSS file, which is used by ALL pages. I find this approach a bit unpractical. Everything is defined in there, and it's getting messy. Couple that with my general ignorance of anything but the basic CSS, and you get something close to a nightmare. My idea is this: inline CSS for all of these parts that I glue together. So header.html would have its CSS in its file, footer.html would have its CSS, and the file that describes the content int its own. **Is this the correct solution to my problem? Is there something wrong with this approach?**


title: Is it bad practice to check object types with an identifying member variable?

text: **Preamble:** I am making a simple board game in C++, in which AI characters move around squares on the board. There are different types of squares, each inherited from an abstract class, each with different effects on the AI character. For example, some are shops where the character can buy stuff, others are workplaces where characters get money, etc. Likewise, there are different AI characters (also inherited from an abstract class), which make different kind of decisions. Some work more than others, some eat more than others, etc. The problem is that the AI character needs to know the square type in order to make a decision about what to do. At the moment checking the type using a type-name string as a member variable is the easiest solution, but it feels horribly inelegant and not very helpful when it comes to adding new types of squares and AI characters. **Question:** Is it bad practice to check the type of an object by asking it for an identifier which is placed into its class for this purpose? Is it bad practice to use other methods of run time type identification such as dynamic_cast and typeinfo for purposes of controlling the flow of execution? **Example:** Below the Square class (accessed through currentSquare() has a member function getType() which returns a string with the name of the type:               //Normal AI character     void decide() {         if(currentSquare()->getType()=="HOME") {             watchTV();             sleep();         }          if(currentSquare()->getType()=="WORKPLACE") {             work();         }      }          //Party animal AI     void decide() {         if(currentSquare()->getType()=="HOME") {             moveTo(getGameBoard()->closestBar());         }          if(currentSquare()->getType()=="WORKPLACE") {             sleep();         }      }


title: How much information about an error should be shown to the user?

text: Applications can always throw errors. If such an error occurs, the user should be notified, because what he asked the application to do has not succeeded. However, how much information should the user be given? I think most of us agree on not showing a stack trace (Should a stack trace be in the error message presented to the user?), but I can't find a question about the rest of the error contents or what to show to the user. For example, a language supporting exceptions (.net, java) has the exception type to share, where the exception occured, and a somewhat clarifying message to go along with the exception. Should this also be hidden from the user? Or should we show this anyway? Or should we show a generic message? or should we show one of a number of messages based on what the underlying exception is?


title: Advanced subversion techniques, what am I missing?

text: I started using SVN about 9 months ago and it's been a game changer to say the least. Although, I feel I'm still a bit lost. I feel like there is a lot more I need to take advantage of to really step up my application development. **For example** I would like to be able to quarantine any volatile/major changes into some kind of 'sub-repository' or something. I'm finding that major changes are impeding minor bug fixes that are quite urgent. How can I push one simple update without pushing incomplete or broken code?


title: Design Pattern For UI Control and Provider to Call Control's Events

text: I have a UI control that uses a provider class to implement the actual logic of a complex task. So the control delegates to the provider to do some work. But the provider needs to work with the control too; it needs to fire some events on the control. I was looking for a good design pattern of how the two could work together, but wasn't sure of any. I didn't want the provider to directly invoke events on the control. I thought about methods on the control that it could call, but I don't know that I quite like that either. Any ideas, thoughts? What is a good design pattern that the provider can use to fire a notification through the control? Each event may also need to pass custom parameters too.


title: How to tackle the outside party developement

text: Currently I'm working on a social networking project whose design is developed by the another company we are dealing with. We informed them that we need a task to be done on high priority to finish the project ASAP. We told them that what we need in the task and the party said, "What you do code or design?"? Is it their concern that I do design or code? When we have given them task, how can he ask a question that what I do? So I ask my boss what to do, and he said to tell him that "We need HTML and CSS". He the did the task. What exactly is this guy asking? I don't want to get into this kind of situation again. I want to handle these situations myself without talking to my boss. What am I missing here?


title: Make the lines hide (logically speaking) in applets

text: I am developing an application where I draw large number of lines (color is given as black) and update them where I need to remove them from screen. I thought of making their color to match with the background so that I can make them hide. It seems to be simple and works but in the practical sense I have 10000 points and almost more than 20000 lines to be drawn and as most the line overlap or cross each other it is so disgusting the view. So I need some kind of function to actually remove those selected lines between two known points from screen. Even I have a problem with the background color I can match the exact background default color of the applets. Can anyone suggest me solution or the color?


title: Helping a new programmer become more self-proficient and not ask me so much?

text: I'm currently working on a project with a new programmer. How do I help him speed up his work? He often asks me questions, and I pair programmed with him in backbone.js (a part of the project). Now I want him to handle the project himself so I can concentrate on other things to speed up the process. He doesn't want to Google things or ask on a forum if a problem comes up. He just comes to me. What should he do? What should I do? When I force him, then he does things quickly. How can I motivate him to do more work on his own?


title: Interacting With Data Using Multiple Databases/Servers

text: All of the projects that I've had to deal with so far have only required a single database on a single server. I'm interested in learning more about how projects that need to scale move to multiple databases and/or servers to help manage the load. I'm aware of High Scalability, but I'm particularly interested in some code examples or additional resources where I could read more on the subject. For instance:   * How are joins constructed between two tables on multiple databases? (A code example here would be helpful).   * Are there any special strategies for tracking which tables are in which database?   * Does the application code need to know that one or more databases are spread across multiple servers? If not, at what level are the requests filtered?   * When is it time to move beyond a 1 database/1 server setup? How common is it to need to do this?


title: Does it make sense to standardize including a created date and last updated date field on all DB tables?

text: My boss is currently attempting to apply some development standards to our team, so we had a meeting yesterday to discuss the standards which was mostly going well until she brought up:   * All DB tables will have a CreatedDate and LastUpdatedDate column, updated by triggers. At this point our team suffered an opinion schism; one half of us think that doing this on all tables is a large amount of work with little benefit (we work on fixed-budget projects so any cost comes from our company's profits); the second half believe it will help with support of the projects. I am firmly in the former camp. While I appreciate that some outside cases would cause the extra columns to improve supportability, in my opinion the amount of work that would be required to add the columns in the first place, as well as maintenance, would cause us to spend less time on more important things like Unit- or Load-Testing. Also, I'm fairly sure that these extra columns would make it more awkward to use an ORM - bearing in mind that we mainly use C# and Oracle, which isn't very ORM-happy to start with. So, my question is twofold:   * Am I in the right camp? I don't claim to have world-renowned database skills, so this might be a trivially easy addition with no adverse side-affects.   * How would you deal with a situation where a meeting about standards devolves into a slagging match? How can I really sell that this standard is not going to help us in the long term?


title: Need to figure out Timesheet via Email

text: So we are thinking that we might want to make timesheet submission easier by having our timesheet system send out a person's timesheet via email to the employee. The employee then should fill out the timesheet and send it back via email for it to be processed. Anybody know of some write up on how other's have done this? I've googled but without luck. Thanks for any thoughts/input.


title: How do functional languages handle random numbers?

text: What I mean about that is that in _nearly_ every tutorial I've read about functional languages, is that one of the great things about functions, is that if you call a function with the same parameters twice, you'll **always** end up with the same result. How on earth do you then make a function that takes a seed as a parameter, and then returns a random number based on that seed? I mean this would seem to go against one of the things that are so good about functions, right? Or am I completely missing something here?


title: Modelling Login and Authentication on an iOS mobile client

text: I'm about to start working on a V2 of a mobile application and I'd like to adopt a more object-centric approach. Primarily because I think it makes for more maintainable code, but a secondary benefit is easier testability. V1 of the app is pretty controller-centric. The Login ViewController has its login fields and it hits the backend via AFNetworking, reports errors if necessary, and receives a token which gets stored away securely for later use. There's only ever a single user. When the user logs out, all local data is deleted, so essentially the current user is 'global' and can either be nil (need a login) or not (doesn't). The situation is complicated of course by the idea of token expiry. Essentially any network request (either explicit GETs or asynchronous, delayed POSTs) can fail because the token expired and we want the user to re- authenticate. The V1 model of a login screen at startup if there's no current user doesn't easily extend to this model, and I feel,I'm missing an object somehow I'd route everything through. An Authenticator that provides a token, or throws up the login screen if it doesn't have one. Then we could do something like - when any request fails, we delete the current token and retry the request. The request asks the authenticator for the token, and the authenticator asks the user. Or something. How this could be better modelled? I feel like the code needs to be centralised, but that's hard as requests are used throughout the apps. Its almost like a filter layer is needed to handle auth errors centrally, but other errors / successes wherever they're needed (in a success/fail block).


title: Where do I put the changelog to display the recent changes to the user?

text: I want to create a changelog for my application to display the set of recent changes to the user. But I'm not sure where I put it. Do I create a text file and write in it? Where do I put this text file then?   Or do I use an action in the menubar and display the changelog in a new window when clicking on the action?


title: Best way to handle nulls in Java?

text: I have some code that is failing because of NullPointerException. A method is being called on the object where the object does not exist. However, this led me to think about the best way to fix this. Do I always code defensively for nulls so that I future proof code for null pointer exceptions, or should I fix the cause of the null so that it won't occur downstream. What are your thoughts?


title: CS subjects that an undergraduate must know

text: In college, I was never interested in theory. I never read it. No matter how much I tried, I was unable to read stuff and not know what was actually happening practically. Like for example, in my course on automata theory, my professor told me everything possibly related to the mathematical aspect of it, but not even once did he mention where it would be used practically. This is just an example. I managed to pass my college and interned with a company also, where I did a project and thankfully they didn't bother about my grades, as they were above average. Now, I am interested in knowing what subjects should a CS student must absolutely and positively be aware of? Subjects that can have relevance in the industry. This is because I have some free time on my hands and it would help me better to have a good understanding of them. What are your suggestions? Like for one, algorithms is one subject.


title: What is the best marketplace for freelance programmers?

text: I need a really talented, hardworking programmer who knows Cocoa and Objective C for my Iphone App. I'm looking for a partner and not just a programmer. It's a pretty big project that takes a talented programmer. What would you say is the best marketplace for someone like this. I've checked out digitalpoint and sitepoint but they are really for smaller projects.


title: How to have an improved relationship with recruiters?

text: I personally, always have problems with recruiter's and their constant spam.. I usually get tons of emails for jobs, not related to what I do. Or they have no idea what I do. Or they say they have a job in my field, but make me go thru hours of paperwork, only to find out they had no real job lead. Or my resume contained a keyword, that they searched for, but that keyword is like 1-10% of what I do, not my main job skill set. My point being is that I want to have a more polite, more accurate, less waste of each other's time. So I want to come up with a form letter, I can create in gmail to automatically send to all recruiter's, to help inform, educate and train them to deal better with me. That way, they know exactly what to send to me, so as to not waste my time. We don't play email/phone tag, just to find out they have no idea what I do, or how to find a job lead that matches that. I want this to be an improvement in my relationship and experience with recruiters, because honestly most of them waste my time. They call me at work, not considering I can't take phone call's at work, and they already had my email address. Mostly they annoy me, but I am tired of having to be rude to get my point across. I want them to immediately make sure they know what I can and have done, (Have you read my resume?) and have actual leads ready to be hired/interviewed soon or now. Any suggestions to how to improve the communication, to avoid wasting each other's time. I certainly hate having to come across as rude or improper, but when they just waste so much of my time, I don't know what else to do. So thank you for your time. Just to be clear, I want your help to write a form letter, that I can send to every recruiter that email's me, how to best work with me, and other people in IT/Web careers.


title: Is there a different usage rationale for abstract classes/interfaces in C++ and Java

text: According to Herb Sutter one should prefer abstract interfaces (all pure virtual functions) to abstract classes in C++ to decouple the implementation as far as possible. While I personally find this rule very useful, I have recently joined a team with many Java programmers and in the Java code this guideline does not seem to exist. Functions and their implementations are very frequently located in abstract classes. So did I get Herb Sutter all wrong even for C++ or is there a general difference in the usage of abstract functions in C++ compared to Java. Are abstract classes with implementation code more sensible in Java than in C++ and if yes why ?


title: Why can you have statefulness inside a static class in java?

text: I was playing around with Java today and I read about static inner classes. Why can you have 'statefulness' inside of a static inner class. For instance:               class outerClass {              static class Test {              private String a;                   String getA() { return a; }                   void setA( String newA) {a = newA; }               }     }      Am I misunderstanding something? It seems like you should not be able to keep mutable state inside of a class that is labled at static. Moreover it seems like you should not be able to instantiate something that is a static class, it should be a static singleton. Perhaps someone could correct me if I am making an incorrect assumption or enlighten me to why the Java authors decided to make this possible. EDIT: I feel as if I am confusing the keyword `final` and `static` in java, as `final` variables do not have state. It still seems _very_ strange to be able to instantiate a static class, though.


title: Is it normal to want some appreciation and acknowledgement?

text: I work for a Multi-national product development organization. I work directly for the person who established the Indian wing of the organization. I work incredibly hard and try to do the best possible work I can. But after 6 months of working here I am finding it hard to stay motivated to do my best because no matter how hard I try I do not get any acknowledgement that I did something right or wrong. Often times what I find that I need to do to get things done are not in the conventional wisdom of how software is made. The problem is bothering me so much that I am considering moving to a different company. I don't know if expecting an occasional "good job" is wrong. But it feels like a little sincere appreciation will help make things better for me. Is it just wrong to need it? Have you had a similar experience?


title: Is there any well known project to VBify C and make C as RAD language?

text: I have two questions: `Question #1`: Is there any well known project to **VBify** C? **VBify** here means **to make it as easy as in VB.NET** and to make C well supported in IDE just like VB.NET, i.e. with following features: word completion, function's argument description and everything just as with VB.NET development using Visual Studio. `Question #2`: Is there any well known effort to make C as **RAD (Rapid Application Development)** language?


title: Is there any scholarly research on the detrimental effects of a noisy workplace on productivity?

text: I work in an open office with typical office noise (people talking and walking by). It is simply too noisy and restless for me to work in. I've been trying and trying to get some change, to no avail. I'm at a point of starting to look for a new job, but thought I'd give it one more shot, and try to argue my case with research. I remember reading about research on how noise and disruptions affect knowledge work and software development in particular. Maybe I'm bad at searching, but I just can't find research papers that deals specifically with noise and work that requires high concentration. PS: While I appreciate tips on how to cancel the noise (music, white noise, etc.), please limit your answer to links to research papers. Thanks.


title: What should and what shouldn't be in a header file?

text: What things should absolutely never be included in a header file? If for example I'm working with a documented industry standard format that has a lot of constants, is it a good practice to define them in a header file (if I'm writing a parser for that format)? What functions should go into the header file?   What functions shouldn't?


title: How to create and publish a useful Java library

text: I've recently worked on a Java class that generates permutations per list of objects. In any case, I would like to have this library offered to the public, so I have several questions:   * Most libraries I see have this complicated package naming, specifically including `com`/`org`. Is there a convention for these or is a `permutations` package enough?   * Is there a specific format to publish these? Should I include separate WARs for source code / javadoc?   * I have the files on a GitHub repository. I guess I can serve the files there, but how do I get people to find my repo?


title: Steps to maintain a good bug database

text: Maintaining bug database is an important for every project. I am used to store the followings at bug database   * Issue date time   * Who is assigned to   * Whether it has been solved or not   * If solved then, solved date time Is those enough to maintain a good bug database?


title: what is the purpose of arrows?

text: I am learning functionnal programming with Haskell, and I try to grab concepts by first understanding why do I need them. I would like to know the goal of arrows in functional programming languages. What problem do they solve? I checked http://en.wikibooks.org/wiki/Haskell/Understanding_arrows and http://www.cse.chalmers.se/~rjmh/afp-arrows.pdf. All I understand is that they are used to describe graphs for computations, and that they allow easier point free style coding. The article assume that point free style is generally easier to understand and to write. This seems quite subjective to me. In another article (http://en.wikibooks.org/wiki/Haskell/StephensArrowTutorial#Hangman:_Main_program), a hangman game is implemented, but I cannot see how arrows makes this implementation natural. I could find a lot of papers describing the concept, but nothing about the motivation. What I am missing?


title: What is exactly the meaning of "portability"?

text: I know very well that java is a portable language..and it is the byte-code that makes it portable.. However I've studied also that C is a portable language. **"The programs written in C are portable i.e. programs written for one type of computer or operating system can be run on another type of computer or operating system."** Then what is the difference between C portability and Java's portability? can we say that C is also a portable language like java? I know that java portability may be in terms of different application such as mac, PC, mobile phone..and C can't be used in such cases..But my question is still as how portability is different in both language? Please clear my confusion. Thanks in advance..


title: Chat room for Ruby on Rails app -- should I do it with EventMachine or Node.js?

text: I have a chat room for a Rails app is implemented the old-fashioned way, using Ajax Polling. This is not scaling, and it is cluttering my log, so I want to reimplement using either EventMachine + HTML5 websocket/degrade to flash, or Node.js. Given that the rest of the app is in Rails, what are the the pros and cons of each of these two alternatives?


title: Finding an A* heuristic for a directed graph

text: In a previous question, I asked about finding a route (or path if you will) in a city. That is all dandy. The solution I chose was with the A* algorithm, which really seems to suit my needs. What I find puzzling is heuristic. How do I find one in an environment without constant distance between 2 nodes? Meaning, not every 2 nodes have the same distance between them. What I have is nodes (junctures), streets with weight (which may also be one- way), a start/finish node (since the start and end is always in the same place) and a goal node. In an ordinary case, I would just use the same way I got to goal to go back, but since one of the streets could have been a one- way, that may not be possible. ### The main question How do I find a heuristic in a directed graph?


title: How do you train freshers?

text: Training freshers has become my responsibility. I work in a good small company and they want me to train freshers (MCA/BCA students). But I am not an expert in training field. So can anyone please help me in this? Few hints/tips and something that is new/different to train them. What care should be taken while communicating them? How to clear their mind covered with college environment? Please help me.


title: Why is #include <iostream.h> bad?

text: I was reading another thread where a guy asked about C++ books for beginners, and one of the programmers answering wrote this: > Some warnings: avoid all books that present an "hello world" stating with >   >   >     #include <iostream.h> >   I opened my C++ book and sure enough it included the iostream header like the example above. Why is that bad? What other pointers should I keep in mind when learning C++? Background: I am proficient with C and I'll start to learn C++ this next semester.


title: Falsey values vs null, undefned, or empty string

text: I've worked with jQuery over the years. However, recently, I've found myself getting deeper into the JavaScript language. Recently, I've heard about "truthy" and falsey values. However, I don't fully understand them. Currently, I have some code that looks like this:               var fields = options.fields || ['id', 'query'];      I need to identify if fields is null, undefined, or has a length of 0. I know the long way is to do:               if ((fields === null) || (fields === undefined) || (fields.length === 0)) {      ...                         }      My question is, is the following the same:               if (!fields)  {      ...     }      Thank you!


title: Session in RESTful web services, how it works?

text: In a web services, how does the server know which request belongs to which session? I know that for a web application, the web server inspects the cookie (or the sessonId query parameter in case cookies are disabled) so it knows which session the request is associated with. But for a request that comes from a rest client, how do the server know?


Where does the word "argument" (in the programming sense) come from?   i.e. Why are actual parameters called "arguments"? The meanings don't seem related, and I haven't found any explanation of it anywhere. * * * **Note** on the terminology:   * "Formal" parameters (also known simply as "parameters") are the "placeholder" names (say, `x`) -- the _declared_ parameters of a function.    * "Actual" parameters (also known as "arguments") are the _actual values_ which are _passed_ to a function (say, `5`), hence I used this term above to prevent any confusion.


title: Moving from Employee to Business Owner smoothly

text: I currently work for a company, a big company. I have a contract that states that I need to ask for permission to have another job. Very standard I suppose. I'd like to start trying out some ideas for start ups. Some of them work without moving money (write a program, release it as shareware or something like that and see if people is interested), that's easy. But some ideas need to move money. One is, in some way, like Amazon's Turk Machine, where money should be involved since day 1. Without having to request permission from my current employer and having to set up a company, how can I give that idea a try?


title: Is there a version control system that can show changes to a specific method or function?

text: Sometimes it would be nice to be able to say something like:               (git|svn|hg|etc) diff Foo.c:main     (git|svn|hg|etc) log log Foo.c:main      to see the changes made to a specific function within a source file since the last commit, or the complete history of changes. My question is two-fold:   1. Does something exist that does this?   2. Would such a tool be practical? It would have to do some simple parsing of the code at each revision in order to compare different versions of the function; would the overhead be too much for it to be efficient?


title: In MVP, should presenters instantiate and control other presenters?

text: I've implemented an application using MVP with GWT, which is working out very nicely for views that have a single purpose. Now, it has evolved into views that are achieving multiple purposes in a single window. So now I have a view of views with each view having its own presenter. I used this example as my model for building out the application, take a look. The "view of views" also has its own presenter, which instantiates (or receives) the presenters for each of the other views it needs to fulfill its purpose. I reveal event interfaces through those presenters for the "view of views" presenter to hook into and listen and react to what's going on inside those other presenters & views. My questions are:   * Am I still following MVP principles or have I violated the separation of concerns somewhere by having presenters create/receive and control other presenters? aka Should I be doing this?   * What are some other design patterns for creating interfaces that are also composed of other complex interfaces? ## Update In response to Robert Harvey's question, there is difficulty with passing objects from a presenter of a view to the presenter of the "view of views" when an event is triggered. For instance, a button will flag a ClickEvent and the handler attached to this will need to pick up the data object related to the ClickEvent through another method revealed by the view's presenter. So this works, but do feel it will cause more problems later on as this kind of object handling grows in complexity.


title: Is there a license for selling a software with the sources so buyer can make modifications without claiming ownership of the code or distributing it?

text: I would like to sell a software that has some open source competitors. Therefore I would like to include the source code with the binaries so that the company buying it can modify it as it wishes. The only catch is that the source code will NOT belong to the company, in other words, I would like to maintain the copyright and ownership over the code so I can sell to other companies, etc. Is there a license name for this kind of model? The buyer can see the code, modify it for its needs, but it cannot take ownership over the code, in other words, it is licensed for a particular use/need and **he cannot give or show the code to anyone else**. Buyers are more likely to be companies in that model, in other words, they will be able to take control of the product by modifying the source code, but they will not be able to take ownership of the original code or do anything with it besides the initial purpose they bought it for. It is still closed source. **Only the companies that buy the product are entitled to see and modify the code but never to distribute it.**


title: Will interns and entry level positions care more about algorithms or projects/experience

text: I am 3 months into learning java, read head first java and made 4 things on my github + many small things. I also started learning android this month, but now am tossing and turning not knowing my next step. I applied to a few jobs and no call backs but have been getting noticed at least. My background is business and I have experience in QA. I have taught myself a lot but never really saw a need to learn algorithms or big o notation, I noticed that most people talking about this go to university and are applying to google or a big fortune 500 company. I have read so many success stories of people teaching themselves programming in 1 year with no background and they never talked about algorithms and still got jobs, but yeah most of them were web developers or android. I also hear that they mainly ask algorithm questions to students because they know students might not have much of a portfolio, so if I have a good portfolio would that negate the need to focus on algorithms? I don't know what kind of career I want so I am applying to anything java/android but no web related jobs as I am not interested. I know html/css/rdmbs/sql. TBH, I just really want to spend the next month or 2 learning more android and than apply for jobs after I put some apps on the market. I also want to finish making java projects to learn core java. The problem is time, I am unemployed and every month goes by looks bad to an employer. I don't want to spend 2 months learning android than 2 months playing with java, if after all that I still have to spend a few months learning algorithms. I feel if its THAT necessary, should I drop everything and focus on interview algorithms and such? I am hesitant to learn something I won't use much JUST for an interview, at least at my current intern level. I studied javascript and jquery before but I never used them, and its as if I never studied them when I think about it. I am aiming for small companies or startups who want an intern to grow with and train. Are these algorithm questions mainly asked for people aiming at the big four? thanks for any tips, I have currently a few pdfs on algorithms and MIT free course to look at...not sure where to start...


title: Is my understanding of abstract datatypes correct?

text: After reading lots of pages on various sites, I came to the conclusion that abstract datatype helps to separate the use of datastructure from its implementation. We can easily map the data into a datastructure by using an already available abstraction. And this abstraction is called ADT. Please tell me if I have understood this correctly. Also if you can give a small example, it will be very helpful. If you prefer to give any code in your example, C or Python would be helpful for me. **Addition:** They are a very special implementation of data abstraction. What separates them from other instances of abstractions is that ADTs are theoretical constructs. Theoretical constructs that help map or represent data in a desired data structure. They have attributes or operations associated with them. These operations may be applied on the data that has been mapped into the ADT. How the data is actually stored inside the ADT or how the operations work are kept hidden. EDIT: I had previously said, "ADT is like the blueprint of a datastructure". A few of the answers have explained why it's not. I didn't have a clear comprehension of what a 'blueprint' is and that was the reason for using the term. So, I've now removed it from my original text.


title: Multiple classes with the same name, but different namespaces?

text: I've run into some code (C# if it matters) that has classes which have the same name, but differ in their namespaces. They all tend to represent the same logical thing, but often are different "views" of the same object. The different namespaces are at times part of the same solution, and even the same dll. I have my thoughts, but couldn't find anything definitive about this practice to be considered a clever use of the tools available or a pattern to avoid. This question on smurf naming touches on this, but from the other direction. Disambiguating the names would likely require an arbitrary and pervasive prefix, which that question wanted to eliminate. What are the guidelines around this practice?


title: How does your team approach technical code QA?

text: For the first time, our team is taking a rigorous approach to technical code QA. We identify work to QA by picking out top level classes and QA'ing it and everything it calls or uses below it (and what they call/use etc.). I reckon our QA code coverage to be reasonably close to 100% and its an eye opener for me in terms of improvements both in code and design as well as catching bugs early. I'll definetly be promoting this in the future, but wondered how other teams approach techincal code QA. Do you have a rigorous approach? Do you aim to QA everything? Does one or two people tend to do it or is it spread evenly about the team? What do you look for when QA'ing? Any thoughts appreciated!


title: API always returns JSONObject or JSONArray Best practices

text: I'm making an API that will return data in JSON. I also wanted on client side to make an utility class to call this API. Something like :               JSONObject sendGetRequest(Url url);     JSONObject sendPostRequest(Url url, HashMap postData);      However sometimes the API send back array of object `[{id:1},{id:2}]` I now got four choices ():   * Make the method test for `JSONArray` or `JSONObject` and send back an `Object` that I will have to cast in the caller   * Make a method that returns `JSONObject` and one for `JSONArray` (like `sendGetRequestAndReturnAsJSONArray`)   * Make the server always send `Arrays` even for one element   * Make the server always send `Objects` wrapping my Array I going for the two last methods since I think it would be a good thing to force the API to send consistent type of data. But what would be the best practice (if one exist). Always send arrays? or always send objects?


title: Why does Linq to Entity Sum return null when the result set is empty?

text: There are quite a few questions on Stack Overflow about the Linq to Entity / Linq to SQL Sum extension method, about how it returns null when the result set is empty: 1, 2, 3, 4, 5, 6, 7, and many more, as well as a blog post discussing the issue here. I feel it is an inconsistency in the Linq implementation. I am assuming at this point that it is not a bug, but is more or less working as designed. I understand that there are workarounds (for example, casting the field to a nullable type, so you can coalesce with `??`), and I also understand that for the underlying SQL, a NULL result is expected for an empty result set. But because the result of the Sum extension for non-nullable types is also non-nullable, **why does the Linq to SQL / Linq to Entity Sum behave this way?**


title: Decoupling software components via naming convention

text: I'm currently evaluating alternatives to refactor a drivermanagement. In my multitier architecture I have Baseclass   * `DAL.Device` //my entity Interfaces   * `BL.IDriver` //handles the dataprocessing between application and device   * `BL.IDriverCreator` //creates an `IDriver` from a `Device`   * `BL.IDriverFactory` //handles the driver creation requests Every specialization of `Device` has a corresponding `IDriver` implementation and a corresponding `IDriverCreator` implementation. At the moment the mapping is fix via a type check within the business layer / `DriverFactory`. That means every new driver needs a) changing code within the `DriverFactory` and b) referencing the new `IDriver` implementation / assembly. On a customers point of view that means, every new driver, used or not, needs a complex revalidation of their hardware environment, because it's a critical process. My first inspiration was to use a caliburn micro like nameconvention see Caliburn.Micro: Xaml Made Easy   * `BL.RestDriver`   * `BL.RestDriverCreator`   * `DAL.RestDevice` After receiving the `RestDevice`within the `IDriverFactory` I can load all driver dlls via reflection and do a namesplitting/comparing (extracting the xx from xxDriverCreator and xxDevice) Another idea would be a custom attribute (which also leads to comparing strings). My question: is that a good approach above layer borders? If not, what would be a good approach?


title: Prevent indent when formatting CSS

text: In Visual Studio 2013 when I format my CSS code (`Ctrl`+`K`+`F`) it will sometimes indent my CSS properties into a hierarchy. For example: .a { color:red; } .a .b {color:blue; } Becomes:               .a {       color:red;     }             .a .b {          color:blue;        }      When I would prefer:               .a {       color:red;     }          .a .b {       color:blue;     }      Is there a way of modifying Visual Studio to prevent this indentation?


title: How to manage security of these self hosted web apis, to ensure that the request coming for accessing data is authenticated?

text: Let's pretend I am going to work on an enterprise application. Say I have 11 modules in the application and I would have to develop **Dashboards** for every role in the organization for whom I are going to develop application. We Decided to use **Asp.Net Web Api** and return json data from our apis. We are going to include 11 Self hosted web apis projects in our application (one **self hosted web api** ) for every module. All 11 modules are connected to one **Sql server 2012 Database.** Then once api is ready we would have to create Business Dashboards (Based upon roles in Organization). So Now my web api client is Asp.Net Mvc application.Asp.Net mvc will consume those web apis. Here is the part for whom all explanation is done. How should I manage Security of all 11 self hosted web apis? How should I only authenticated request is coming? If I authenticate user by login and password and then redirect user to appropriate Dashboard designed for the role that user have and load data by consuming web apis. How should I ensure that the request coming for accessing data is authenticated?


title: Models structure in PHP/MVC

text: I have some classes that are composed with ORM generated Models. example1: For example the Report.php (Model) is using a Document.php Model generated with ORM. Based on the document object a report is created. I would like to know some name suggestions for the Report.php folder path. It clearly belongs to the /Model folder but in what subfolder? example2: The CustomTagFilter.php will remove some html tags from a html string. I wish to find a clear path name for this kind of Models. Any suggestions ?               /Models/[SUGGESTION]


title: Architecting related products for different markets: MEF?

text: Hopefully, this question is not too open-ended... I have been tasked with taking a 3 year old application (.NET 4.0, WPF, WCF, EF 4, SQL 2008) that was designed for a very specific market X and "re- purposing" it for a another very specific market Y. To further complicate things, the company has also mentioned a third market Z, but that may be a year+ down the road. But it’s definitely coming. The deadline for getting the application Y ready for market is aggressive. It might be negotiable, but just assume it’s a matter of 2-3 months. I have been working at the company for a while, and I was very intimately involved with the initial creation of application X, and I am still involved with the maintenance. The new “application” Y is interesting because there is some “overlap” between the features required for X and Y. For example, let A, B, C, D, and E be features and let ‘ (prime) denote an enhancement to a feature. All of the following scenarios are valid:               ---X---|---Y---  …  ---Z--- (down the road)        A   |   A        B   |   B’        C’  |   C            |   D        E   |      Some features can be merged from X to Y as-is (A). Some features from X must be enhanced before they can be merged into Y (B). Some features in X will not be in Y at all (E), and Y will contain features that are not in X (D). You get the idea. Here are my questions: (1) In the eyes of upper management, they ultimately see 3 different applications - one for each market: X, Y, Z. Moreover, they see 3 different copies of the same feature A that will need to go into each application. As discussed, there may be some enhancements that will make it to select products, but at the core, they are nearly identical. Sometimes I'm guilty for finding excuses to use the latest programming trends, BUT I think there's a strong business case here for utilizing the Managed Extensibility Framework (MEF). Why have 3 different physical applications (and hence 3 code bases) when it could really be one “next generation” application with plug-able features through something like MEF? There are several benefits that something like MEF could bring to the table. Does an extensibility solution like MEF seem valid in a case like this? (2) Given the limited time to get application Y to market... (a) Should I go with a conservative approach and simply give management what they’re asking for, i.e. make a deep copy of X and modify it for Y? Perhaps there will be time after Y goes to market to develop a more ideal and extensible solution? My past experience with this company has seen demos become fully-fledged products within no time – if you get my drift ;) It could very well be more difficult to modify X code to make it work for Y rather than it would be to create Y from scratch and import X features. (b) Leaving X alone for now, should I create Y with MEF in mind. Features from X can easily be imported into Y. If this is done properly, Z should be easy to implement. It will probably be a risky undertaking to go back and address X to fit into this framework since it's so widely used, but it could be done on the side with no specific deadline. I have to pitch this to upper management. Any advice or thoughts?


title: Do any OO languages support a mechanism to guarantee an overriden method will call the base?

text: I think this might be a useful language feature and was wondering if any languages already support it. The idea is if you have:               class C       virtual F          statement1          statement2      and               class D inherits C       override F          statement1          statement2          C.F()      There would be a keyword applied to C.F() such that removing the last line of code above would cause a compiler error because it's saying "This method can be overridden but the implementation here needs to run no matter what".


title: Finishing an iteration early

text: I'd like some input on this on those working with agile methodologies... A current project is finding that development on our planned user stories is finishing some time before the end of the iteration, and that the testing effort and business acceptance is what's actually dragging us out longer towards the end. This means that the devs in question have spare time, and they're essentially going out to the iteration+1 backlog and starting work on cards there before our current iteration cards are 'done'. As iteration manager, I want to put a stop to this - I want a more team-orientated approach where the group takes ownership of getting all the cards done, as opposed to "Well, dev's done so what do I dev next?" The problem I face is convincing the team of this. On one hand, I understand why the devs don't want to test the code they've written (there are unit tests they write of course, but the manual testing to be done could be influenced by their bias). The team sees working ahead as making our next iterations easier, because a lot of the work is done before we start. I see this as screwing with the whole system of planning/actuals - but it's difficult to convince the team as to why this matters. What advice can you guys and girls give? How do we stop devs reaching ahead? What should they be doing instead? How much of a problem is this in the scheme of things, if things are still getting done?


title: Resources on securing domain models?

text: I'm have good resources on both security, domain modelling, and architecture patterns. I've noticed a distinct lack of any suggestion of how and where to integrate security into the systems I build. I imagine the thing that applies the most is Access control, as Authentications and many other security forms would seem to be obviously a layer above the model and is pretty easy to separate and find a place for. Access Control to actions seems more of a grey area. Are there any good resources on this? I prefer well written books, but other resources are also welcome.


title: How to use TFS as a query tracking system?

text: We already use tfs for managing defects in code etc, etc. We additionally need a way to "understand the domain & requirements of the products". Normally, without tfs we exchange emails with the consultants and have the questions/queries answered. If it is a feature implementation we sometimes "find" conflicts in the implementation itself. And when that happens the userstory is modified and the enhancement/bug as per that is raised in TFS. Sometimes it is critical we come back to decisions we made or questions we wanted answers to. Hence we need to be able to track how that "requirement idea" or that "query in concern" evolved. Hence how is it that we can use TFS to track all of this? Do we raise an "issue" item for this? Or do we raise a "bug" item? The main things we'd ideally look in a query tracking system are as follows:   1. Area: Can be a module, submodule, domain. Sometimes this may be "General" - to address domain related stuff, or, event more granular to address modules, sub-modules. Take the case for the latter, if we were tracking this in excel sheets, we'd just write `module1,submodule2`; i.e. in a comma separated fashion. The things I would like here is to be able search for all queries relating to `submodule2` sometime in the future.    2. Responses: This is a record of conversations between the consultant and any other stakeholder. For a simple case, it would just be paragraphs. Each para would start with a name and date enclosed in brackets and the response following that...each para would be like a thread - much like a forum thread   3. Action taken: We'd want to know how the query was closed, what was the input given, what were the changes that took place because of that, etc etc.  These are fields I think I would need in such a system apart from some obvious ones like status, address to, resovled by, etc. I am open for any other fields which are sort of important. To summarise my question: how can we manage "queries" in the system? Where should we ideally store data pertaining to those three fields I have mentioned above (for e.g. is it wise to store responses in the history tag assuming we are opening a bug for the query)?


title: What reasons are there for not using a third party version control service?

text: I've recently noticed a bit of a trend for my projects as of late. I use to run my own SVN server on my VPS, but recently the nail went in the coffin for that when I got my last project migrated from my server to a Mercurial repo on Bitbucket. What are some of the ramifications to this? (disregarding the change in version control systems) It seems like there has been a huge explosion in version control hosting, and companies like Bitbucket even offer private repos for free, and Github and other such services are extremely cheap now. Also, by using them you get the benefit of their infrastructure's speed and stability. What reasons are there these days to host your own version control? The only real reason I can think of is if your source code is super top secret.


title: Setting source IP with posix sockets

text: Is it possible for an application to request a socket (tcp) and have it set the source address without using raw sockets? (the addresses would be bound to the interfaces. [no spoofing]). This would be a tcp client connection, not bind()ing to a specified address.


title: Microsoft's coding standards for ASP.NET controls

text: I cannot find any naming standards/conventions in MSDN for naming ASP.NET controls. One of the following standards tends to be used by programmers:   * `lblAddress`   * `AddressLabel`   * `Address` According to MSDN's Name of Type Members, should we be treating ASP.NET controls as fields, hence using Pascal Case (e.g. `AddressLabel`)?


title: Are there any reasons not to accept a software deliverable as a virtual machine?

text: This is a question about logistics, not a technical question. My company has outsourced some embedded software work. Specifically, we have payed a contractor to develop an embedded system for us since we do not have adequate in-house knowledge to do it ourselves (we only have desktop application developers). So, the contractors have finished the software and they have asked if they may deliver it to us in a virtual machine. The VM is a Windows 8 machine containing the pre-configured CodeWarrior IDE with the source code as a CodeWarrior project. The idea is that this will allow us to make code changes within the VM that is already configured for further development of this project. Are there any drawbacks to doing this as opposed to having them walk us through how to configure our own development machines to make code changes to the project? The only problem I can foresee is the VM running slowly and it taking a long time to rebuild the project when we make code changes. But on the other hand, I like the idea of getting a pre-configured embedded system development environment so I don't have to add yet another IDE on my desktop application dev machine. I can't really think of a good reason why not to accept a VM deliverable, but I just wanted to run it by this community in case there's something I'm missing.


title: Lambda Calculus Free Variable

text: Here's something from Slonneger's "Syntax and Semantics of Programming Languages": > A variable may occur both bound and free in the same lambda expression: for > example, in λx.yλy.yx the first occurrence of y is free and the other two > are bound. I assume the free variable is the y right after the λx. and the bound y's are the λy.y which I can sort of intuitively grasp. So ((λx.yλy.yx)a)b) would reduce to (yλy.ya)b) then to bba ? Can someone explain how this came to be? In the end it's the expression b twice. Can someone perhaps provide more examples of bound and free variables?


title: Why have a wrapper constructor when storing a function in a data type?

text: I can never do too many Haskell tutorials. There is always something to refine and learn. So, I am working through chapter 10 of Real World Haskell, and everything makes sense. _but_ Why do               newtype Parse a = Parse { runParse :: ParseState -> Either String (a, ParseState) }          identity :: a -> Parse a     identity a = Parse (\s -> Right (a, s))          getState :: Parse ParseState     getState = Parse (\s -> Right (s, s))          putState :: Parse ()     putState = Parse (\s -> Right ((), s))      Why not simply do               type Parse a = ParseState -> Either String (a, ParseState)          identity :: a -> Parse a     identity a = \s -> Right (a, s)          getState :: Parse ParseState     getState = \s -> Right (s, s)          putState :: Parse ()     putState = \s -> Right ((), s)      In other words, what is the purpose of the wrap and unwrap pattern in here (which I see used in a lot of different places in Haskell)? We get the same `Parse Whatever` data type, but without the extra indirection.


title: Analogy of a class being a cookie cutter and objects being cookies

text: I came across the analogy of the _class being a cookie cutter and the cookies being objects_ while reading Code Complete. I fail to see why this analogy was drawn.How is it related to the concept of objects being run time instances of their classes?


title: Refactoring: Isn't it just a fancy word for clean up your code?

text: Before Martin Fowler's book "Refactoring: Improving the Design of Existing Code" came out, we used to call major changes to code "rearchitecture" and minor changes "cleanup". IMO, refactoring techniques are all common sense / obvious things we've been doing forever. Do you think refactoring was ever anything new? Perhaps just a way to trick management into allocating time for code cleanup?


title: Why does IIS default to Recycling the Application Pool every 1740 minutes?

text: Why does IIS default to recycle the app pool after a given time? Is there some specific reason other than perhaps most web apps are not managing the memory prudently? Given that you are managing your application's memory properly, is is safe to go ahead and turn this off? What are some potential down sides, up benefits to turning off recycling or keeping it on?


title: Is programmatically clearing the browser's history an accepted best practice?

text: A colleague is pushing clearing the client browser's history (i.e. back- button) when they logout of our web application. Is this considered a good practice? It strikes me as a really intrusive. If only conditionally, what conditions need to be in place for this practice to be useful?


title: Designing a large database with multiple sources

text: I have been tasked with redesigning, or at worst optimising the structure of a database for a data warehouse. Currently, the database has 4 other source databases (which is due to expand to X number of others), all of which have their own data structures, naming conventions etc. At the moment an overnight SSIS package pulls the data from the various source and then for each source coverts the data into a standardised, usable format. These tables are then appended to each other creating a 60m row, 40 column beast!. This table is then used in a variety of ways from an OLAP cube to a web front end. The structure has been in place for a very long time, and the work I have been able to prove the advantages of normalisation, and this is the way I would like to go. The problem for me is that the overnight process takes so long I don't then want to spend additional time normalising the last table into something usable. Can anyone offer any insight or ideas into the best way to restructure or optimise the database efficiently? Edit: All the databases are MS SQL Server 2008 R2 Thanks in advance CM


title: How to create a centralized update mechanism for a hosted CMS?

text: We're a team developing a hosted CMS (something like WordPress.com, but in .NET platform), and we want every site to get updates as we update our software. Our CMS is not **multi-tenant** , i.e. each site is an entire copy of a site template and has an individual database, files and folders, and would be **deployed across many servers** (2000 sites per server). Now our problem is that we can't figure out how to update all these sites in a centralized way, without users firing the update process (because this is a hosted solution, not on-premise). For example, imagine that we want to add a module to these sites and imagine that we have over 10,000 sites over 5 servers. It's **really really really** horrible to install this new module on 10,000 sites. Or imagine that we want to add a new template. Again it's not practical to copy template files to 10,000 sites. Is there any known pattern for such a **distributed hosted solution update/upgrade**?


title: Class Versus Struct

text: In C++ and other influenced languages there is a construct called Structure (`struct`), and another called the `class`. Both are capable of holding functions and variables. Some differences are:   1. Class is given memory in the heap and `struct` is given memory in the stack   2. Class variable are private by default and in `struct` they are public My question is: was the `struct` somehow abandoned for Class? If so, why? Other than the differences above, a `struct` can do all the same things that a class does. So why abandon it?


title: When should I be offloading work to a GPU instead of the CPU?

text: Newer systems such as OpenCL are being made so that we can run more and more code on our graphics processors, which makes sense, because we should be able to utilise as much of the power in our systems as possible. However, with all of these new systems, it seems as if GPUs are better than CPUs in _every way_. Because GPUs can do parallel calculation, multi-core GPUs actually seem like they'd be much better than multi-core CPUs; you'd be able to do many calculations at once and really improve speed. Are there still certain cases where serial processing is still better, faster, and/or more efficient than parallel?


title: Does software in a professional environment need to be licensed?

text: **Background** : I'm writing in-house software - it has absolutely no contact with the world outside the company - but I'm using various libraries, which themselves do have some license structure. So for example GPL requires that software that re-uses the a GPL-licensed piece of code, to also be under GPL- license. Does that require my in-house application to have an explicit GPL- license, or is this understood implicitly? Does using AGPL-licensed code, require my code to be available to co-workers who use the in-house system? **Question** : Does my in-house software need to have an explicit license, to be compliant with the licenses of such libraries? In what cases does in-house software need to have its own license?


title: How do I collect a list of rss feeds?

text: I am developing a rss reader where users search and follow blogs. But, how will I collect and store the feeds of thousands of blogs? Manual process of adding individual feeds is painful. Is there an easier way to add or import site feeds?


title: Use the terms "vector" or "array" in high level discussion of C++ code

text: When I write high-level documentation about what an algorithm does, I use the term "array" to refer to the data structure on which the algorithm operates even though the actual data structure is an `std::vector`. I feel that using the term "vector" in this context does not (to me) best convey the meaning I'm after which is "a sequence of elements with constant-time random access" or perhaps more generally "a dynamic array". Is there a convention or common documentation standard for this distinction of similar terms?


title: How to convince my teammates to follow some basic rules

text: I have a problem with my teammates. Long story short: We are three students working at a project for a competition. The project consists of 2 separate applications: one for Windows (that I develop) and one for Android (my colleagues are responsible for developing it). Our code bases will never intersect, the apps will communicate via third party tools. The problem is as follows: I have some experience working in teams as I made an internship at a big company last year, and I try to enforce some coding standards for our code. I also set up a git repository / wiki / collaboration software that we can use to push code / write ideas, document protocols and so on, but it seems that I am the only one that uses these tools. I tried to tell them that writing quality code and documenting every step will benefit us in the long run, but they don't seem to see the advantage of it. Also I was thinking to add some integration tests but from what I can see, as long as they don't use current tools to make their life easier, I don't think I can convince them the usefulness of integration tests. Most of the peer's code resides on their computers, they don't share a common code base and as I found out, they integrated their pieces by meeting and sharing code via usb stick. My question is: am I too harsh on this matter? Do I enforce some absurd rules? Keep in mind that this is a small project, the requirements are very clear(I created documents specifying what should the applications do), three skilled developers could do this in 3-4 days, so they might not see the added complexity of writing quality code as long as their current method just works. Is there any way that I can show them the benefit of documenting code, using git and so on?


title: Teach Linux programming to home-schooled 15-year old

text: I am home schooling a 15-year-old and would like to teach him programming. Our home computers are all running Ubuntu. What are some good options? So far I am leaning toward Scratch, but I also recently found out there is a free Basic project in the Ubuntu repo geared toward teaching, although I haven't checked it out yet. I also have thought of jumping straight to Mobile development, since he has an Android phone and that would be a pretty impressive conversation starter if he could learn to develop his own apps. I'm very open minded on this... sky's the limit!


title: How to improve algorithms studying?

text: I'm currently studying computer science at the Institute, and I have some problems with course which is named Algorithms, I've just begun to study it, but I'm already feeling, that I'm going to fail it, my problem is that while understanding different algorithms on graphs I need to keep in my mind a lot of info, and usually I can't do it, I forget some points of the exercise or can't proceed to final result, I'm very desperate about it cause I like programming very much. Did somebody feel the same while studying in the University? P.S. I began to program only two years ago, may it be the problem?


title: Does a project using proper TDD have a lot of code without tests?

text: Most (all?) TDD resources show you how the cycle goes:   * Write Test   * Check Test   * Write Production Code   * Check Test   * Clean up Production Code   * Check test They also - to me - seem to imply that _all code is covered by tests_. However, reading posts like Writing Great Unit Tests: Best and Worst Practices (for example, linked to here) it's said that > **TDD is a robust way of designing software components (“units”) > interactively so that their behaviour is specified through unit tests** To fill in some more context: > At the other end of the scale, **integration tests** contain no knowledge > about how your codebase is broken down into units, but instead make > statements about how the whole system behaves towards an external user. This makes perfect sense to me. However, it implies that **large parts** of the applications **code** are **not covered by tests**. Why? Because if you have units (and you need a lot of units to get your Unit Tests right) you need code that wires the units together. This code, IMHO, _will_ get complicated enough that it deserves to be tested on a more granular level that integration tests while it probably falls into "Dirty Hybris": > Anywhere in between, it’s unclear what assumptions you’re making and what > you’re trying to prove. Refactoring might break these tests, or it might > not, regardless of whether the end-user experience still works So to sum up:   * I easily see the value of _Unit_ Tests with TDD   * Some code is needed to wire the units together   * This code will be complex and integration testing will/may not be enough.   * TDD resources on the net seem to imply 100% code/test coverage, yet   * looking at TDD with True Unit Tests will leave some code untested * * * Edit: wikipedia says: > Integration testing takes as its input modules that have been unit tested but somehow I feel there's still quite a bit of wiring code missing from the picture. (except if "module" means "class or function" because that is what's unit tested in isolation) * * * Insights?


title: Managing cross-thread communication on issue/bug reports

text: On my current project we have two or three engineers who are tagged as Tier 2 or Tier 3 support. We often work directly with customers to gather detailed information about bug and issue reports. Frequently we get cross-talk in the email threads and conversations about issues. While discussing Issue #1, someone pipes up "Oh by the way we found Issue #2". Or having resolved Issue #1 we get asked "Thanks for fixing that. Where are you with Issue #3". I find this incredibly annoying and it can make it tricky to unravel threads when reviewing the history of a bug report because the threads are all mixed up. Can anyone suggest any strategies to manage this communication? Is there a polite way to address this and keep things single task focused? Is there a disadvantage to a single issue focus?


title: Python: Future as a major programming language?

text: After reading some Python material and seeing some Python code a few years back I decided to give it a whirl. I decided to start with Python to solve the problems on Project Euler and was throughly impressed with the language. Since then I've went on to learn Django, and now use it primarily for my web applications. I would love to have a career programming in this language, however I fear the future of the language is currently in a state of uncertainness. With Google and other major companies embracing it there may be some hope, what are your thoughts on Python, do you see many job opportunities out there?


title: Motivating developers in a project perceived as dull?

text: As a manager, I can't always end up generating work that'd be cutting edge. Some of the projects do run on maintenance mode, and generate a healthy free cash flow for the company. As a developer what would it take for you to stick around in this project? I have been thinking of re-branding the work, but I could do with a lot of help here. EDIT: Thank you all for the suggestions. So far here's what we've got:   1. Rotation of work as per developer interest   2. Flexible working environment   3. Allot time to work on pet projects   4. Socials and fun    5. Branding of the project    6. Use this as a stepping stone for other projects


title: Getting involved on Github (how to find projects)

text: I want to contribute to open source projects on Github. Mostly, I'd like to just start out fixing small bugs or adding features. I don't have a particular project in mind. I'd like to work on C, C++, Python, .NET, Java, etc projects. However, my problem is I can't figure out how to find anything on Github. I did find a page on Explore Github, that lists C projects. Basically, it lists the top 5 "watched" C projects. OK, that's fine, but I want to see more than 5. Sourceforge was/is great because you can browse projects by programming language. Also, SourceForge has or used to have a forum for finding projects that are asking for help. I can't find any of that on Github. There is a "Search" feature that, seems fairly useless for finding projects to contribute to. I tried the advanced search, setting it to "Repositories" and "C" for the programing language. However, you have to put something int he search; although I just want to browse titles and descriptions of projects. So, I tried putting "network" just to see what comes up. It gives just a list of everybody's fork of every project there is. Is there any way I can search, say through a third party or something, for projects in a sane way? It seems like Github should have such a thing; I would just choose from Sourceforge since I can search there, but I want to establish a Github profile, since that is the flavor of the month and there are all these fanboys on Hacker News that seem to think a Github profile is better than a Resume/CV. :)


title: Parsing excel data in java, before saving it to database

text: I'm working on some project where I have to make a database for data which is currently kept in excel files, so I have to do some changes before writing the data into the database. I'm going to read those files using Java, and write them from Java into the db. Should I use Hibernate for that job? Or how else can I connect to those Excel sheets, read data in Java, with database? I'm new in this, so I don't have any experience. Also english isn't my native language, so I'm sorry because of grammar errors.


title: How to name event types?

text: Clean code recommends to name methods to be a verb, and classes to be a noun. I am developing an c++ application using boost::signal as some kind of event framework, and have defined various events, but naming them to make the code cleaner seems to be problematic. So, how to name event types?


title: Is it possible to loosely couple an application to its framework?

text: Let's say I'm developing a web application. My first choice is to use PHP with Fat-Free Framework (F3) and MVC pattern. Next year, I might decide I want to switch to Zend Framework, or maybe even ASP.NET MVC. Does it make sense to try and design my application in such a way that it is loosely coupled to its framework, or is the framework too integral to make this realistic? The only reason I ask is because it came up in conversation with a peer recently, who criticized my pie in the sky idea of loosely coupling my application to F3.