title: Semantic coupling vs. large class

text: I have hardware I communicate with via TCP. This hardware accepts ~40 different commands/requests with about 20 different responses. I've created a HardwareProxy class which _has a_ TcpClient to send and receive data. I didn't like the idea of having 40 different methods to send the commands/requests, so I started down the path of having a single SendCommand method which takes an ICommand and returns an IResponse, this results in 40 different SpecificCommand classes. The problem is this requires semantic coupling, i.e. the method that invokes SendCommand receives an IResponse which it has to downcast to SpecificResponse, I use a future map which I believe ensures the appropriate SpecificResponse, but I get the impression this code smells. Besides the semantic coupling, ICommand and IResponse are essentially empty abstract classes (Marker Interfaces) and this seems suspicious to me. If I go with the 40 methods I don't think I have broken the single responisbility principle as the responsibility of the HardwareProxy class is to act as the hardware, which has all of these commands. This route is just ugly, plus I'd like to have Asynchronous versions, so there'd be about 80 methods. Is it better to bite the bullet and have a large class, accept the coupling and MarkerInterfaces for a smaller soultuion, or am I missing a better way? Thanks. ## Possible Solution Based on DXM's response this is what I came up with:               struct Proxy     {        template<class C, class R>        ICommand<C, R>* CreateCommand()        {           return new C(this);        }             void Send(std::string s)        {           //tcp send here for now print command name           cout << s << endl;        }     };          template<class Derived>     struct IResponse     {};          struct DerivedResponse1 : IResponse<DerivedResponse1>     {        std::string GetValue()        {           return "DerivedResponse1";        }     };          template<class Derived, class Response>     struct ICommand     {     protected:        Proxy* pProxy;     public:        Response* Send()        {           std::string msg = "Sent: " + static_cast<Derived*> (this)->GetName();           pProxy->Send(msg);           //wait for future here           Response* pResponse = new Response; //replace with future value           return pResponse;        }     };          struct DerivedCommand1 : public ICommand<DerivedCommand1, DerivedResponse1>     {        DerivedCommand1(Proxy* pProxy)        {           this->pProxy = pProxy;        }             std::string GetName()        {            return "DerivedCommand1";        }     };          int main()     {        Proxy proxy;             ICommand<DerivedCommand1, DerivedResponse1>* pDerivedCommand =                 proxy.CreateCommand<DerivedCommand1, DerivedResponse1>();        DerivedResponse1* pDerivedResponse = pDerivedCommand->Send();        cout << "Received :" << pDerivedResponse->GetValue() << endl;             return 0;     }      How does that look? It seems like I may not even need the IResponse interface, we'll have to see when I implment it. I realize there is a lot of important stuff missing, like the futures, but I wanted to get the template stuff down first. What do you think of passing in the proxy to the command? Also what about having the send in the ICommand as opposed to writting it for every command? Am I violating any other OO principles? Thanks.


title: Coding user rights

text: Imagine a system which has a number of functions and a number of users. A user must have rights to a specific function. Users may belong to a group. A group may belong to a group. So as a simple illustration, user A has rights to function 1 and 2. User b has rights to function 2 and 3. User A is in group1 which has rights to function 3, but negative, i.e. explicit denied access to function 1. For extra complexity, perhaps the function has default rights. So you can say, but default everyone has access to function a, or no one has access to function a. I guess it's the same as having an Everybody group. So the question is how are you managing user rights? Do you make all rights additive? Do you allow the explicit denied I mention at the end? Do you have a system where the most access possible is granted or the least? Do you make user rights trump group rights, or vice versa? I've seen a number of variations for applying rights. I'm now defining my own and I'm really looking for any experience you have in that area where you wish you'd done something different, or were delighted you chose a particular way of doing things. Thanks


title: How to become a professional web developer from a C/C++ programmer?

text: I am currently a high school student and know how to use Pascal and C/C++ to take part in competitions such as the Informatics Olympiad. I have learned data structures and many algorithms to solve various kinds of problems. Now, I want to move on to become a web developer. However, I know web development is quite different from competitive programming. To make a web application, I have to master HTML, databases, back-end programming etc. But these all look like separate pieces of information. I don't know where to start and what order should I follow. Anybody who can give a comprehensive list of learning points? I know there are HTML, Ruby on Rails, CSS and Javascript. What else? More importantly, can someone give a brief outline of their relationship?


title: Are Django forms violating MVC?

text:
I just started working with Django coming from years of Spring MVC and the forms implementation strikes as being slightly crazy. If you're not familiar, Django forms starts with a form model class that defines your fields. Spring similarly starts with a form-backing object. But where Spring provides a taglib for binding form elements to the backing object within your JSP, Django has form widgets tied directly to the model. There are default widgets where you can add style attributes to your fields to apply CSS or define completely custom widgets as new classes. It all goes in your python code. That seems nuts to me. First, you are putting information about your view directly in your model and secondly you are binding your model to a specific view. Am I missing something? EDIT: Some example code as requested. Django:               # Class defines the data associated with this form     class CommentForm(forms.Form):         # name is CharField and the argument tells Django to use a <input type="text">         # and add the CSS class "special" as an attribute. The kind of thing that should         # go in a template         name = forms.CharField(                     widget=forms.TextInput(attrs={'class':'special'}))         url = forms.URLField()         # Again, comment is <input type="text" size="40" /> even though input box size         # is a visual design constraint and not tied to the data model         comment = forms.CharField(                    widget=forms.TextInput(attrs={'size':'40'}))      Spring MVC:               public class User {         // Form class in this case is a POJO, passed to the template in the controller         private String firstName;         private String lastName;         get/setWhatever() {}     }               <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>          <form:form commandName="user">

                   First Name:	                                      <form:input path="firstName" class="special" />

                   Last Name:	                   <form:input path="lastName" size="40" />

                                          <input type="submit" value="Save Changes" />

       </form:form>


title: Delphi Build Server - Do I need to check in .dres files?

text: We're using final builder to build a Delphi project and the person managing the build server noticed that projects with no .dres files were not building because they're not in SVN and because they're not in SVN they're not on the build machine. So he put them in SVN. I'm a little skeptical about the necessity of putting them in SVN though. For one thing, if they're needed by the build server then they're not being built by the build server and we're not really creating the build in one step since we're using pre-compiled code (I might as well just check in my DCU's, tear off my beard and return my Delphi-4-Ever allegiance card). I see in Delphi after compiling a project: ` c:\program files (x86)\embarcadero\rad studio\9.0\bin\cgrc.exe -c65001 "PROJResource.rc" -foPROJ.dres ` Those files are produced by brcc32 compiling an RC file. I'd say, well just add that line to the build server, but `PROJResource.rc` isn't in SVN either! `PROJResource.rc` is automatically generated by Delphi from adding things using the project manager and I never noticed it so I never added it to SVN and no one else complained (I think the .dproj file is behind this). The RC files that I wrote myself are in SVN though. So... what's the best way to fix this, just check in the PROJResource.rc or is there something else we can be doing to streamline this?


title: Transactional database and Datawarehouse on the same Postgresql cluster?

text: Is it conceptually feasible to have on a Postgresql Cluster a transactional database and at the same time a datawarehouse that would get feeded by the transactional database ?


title: How to be up to date with the LAMP platform?

text: Most of times I get to know about the new features too late. It is okay at least I know about them does not matter from where I know But I feel it is too late to know about those features. I am working on LAMP platform and I want to keep myself up to date with the new things, anything happening new with LAMP. Can you please let me know what resources should I use? What groups should I follow? From where I can get the latest updates about any activity, event and feature about LAMP?


title: Looking for an open source project in Python

text: I am looking for practical tasks to get experience with Python. Just reading the books and not doing any tasks in the language is not effective. I solved some problems on the Project Euler and TopCoder and it helped me to learn the syntax of the language better. But those tasks are hard algorithmically, but as a rule is quite simple from the point of view of programming. Now I'm looking for an interesting open source project in Python, participation in which will help me to better understand the OO-model of language. Although, this is my first step with Python, in general, I am an experienced programmer and I can be useful for a project. May be someone can suggest something?


title: What is detailed design? what are the advantage disadvantages using it?

text: Im really not getting the idea:   1. What is Detailed Design.   2. Why use Detailed Design.   3. Advantages/Disadvantage of using Detailed Design.   4. Any alternative methods other than using Detailed Design. Could some one please guide/explain me ?


title: What do I call people who extend my class in base class documentation?

text: Been calling them "implementers", but it seems weird to me.               /// <summary>     /// Implementers should implement this.  Derp     /// </summary>     protected abstract void InternalExecute();      A point of clarification, I'm interested in what to call the **people** who create child classes, not the child classes themselves. "Hey, you there" not "that thing there."


title: How to store multiple requirements with OR and AND?

text: Well I'm working on a personal project that needs to check if a user has met certain requirements, and they come in a form of Requirement: [c1 OR c2] AND [d1 OR d2] Requirement: [c1 AND c2] OR [d1 AND d2] Requirement: c1 AND any dn(n can be any integer) I'm just not sure how to store these sorts of requirements, I'm thinking of using another object to hold c1,c2,d1,d2....dn and OR, but that seems like a roundabout way of doing things. Is there a better method?


title: What is the best way to implement different views of one resource in RESTful manner?

text: Imagine, there is a resource, for example event. User is able to get list of events in HTML format. He should be able to view that list in two ways: as a list and as a calendar. How the API should respond to this options? The simplest approach, I think, is to pass some parameter to index action to determine which type of presentation to use, but I don't like it. Don't know why, it is not RESTful for me. What do you think, do I misunderstood something and should keep things simple or there is a better approach?


title: Where does Microsoft currently stand on dynamic languages?

text: With languages Python and Ruby still having a good foothold in the market what is Microsoft's current stance on dynamic languages? Does Microsoft have any plans to incorporate or invent it's own dynamic language?


title: Using a back-end mechanism to copy files to DB and notify the application

text: This Scenario: User copies large files to a local folder. I want to watch that folder and when a new file is dropped then go and copy it to Database, so later when coping is done I can actually use it in my application. ( A C# WinForms App). It would be awesome to also find a way to somehow get notified in the Application that hey copying the file to DB is finished and ready for use... I am using C#.net, Windows... What solutions/architecture do you suggest for this? For example having a windows service running all the time watching that folder, when something copied goes and write it to DB ... then how about getting notified? MSMQ is something I can use? don't know much about it yet. Thanks.


title: How do you manage projects left over by other employees?

text: It happens that some one just leaves the company all of sudden. Now his work needs to be completed and you are being assigned it. Having no idea what was he up to (was it 90% done or 9%), how do you manage the leftover?   1. Shall I start from scratch? What if it was 90% done?    2. Shall I try and understand whatever he has done? What if it was just nonsense?


title: Is my application secure enough

text: first of all, I don't have any code to display in my question here, because I'm still designing the application structure, so i only got design developed. I'm building a phone application that I'm trying to make as secure as possible, i know it's not that necessary on application that is the size of mine, but still, good practice. My app is on Angular with phonegap, server side is accessible through https and is nodejs with mongoDB, is a stateless server, restful api. Once the user is logged in (using user and password or facebook), a session id is stored on the client side (angular cookies) and is required with each access to the server (checking if there is a user logged in with that session id). I also heard about form tokens so i implanted that - On each form that in the end will send a request to the server (for example, changing user information and hitting save) it will also require a form token, random value that is generated for the session on building the form - onLoad function that calls the server to generate a specific form token. Seems pretty cool, but still not sure if it any good. By thinking of it, someone can call my restful method to generate any form token he wants using session id he found (by brute forcing or whatever), and then call any other restful method to change anything for that user.. also, my server should be limited to be accessed only from the application...can't restrict origin because the IP changes from phone to phone...what are the restriction my server should have? I am a starter at security for web apps and any advice, explaining and help would really help! is my application secure enough?


title: Why do Git/Mercurial repositories use less space?

text: I've read on several discussions here and on SO that DVCS repositories use about the same or less space than their centralised counter-parts. I may have missed it, but I haven't found a good explanation of why that is. Anyone know?


title: How to design a domain entity that uses a dependency to manage a state field?

text: I'm new to DDD and IOC/DI and I'm having some trouble figuring out how to design an entity that needs to use a state pattern to manage its status. As the transitions are somewhat complicated, I'm using a finite state machine (FSM) to handle the states (I'm using Stateless). To further complicate the situation, the FSM needs to be loosely coupled to an entity. I.e. while I know that the state of the entity must be handled by a FSM, I don't necessarily know exactly what the FSM is (i.e. the entity doesn't know what states/triggers/transitions it might go through). The users use the term workflow to define the FSM (state, triggers, transitions, rules etc). The workflow changes independently of the entity. They might want to add new states, change rules, triggers etc. independent of any changes to the entity. I'm handling this by dynamically loading an assembly that contains a definition of the FSM (which implements a known interface), then using a service that is injected into the entity, the entity calls the service and gets the FSM it is using. This involves potentially loading assemblies, caching the factory that creates the FSM and then assigning the FSM that is in the appropriate state to the entity. Finally, the FSM can return the set of valid triggers that can be provided to the UI so one of the those triggers can be selected and fired. The actual workflow in completely encapsulated externally to the entity. So, currently I'm my entity looks something like this:               public class EntityUsingWorkflow     {       private readonly workflowService;            public Order(IWorkflowService service, string workflowKey, string status)       {         this.workflowService = service;         this.WorkflowKey = workflowKey;         this.Status = status;              // Note that the two lambdas are used to retrieve         // and set the state on the entity.         this.Workflow = service.GetStateMachine(workflowKey, () => this.Status, stateValue => this.Status = statValue );       }             public string WorkflowKey { get; set; }       public IStateMachine Workflow { get; private set; }       public string Status { get; private set; }          }      I'm concerned with this design. My basic understanding is that domain entities should not have dependencies injected into them, yet here I am injecting one. I also understand that the entity needs to handle its own state, so I'm hesitant to move the workflow completely out of the entity. Other ideas I've had, like an init method, would just move the injection to method injection. What would be a clean way to design an entity with these requirements? Is it OK to inject a dependency in this situation?


title: Is it legal / moral to republish oss project of an author that does not respond?

text: I have found a small oss project (one file) in someone's blog a few months ago. The license is "Attribution-ShareAlike 2.5 Generic". I sent a mail to the author if I can put this in github but got no response back. Meanwhile his blog has been shut down. I am not a lawyer, but this seems legal to republish the code (with appropriate attribution) in github. Am I right? Is this moral? Maybe the guy just wants to disappear for a while...


title: How can I distribute a unique database already in production?

text: Let's assume a successful web Spring application running on a MySQL or PostgreSQL database. The traffic is becoming so high and the amount of data is becoming so big that a distributed database solution needs to be implemented to address scalability issue. Let's also assume this application is using Hibernate and the data access layer is cleanly separated with DAOs. Ideally, one should be able to add or remove databases easily. A failback solution is welcome too. What would be the best strategy to scale this database? Is it possible to minimize sharding code (Shard) in the application?


title: I read Pro ASP .NET MVC 2 Framework - anything else for AJAX in MVC 2?

text: I read Pro ASP .NET MVC 2 Framework to try and learn the ASP .NET MVC Framework, but I'm really struggling with Ajax in MVC even after going over that chapter again and again. I seem to have a decent grasp on MVC 2 without Ajax. I used the Ajax controls from ASP .NET (non-MVC) and am used to user controls in update panels. I have somewhat complicated objects with nested sets of objects on my website, and trying to update them from the client side and keep their nested array indexes ordered is killing my brain. Having little familiarity with web scripting in general and Javascript / jQuery / JSON in specific isn't helping. Is there anything else I could read that might help me get a better grasp of Ajax in MVC? Is Ajax poorly supported in MVC 2, or am I just struggling because I have huge holes in my understanding of the web due to the WebForms- ish style of the old ASP .NET? Hoping for the latter . . . my own ignorance can be fixed.


title: Is it possible to modify Lamport's mutual exclusion algorithm to work without a FIFO guarantee?

text: I'm trying to implement a modified version of the Lamport Mutual Exclusion algorithm. The original algorithm assumes FIFO message ordering between connected systems, but I would like to use ~~UDP~~ a protocol which does not guarantee FIFO. Is it possible to modify this algorithm to work without FIFO? EDIT: Forget UDP. Just assume it is some protocol where the only problem is that FIFO is not guaranteed. That is the only problem I'm concerned with right now.


title: Should a programmer take writing lessons to enhance code expressiveness?

text: Given that programmers are authors and write code to express abstract thoughts and concepts, and good code should be read by other programmers without difficulties and misunderstandings, should a programmer take writing lessons to write better code? Abstracting concepts and real world problems/entities is an important part of writing good code, and a good mastery of the language used for coding should allow the programmer to express his thoughts more easily, or in a better way. Besides, when trying to write or rewrite some code to make it better, much time can be spent in deciding the names for functions, variables or data structures. I think this could also help to avoid writing code with more than one meaning, often cause of misunderstanding between different programmers. Code should always express clearly its function unambiguously.


title: Where does Java get its SOA reputation from?

text: I see lots of SOA books surrounding Java and have always had the subliminal notion that Java is the "right" language for robust/enterprisey SOA, even though I know what SOA involves and that it is perfectly possible using other languages & frameworks. What _exclusive_ traits Java has that other languages/platforms don't, that makes it so popular for SOAs?


title: How well do free-to-open-source-projects policies work in practice?

text: In comparison with an open source license and requesting donations, is a free- for-open-source-projects (or free for non-commercial developers) closed source and otherwise commercial project likely to get more license fees? Or just to alienate potential users? Assume the project has value to programmers - I'm looking for generalizations here, though specific examples comparing existing projects will be very interesting. What I have in mind involves code generating programming utilities. And one issue I can think of, either way, is a near total inability to enforce any license restrictions. After all, I can't go around the internet demanding that everyone show me their source code just in case!


title: Is it possible to migrate struts/spring based application to GWT?

text: I am using the combination of spring, spring-security, struts and iBatis in my application. Now I am looking to migrate the struts UI to GWT. The new combination must be spring, spring-security, GWT and iBatis. I applied a layered approach to develop my application. In Controller/UI layer i am using Struts. I want to replace struts and use GWT in Controller/UI layer. Is is possible to use GWT without affecting another layers DAO/BL/SL?


title: What is an integration test exactly?

text: My friends and I have been struggling to classify exactly what is an integration test. Now, on my way home, I just realised, that every time I try to give a real world example of an integration test, it turns out to be an acceptance test, ie. something that a business person would say out loud that specs out what the system should be delivering. I checked the Ruby on Rails documentation for their classification of these testing types, and it's now completely thrown me. Can you give me a short academic description of an integration test with a real world example?


title: How to suggest changes as a recently-hired employee?

text: I was recently hired in a big company (thousands of people, to give an idea of the size). They said they hired me because of my rigor and because I was, despite my youngness (i'm 25), experienced as a C/C++ programer. Now that I'm in, I can see that the whole system is old and often uses obsolete technologies. There is no naming convention (files, functions, variables, ...), they don't use Version Control, don't use exceptions or polymorphism and it seems like almost everybody lost his passion (some of them are only 30 years old). I'd like to suggest somes changes but i don't want to be "the new guy that wants to change everything just because he doesn't want to fit in". I tried to "fit in", but actually, It takes me one week to do what I would do in one afternoon, just because of the poor tools we're forced to use. A lot my collegues never look at the new "things" and techniques that people use nowadays. It's like they just given up. The situation is really frustrating. Have you ever been in a similar situation and, if so, what advices would you give me ? Is there a subtle way of changing things without becoming the _black sheep_ here ? Or should I just give up my passion and energy as well ? Thank you. ## Updates Just in case (if anyone cares): following your precious advices I was able to suggest changes and am now in charge of the team that must create and deploy Subversion :D Thanks to all of you !


title: Should I be a good programmer immediately after college?

text: > **Possible Duplicate:**   >  I've graduated with a Computer Science degree but I don't feel like I'm > even close to being an expert programmer I recently graduated from university, and I have since then joined a development team where I am by far the least experienced developer with maybe with a couple work terms under my belt. Meanwhile, the rest of the team is rocking 5-10 years experience. I was a very good student and a pretty good programmer when it came to bottled assignments and tests. I have worked on some projects with success, but now I'm working with a much bigger code-base, and the learning curve is much higher. I was wondering how many other developers started out their careers in teams and left like they sucked. When does this change? How can I speed up the process? My seniors are helping me but I want to be great and show my value now.


title: How much inconsistency arises from Javascript's high flexibility?

text: I'll admit it, I haven't yet mastered the language, but my experience with it tells me that Javascript is a highly flexible language, allowing prototypal inheritance, dynamic typing, functions as first class citizens and so many more cool stuff. I think such features bring some inconsistencies, but that's nothing new, most people would agree with me. I wanted to discuss specific examples that have been annoying me, like "for in" loops:               for(var role in rolesToAdd){                     if(rolesToAdd.hasOwnProperty(role)){                         // for body                     }     }      Why should I need to do this? Doesn't this break the concept of classes and inheritance? I might not want to loop through the whole prototype, but what if I still need some of the attributes/methods from an object's direct parent, for example? Also, I would be most grateful if someone could explain me why the interpreter doesn't allow synonymous global/local variables to share the same scope, when there is certainly a way it could distinguish one from the other. Like in:               var foo = function() {             var wth = bar();             var bar = wth;             // body...     }();          function bar(){         return 'bar mitzvah';     }      You can see that, even though our local bar has been declared after the call to our global bar, bar's value in foo's scope will always reflect the local bar, which will hold 'undefined'. Isn't that a strange behavior? I would love if senior Js programmers enlightened me on this and showed me what is gained from these seemingly strange features and if the disadvantages I mentioned here are valid.


title: Best Practices for Renaming, Refactoring, and Breaking Changes with Teams

text: What are some Best Practices for refactoring and renaming in team environments? I bring this up with a few scenarios in mind:   1. If a library that is commonly referenced is refactored to introduce a breaking change to any library or project that references it. E.g. arbitrarily changing the name of a method.   2. If projects are renamed and solutions must be rebuilt with updated references to them.   3. If project structure is changed to be "more organized" by introducing folders and moving existing projects or solutions to new locations. Some additional thoughts/questions:   1. Should changes like this matter or is resulting pain an indication of structure gone awry?    2. Who should take responsibility for fixing errors related to a breaking change? If a developer makes a breaking change should they be responsible for going into affected projects and updating them or should they alert other developers and prompt them to change things?    3. Is this something that can be done on a scheduled basis or is it something that should be done as frequently as possible? If a refactoring is put off for too long it is increasingly difficult to reconcile but at the same time in a day spending 1 hour increments fixing a build because of changes happening elsewhere.   4. Is this a matter of a formal communication process or can it be organic?


title: Refactoring jQuery spaghetti code to use DDD

text: Most of my client side code ends up as a long script in one file the mostly looks like this:               <script>     function someFunction1(){/*...*/}     function someFunction2(){/*...*/}     ...     var globalVariable1;     var globalVariable2;     ...     $(function(){          $('selector1').click(function(){         //get relevant data from various DOM elements              //some business logic rules and validation              //open dialog box              //more business logic rules and more validation              //post an ajax request              //update the DOM         });          //many other events          //many jQuery dialogs         });     </script>      It's a maintenance nightmare. Although I use a well designed server-side structure using DDD (application services, domain sevices, value objects,...etc.) I have had little luck structuring my client code to a better separation of concerns. I'm not building a client-side application. I just use jQuery intensively for the client side. How should I approach the code structure to apply DDD client-side wide?


title: What programming related tasks can you do with a "dead" brain?

text: Here is my problem: programming (learning about programming, coding, etc) is my hobby. I do it in my freetime.   I have a full time job, which literally drains my brain (no kidding!) by the end of the day so much I can't even add three-digit numbers, but I still want to do some programming-related things. Learning in this state is stupid, finding bugs is impossible. Writing unit test worked sort-of :D   I understand that programming is a very conscious activity, but I need to get my job done every day and I still want to deal with some programming-related stuff, as it's very fun to me. What do you suggest ?   I tought about watching videos, but what topic should I looking for with this state of my mind (which are easy to understand but I can still learn a lot from them) ?   (I can't do it before work, as it is far more important to be fresh there than during my hobby...) Edit: The question need a bit of addition, which I left off intentionally at first, because I tought my question is clear.   I have no problem at all with my brain activity or anything like that, the "brain drain" cause is that I do 9-10 hours _very intense_ mental job a day (much more intense than for example programming or thinking about solving problems), with only less than 5 minutes pause every hour. It is not possible to change it or pause more or think less (huh?!) between those working hours.


title: Sprint Meetings - What to talk about

text: In work we have just started using the Scrum methodology, it is working well but I have a question on the daily sprint meetings. We set aside 15 minutes for the meeting (between the three devs and the scrum master if we think he is needed) but I have found that we have normally finished by 5 minutes. This might be because we have said all that needs to be said but I was wondering what people tend to talk about in them, in case we are missing something. For the record we normally update each other on current objective, troublesome previous objectives and plans for the rest of the day (including if we will not be available on that project).


title: What techniques are there for debugging remote client side errors?

text: What techniques are there for debugging remote client side errors in a web application, especially when they only affect a small subset of users? In my case we have an app that is working well for hundreds of users, internally and externally, but a handful (12) have a specific problem with a JavaScript that prevents them from using the site. We have screenshots of the error, have confirmed they have no server side errors, confirmed that everything is getting rendered to the browser correctly, have seen the specific error in the IE console, but still have no idea why it isn't working for these specific users. The issue is exhibiting on different versions of IE. We have never been able to replicate the problem here. I'm not looking for a solution to my problem here, but rather what are the steps you would take to solve this kind of problem, and what tools there may be that might help?


title: Apply filter in Kafka Queue

text: Is it possible to apply a filter on the Kafka stream of topic? What I want to do is filter out messages while consuming and then run some custom logic on top of it. It is a sort of thing that Storm trident allows us to do ( apply filter on the stream ). What I've found so far is I can create a trident topology and do the filtering but would be of great benefit if I can filter out the stream itself, as it will reduce the amount of traffic at my consumer's end. I know this is crazy but could this be a valid approach? Please correct me if I am wrong.


title: C++ Interview question

text: This problem was given to me on previous job interview test. It is over now, but I would like to go through my mistakes and hopefully be more prepared next time!               // Identify as many bugs and assumptions as you can in the following code.     // NOTE that there is/are (at least):     // 1 major algorithmic assumption     // 2 portability issues     // 1 syntax error          // Function to copy 'nBytes' of data from src to dst.     void myMemcpy(char* dst, const char* src, int nBytes)     {          // Try to be fast and copy a word at a time instead of byte by byte              int* wordDst = (int*)dst;         int* wordSrc = (int*)src;         int numWords = nBytes >> 2;         for (int i=0; i < numWords; i++)         {             *wordDst++ = *wordSrc++;         }              int numRemaining = nBytes - (numWords << 2);         dst = (char*)wordDst;         src = (char*)wordSrc;         for (int i=0 ; i <= numRemaining; i++);         {             *dst++ = *src++;         }     }      All I found was a syntax error on line                   for (int i=0 ; i <= numRemaining; i++);      Also the first for loop looks fishy. Can you guys find any other mistakes?


title: Programming languages with these features

text: I've got a small project coming up where I can choose any language I want. My team prefers the feeling of safety we get from static typing. In our experience, dynamically typed languages can be more difficult to maintain (we feel they are too "magic"). The usual choice would be Java, but our team is expressing interest in the conciseness and flexibility provided by features of some of the other languages such as Python and Ruby. Based on my team's interests, I need some help evaluating which language to use. Ideally, the language would support these features:   * Statically typed,   * Properties or some form of the Uniform Access Principle,   * First-class functions,   * Anonymous functions (less important). Bonus points for languages that:   * Aren't dependent on Microsoft or any specific operating system.   * Have a non-JVM implementation.   * Have an ORM.   * Have a web development framework. Apart from these criteria, I'd still love to know more reasons why to choose the language(s) in your answer, and any experience you've had with them. Hopefully the answers here will be useful to anyone else that wants to evaluate some alternatives to Java without blindly switching another popular language such as C#. _*Edit: My question was closed due to how poorly I communicated my question before. I hope that I have cleared things up since I got the question re- opened. By the way, I've put my own research into a community wiki answer below, so don't think I haven't done any homework. ;-)_


title: Where are all the DBAs?

text: For some reason I got thinking the other day about DBAs and what they do. This thread goes some way to answer this question, but then I looked up the leading jobs site in my area out of curiosity, and it seems like there are more Oracle DBA jobs around than many other technology specialties. Even relatively common-sounding ones, such as "Java Developer" or "Network Administrator". Here's the thing: I've been in this industry for ten years, worked in several jobs (a couple in fairly large corporate shops too), and I've never actually seen a real live DBA. There was usually a self-taught "database guru" around who was the goto guy for database issues (otherwise employed as a developer like the rest of us), but I've never seen anyone in an official DBA role, anywhere, ever. So, where are all the DBAs? I'm guessing that since all the places I've worked so far were relatively application-oriented, I've just never experienced a very hardcore DB-heavy environment. At the same time, at least one of the jobs I've had seemed like a pretty extreme data-centred operation (real time market/trading systems, huge databases), and even here the only "database people" were these "developers who were database gurus on the side". No official DBA roles. Is it really just a case of me never having been in the kind of environment where DBAs are needed? If so, what kind of environment is that? Is this phenomenon perhaps to do with data centres being separate/outsourced operations these days, so most application level programmers just don't see them anymore? **Note:** I am basically trying to understand where the separation between "developers who know databases well" and actual DBAs is. It seems like a lot of dev roles require some pretty hardcore database knowledge these days (and that most development teams - even in quite DB-heavy environments - get by without an official DBA on staff). ie Please don't close or move to dba.SE.


title: Javascript: Anonymous functions

text: How do I turn this definition of an anonymous function, An anonymous function is a function that is assigned to a variable. Anonymous functions are also used when you want to perform a short and straight forward task, into an analogy?


title: Natural Language to Search Criteria - Date Ranges

text: Consider an application that stores a set of records that contain:   * Description   * Cost   * Purchase Date I'd like to be able to allow users to utilize natural language to search the dataset. For example, the search expression: > blue from last month less than $20 would translate into (Linq as an example only - correctness of the query is not in question):               _db.Widgets.Where(w => w.Description.Contains('blue') && w.PurchaseDate >= DateTime.Now.AddMonths(-1) && w.Cost < 20)      I'm struggling to find a starting point. Any resources to get me in the right direction would be appreciated (I am working in .NET).


title: Which contract work type provides the most stability while offering flexibility?

text: I tried my best to frame this question in such a way that it will help others out there who are curious about the same thing as I am. I am currently a full time C++ programmer. I also do a little bit of C#/.NET programming as well. I have over 4 years of experience total. I have looked into the possibility of doing contract programming. I am looking to avoid having to be stuck on one team/project forever. I am single, have no kids, and have enough money saved up to last over a year without an income. I live in one of the biggest cities in the U.S. I know there are different types of contract work, such as W2, independent, contract-to-hire, etc. I'm looking to work on contracts that last 6 months to a year. I would like to avoid having to do most of the marketing/overhead work myself and just want to do the programming work. I thought about getting contract work through different agencies and they would get a cut of the pay for doing the searching/overhead work for me. I just feel so stuck in my current job and want the freedom of working on a variety of projects and have some flexibility in hours and location (whether it's working at home or at another office). I have no desire to move up to management or navigate through office politics every day. What would be the best option for someone in my situation? W2 contracts through an agency? I wouldn't mind getting a little less pay as long as someone would take care of most of the marketing/overhead work involved.


title: Java Communcation API not available for Windows

text: I want to write a program in Java using RS-232. But I am unable to find the java.comm Package for the windows. Which library should I use for this purpose? http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive- downloads-misc-419423.html The only package avaiable here are not for Windows. Can you please guide me as I am new to this kind of development. Using rxtx + java I got this code from the internet               import java.util.Enumeration;     import gnu.io.CommPortIdentifier;     public class SimpleWrite      {     public static void main (String args[])     {              Enumeration port_list = CommPortIdentifier.getPortIdentifiers();         System.out.println(port_list);              while (port_list.hasMoreElements())         {             CommPortIdentifier port_id = (CommPortIdentifier)port_list.nextElement();                  if (port_id.getPortType() == CommPortIdentifier.PORT_SERIAL)             {                 System.out.println ("Serial port:" + port_id.getName());             }             else if (port_id.getPortType() == CommPortIdentifier.PORT_PARALLEL)             {                 System.out.println ("Parallel port:" + port_id.getName());             }             else                 System.out.println ("Other port:" + port_id.getName());         }     }      }      But this code gives me error of gnu.io.rxtx.properties has not been detected.


title: Do frameworks put too much abstraction?

text: I've been programming for a little under a year and have some experience writing systems applications, web apps, and scripts for businesses/organizations. However, one thing I've never really done is working with a framework like Django, Rails or Zend. Looking over the Django framework, I'm a little frustrated with how much is abstracted away in frameworks. I understand the core goals of DRY and minimal code, but some of this over-reliance on different modules and heavy abstraction of core functions feels like it:   1. Makes programs get dated really fast because of the ever-changing nature of modules/frameworks,   2. Makes code hard to understand because of the plethora of frameworks and modules available and all of their idiosyncrasies,   3. Makes code less logical unless you've read all of the documentation; i.e., I can read through some list comprehensions and conditional logic and figure out what a program is doing, but when you see functions that require passing in arbitrary strings and dictionaries, things get a little hard to understand unless you're already a guru in a given module; and:   4. Makes it difficult and tedious to switch between frameworks. Switching between languages is already a challenge, but it's manageable if you have a strong enough understanding of their core functionality/philosophy. Switching between frameworks seems to be more a matter of rote memorization, which in some ways seems to encourage the very inefficiency these frameworks were designed to eliminate.  Do we really need to put like 50 layers of abstraction on top of something as simple as a MySQL query? Why not use something like PHP's PDO interface, where prepared statements/input testing is handled but the universally understandable SQL query is still a part of the function? Are those abstractions really useful? Isn't feature bloat making them useless, making applications more difficult compared to similar applications written without using a framework?


title: Static analysis, dynamic analysis and testing

text: Based on answers I have received here and then confirmed in some authoritative sources (not ISTQB which seems to be too vague), there are 3 activities:   * Static analysis    * Dynamic analysis    * Testing But is there any reason why we cannot combine all of that as "testing"? I mean, even a dynamic analysis review of a program to look for memory leaks is a kind of testing, right?


title: A little code to allow word substitution depending on user

text: I'm creating a demo web app in html in order for people to physically see and comment on the app prior to committing to a proper build. Whilst the proper app will be database driven, my demo is just standard html with some JavaScript effects. What I do want to demonstrate is that different user group will see different words. For example, imagine I have an html sentence that says: > This will cost £100 to begin. What I need to some way of identifying that if the user has deemed themselves to be from the US, the sentence says: > This will cost $100 to begin. This requirement is peppered throughout the pages but I'm happy to add each one manually. So I envisage some code along the lines of 'first, remove the [boot US] trunk' where the UK version is 'first remove the boot' but the code is saying that the visitor needs the US version. It then looks up boot (in an Access database perhaps) and sees that the table says for boot for US, display 'trunk'. I'm not a programmer but I can normally cobble together scripts so I'm hoping someone may have a relatively easy solution in JavaScript, CSS or ASP. To recap: I have a number of words or short sentences that need to appear differently and I'm happy to manually insert each one if necessary (but would be even better if the words were automatically changed). And I need a device which allows me to tell the pages to choose the US version, or for example, the New Zealand version.


title: Streamlining ASP.Net MVC deployment?

text: I own a VPS with Windows Server 2012 on it. I can install whatever I want on it. In the past when deploying an ASP.Net MVC project, I would right click the project in the solution and `Publish` it. I would then copy over the files to the IIS folder and that would be a `deployment` for me. But this is no longer something I want to do. There has to be an easier way right? How can I streamline the deployment process? I'm 100% in the dark on this subject with .NET. Can I set something up on my server so I can `Web Deploy` to my VPS? Or is there a better alternative? Thank you!


title: solve TOR edge node problem by using .onion proxy?

text: I would like to improve the TOR network, where the exit nodes are a vulnerability to concealing traffic. From my understanding, traffic to .onion sites are not decrypted by exit nodes, so therefore - in theory - a .onion site web proxy could be used to further anonymize traffic. Yes/no? perhaps you have insight into the coding and routing behind these concepts to elaborate on why this is a good/not good idea.


title: ACID compliant Database that isn't NoSQL?

text: I'm not necessarily asking if a NoSQL database can be ACID compliant, which has been asked here: Is there any NoSQL that is ACID compliant? I'm wondering if we have a database either now or in the future that is wanting or is another option to a traditional RDBMS? I know NoSQL was supposed to be the big thing and RDBMS were supposed to go by the wayside and so forth (I've read I dunno how many articles on it). But that never really solved the issue of data that was very strict and had to be kept consistent (like bank transactions... stuff like that). So when RDBMS was "supposedly" supposed to go to the wayside... what was supposed to replace this Data that had to be strict?


title: Flat organizations vs hierarchical for software development

text: My organization was flat two years ago, and people felt that the general manager had disproportionate almost dictatorial powers. Also the general manager didn't have time to coach employees, so some employees were dysfunctional and nothing was done about them. However on the plus side everyone was involved in the decision making, thus motivation was very high. So what do you think about flat vs hierarchical organizational structures in software development?


title: Understanding clojure keywords

text: I'm taking my first steps with Clojure. Otherwise, I'm somewhat competent with JavaScript, Python, Java, and a little C. I was reading this artical that describes destructuring vectors and maps. E.g.               => (def point [0 0])     => (let [[x y] point]     =>   (println "the coordinates are:" x y))     the coordinates are: 0 0      but I'm having a difficult time understanding keywords. At first glance, they seem really simple, as they just evaluate to themselves:               => :test     :test      But they seem to be used is so many different ways and I don't understand how to think about them. E.g., you can also do stuff like this:               => (defn full-name [& {first :first last :last}]     =>   (println first last))     => (full-name :first "Tom" :last "Brennan")     Tom Brennan     nil      This doesn't seem intuitive to me. I would have guessed the arguments should have been something more like:               (full-name {:first "Tom" :last "Brennan"})      because it looks like in the function definition that you're saying "no required arguments, but a variable number of arguments comes in the form of a single map". But it seems more like you're saying "no required arguments, but a variable number of arguments comes which should be a list of alternating keywords and values... ?" I'm not really sure how to wrap my brain around this. Also, things like this confuse me too:               => (def population {:humans 5 :zombies 1000})     => (:zombies population)     1000     => (population :zombies)     1000      How do maps and keywords suddenly become functions? If I could get some clarification on the use of keywords in these two examples, that would be really helpful. **Update** I've also seen http://stackoverflow.com/questions/3337888/clojure- named-arguments and while the accepted answer is a great demonstration of how to use keywords with destructuring and named arguments, I'm really looking more for understanding how to think about them--why the language is designed this way and how I can best internalize their use.


title: Am I overusing trees as a model or are they just very common?

text: I'm working on a project and I've found that I've modeled the two largest components as trees. My main uses so far are:   1. Generically model physical containers (and sub containers, sub sub containers etc)   2. Model liquid samples (and sub samples, and sample derivatives - and subs of those, etc) I now need to model some events based on the shipment of samples e.g. collected at location X, when arrive at processing centre do Y It now seems natural to model the events as a tree to denote which events follow on from others. I'm starting to wonder if I am just seeing trees everywhere because I want to, or if its a legit approach? **Edit To Answer Some Points Raised** Everyone seems to agree with trees for the containers. For the liquid samples, although there are various types - what I really need to track is parentage so that given any sample, I can quickly find all things that derived from it in some way. I have been told I can assume that samples will not be combined so all sub samples (or derivatives) will have only 1 parent. As to the events, yeah I think I was just going for a tree for ease. It doesn't make much sense to me after reading comments and further thought. Thanks all for the input.


Are symbolic programming and metaprogramming the same thing? I've always read about symbolic programming while using Mathematica, but I've never searched about it's meaning, I've searched about it today and I found that both concepts are similar, are there any differences?


title: Ever taught yourself drawing/art skills?

text: I often see programmers advise non-tech people that they should 'just learn to code' if they want to execute their big idea, saying it's not that hard to get the ball rolling. However, while as programmers we can be adept at writing websites including backends and CMSs etc., there's still a great need for the thing **to look nice.** Usually we can leverage clipart and templates etc. and do some image editing to get by. But being able to draw original art yourself would be a big advantage I'm guessing. So my question is has anyone here tried to brush up on their art skills to help with the design aspects of their projects? I know some people have 'always' been good at art, or at least been good at drawing since their highschool days, but I'm curious about anyone who went from being bad at drawing, to regularly completing original art work that went into production on a site or application front-end.


title: JIT compiler for C, C++, and the likes

text: Is there any just-in-time compiler out there for compiled languages, such as C and C++? (The first names that come to mind are Clang and LLVM! But I don't think they currently support it.) Explanation: I think the software could benefit from runtime profiling feedback and aggressively optimized recompilation of hotspots at runtime, even for compiled-to-machine languages like C and C++. Profile-guided optimization does a similar job, but with the difference a JIT would be more flexible in different environments. In PGO you run your binary prior to releasing it. After you released it, it would use no environment/input feedbacks collected at runtime. So if the input pattern is changed, it is probe to performance penalty. But JIT works well even in that conditions. However I think it is controversial wether the JIT compiling performance benefit outweights its own overhead.


title: How is JavaScript insecure, and what are the main methods used to deal with that?

text: I just read about Caja, which is a "sanitized" version of JavaScript. But I'm wondering - what is the big problem with JavaScript(it seems so widely used )? Just how dangerous is it?


title: Why I'm not selected in an interview?

text: I'm working in development for 4 years, and 3.5 in PHP - why I don't seem to be able to be selected in an interview. I want to know what special things the interviewer wants to see in candidates - for senior PHP developer roles. Interviewer asks me 10 questions and I'm able to answer only 5. Does selection depend on these things? It doesn't mean that I can't solve the problem, I can google the question, I can ask on forums. Why don't they understand that a man can't remember all the answers for each and every question? Especially programming ones. Please advise.


title: Introducing functional programming constructs in non-functional programming languages

text: This question has been going through my mind quite a lot lately and since I haven't found a convincing answer to it I would like to know if other users of this site have thought about it as well. In the recent years, even though OOP is still the most popular programming paradigm, functional programming is getting a lot of attention. I have only used OOP languages for my work (C++ and Java) but I am trying to learn some FP in my free time because I find it very interesting. So, I started learning Haskell three years ago and Scala last summer. I plan to learn some SML and Caml as well, and to brush up my (little) knowledge of Scheme. Well, a lot of plans (too ambitious?) but I hope I will find the time to learn at least the basics of FP during the next few years. What is important for me is how functional programming works and how / whether I can use it for some real projects. I have already developed small tools in Haskell. In spite of my strong interest for FP, I find it difficult to understand why functional programming constructs are being added to languages like C#, Java, C++, and so on. As a developer interested in FP, I find it more natural to use, say, Scala or Haskell, instead of waiting for the next FP feature to be added to my favourite non-FP language. In other words, why would I want to have only **some** FP in my originally non-FP language instead of looking for a language that has a better support for FP? For example, why should I be interested to have lambdas in Java if I can switch to Scala where I have much more FP concepts and access all the Java libraries anyway? Similarly: why do **some** FP in C# instead of using F# (to my knowledge, C# and F# can work together)? Java was designed to be OO. Fine. I can do OOP in Java (and I would like to keep using Java in that way). Scala was designed to support OOP + FP. Fine: I can use a mix of OOP and FP in Scala. Haskell was designed for FP: I can do FP in Haskell. If I need to tune the performance of a particular module, I can interface Haskell with some external routines in C. But why would I want to do OOP with just **some basic** FP in Java? So, my main point is: why are non-functional programming languages being extended with **some** functional concept? Shouldn't it be more comfortable (interesting, exciting, productive) to program in a language that has been designed from the very beginning to be functional or multi-paradigm? Don't different programming paradigms integrate better in a language that was designed for it than in a language in which one paradigm was only added later? The first explanation I could think of is that, since FP is a new concept (it isn't new at all, but it is new for many developers), it needs to be introduced gradually. However, I remember my switch from imperative to OOP: when I started to program in C++ (coming from Pascal and C) I really had to rethink the way in which I was coding, and to do it pretty fast. It was not gradual. So, this does not seem to be a good explanation to me. Or can it be that many non-FP programmers are not really interested in understanding and using functional programming, but they find it practically convenient to adopt certain **FP-idioms** in their non-FP language? **IMPORTANT NOTE** Just in case (because I have seen several _language wars_ on this site): I mentioned the languages I know better, this question is in no way meant to start comparisons between different programming languages to decide which is better / worse. Also, I am not interested in a comparison of OOP versus FP (pros and cons). The point I am interested in is to understand why FP is being introduced one bit at a time into existing languages that were not designed for it even though there exist languages that were / are specifically designed to support FP.


title: Why would I choose Unity over Autofac

text: I'm looking to start a new application and I want to use Dependency Injection. I have a lot of "Microsoft is the only way to go guys" in our shop so of course Unity is the way they wanted to go. However I am leaning more towards Autfac because of its speed and its Module feature. I found the speed results on this page. If you use Autofac or Unity can you give me some solid reasons not to use Unity and to use Autofac over Unity? If not, can you point me into a good direction to do some research on bringing back to our next meeting?


title: Why do computer architecture textbooks prefer MIPS architecture?

text: I have read a lot of computer architecture textbooks, and I wonder why most of them (if not all) used MIPS as the architecture to teach. Why MIPS and not Intel or AMD or something else? What makes the architecture suitable for teaching?


title: Is adding in the header the license type enough to say: "my code is licensed"?

text: I read on various sites about licenses. I did just put the license type in the header file (in my case a javascript file, open-source):               /*      * "codeName" "version"      * http://officialsite.com/      *      * Copyright 2012 "codeName"      * Released under the "LICENSE NAME" license      * http://officialsite.com/LICENSE NAME      */           javascript code      ...      In the same folder I leave a copy of the license. The listing of the folder looks like this:               * codeName.js     * LICENSE      In the file `LICENSE` is the full text of the license my code uses. What I cannot find anywhere that says is this is enough to say _my code is licensed_ (the case of open-source). Is something more required?


title: Are for loops supposed to be read inward or outward?

text: for (i = 0; i < 3; i++)      {         for (j = 0; j < 4; j++)         {             cout << arr2d[i][j] << "\t";         }             cout << endl;         .....      Like that for example. Do you read the for loop inward-out (starting from `for (j = 0; j < 4; j++)`) or outward-in (starting from `for (i = 0; i < 3; i++)`) Just wondering. :D


title: A question about password storage concept

text: My previous question is here - A question about storing passwords This question is somewhat related to my previous one but with some new doubts. Take for example Windows. I've heard that Windows stores passwords in NTLM hashes somewhere inside the registry (if I'm not wrong). There are programs that crack the NTLM hashes to recover the passwords (brute-force method) in- case you've forgotten them or just want to hack someone's PC. Why don't they just replace the NTLM hashes in the registry with something common like - NTLM hash of 'password'? This was just an example for your understanding. I'm trying to learn, how large programs store, change or verify passwords without any hacker/attacker being able to read them?


title: Is a large increase in velocity realistic in a Scrum environment?

text: My manager has recently really been pushing to use velocity as a target and measure of productivity. We are currently working at an average velocity of 50 story points. My manager wants us to increase it by 40% to 70 story points (with no increase in team members). If we don't achieve this increase he wants us to deliver a full break down explaining why. The whole idea of measuring team performance by velocity and using it as a target seems wrong to me, but I am finding it difficult to explain why. Any help? Why isn't this the right way to measure and incentivize productivity?


title: Implementing User Authentication on an N-Tier Web Application

text: _I appreciate all help and feedback. Parts bolded are critical parts if this is too verbose. Perhaps it will help to mention I am a green developer. I have found some useful info from related questions posted here and on Stack Overflow but nothing that felt 100%._ ## Background Currently at work we are developing a web application with strict constraints set forth by the client. Normally we are a Rails shop, but the client really wanted to work with us. Thus to fit into their architecture we will be using ASP.NET. We are not very experienced with ASP.NET but some of the team including myself have used .NET for desktop applications. This application is three tiered and includes:   * Public facing server(s)   * Web services server(s)   * Data server(s) The client is expecting high demand and they may have multiple servers in any one of the tiers. There is a firewall between every tier. From my understanding this is a very common set up. **A core goal is to minimize trips over the wire from the public facing server to the database.** ## The Problem **How do we handle user authentication without hampering performance on an N-Tier application with potentially many servers at each layer?** ## What We've Done so Far We toyed with the idea of using view state but ultimately felt like this would be a poor idea. Of course we are not opposed to re-visiting view state, but feel that view state offers no benefits over cookies and simply makes it harder for a user to have multiple tabs of our application open. I have been exploring the path of using the default session state with a custom implemented session store. **The default session state tends to generate multiple requests going over the wire. Logging in and out this is okay, but when the user is using the app we do not want this.** The custom session store helps minimize impact, but not by enough. ## Conclusion & Possible Idea Since trips to the database will be inevitable on almost all requests once inside the application, perhaps giving the user a key on successful login is the best way to go. Then when the user requests a new page, or posts a new page we could send that key with the related SQL transaction for the request and validate the key. I believe this will simplify the code base immensely. So to re-iterate the problem: **How do we handle user authentication without hampering performance on an N-Tier application with potentially many servers at each layer?** Does the idea above sound like a solid implementation? Thanks,   Jonathon


title: How to lock items when we do check out in commerce applications

text: I have a specific requirement. Lets say we have 3 items and a user has selected all 3 items to buy. I need to lock the 3 items (meaning the other people who want to buy the same items cannot view it) for around 10 minutes. How do I implement this? I am developing a Java web app using Hibernate and struts.


title: Use a service layer with MVC

text: If a controller gets to fat and model instantation starts to add up a service layer could be used.   * If I just wrap the logic inside a service class I will get a bunch of Services with one/two methods. This feels like a code smell. Any best practice regarding this?   * Can a service instantiate models?   * If a service instantiates models the services can't be unit tested. They can only be covered by integration tests?


title: The best way to store dictionary from file

text: I'm working on a translator in C++. Basically I want to parse the file with translations and store it in my program, so I can **perform search through the words and simply access the corresponding word**. My file will look like that:               word|translation     second word|second translation      etc. It doesn't have to be `|` as delimiter and the word can contain spaces. So after I store it in my program I want to search for a word and get the corresponding word easily. The question is, what is 'the best' way to store this dictionary? Should I use dynamic structures and link them? Maybe vectors? Or should I use two- dimensional array to store the 2 strings? Could you please propose to me how the structure will look like?


title: How can one use git-flow effectively on a project in which more than one major version is being maintained?

text: I've migrated several of my projects over to the git flow work flow, and I'm loving it. However, I haven't found a best practice that keeps things flowing as smoothly when working with a project in which more than one major version is maintained at a time. _Specifically, I'm not maintaining a "free version" and a "paid version" or any other parallel model, I'm talking about a project in which Version 1 gets released, and remains supported with minor versions (1.1, 1.2, etc.) until Version 3 has been released, at which point 2 and 3 would be maintained, until 4 is released...you get the idea._ How have you, or would you, maintain two or more supported versions of a project at once in a gitflow workflow?


title: Dealing with resistance to testing code

text: I've recently switched jobs. At my previous job, everyone wrote tests and we were all in a happy place. In my new role, I've been asked to setup CI and testing. I'm experiencing some resistance to testing from some developers and wondered if anyone had experienced this and had strategies for dealing with resistance?


title: What is meant by "code rot"?

text: Please say that 'code rots' if you don't clean it. What does that mean? Obviously code is text, not an organism that can change itself. So why does code 'rot' if you don't touch it? What makes it 'rot' and what does it actually mean? Please explain, examples would be welcome.


title: code review with git-flow and github

text: With regular git and github I can do a code review by simply creating a pull request of the feature branch I'm working on to the master branch. How would I do code reviews with git-flow? With workflow like "git flow feature finish` I'm confused as to where the code review actually happens and how git-flow or git can facilitate that review.


title: Are there any empirical studies about the effects of commenting source code on software quality, maintainability and developer productivity?

text: I am an advocate of commenting on source code and documenting software products. It is my personal experience and observation that working on source code that is rigorously commented has helped me in different ways when I have had to grow software or maintain it. However there's another camp that says commenting is ultimately worthless or its value is questionable. Numerous proponents of coding without commenting argue that:   * If a piece of code is well-written, it is self explanatory and hence does not need commenting   * If a piece of code is not self-explanatory, then refactor it and make it self-explanatory so that it does not need any comments   * Your test suite is your live documentation   * Over time code and comments get out of sync and it becomes another source of headaches   * Agile says working code is more important than piles of documentation, so we can safely ignore writing comments To me this is just dogma. Again, my personal observation has been that software written by teams of smart and experienced developers ultimately end up with a considerable amount of code that is not self-explanatory. Again, the Java API, Cocoa API, Android API, etc. show that if you want to write and maintain quality documentation, it is possible. Having said all these, conversations about pros and cons of documentation and commenting on source code that are based on personal beliefs usually do not end well and lead to no satisfying conclusions. As such I am looking for academic papers and empirical studies about the effects of software documentation, especially commenting source code, on its quality and maintainability as well as its effects on team productivity. Have you stumbled upon such articles and what's been the outcome of them, if any?


title: How does the ETVDX model fit in with project management?

text: In a lecture, the lecturer described the following model : E - entry (the preconditions to a task).   T - task - doing the task   V - verifying the tasks quality   D - Delivering the tasks   X - Exit.   or ETVDX If anyone is familiar with this 'generic compliance model', how does it fit into software development exactly? I presume it's equivalent to the waterfall model of negotiating requirements > defining/decompose stage > estimating effort > estimating resources > developing schedule.


title: Frog crossing N lane road problem

text: Problem says that: > There are `N` lanes, and the speed of each lane is given. There are many > cars in all the lanes and the start position and the length of each car and > its corresponding lane is given. There is a frog which can do 2 functions: > `wait()` or `jump()`. Find if there is a path for the frog to go from lane > `1` to lane `N` without getting hit by any of the moving cars. I am not able to solve it. I took the data structures `speed[1..n]` to denote speed of cars at `i`th lane, `length[1..n]` denoting length of cars, `start[1..n]` denoting starting position of cars. Then I took starting lane and on the basis of time calculations I decided whether to jump or wait. **My algorithm** : for each lane   1. I will assume that it is safe to jump to the next lane.   2. Then I will calculate the time period within which frog can be hit (time when I will add car length in total distance and time when i will not add car length.)   3. Now if frog will reach to the next lane within that time period then it is good to wait on the current lane.   4. While waiting I will also check whether it will be hit by the car in current lane or not. But in some cases my algorithm will not work. How should I structure my code to solve this problem?


title: How to start competitive programming?

text: I have been practicing coding for a while, but the problem is that it takes me a lot of time to write a solution for the problems. I want to ask if competitive programming can help me in improving this. If yes, then how should I start and from which web sites could I use (like TopCoder)? I obviously won't be able to solve very hard problems for now. What should I do? If no, what else should I do? I also have another problem that I want to learn coding but the thing is that I feel that I am not very good at it. What should I do? It's like bugging me from inside. I know some people may not find this question informative but please at least allow me to get an answer.


title: Why is Invariance, Covariance and Contravariance necessary in typed languages

text: Ok not really sure if I'm right. I only recently learned that I needed to have contravariant interface to be able to pass that interface as a parameter in C# and this feature was only added in .NET 4.0. So obviously there is some reason you can't do this Covariant or Invariant interfaces and it probably has something to do with passing in, getting out the generic class. I'm not really sure what the limitation here is, and know that I've seen where Contravariant interface can be used where the others can't where can I use Covariant (when is that neccesary?). This is all out of curiosity (I'm very interested in programming concepts surrounding some languages). I would love to see (link would be fine) some examples of why it is necessary to use these features, what would break if you would allow covariant/invariant into contravariant scene and vice versa and where each one shines.


title: Is it better to use multiple html pages or just change content on the same page using JavaScript?

text: Is it better to use multiple html pages and link them together with `href` or just change content on the same page using JavaScript? I am thinking of how to layout a page and I don't have a lot of content. It would probably be about three of for pages if I just used all html. If I toggled and swapped bits of html around using JavaScript, I could probably fit it all on one page, and it would be a bit "cooler", in that it's more of an application, dynamic, etc. But I'm just wondering what the best way to go here? Is it horrible to have to much JavaScript "squashed" to one document? How do you know where to draw the line when thinking about this?


title: Are these steps enough to put my bash script under GPL 3?

text: I have written a bash script I would like to put under GPL v3. I've read the GNU documentation on How to Apply These Terms to Your New Programs and How to use GNU licenses for your own software. Still, I'm not quite sure what to put there and which artifacts are needed. So far, I did the following:   1. Put a file called `COPYING` (which contains the license) into the project folder   2. At the beginning of my script, I attached the following to my script: > up is a bash function to simplify vertical file system navigation. > > Copyright (C) 2012 Oliver Weiler > > This program is free software: you can redistribute it and/or modify it > under the terms of the GNU General Public License as published by the Free > Software Foundation, either version 3 of the License, or (at your option) > any later version. > > This program is distributed in the hope that it will be useful, but WITHOUT > ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > more details. > > You should have received a copy of the GNU General Public License along with > this program. If not, see http://www.gnu.org/licenses/. Is this all I have to do? Is putting the licence into a separate file actually needed, if the notice in the script file links to it?


title: Applying for job: how to showcase work done for (private) past clients?

text: I want to apply for my first "real" (read: non-freelance) Ruby on Rails job. I've built several apps already. My best work (also the most logically complicated app) was for a freelance client, and I'd like to show it to potential employers. Only problem is: it isn't online anymore. And I've lost touch with the client. How can I include this work in my portfolio? * * * **About the app:** It's a Facebook game. The client's business idea for this app was not the best. It was never going to make any money. I think it was kind of a vanity side project for him. The logo and graphics are nice-looking, though, and were designed by the client. I've actually spent a lot of time recently recoding most of the app, and adding a full test suite. I want to showcase the BDD / TDD skills I've acquired. * * * I'm not very familiar with the etiquette (/law?) concerning this situation. Can I just put my new version of the app up at a free Heroku URL (perhaps with a "credits" section, where I credit the ideas and graphic designs to my former client)? **NOTE:** Again, this is just to show potential employers. I am **not** trying to market the app as my idea, or attract any users. Can I put some or all of the code on GitHub? What if I don't put the code up publicly, but merely send a tarball to potential employers? Do I need to ask permission from my former client (and what if he says no)? The last thing I want to do is get in any legal trouble, or offend people I'm trying get a job from. But I believe that my work and experience on _this app_ are my highest recommendation for getting a job.


title: What are the disadvantages of starting an opensource project if one is not an experienced programmer?

text: I have lots of ideas for products to be built. The problem is that I have less than a year of professional work experience and I am afraid of getting **judged negatively in the future** based on what I produce now. I have no clue if my code is any good. I am not familiar with any of the coding patterns. All I know is to build products that work. I want to have a public profile in github for my future projects and I will try hard to make sure that it is well commented, is optimized and clean. These are the things that I fear getting exposed publicly:   1. My code may not be highly optimized.   2. Wrong usage of certain libraries or functions which coincidentally get the job done.   3. Not knowing or following any coding pattern.   4. Lots of bugs/ not considering corner, edge cases   5. Fundamental lack of understanding and application of certain concepts such as thread safety, concurrency issues in multi-threaded programming, etc. Should I go ahead and get started or continue to stick to building stuff locally and privately till I get more experience. I don't want the mistakes made here to haunt my career prospects in the long run.


title: What sorts of software patent issues should one be aware of when writing software?

text: **The scope of this question is intended to be global in nature:** techniques (approaches to solving a problem, such as the use of a layer palette), operations (actions that the software or its user can take, such as using a paint bucket tool to fill in a selection or otherwise bounded area), etc. If the development process comes into play, such as Person A saying "We need to implement this one cool feature in Software X" and perhaps any study of that functionality via decompilation, hex-editing, etc. (vs. a more genuine, independent process of imagining functionality or writing up the spec), then that would be appropriate to mention. I am in the process of creating a substantial application, and I don't know how much of a problem software patents will be. I'm of the impression that no one can patent a "paint bucket" tool (though I wouldn't know the legal justification behind why that can't be patented), but perhaps if you stray much further from that, you'll get hit with a lawsuit? I really have no idea! In my case, I'm not even looking at competitor's software for this very reason. I did sit down with someone who uses software that is currently on the market long enough to know that I can easily demolish it, but I would just consider that market research. The only things that excited me during that little demo session were instances where I would dream up some functionality and his response would be "Yeah, that would be really useful, and no, this software can't do that." There was no "I really need to copy that feature!" because, well, the application was garbage for the most part, despite it price tag.


title: Add complex customization to form or create two forms?

text: I'm working in a WPF application that both imports and exports delimited text files. At both ends, there is a UserControl which encapsulates some logic about delimiter configuration. It has some controls for individually selecting delimiters, and a 'Presets' dropdown for quickly selecting certain common combinations such as CSV. I've been tasked with modifying the export configuration dialog. They want the presets feature modified to also cover some text formatting options that aren't related to delimiters. The changes should only appear in the export configuration dialog, because the settings in question aren't applicable to importing. They will involve both adding some new controls, which isn't too bad. But there will also need to be some additional presets which aren't available on the import dialog, and their presence may impact the behavior of the dialog overall. I'm unsure of the best way to do this. Three options come to mind, but of course I might be missing one:   1. Clone the UserControl and make the requisite changes to it. Each dialog now has a separate control. However, both controls will have a lot of logic in common, so I'm uncomfortable with this from a DRY perspective.   2. Keep the single UserControl but throw in a 'mode' property. Based on its setting, show or hide certain controls, swap out the ItemsSource for the 'Presets' dropdown, etc. This is attractive since it involves less copy-and-paste, but at the cost of the single control being more complicated overall, and perhaps more difficult to maintain on down the road.   3. Redo the whole thing's architecture so that the behavior-related aspects are properly managed in a separate ViewModel. This new ViewModel should be programmatically configurable to represent the different working modes (basically by just swapping out the list of available Presets, each represented as an instance of a Preset class). Create two different sets of UI to represent the different layouts, with one simply not having the controls for options it doesn't care about.  My gut instinct is that #3 is the best option. I'm concerned that it's an excessive effort, though, and that I'm just being too picky about one of the first two options. Or that there's some other pitfall with it I haven't thought of. I have a bit of a history with this UserControl and my personal feeling is that it's kind of a PITA to maintain, so I want to be cautious in case I'm overeager for the rewrite for emotional reasons.


title: Switching between Azure Mobile Services vs my own implementation. Will UIDs change?

text: I'm looking at Azure Mobile Services, particularly the Authentication part (which I believe relies exclusively on OAUTH 1 or 2). I want to make sure that my application isn't tightly coupled to the service and I can bring authentication back in-house using either of the following methods:   1. I use a version of Azure Mobile Services built for 2012 R2 (which may include support for AMS + OAUTH)   2. I use a local DLL such as .NET Open OAuth to handle the authentication. My theory is that UIDs are portable between all three scenarios (the third being Azure Mobile Services itself), because I manually would be typing in the same secret into each provider. My second gut reaction is that any Windows Live IDs will not have the same URL and aren't portable in these scenarios (based on my Azure ACS and LiveID experience). However since I've noticed OAuth support in .NET OpenID I think I could be mistaken. **Question** Could someone more well versed in authentication, and Microsoft products let me know if authentication can be "moved" to and from Azure Mobile Services if needed? The main contention point I believe will be differing user IDs after the switch which would mean that after migration, users will loose their previous history, etc. in my application.


title: What arguments can I use to justify the use of either XML or JSON to store and transmit object data?

text: My project lead considers both of these approaches to be unnecessary overhead. I have been involved in and have witnessed a lot of talk around XML vs JSON, but this is the first time that I have heard an argument against BOTH. We are using c# in .Net 4. We'll be storing data in a sql server database on the server and also on mobile devices. I've heard all the arguments between the two but now I need to understand the arguments for and against the use of any object notation to store data - my project lead prefers csv format.


title: Which functional language is good for a beginner?

text: > **Possible Duplicate:**   >  Choosing a functional programming language I am a C++ programmer looking to learn a functional language as a hobby and out of sheer curiosity. I am not looking to be an expert, but just to get a grasp on functional programming. This language should be simple to learn and have good tutorials and resources for beginners. Are there any such languages?


title: Using visitor pattern with large object hierarchy

text: **Context** I've been using with a hierarchy of objects (an expression tree) a "pseudo" visitor pattern (pseudo, as in it does not use double dispatch) :                public interface MyInterface      {           void Accept(SomeClass operationClass);      }           public class MyImpl : MyInterface       {           public void Accept(SomeClass operationClass)           {                   operationClass.DoSomething();                operationClass.DoSomethingElse();                // ... and so on ...           }      }      This design was, however questionnable, pretty comfortable since the number of implementations of MyInterface is significant (~50 or more) and I didn't need to add extra operations. Each implementation is unique (it's a different expression or operator), and some are composites (ie, operator nodes that will contain other operator/leaf nodes). Traversal is currently performed by calling the Accept operation on the root node of the tree, which in turns calls Accept on each of its child nodes, which in turn... and so on... But the time has come where I need to **add a new operation** , such as pretty printing :                public class MyImpl : MyInterface       {           // Property does not come from MyInterface           public string SomeProperty { get; set; }                public void Accept(SomeClass operationClass)           {                   operationClass.DoSomething();                operationClass.DoSomethingElse();                // ... and so on ...           }                public void Accept(SomePrettyPrinter printer)           {                printer.PrettyPrint(this.SomeProperty);           }      }          I basically see two options :   * Keep the same design, adding a new method for my operation to each derived class, at the expense of maintainibility (not an option, IMHO)   * Use the "true" Visitor pattern, at the expense of extensibility (not an option, as I expect to have more implementations coming along the way...), with about 50+ overloads of the Visit method, each one matching a specific implementation ? **Question** Would you recommand using the Visitor pattern ? Is there any other pattern that could help solve this issue ?


title: How do "custom software companies" deal with technical debt?

text: **What are "custom software companies"?** By "custom software companies" I mean companies that make their money primarily from building custom, one off, bits of software. Example are agencies or middle-ware companies, or contractors/consultants like Redify. **What's the opposite of "custom software companies"?** The opposite of the above business model are companies that focus on long term products, whether they be deployable desktop/mobile apps, or SaaS software. **A sure fire way to build up technical debt:** I work for a company that attempts to focus on a suite of SaaS products. However, due to certain constraints we sometimes end up bending to the will of certain clients and we end building bits of custom software that can only be used for that client. This is a sure fire way to incur technical debt. Now we have a bit of software to maintain that adds nothing to our core product. **If custom work is a sure fire way to build technical debt, how do agencies handle it?** So that got me thinking. Companies who don't have a core product as the center of their business model, well they're always doing custom software work. How do they cope with the notion of technical debt? How does it not drive them into _technical bankruptcy_?


title: Avoiding ubiquitous language clashes

text: I have been reading DDD Quickly and wondered about how to avoid naming clashes with technical terms and domain terms. For example, if I commonly used the repository pattern (with classes such as AddressRepository), but a customer also has something called a repository in their domain. How would I best avoid confusing the two?


title: How to implement isValid correctly?

text: I'm trying to provide a mechanism for validating my object like this:               class SomeObject {         private $_inputString;         private $_errors=array();              public function __construct($inputString) {             $this->_inputString = $inputString;               }              public function getErrors() {             return $this->_errors;         }              public function isValid() {             $isValid = preg_match("/Some regular expression here/", $this->_inputString);             if($isValid==0){                 $this->_errors[]=  'Error was found in the input';             }             return $isValid==1;         }          }      Then when I'm testing my code I'm doing it like this:                   $obj = new SomeObject('an INVALID input string');              $isValid = $obj->isValid();         $errors=$obj->getErrors();              $this->assertFalse($isValid);         $this->assertNotEmpty($errors);      Now the test passes correctly, but I noticed a design problem here. What if the user called `$obj->getErrors()` before calling `$obj->isValid()`? The test will fail because the user has to validate the object first before checking the error resulting from validation. I think this way the user depends on a sequence of action to work properly which I think is a bad thing because it exposes the internal behaviour of the class. How do I solve this problem?   Should I tell the user explicitly to validate first? Where do I mention that?   Should I change the way I validate? Is there a better solution for this? UPDATE:   I'm still developing the class so changes are easy and renaming functions and refactoring them is possible.


title: How can I compute the Big-O notation for a given piece of code?

text: So I just took a data structure midterm today and I was asked to determine the run time, in Big O notation, of the following nested loop:               for (int i = 0; i < n-1; i++) {         for(int j = 0; j < i; j++2) {             //1 Statement         }     }      I'm having trouble understanding the formula behind determining the run time. I thought that since the inner loop has 1 statement, and using the series equation of: (n * (n - 1)) / 2, I figured it to be: 1n * (n-1) / 2. Thus equaling (n^2 - 1) / 2. And so I generalized the runtime to be O(n^2 / 2). I'm not sure this is right though haha, was I supposed to divide my answer again by 2 since j is being upped in intervals of 2? Or is my answer completely off?


title: Should programmers talk with customers / users according to MSF / agile methods?

text: I've just read two statements that seem to be very different: > Des Weiteren ist mangelnde Kommunikation zwischen Programmierern und Nutzern > eine nicht zu vernachlässigende Quelle von unzureichenden Produkten. > > Translated: > > A lack of communication between programmers and users is a source of poor > [software] products. Source: de.wikipedia.org I think I have read something similar in CHAOS report of Standish Group. And > Insbesondere bei der Rolle Development ist Kontakt zum Kunden oder zu den > Benutzern nach Meinung des MSF geradezu zu unterbinden. > > Translated: > > According to MSF, especially the role "Development" should not have contact > to the customer or to the user. Source: msdn.microsoft.com This also makes sense, because as a programmer I want to have happy end users. So the user likes to have a new feature, I'll try to implement it. This could lead to feature creep. If I understand it correctly, MSF (Microsoft Solution Framework) tries to avoid this problem by a role that has contact to the customer (this is the product manager, the user experience role and maybe the testing role, isn't it?) and only one role that has contact to the development role (the program manager). **Question 1:** How do agile methods deal with the problem of feature creep? I read that the developers should have very strong contact with customers in agile methods and that one of the main problems in using scrum is to persuade the customer to get involved in the process. Does in SCRUM only the Product Owner have contact with the user / customer? Isn't this a problem, as the programmer might see different problems than the Product Owner? **Question 2:** Who does the requirements engineering in agile methods and MSF? **Question 3:** Do you validate in MSF / agile methods if your product does what the customer wants and the user needs before shipping it? How do you do it?


title: mind map for programmers

text: How are mind maps useful for programmers in organizing the way they work?


title: Spartan programming... What is it good for?

text: We are being forced to use Spartan programming on a project, to everybody's dismay. So I get it, it makes the methods really short and it handles the simple cases first. But is it really worth the price of the code looking like something out of the Obfuscated C Code contest? Can you see it being useful for something?


title: best practice: setting up several IDE / frameworks (at file/dir level)

text: I don't know how to exactly search for this topic, so if there are a lot of answers to that, please just provide a link :) I'm getting a new laptop in a few weeks and am thinking about setting up a logical, easy-to-use and clean folder structure for coding from the beginning.(mixing everything coding related now)   My question is: Does your folder structure look like:   C:\grails   C:\Java\jre-...   C:\JAVA\jdk-...   C:\eclipse   ... etc   or do you always use the default directory?   or do you sort them, like: C:\ide\, C:\framewor and C:\CMS\   Do you put the frameworks and ide on a separate partition? Do you map your projects accordingly? How do you name your projects and how is the saving file structure? Is there a really good way that I've missed? I mean I just have a handful of projects to take care of and I mostly just do some light coding or minor changes, and still I'm confused every time I try to find anything or am often surprised to find several older versions still active... A few information:     * Dual boot to a second partition is out of the question, I do like convenience (#1 reason for me to try programming: make things easier for me.)   * I'll be getting a SSD, so the space is limited.   * Running Windows 7 Prof- 64bit   * I'll need: Eclipse, NetBeans, Grails, Groovy, VisualStudio, Ruby, Perl.  Hopefully anyone has a good idea about that. It really annoys me and since I do have the opportunity to change that it's a good time to think about it.


title: Result class dependency

text: I have an object containing the results of a computation. This computation is performed in a function which accepts an input object and returns the result object. The result object has a print method. This print method must print out the results, but in order to perform this operation I need the original input object. I cannot pass the input object at printing because it would violate the signature of the print function. One solution I am using right now is to have the result object hold a pointer to the original input object, but I don't like this dependency between the two, because the input object is mutable. How would you design for such case ?