instruction
stringlengths
34
19.9k
I'm implementing a Windows 8 app using C#, part of it is One Way Chat. It will be for multiple users such as teacher and student. We want to use a chat room for every course. Teachers teach different courses that include many students and students study different courses, so when the teacher and student open the course...
I have an SQL query which does several things at once¹: it does multiple checks and then, if the checks pass, updates some data. Without entering in the domain-specific details, here's an imaginary example: -- The user password should be updated only if the user account is not removed and -- not locked, and the thresho...
A few times in my past I've wanted to store data in code. This would be data that seldom changes and is used in places where access to a database isn't possible, practical, or desirable. A small example would be storing a list of countries. For that you could do something like: public class Country { public string ...
So I have been building this ORM style library for AngularJS (JavaScript) and since I come from a C++/PHP/C# background, I always try to make sure that private things stay private. While this can be accomplished in JavaScript, I keep running into issues that I have to work around probably because JavaScript really doe...
After reading Applying UML and Patterns (Larman) and looking around on the Internet it still seems ambiguous to me if a UML communication diagram should depict implementation details (such as GUI related function calls) or be more bound to the analysis. What is the correct answer? Does UML even specify it?
So I have a generic framework with a concept of children and parent objects, the objects don't have to be the same type, and I can add or remove any of them. Adding calls add on all the children, and informs the parents, inverse for remove. the concept of Parent is generic enough that there can be a loop across classe...
I have a list of objects that all require the exact same filtering, basically a set of conditionals in a function which outputs if the object is "good" or "bad". I want to keep all of my "good" objects in the list. Lets say I have 1000 objects in this list and the function I want to filter on in written. What langua...
I am working on a CMS that is starting to evolve a bit. We started off with content that had the following priorities ( columnn in the db on the content table): HIGH MED LOW. Data was fetched by priority HIGH being on top etc. Now after a few months a need has risen to have sub priorities: HIGH [ high, med , low ], M...
I was reading this article: Designing Flags Enumerations @ msdn and it says Combining flags enumeration values is an intermediate skill that should not be required for developers implementing common scenarios. I think flags enumeration are awesome - something I learned about during my experience with C. Why does it s...
Before asking my question, I must explain the situation. I'm working for a company as a junior software engineer. One of the seniors always stops me when I have finished my development and want to commit. He always wants me to wait for him to review it. This is ok, because usually he finds some bugs, and does some opti...
I have an abstract class A which declares an abstract method doStuff. Currently there are many classes that inherit from A and implement doStuff. The class' instances are initialized at run-time via AFactory based on user input. Originally all the classes had the same single parameter (the user input). But now I have...
I can see that GitHub allows you to have multiple mail account and associate every organization you are part of with a different address. Can this be done also for SSH keys? What I would like to do is having two different keys, one to push on my private repository, another to push on an organization repository.
When working on code, I face many of the same challenges that my teammates do, and I have written some helpful functions and classes, and so have they. If there is good communication, I'll hear about some great thing someone put together, and six months later when I need it I may remember it and call that function, sav...
I want to know how exactly, we can ensure that a project is 100% tested ? In banking or financial applications not 1% also tolerable. So being a developer, how can you say your code is 100% tested? Explanation with example is highly appreciated.
I work in a team that keeps growing. However, there are no code reviews and I see this as a problem every day. There are people with really limited skills committing code to our repository that I believe should not commit. I'm not the team leader nor am I in a management position. I already proposed code reviews abou...
It seems like Python, PHP, and Ruby all use the name "argv" to refer to the list of command line arguments. Where does the name "argv" come from? Why not something like "args"? My guess is that it comes from C, where the v would stand for "vector". Wikipedia has a footnote that says: the vector term in this variable's...
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...
When I first came to OOP (at first in Java, and then C++) after years of working in C and VB, it was amazing. The idea of extending existing behaviour and operating generically over things of related types was very appealing, and I almost immidiately saw why it was that I wanted this. That is, my motivation for OOP w...
For those who have sold software successfully over the Internet, after going to the effort of writing the software, creating a website, get a domain name, hosting the website, setting up a merchant facility, creating a trial version, etc - what do you do about the legal aspect of allowing the version downloaded from th...
I work for a large bureaucratic (and security paranoid) organisation that provides SVN for its development teams to use. I am working with a 3rd party vendor (at their site) and we currently share code via SVN export and patch files. The only way I have for transferring files is by a FTP drop box or email. I would lik...
I often feel that it would be more convenient if, within an issue tracking system, each issue were attributed to a certain function/method. Then, we can easily list all the issues related to a certain function/method. Many issues can be clearly attributed to a certain function/method. At times, we may want to look at i...
I work in a control systems company, where the primary work is SCADA and PLC, along with other control systems stuff. Software development is not really something the company does, apart from little bits here and there, until there was a decision to create an internal project management and appraisal system. This proje...
I started with sftp, then switched to WebDAV and I'm currently using rsync through ssh to deploy any updates/upgrades from my development server into my production server. I'm still not very happy using this system and think using git to deploy may be better, mainly because of the possibility of rolling back any change...
I am currently a reviewer on a Best Practices document for Developers or Business Analysts in writing a Functional Requirements document. This document is not necessarily a template for functional requirements documents, but a guide to what elements are necessary, optional, and dangerous to include a Functional Requir...
I have a Java HashMap with a String key and POJO value in a long-running application, and it's taking up a large chunk of memory (over 500mb, and this number is expected to grow - I'm guesstimating that it will exceed 2GB in two to three months); this is used to memoize the results of an expensive calculation (typicall...
These days there are more cross programming language compilers (specially from some 'X' language to JavaScript). I wonder how these are developed? What are the general steps to be taken care to write algorithms if I were to develop one? Do I need to be completely thorough in Lexical Analysis? As far as my knowledge is ...
Let's say I have 4 (A,B,C,D) parameters with 3 possible values, also 81 unique combinations. With e.g. orthogonal array, I will end up with 9 test cases, each combining 3 pairs. But that means that if one test case fails, I do not know which combination in the test case is faulty, right? Whether values of A,B or A,C or...
Let's have a program that checks an email mailbox and then "processes" the messages contained there. (For this question it doesn't really matter what it actually does with the message). The program will run once per hour and can easily handle the volume of new messages and there is no penalty for processing a message t...
Can anyone help me think of a way to dynamically generate the patterns section of a tool I am creating? I'm not sure how to store and generate these "patterns" dynamically. What the program does is take a big list of links (100,000), puts them in a database, groups them by domain and then curls a page from each domain ...
I've been thinking a lot about best practices regarding branching in distributed version control systems such as git an mercurial (the two dvcs's I have experience with and use on a daily basis). The way I've been doing it is slightly different in each of these, but generally follows these guidelines: master branch - ...
I hope this is not off topic. I have to save output from a command to file, but only if length of this output is positive. I've thought about two solutions: save output to a python variable, check length, if positive save to destination file; save output to a temporary file, check length, if positive rename to destina...
Please tell me why the same piece of code behaves differently in C++ and JAVA. Ok first I implement a function to calculate the factorial of an Int RECURSIVELY In JAVA: int f(int x) { if(x==1)return 1; return(x*f(x-1)); } System.out.println(f(5)); -----> outputs 120, ok that makes sense. JAVA ...
I'm starting a side project, the first stage will be a building a web application with MVC, in later stages we will be adding clients for mobile platforms. My thought was to create one API that all of the applications (web and mobile) go through to get/save data. Because these different platforms will be on different ...
A customer asked me to add a (fairly generic monitoring and notifications) functionality to the in-house solution he has assembled on top of JBoss and couple of GPL-licensed components (downloadable from the open source vendor as EARs). I am using JMS and JMX to communicate with these components. Do I have to provide t...
The first part of the license implies you can do basically whatever you want with it (copy, modify, sell etc). But the second part says that these freedoms must propagate into all copies of the software. My interpretation of that is, you can incorporate the software into your proprietary project, but that portion must...
I am maintaining a small code base that I am considering selling– but I want to allow developers that use it to submit code for addition to the trunk. This way they can extend the framework and the community can benefit. I want them to retain copyright to their code, but to allow me to use it however I desire, for com...
Sorry for the confusing title of this question, but I can't think of an exact way to word it. I have a very long class with hundreds of similar methods and I am trying to find a way to construct it without so many lines of code and so many DRY violations. Each time I add a new property to my class I have to write two m...
I do a lot of web development and there are many code snippets that come up again and again so I dive back into the most recent project where I used it which isn't that efficient. How do you store all your useful and oft used code pieces? Are there any products meant for this?
In my application I keep track of the running threads via a hash map, in that way I can retrieve the correct thread and do any actions. The app evolved in a way that new threads are created and old threads must be destroyed. My concern is if I'm removing the elements of the hash correctly, or if there's any efficient p...
I very much enjoy the functional programming paradigm, but I am still not sure how to go about designing a small/medium project with it. When using OO, I have a set of labelled entities (classes) with clearly defined boundaries. I can reason about stuff like: what is this class doing? should I put this code inside or ...
I have a Visual Studio solution with multiple projects: Acme.Core Acme.Core.Tests Acme.UI.MvcSite1 Acme.UI.MvcSite2 Acme.UI.WinformsApp1 Acme.UI.WinformsApp2 ... The entire solution is checked-in in a single GitHub (private) repo. Acme.Core contains our business logic and all UI projects are deployables. UI projects ...
Unlike other professions (such as Accounting, Law, Medicine, etc.), there is no profession-wide certification for Software Engineering. I am well aware of the multitude of technology and methodology specific certifications that aim to serve as proof of specialisation and experience, but there is no public Software Engi...
Should boolean methods always take the affirmative form, even when they will only ever be used in the negative form? Say I wanted to check whether an entity exists before creating one, my argument is that the first form below is better than the second form, whether or not the method is ever used in the affirmative form...
I am having a head ache understanding quicksort with middle pivot. I found lot of explanations about using left most or right most, but not many about a middle one. Can I safely assume these?: If left and right pointers meet at the same position, means that the element at that position is at its final sorted position,...
I have two lists of data, A and B. These lists are themselves aggregated from multiple sources, and contain typos, abbreviations not found in the other, and also lack a 1-1 mapping, but will never have a value in A that maps to two values in B and vice-versa. Right now, we're doing a naive (string comparison) match to ...
At the beginning of each sprint our team will pull in a handful of user stories and then, one by one, write slightly more detailed tasks for them as well as assign specific hours to each task. Having individual tasks helps us establish our sprint burn-down by having a specific total number of hours up front, as well a...
I believe that warnings should be treated as errors. If you start ignoring warnings you'll start missing "important" warnings among the "unimportant" ones. So my Continuous Integration system fails a build if there are warnings. One of my compilers has a bug that causes it to raise a warning when it shouldn't. My code ...
I designed an application framework by considering the SOLID design principles and supported by design patterns. However, I wonder if there are any automated tools or well-known approaches to evaluate whether the SOLID design principles are satisfied or violated in the proposed design?
I'm trying to document my code using JSDOC3, that has a similar syntax to PHPDocumentator / Apigen. But is there a de-facto standard for Javascript inline documentation? I think Google Closure is the most complete (or so it seems), but what is widely adopted by IDEs and what most people expect to the docs to be?
I apologize if something like this has been asked, I did try to look for something similar. I am graduating May 16th, and I applied for a position posted as '.NET Application Developer' requiring 1-2 years experience and a Bachelor's in CIS. I had the phone screen, which went well. They brought me in Friday for an inte...
Browser support issues aside, if you're being an Http/hateoas stickler what verbs should the request to log into/out of a site be? DELETE would seem like the obvious choice but I'm not sure what the resource you're deleting would be.
I have a requirement to read a text file with lines in tag=value format and then output the file with specific tags listed first and the rest sorted alphabetically. The incoming file is randomly sorted with the exception of the first line. The output needs the first two lines to always be the same. For example, give...
Is there any possibility to automate/semi-automate deployments of ASP.NET web applications using Jenkins. It can be under controlled or uncontrolled environments, for uncontrolled user needs to enter userid and password. I am looking out for ways to copy the files from target to destination and run sql scripts in web f...
Design By Contract uses preconditions and postconditions of the public methods in a class together to form a contract between the class and its clients. a) In code we implement preconditions and postconditions either as assertions or as exceptions? b) We implement preconditions and postconditions in code as exce...
My goal is to have a Python application that runs a web server which hosts the user interface, and based on interactions from a user in their browser, long running tasks get kicked off and through some process, feed status information back to the web server and subsequently back to the browser. The application will not...
Recently, a colleague told me that it wasn't advisable to make conditions in the join clauses. Instead he suggested to make conditions in the where clause. He told me that the SQL engine was optimized for this way. Here is a simple example to illustrate my question. In this case, I think it would make any difference. W...
I'm writing a PHP API wrapper for a third party API. I want to make all the methods consistent, but I'm not sure how to handle the number of arguments some API routes accept. One API request accepts up to 30 arguments. Obviously, it would be unwieldy to list each argument as a parameter on the method. Currently, I'...
I'm not so hot on the maths for this but for what I understand... A graph g exists with v vertices and edges. g = (V,E); The spanning graph for this is an acyclic copy of this where all the vertices are present, and all the edges are a subset of the graph with the condition that each connection is distinct. Apparently ...
Please excuse me as I am a bit new to the following technologies and practices. I have been given the task to create a management suite utilizing an MDI GUI. This suite will be the front end to a WCF data service. My question is, what design pattern is typically used by most professionals when designing such an appli...
I am working on an application that connects to another application (Quickbooks) using an API by sending/receiving XML requests/responses. I am able to work with the data in the XML response and load it into a datatable in c#, so that's not the issue. What I am looking to do is write the data from the Quickbooks XML ...
I work on projects which are usually of a duration, not more than 3 months. Recently there has been a discussion about the use of JUnit in the projects. There are activities being planned related to that and, there could possibly be some kind of training too. But I was wondering whether it is a good idea to use JUnit f...
The principle is defined as modules having one reason to change. My question is, surely these reasons to change are not known until the code actually starts to change?? Pretty much every piece of code has numerous reasons why it could possibly change but surely attempting to anticipate all of these and design your code...
Trying to convert some entities into value objects I am stuck in a case where what seems a value object must be unique within an aggregate. Suppose we have a Movie entity which makes the root of an aggregate. This Movie entity is related with some set of AdvertisementEvent objects with the role of displaying an adverti...
I'm currently on a project, which integrates domain specific techniques in the modelling tool Enterprise Architect through UML Profiles. The domain specfic model almost matches the structure of the composite structure model, with a couple of restrictions though, so I'm trying to use the model as a foundation for my res...
If you are working on something new you have less than the required time to do it, and sometimes you are expected to work late, weekends etc (even when you are waiting on people who are not working those hours). I even had a boss once who came by and told me to make sure I had something to do on Saturday. This seems to...
We are working in a Visual Studio Environment using TFS. When developers get the latest source code it includes a copy of the 'update' sql scripts for the database of the application. The challenge is keeping our local copies of the DB up to date. When changes are made to the DB by another developer, we are looking f...
I write a lot of javascript applications and in many different circumstances the browser will become unresponsive or give a "slow script" error. Even when following best practices, initializing large data sets, complex animation, or when too many event handlers fire at once, I have to include extra setTimeouts or reque...
I'm designing my own programming language for fun, and I'm thinking of making it fully Object-oriented (no statics, no globals, no class variables, no class methods), so I need to find a way to completely eliminate the needs of class methods, but, first, I need to make sure that I know all the problems that could only ...
Is a grid or p2p architecture a subset of a broker architecture? what are the key features that make these similar or distinct?
In an attempt to write some generic code I find myself putting, in my abstract class, a method that returns some static information about how the class should be treated. This method doesn't use any state data and would be static, except that static abstract methods aren't allowed. Is this a code smell? is there som...
I have a simple domain with about 6 objects in the model. For the most part they have a clear child/parent relationship with parent having multuple children. I'm going to have all of them be immutable. However, at some point I'll need to both fetch a set of all objects of a given type, and be able to fetch a specifi...
We've all been there - a product feature is called "gold", and then a week before launch they decide it is to be called "platinum". Luckily, you had some nous about you so the UI code is easy to change. But...what about all the variables and methods? Sure, you could change all these but what about the testing time? Obv...
So I went to a job interview today. Long story short, the interviewers were delighted with my knowledge and experience, they were practically showing me to my new desk. Needless to say, what delighted them was a factual and unexaggerated description of things that I've actually worked on. But then suddenly, as I was ge...
class Boxer: def punch(self, punching_bag, strength): punching_bag.punch(strength) class PunchingBag: def punch(self, strength): print "Punching bag punched with strength", strength boxer = Boxer() punching_bag = PunchingBag() boxer.punch(punching_bag, 2) No doubts that punch is a good me...
I am taking an introductory course on python and the instructor says that python is a high level language and C and C++ are low level languages. It's just confusing. I thought that C, C++, Python, Java, etc were all high level languages. I was reading questions at stackoverflow on C, C++, etc and they all seem to refe...
Here's a question that's always bugged me. I'm going to use java as an example because I've almost never run into a problem in java where I didn't need to use helper methods in its class structure. Let's say I have a method that does a thing or two and then calls a helper method: public void doStuff() { int x = 4;...
Essentially it is a branch of software engineering but SE itself is too large an umbrella. I was curious if there was a title for the knowledge base that encompasses TDD, BDD, mocks/stubs/spys, unit tests vs. integration tests, code coverage, etc.
I need to validate some form inputs in complex way. E.g. <select id="options" multiple="multiple"> <option>A</option> <option>B</option> <option>C</option> <option>D</option> <option>E</option> </select> For example, if user selects A and B, user should be given an error if user also selects D. Note, I'm...
It seems to me that instanceof comes from the land of functional programming and is a watered down version of pattern matching and that the OO altenative to it should be dynamic dispatching. In OO languages (think Ruby), is there any situation where instanceof is the only solution? I can't think of any myself, especial...
I have an unsorted array. I have queries in which I give a range and then the maximum value from that range has to returned. For example: array[]={23,17,9,45,78,2,4,6,90,1}; query(both inclusive): 2 6 answer: 78 Which algorithm or data structure do I construct to quickly retrieve maximum value from any range. (There ...
Why a single page application is a desktop client replacement why should I show certain url`s in the url bar of the browser. Why is mysite.com not enough. My question to you guys is now: What are the reasons and advantages for the user to show such an url like mysite.com/customers/3 Are there any reasons like the user ...
Most people say do not use JSPs. But what if I have a JSP that does not show anything, it only acts as a controller? Why would I do that? Because we do not need to redeploy complete webapp to make a small but significant change in a servlet -> instead can just put my new JSP in the JBoss tmp folder till we do a full de...
Note: I know that none of you (probably) work for google, so this is a lot more of a conceptual question. So yeah, i discovered that Gmail uses java and that got me thinking, Why? I personally never really learned java and am familiar with C/C++, Python, Php e.t.c But what i dont understand is why do some websites use ...
Well it's a problem me and my friend had thought of, and well, haven't come up with anything to solve the following problem(I'll try to phrase it in the best way I can): Given that there are n number of teams, and the number of matches each team has played, and that no team can play more than 2 matches with any other ...
Is it really necessary to differentiate between code and data ? Is there any language where such differentiation is not there ?
My coworker and I are arguing very hard about this topic. He's thinking that every single class should have an Interface that the class implements (also Single-Implementations). He uses this design for documentation principles. In my mind that is obsolete because in Java you can comment on implementations, too. I think...
I heard almost all parts of Windows are written in C and C++ with some assembly. Why did Microsoft skip C#? Is there any scope for C# in the development of future Windows versions?
As far as I know Linus holds the copyright to Linux. While looking around in the kernel sources, I see that almost every file has it's own copyright holders. For example the file module.c in the Linux kernel contains: Copyright (C) 2002 Richard Henderson Copyright (C) 2001 Rusty Russell, 2002, 2010 Rusty And the COPYI...
I am wondering... Recently I have observed github; I saw many Java projects' codes which don't have copyright at their headers... I mean, as I may guess, in this case the only thing which can prove the code author is - it is author's github account; So my question is... is it safe to protect open source code with githu...
I thought it would be very useful if there is an embedded application development tool like Visual Studio for web development. I mean when we develop web applications we have a toolbox and we drag and drop components and generally use events. In embedded systems events are interrupts. So why don't we have a toolbox whi...
Are there any obvious flaws to this OO architectural model which I intend to implement using javascript? It is similar to the MVP model but instead the role of the model is broken down into three modules: the cache (stores data instead of rerequesting from server) the model (manages requests for raw data, retrieving i...
I am a sole developer working with an offshore employer. I do realize the importance of unit testing (although haven't practiced before) but currently, the code hasn't ever been tested. The problem with the code is that it isn't what I call "been moduled well", some parts are really messy, extensive use of globals and ...
Well in my book it is says that "there are non-decidable languages" And the proof is: Every algorithm is a word. Then there are only countable algorithms. But there are uncountable languages and therefore more than algorithms Why is it said that every algorithm is a word? A word is a concatenation of symbols, element...
In divide and conquer algorithms such as quicksort and mergesort, the input is usually (at least in introductory texts) split in two, and the two smaller data sets are then dealt with recursively. It does make sense to me that this makes it faster to solve a problem if the two halves takes less than half the work of de...
Some pseudo code or resources will be appreciated.I was thinking if implementing it in form of a BST stored in an array. However,not all operations can be performed easily using this approach. I am open to using STL's for this purpose as well.My main purpose is to implement it in the simplest manner possible.
I'm currenetly struggling with choosing how to proceed as a programmer. I mainly programmed games and would like to continue. And for about 5 years or so I just used C++ and OpenGL, so I spent a lot of time on infrastructure, strange bugs, and mostly getting basic things to work. A friend of mine then recommended pytho...
I am developing an application which will handle many virtual stores and I would like to have many themes that the user could choose anytime. I would to know what's the main ideia to implement it. I will be developing it using Symfony 2. I was thinking about implementing own views and assets for each theme Resources ...
So I'm a relatively junior programmer, been doing it for a couple years now and have been recently working on a redo of the company's website, and have ran into some frustrations and was just wondering if that's the way it goes or if I'm missing something. I am by no means a designer, I focus on the code and don't pay ...
I have an open source project that is licensed under the GNU General Public License v3 and it's done in Windows Presentation Foundation. I came across someone that sells themes/skins for WPF projects and he is willing to donate one of the skins for use with open source project. However, he only wants the skin to be all...
I have a java program which listens on a port for input. Based on Input, it calls a webservice and then returns a success/failure back to the client program. I fork a thread for each client connection. The response back to the client which connects to the program has to be quick. These are the choices I am considering ...