instruction stringlengths 34 19.9k |
|---|
I need to add a new payment type to an existing code base. That means that I'm going to have a few methods looking like this:
if (old payment type)
process old type of payment
else
process new type of payment
Now, if this could have been determined beforehand, I would have this method point to an interface imp... |
I have created a a number of non-trivial scripts in Python that do some long running reporting. At first these reports started off as scripts with a config file. Then I added in the a database component to persist data. Now I'm building a GUI to sit on top of all of them.
My question relates to design. Each time I add ... |
Everyone says that I should make my code modular, but isn't it less efficient if I use more method calls rather than fewer, but larger, methods? What is the difference in Java, C, or C++ for that matter?
I get that it is easier to edit, read and understand, especially in a group. So is the computation time loss insigni... |
I am confused about the use of register keyword in C. It is generally told that its use isn't needed like in this question on stackoverflow.
Is this keyword totally redundant in C due to modern compilers or are there situations in which it can still be useful? If yes, what are some situations in which use of register ... |
I will be moving workplace in the near future and I believe they will be very interested in my experience of Scrum and how it may relate to their business. I am trying to understand if it will work in their environment.
My current place of work we have a 2 products/2 backlogs/2 separate teams. These backlogs are obviou... |
I'm creating a menu system in PHP and MySQL. I will have several different menus and each menu will have a set of menu items connected to it.
On the site, I also have different user permissions, some users can see all menu items and some items are hidden from some users. I'm curious on how I could handle the permission... |
I have a list of objects that will need to go through an approval process.
I am curious if it would be best to simply add some properties to my object, like ApprovedBy, and ApprovedOn.
Another option is to create an ObjectApproval class that contains this information as well as other information that needs to be stored... |
I'm working on image processing and I need to use big Images in a critical system.
A good practice for critical systems is to avoid dynamic allocation of memory but what is the design/recommendations for static memory allocation?
If we do a static allocation of a big matrix we get stack overflow.
class test
{
publi... |
I've inherited a lot of poorly designed code; the code has no tests. I am putting tests in place before I attempt a major refactor, but I have run into a problem with my unit tests.
The problem is, I will unit test a function, and then later decide that function is a liability. I will either get rid of the function, o... |
I am trying to solve the following kind of problem. I do not know if there is already a name for this, or a solution; however, I'm willing to bet there is. I was hoping someone could point me in the direction of implementing a solution for it, or at least tell me the name of the problem?
Suppose a traveler has a cert... |
I'm writing a library for sparse linear algebra computations as a backend for my thesis work and I've come to a bit of a crossroads. I'm using modern Fortran (don't groan, it's had inheritance and polymorphism and all that jazz for 10 years now).
From a software design standpoint, my main issue was making iterative sol... |
I am not sure whether there is a 'right' or 'wrong' answer to this one, but I was curious about the general consensus.
I have a User model that currently performs user functions (such as retrieving user details from the database, inserting new users to the database, updating user details etc.)
This leads to a fairly l... |
I've been using PHP Frameworks for so long that I've actually forgot the "best practices" for create websites without one.
Usually I will use Symfony, or more recently I've been using Laravel. A client wants a very simple website, but with certain parts of it dynamic. Due to the nature of the site using Wordpress, or a... |
I'm a Java developer with a bit more than a year of experience which places me somewhere above a junior, but not among mid-level developers yet. Recently I was offered a long-term project which is about studying an existing banking application code for 4 months and then introducing changes when needed. As a not-so-expe... |
I am writing a piece of software and I would like to release it open source.
Should I try just getting it stable on my computer (with normal use; no "things a monkey wouldn't even do") before releasing it, or should I take a different approach?
What I am leaning towards doing right now is:
Write it myself during the... |
Firstly, I'm not new to this. I've written desktop applications for Windows going back to 1991 with Visual Basic 3.0. I've used C/C++ and Win32 API, VB3-6, C# 1.0-4.0 and currently knock out web applications in ASP.Net MVC. However I haven't touched desktop stuff since 2000 in depth bar playing around with some ClickOn... |
Do JAX WS implementation classes come as part of the Java5 package, as part of the Java6 package or only as part of an application server libraries like WAS?
I read that it comes as part of Java EE? What does that mean? Java 5?
|
Consider a table in which a column represents a monetary value in some cases and a link to the value of another record in other cases so that we have the following:
TABLE 1
Id Product Composite
1 Apple False
2 Orange False
3 Pear True
TABLE 2
Product Date Price
1 2010-01-01 0.45
2 201... |
In this thread, an Oracle Product Manager (username "Alex Keh") refused to make Oracle's EF provider to conform with .NET's PascalCase coding standard for class names and property names, saying that it is only "cosmetics" without any "functional needs".
I discussed it with my team. One of the key things we want to kn... |
At one of the DevDays conferences a presenter said that Workflow Foundation isn't just for applications that require persistence, but they can make it easier to write and maintain Async WCF code and the corresponding error handling. (try.. catch)
Assuming that is true, is Workflow Foundation able to use all the CPUs ... |
I am new to GitHub and new to the open source world (coming from .NET). I have a media wiki site and want to install a Google analytics extension: http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration
The extension's documentation says to download the code from GitHub.
In the GitHub repo, there are some... |
You can't ever have a talk about so called "NoSQL" database without bringing the CAP theorem (Consistency, Availability, Partition : pick two). If you have to pick say, between MongoDB (Partition, Consistency) and CouchDB (Availability, Partition), the first you need to think about is "Do I need correct data or do I ne... |
It was my freelancer job at oDesk. I have done several jobs earlier in given time, but is was the first time I missed the deadline. It was a very lengthy job and I tried my best but I still missed the deadline. Now, I am very scared. Because it's my fault that I missed the deadline.
My question is: Is this is a big con... |
I have the web application where i am serving file downloads in php.
All is working fine and i have the download column in file field where i increment it.
But i want to have full statictics of downloads like how many downloads on each day or in month or time of day or from which location
But i am not able o find how t... |
As a developer I should strive for low coupling between classes.
But low coupling doesn't mean "No coupling" so sometimes I have to allow some code flexibility and use "new" inside a domain model. (I'm sure everybody does this in real production code)
If I use "new" inside a method to create an object and I have to un... |
I like to create simple class diagrams for my projects. Most of the time I just use composition, inheritence and associations.
IBM's basic UML resource tells all about this.
However I'm using ruby so I got the option to define a module with some methods. I can just include this module in every class where I want to use... |
I created login form. When user clicks on login button this form shows up with some fade effect (jQuery). What I want to do is to display error message in this form when user inputs invalid data. Before showing any messages, PHP must read data from database, therefore page must be reloaded and when page is reloaded thi... |
I found an interesting article on high scalability web site where it talks about EBay scalability and especially a specific passage struck me:
"(Ebay strategies)...Move work out of the database into the
applications because the database is the bottleneck. Ebay does this in
the extreme. We see it in other architect... |
Here is, roughly, our structure of work using git, for web development. We have a master branch, and individual or groups of work are done seperately in branches, then merged in.
A ticket (or several) comes in.
We create a branch on our local development repository, and push it to origin.
We fix the tickets in code, c... |
I have a system that checks the status of a number of systems, such as, is http up, does the system respond to ping, that sort of thing.
I check all of these systems every 5 minutes. If something is broken, I send out an e-mail with a notice. If the problem is cleared I send out an "all clear, problem resolved" notice... |
I am writing a Java web application that consists mainly of a bunch of similar pages in which every page has several tables and a filter that applies to those tables. The data on these tables comes from an SQL database.
I am using myBatis as ORM, which may not be the best choice in my case, since the database is poorly... |
Since the released of Web API, I've been wondering whether it's necessary or helpful to migrate/change MVC controllers to use Web API calls. Since it's hard to describe code I'll show an example of what I mean:
Current controller, the _userService is basically the Business layer of the application that is then calling ... |
There are answers to the question on how test classes that connect to a database, e.g. "Should service test classes connect ..." and "Unit testing - Database coupled app".
So, in short let's assume you have a class A that needs to connect to a database. Instead of letting A actually connect, you provide A with an inter... |
I've written an API which can be configured to signal errors in different ways (return values, debugging messages, or exceptions). I've got a check in place when the API is first initialized to see what type of error handling the client is requesting - what should I do when they request an undefined error handling type... |
I know some people that are currently working on a project for the US military (low security level, non-combat human resources type data).
An initial state of the project code was submitted to the military for review, and they ran the program through some sort of security analyzer tool. It returned a report of known se... |
I've made a container which functions like a Binary Heap in terms of insertions and popping the root element. The key difference is that the comparison steps are all replaced with a random call for deciding when to go left/right. (The underlying data structure is a Vector, written as an expandable array, so you don't... |
A db index is analogous to a table of contents. This helps me understand db index in an easy way. My question is are tehre any real world analogies for a clustered index?
|
I am not a licenses expert so I got confused a bit... The license Apache 2.0; Does it allow to get source codes and modify them for new projects? I mean modify source codes (some its parts) and recompile them?
|
I was wondering if it's valid to initialize an instance of a class within the same class? For example:
public class Person()
{
string name;
string age;
public Person getPerson()
{
Person p1=new Person();
//some logic here
return p1
}
}
I ended up doing that for a part of my code ... |
I already had question about this but obviously it was not accepted very well, apparently too long when it's actually more information so you could have given me better answer.
Ok, I will be much clearer now. Best possible logic to develop scalable chat in terms of stability, storing/reading messages on chat, updating ... |
I am a little confused on both pointers and reference. From my understanding pointers are addresses in memory. If I pass a variable using pointers and reference to a function, any manipulations of the variable in the function will change the original variable.
I read online that passing by reference is not encourage... |
So I am creating a web api for an app I am making. The data is sanitized before it is sent to my web api and then encrypted before it is stored in my MySql server.
The phone app sanitizes then behind the scenes calls -> web php api which encrypts aes style with a hard coded salt then calls -> server
My question is if ... |
I am implementing a vector in C. I am doing this for the fun of programming, for the fun of learning, and for the use of the data structure in later projects. This is not homework. My question is regarding methodology, not necessarily implementation, therefore I am not really looking for a code review.
Now, I have read... |
I'm trying to hack on the ROS bloom build system (https://github.com/ros-infrastructure/bloom). After I've made some edits, I build it and install it to a virtualenv to test using
python setup.py build
python setup.py install --root /path/to/my/virtualenv
However, once in my virtualenv, it doesn't work since pkg_reso... |
I can not come up with a good architecture for my card game. I need help to understand how games usually are designed.
First, I will describe game rules.
Game Rules
Setup
There are four players, each two player form a team.
Each player gets 12 shuffled cards
There are 4 blinded cards on table(river)
Players order ar... |
To illustrate the question, let's say we have two programmers of comparable skill that both solve the same problem. The code they turn out has roughly the same lines of code, but one programmer uses 5 classes while another programmer uses 20.
Both sets of code get comparable wtfs per minute in code review, implying tha... |
I was just wondering why does Java compiler decide whether you can call a method based on the "reference" type and not on actual "object" type? To explain I would like to quote an example:
class A {
void methA() {
System.out.println("Method of Class A.");
}
}
class B extends A {
void methB() {
... |
I was reading Towards Architecture-based Self-Healing Systems, and came upon the term
first-class connectors. What are they?
Searching some more finds this paper Systematic Construction of Software Architecture Supported by
Enhanced First-Class Connectors, which looks like it might have an answer, and I might read it i... |
I am building an application in C# that works with a Progress database. The passwords that are stored in this database are stored using a hash algorithm that Progress has not made public. However, I would like to authenticate using these hashes. Is it feasible to reverse engineer such a hash algorithm and how would I g... |
It is an error if you do anything in a constructor before calling the superconstructor. I remember that I had problems because of that. Yet, I do not see how this saves us from errors. It could save you from using uninitialized fields. But, the Java compiler that checks for using uninitalized variables does that and th... |
I'm focusing on trying to understand UML diagrams and learning to interpret them in order to implement the designs they describe. In the following diagram, I am not clear on what the implementation for Port Operation should be.
It looks like it should be a class/entity the same as the others in the diagram. I underst... |
So i'm looking for some input/consensus on what terminology we should be using to describe something that looks like this:
class Printable
{
public:
virtual void printTo(Printer *) = 0;
virtual double getWidthInPoints() = 0;
virtual double getHeightInPoints() = 0;
};
So this is a class that only has pure... |
I've been developing a custom PHP template engine to suit just my needs and also to get a little more practice with PHP.
What I did was to create a Template class that simply receives as constructor parameter a path to a template file and a string that should be the placeholder for the contents of the pages. In that c... |
If my solution has both a "dataservice" project and a "business logic" project, where do the entity models, which represent database tables, belong?
At first i thought putting them in the dataservice layer, but then i would need duplicate models in the business logic layer, if i wanted to provide reusable logic dealin... |
I am migrating a 10-years-old big CVS repository to Git. It seemed obvious to split this multiple-projects repository into several Git ones. But the decision-makers are used to CVS, therefore their point of view is influenced by CVS philosophy.
To convince them to migrate from one CVS repo to different Git repositorie... |
EDIT
After a good amount of thinking and self-reflection on the topic, I realised that most of the issues I raised in this question was coming only from a personal, rather than a professional perspective. Hence the moderators put this question on hold because of the highly personal, subjective nature of the problem I t... |
Should tests in some project be written by the actual person that does the coding (usually senior in our team) or it can be done by junior coders with less experience?
|
When is it absolutely necessary for a controller to be async? Should all controllers be async or is it bad practice to make all of them async unless it is necessary.
Just looking for some general guidelines.
|
I have this dynamic data in PHP, but for each array record, I want to allow a downloadable option to save a zip archive of all records (each as a separate file).
These are actually DNS zone records that are housed in a database. It wouldn't make much sense if they're in a single text file, so I'm looking to somehow hav... |
I was recently refactoring a method that was both a command and a query method.
After separating it into a one command method and one query method, I found that there are now multiple places in the code where I am calling the command then getting the value from the query, which seems like a violation of the DRY princip... |
I'm using JavaFX for gui of my app. Its license is GPL+Linking Exception. GPL requires me to release my source code. But what's the linking exception?? (I'm just using it as a library. Not modifying or using its source code.)
|
I was reading about the rules for royal succession of the British monarchy and thought the easiest way I could understand it is with code (or pseudo-code). I came up with this (in a C# like pseudo-code):
EventHandler CurrentMonarch_Died {
CurrentMonarch = SuccessorRootedAt(Person.Electress_Sophia_Of_Hanover);
}
e... |
If I have a file config.php with some configurations in some variables and in some page I include this file, each time the variables will be loaded again in the memory of the server?
I think the answer is yes, but I'm not sure, I don't know to much of the PHP lifecycle. I don't know if I made myself clear, so here is a... |
I've been trying to see a way to get a measure of how much a PHP script costs of memory to the server. Well, I've found some solutions out there that requires some software to make tests and even require to install something on the server. Those solutions are not what I'm looking for, as I just want a simple measure of... |
Today I was asked this interview question and could not answer.
If you have two instances of a Person class which has a setAddress method that is synchronized. Now if it was only one object and multiple threads were accessing it, the synchronized will make sure that only one method can access it at a time.
But if there... |
I've done a spot of Googling, and all I can find is information on using code under the MPL in a larger GPL licensed project.
What I really want to know is: can I included GPL(v3) licensed code(/binaries) in a larger MPL(2.0) licensed project?
My understanding so far is that I can't, and that any project which uses GPL... |
In Java, I'm used to declaring collections using the most-abstract interface possible and then constructing them using the concrete implementation that makes sense at the time. It usually looks something like this:
public class MyStuff {
private Map<String, Address> customerAddresses;
private List<ToDoItem> tas... |
I have just started learning about recursion but I'm having a hard time understanding it. Please would you recommend any links or books that explain recursion in detail.
|
I just have a quick licensing question about PSEXEC by sysinternals.
As some of you may know if you have ever used PSEXEC, it is confusing to learn at first. I have created a program that makes it easier to use, and was wondering if I am allowed to sell that program (even if PSEXEC is included with it?). I looked in th... |
Looking at different collection constructors the question comes to mind. Why does ArrayList()
construct an empty list with an initial capacity of ten and ArrayDeque()
constructs an empty array deque with an initial capacity sufficient to hold 16 elements.
|
I have been in this problem for long time and I want to know how it's done in real / big companies project?
Suppose I have the project to build a website. Now I divide the project into sub tasks and do it.
But you know that suppose I have task1 in hand like export the page to pdf. Now I spend 3 days to do that , came a... |
How would one approach the following question:
We have two strings: a normal alphanumeric string and a pattern string. the pattern string can be composed by alphanumeric chars plus the char "?" and "*"
We want to check if the first string match the pattern, where the ? means that every char (alphanumeric) is permitted... |
When designing a RESTful API that uses JSON to respond to requests, I usually return an object like this when an error happens:
{
"error": "Something bad happened",
"error_code": "XXX"
}
Do I need to have a "error": "" or "error": null in my object when there is no error?
|
Single Page Apps strips server down to a REST api. If SPAs are the modern and better way of developing web apps, then would someday JavaScript rule the world and server-side languages like Java, C++ etc would not be the prominent skill companies look for?
Or are there still parts of huge and prominent web apps like you... |
I have read Would a NoSQL DB be more efficient than a relational DB for storing JSON objects? and am building a small test project in Asp.Net. I have a webapi up in Azure. It returns a List<Company> and Company is my object which has several properties and child list and a lat/long value.
//id, name etc.
public List<Ce... |
I asked this question a while back on SO (https://stackoverflow.com/questions/15506040/maximising-the-features-of-php-and-mysql-when-used-together) but it's a recurring topic, so I thought I'd ask in a different way over here.
Basically, we are stuck with the infamous php and MySQL combination (for various reasons), an... |
I was looking into concurrent programming in Erlang and Go programming languages. As per my finding they are used Actor model and CSP respectively.
But still I am confused with what are the objective differences between CSP and Actors? is it just theoretical different only but the same concept?
|
Can SQL queries be compiled into byte code or equivalent to enhance performance?
I know that most database servers support prepared statements, but is that the same thing as compiling? Most applications have to prepare statements on run-time so there is no benefit of pre-compiled byte code. Since it's prepared each ti... |
I was asked to sell the source code (along with existing users) of small utility app I created years ago. I've investigated how to put a price on the source code but so far haven't come up with a good solution.
I've searched the net, but haven't found anything useful. Then I came across a few others who also sold thei... |
I'm about to improve my skills in all that is related to designing applications from scratch using proper OOD principles, involving MVC pattern and using TDD approach to do it.
I have a project for that. I also finished reading a book by Matt Zandstra: PHP Objects, Patterns and Practice
And my question is still left un... |
I was going through the PhonGap Documentation about how to package your HTML/JS/CSS to a platform specific "native app". They have maintained separate documentations for the separate Cordova versions which seems fine.
I essentially understand most of the things there. But the confusion I have is the disparity or the lo... |
The experts in clean code advise not to use if/else since it's creating an unreadable code. They suggest rather using IF and not to wait till the end of a method without real need.
Now, this if/else advice confuses me. Do they say that I should not use if/else at all (!) or to avoid if/else nesting?
Also, if they refe... |
I have the following :
public Class A {
public void methodA() {
....
}
public void methodB() {
....
}
}
I don't have control over Class A. I would like to create subclasses of Class A with a restriction that it must override methodA() (super.methodA() call must run the implementatio... |
I will be involved in a project where all the software design is made by a local team and these designs are sent to an offshore team for coding.
This is the first time I face a project with this characteristics and for me it feels kind of odd: The managers expects us to make very detailed design documents so there's no... |
I was asked this question "How would you find weight of Aeroplane" in an interview and I am not sure why this question was one of the two question asked in the interview.
I tried to answer it using all possible ways but could not give the correct answer.(found the correct answer after google search)
How much such quest... |
I am currently developing a product that is broken up into a few main parts: A Server, an Android client, a Desktop client, and a class library for providing common data structures. Currently my team is using Maven (with a private Nexus repo) and TeamCity to do continuous integration, but we're having a ton of problems... |
I'm getting pushback from operations for having a server process listen on a dynamically-assigned port number (i.e. it binds a socket to a port number of 0, triggering a dynamic assignment by the OS, which it retrieves using getsocketname()). The argument was that is "creates all kinds of issues for firewalling, routi... |
I read in a book that both methods and fields are considered the attributes of a class in Python. However, recently I was told by a friend of mine that methods may not be considered the attributes of a class.
Then I decided to check this out again, and found this question mentioned on Wikipedia saying that this is a Py... |
I would like to know if I am expected to memorize coding in a workspace or am I allow to fall into references whenever I am unsure.
In a week of non-stop self learning, I feel I can understand the basics html and CSS, but am I required to memorize every single code once I get a position in this field or is it fair to u... |
How should I handle deploying web applications to multiple servers?
Constraints
I have a dev, test and prod environment. No build server is available. Developers can't deploy to prod. The people that do deploy to prod copy files from test to prod. They don't have VS installed.
Currently
The way it's handled is using ... |
Some software producers provide minimum requirements, some examples: Skype, Diablo III, Ubuntu-Server and OpenOffice.
I wonder how those minimum requirements are determined, especially RAM, CPU frequency in general? Is there a logic behind it or is it just determined by testing the program with different hardware to fi... |
I'm working on software that uses the following libraries:
Biopython
SciPy
NumPy
All of the above have licenses similar to MIT or BSD.
Three scenarios:
First, if I don't redistribute those dependencies, and only my code, then all I need is my own copyright and license (planing on using the MIT License) for my code. ... |
I am looking to create a simple code generator to convert XSD definitions to C# classes. This is partly as a learning exercise, but I would also like to get some practical use out of it eventually.
What would the general design of such an application look like? I assume that I will need to use one of the XML parsers ... |
I am working on an e-commerce website. There is a case where I need to fetch the whole data in database through a third-party API and send it to an indexing engine. This third-party API has many functions like getproducts, getproductprice, etc., and each of those functions will return the data in XML format.
From there... |
I've been a developer since 2009 and I've learnt a lot of languages since, but I've always wanted to understand and be able to code in the lowest level language so I can directly (or at least very close to directly) speak to machines through my code.
There was a point in time when someone showed me how to do an if stat... |
I want to develop a rather simple app using windows 8 metro style for GUI. But i need this app to have the same appearance, GUI, for both platforms, so that end users that uses it both on PC and a mobile device to have the same visual experience and a flawless navigation.
So, does anyone have knowledge of a Java framew... |
I'm trying to understand OOP so I can write better OOP code and one thing which keeps coming up is this concept of a delegate (using .NET). I could have an object, which is totally self contained (encapsulated); it knows nothing of the outside world... but then I attach a delegate to it.
In my head, this is still quit... |
Do Areas in ASP.NET MVC end up being a help or just a drag in the end (because of the URL construction)? Would it be better to have subdirectories inside the main Controllers folder? or are there any other options to organizing a project?
EDIT
For example, this is your average link without Areas:
@Html.ActionLink("Home... |
My question is on the best way to cluster a graph of class instances around specifically marked objects (objects are the graph nodes and the references to each other are the directed edges of the graph). To better explain my question, let me explain my motivation:
I currently use a moderately complex system to serializ... |
I'm building an application in PHP, using Zend Framework 1 and Doctrine2 as the ORM layer. All is going well. Now, I happened to notice that both ZF1 and Doctrine2 come with, and rely on, their own caching implementation. I've evaluated both, and while each has its own pro's and cons, neither of them stand out as super... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.