instruction
stringlengths
34
19.9k
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 ...
I am working as a software engineer turned team leader in a large software company. One of my areas of strength is node.js, and we are in the process of moving a lot of our services to separate node.js services, which is proving to be very successful so far. However, I am supposed to stop day to day development of sma...
I'm reviewing my notes on Kruskal's algorithm and have a question about getting the runtime down to O(E lg V). By using a PQ with edges and a boolean array of which vertices we have added to our tree T, the running time is O(E lg E), but in my notes there is also a variant with running time O(E lg V), by using a PQ wit...
I have an application that consists of a set of Java and C++ of processes running on one or more systems and need to ability to monitor and control the components as if they were one complete system. My requirements: runtime statistics (messages per second etc..) log of events control: "service X set rate to 1000 mps"...
I usually feel reluctant to use any third party or open source controls while coding in Objective-C iPhone due to following reasons. Open source controls are developed in incremental manner. So once integrated I have to keep looking for update and will have to update my code. Will increase effort. Open source controls...
I am working, with a co-author, on a data modeling toolbox that will someday be sold. Part of the functionality is the extremely common PCA, which we are doing in a more robust way. Thus, we need a PCA function that has the usual algorithm with some modifications. For non-commercial peer-review academic research, I cou...
I have a rather odd problem. I love the practicality of PHP - specifically that I can fairly safely assume that on any random server I'll have access to the MySQL libraries, and that I can go between PHP/HTML with <? and ?>. That said, I find the language atrocious - Ruby and Python are considerably more expressive, ye...
In refactoring a lot of MVC code, I have run into an issue with my URL design. For example, let's say we have a Venue object public class Venue { public long ID { get; set; } public List<Event> Events { get; set; } } and an Event object public class Event { public long ID { get; set; } public Venue V...
It's a common issue to see a company's sales team promise new features in order to close a sale. Many times these new features are still in development or are still being designed. Sometimes features are sold before the development team even knows about them. If the customer understands the features are not yet impleme...
I am reading "Javascript : The good Parts" to improve my Javascript bases and knowledge. I was reading stuff about prototype and I encountered in this function : var stooge = { ... } if(typeof Object.create !== 'function'){ Object.create = function(o) { var F = function () {}; F.prototype = o; return new ...
Is there a guide out there on how to choose when to pay for web hosting vs. hosting your own? Assuming that root access is a must I would like to compare things like cost, scalability and personal stress. Here is what I could come up with. Paying for web hosting: Benefits: Much cheaper for a small scale. I assume any...
Given that we do not know the encoding of a string what is the best way to make sure that it is transformed to say ASCII? Also in such situations we are willing to accept potential loss of data.
How do I include the copyright/license for a library if I use on 1 function? Say if I have a class that I have taking 1 function from another library: class MyClass { ... public function someOtherLibrariesFunction() {} } And the at the top of the file I took the function from it says: /* * This file is part o...
I have been working freelance for a few years, and before that I worked as an entry-level coder for a non-technical company. I "understand" how delegates, and MVC, and how to make an app and make it work, but I have done a few interviews recently and they are throwing questions at me that I don't know the answers to. T...
I developed a pretty big website. I tested it myself to the best of my ability, but I cannot test all scenarios that my users may run in to. I found a testing team in India, but they don't seem to have any systematic approach to testing website functionality. They test each individual page rather than the full process ...
I am new to Clojure. I can understand the code I write but it becomes too difficult to understand it later.It becomes difficult to match parentheses. What are the generic conventions to follow regarding naming conventions andindentation in various situations? For example I wrote a sample de-structuring example to under...
I started reading some tutorials about OOP, because I want to learn the basics. I have a question about it. I understand how you can have a object "Car" and give it a color like this $oCar->setColor("white"); But there are some things unclear to me. Let's say I have a database with all kinds of cars. What is the best ...
This is part of a series of questions which focuses on the sister project to the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. The sister project is called OILexer, which aims to construct a parser from grammar files, without the use of code injection on ...
I wrote a comparator for a custom class of mine and when I ran my code I realised the output of my list of these objects was in the reverse order as to what I wanted. It was "ascending" as opposed to "descending". This was because I stuck to the spec of compare where a return value of less than 0 means the other object...
I've extracted interfaces from my repository classes, like ICustomerRepository, IProductRepository and so on. The project which contains the repositories is named X.DataAccessLayer. Should I call the project with the interfaces X.DataAccessLayerInterfaces, or what is better? And I definitely have to keep the interfaces...
Do you write your code then optimise it? Or do you write an optimised code from the beginning. I always believe in writing optimised since I really dont like to rewrite code, But please share your thoughts.
I use eclipse for coding, and the language which we use is Java. Once it was suggested by someone that to properly format the code, using the auto formatter(CTRL+SHIFT+F) While this command does format the code, but sometimes I feel that overall look becomes weird, and it is not actually very readable. So is this a rec...
This is in summary the TDD method: Write a test check if thes test fails write production code run test I think that TDD as presented works only in ideal circumstances. I'll take a simple example: Specification: Write a program that calculates the square root of a number, the user must enter a number. If the number...
I have a large project with a driver part and about 5 libraries doing various associated tasks. Many of the libraries require access to 'global' configuration data which is read from a database at startup by the driver code. By driver I just mean the part which contains the main function. My idea on how to handle thi...
I have an application, where font size, font type, color, background color, image and a lot of things change based on theme. I realised in the beginning itself that using enums to denote themes and then checking the theme everywhere was a horrible mistake. So I have two approaches now and I am confused which one to go ...
I've created an app that has some sound file that I've downloaded from Macloops. The user can only listen these sound files (he can't create any new sound files using them) with the app. Now, I want to distribute the app over the internet and I'd like to know if I can do this legally. I've only found the following the ...
I am currently reading a draft of the C11 specification. The new introduced keywords: _Bool, _Alignof, _Atomic all feel like custom extensions, instead of standard reserved keywords like struct, union, int. I realize that the standard basically consists of standardized extensions ... but still, this is awful! Maybe we ...
My team is just getting started integrating agile practices (we've chosen kanban) into our dev, test and design teams, but we have a lot of bug cases and feature cases not written in user stories left over from the old system and we're trying to find a good way to take care of the bugs but still keep the devs that need...
I currently have four projects in my website's solution: Project.Data This holds the EntityFramework DbContext object and also the Repositories that interact with it. It references Project.Models. Project.Models This holds the business objects and doesn't reference any other project Project.Web This holds all ViewModel...
I have a DAO that brings data from a web service, that data comes in a string, in the likes of: *NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...) I have a DTO that I wanna fill up with the parsed data (the DTO has fields in the like of name, birthdate, id...) So, my question is, what is the best practice: Parsi...
I am developing a web application based on a proprietary (but free) JavaScript API. My company is considering releasing our application as "Open Source", but we are unsure of the different licensing options and how they will work considering we are using a third-party proprietary API. Can anyone help me with the follow...
I am test-driving a method that is to generate a collection of data objects. I want to verify that the properties of the objects are being set correctly. Some of the properties will be set to the same thing; others will be set to a value which is dependent on their position in the collection. The natural way to do this...
I'm jumping back into ASP.NET development after spending the past 7 years playing manager, dba, and winforms developer. I've dabbled with a few things web related, primarily maintenance of existing webforms apps, but I haven't done anything with newer technologies. My, how things have changed! After watching a lot of...
I am trying to convert decimals, (0.05, -0.28, 25.00, etc), to a 17-bit 2's complement Signed Number. The parameter data I am sending is SysEX Midi Data (to some external Synthesizer). The data parameters are composed of 3 bytes. For example, the example given is as follows: The parameter data to set the value to ...
I was looking over the evolutionary history of Unix and Unix-like systems on Wikipedia and one operating system name stood out to me: OpenServer. Judging from the image, SCO's OpenServer is completely closed sourced; so why does SCO OpenServer have the word "open" in its name if the operating system is proprietary and ...
I see all the examples that demonstrate unit testing code and mocking the calls to the DB since you are not suppose to touch the DB. But it seems to me having a set up tasks that uses the actually schema, loads the lookup tables and then populates it with data using the methods to be tested... This way it is more real ...