instruction stringlengths 34 19.9k |
|---|
I am trying to convince the lead developer of an open-source project I'm contributing to, to conform to the PSR standards (PSR-2 in particular) created by the PHP Framework Interop Group.
He is willing to adopt PSR-0 and PSR-1, but he is opposed to PSR-2. His argument is that PSR-2 is too inconsistent: opening braces f... |
I'm trying use the PSR conventions in all my projects, but today I view some code of my co-worker and I disagree.
if ($cond == 1 AND $cond == 2) {
// to-do
}
For me, the correct is:
if (($cond == 1) AND ($cond == 2)) {
// to-do
}
What is the correct use of the PSR?
|
I would like to create a site where users can post articles with the following optional parts:
A title
Contents (text)
Categories
Keywords
Articles will be stored in mongodb and the site will be built in node.js. Users can search the site using a normal search text box.
I'm thinking about creating the following colle... |
I'm having trouble coming up with a good way to structure the interfaces for two modules that are logically independent but whose implementations may be combined for the purposes of performance or efficiency.
My specific situation is the replacement of the separate queuing and logging modules in a message routing appli... |
I was reading the following article:
Polynomial interpolation of GPS satellite
coordinates, Milan Horemuz and Johan Vium Andersson 2006
and it states the following:
"The estimation procedure of the ai coefficients is done
with the Matlab function polyfit, which estimates the
coefficients in a least squares sense. To im... |
I saw this nice image here. I learned that all the compilers that support .net language convert the source code to CIL format. Now Microsoft is never bringing in .NET for all the operating system by writing a CLR for all operating systems. Then why keep such an intermediate code format and a CLR to execute that CIL. Is... |
I am working on a project with a few file formats. Some formats are specified by .xsds, others by documentation on their respective websites, and some are custom in-house formats that have no documentation. Mwahahahaha.
What's the problem?
I would like to test my file readers, but I'm not entirely sure how to go about ... |
static void Main(string[] args)
{
var c2 = new Class2();
var c3 = new Class3();
var c1 = new Class1(c2, c3);
c1.Method1();
}
class Class1
{
readonly Class2 _class2;
readonly Class3 _class3;
public Class1(Class2 class2, Class3 class3)
{... |
I want to improve my multi-threading and design pattern skills. As such I'm designing an Instant Messaging server.
I'm writing the Server first.
My plan so far is to have Client "Proxy" Classes to handle the socket connection for each Client. I want to have an "Exchange" Class that takes a message from a Client Proxy a... |
I am new to nopCommerce and ecommerce in general but I am involved in an ecommerce project. Now from my past experiences with RavenDB (which mostly were absolutely pleasant) and based on the needs of the business (fast changes with awkward business workflows) It seemed to be an appealing option to have RavenDB handling... |
A HashMap allows only one null key. Is it because it allows only unique keys? Or is there another reason?
|
For some background of why I am asking this question here is an example. In python the method chain chains an arbitrary number of ranges together and makes them into one without making copies. Here is a link in case you don't understand it. I decided I would implement chain in c++ using variadic templates. As far as I ... |
I'm involved in a project with several modules. I found that programmers have designed one module to be easily decoupled from its dependent modules using Java Reflection. If other modules need to call a method in this module, the programmers are expecting them to use reflection to call it. This has resulted in a lot of... |
One minimal Kanban-like system has three places for cards: "To do", "In progress", "Done". As I've seen Scrum and Kanban on the web, it is maybe five or six categories.
What are some of the common options for categories for Kanban and Scrum JIRA boards?
|
How can I unit test my generic repository?
Unit testing code:
[TestClass]
public class UnitTestLanguage
{
private IUnityContainer _unityContainer;
private IUnitOfWork _uow;
private IGenericRepository<Language> _languageRepository;
[TestInitialize]
public void TestInitialize()
{
_unityC... |
I'm learning C# using visual studio express 2012, and I cannot find a source online that explains window content convention. What I mean by this is, what's the appropriate way to change the context / pass variables from the main window to different contexts?
I've been able to change the content of my window by creatin... |
There are some well-known techniques for dealing with the notion of time in unit tests. These allow you to write unittests that always work with a specific time so the outcome of the test is predictable and can be verified. However, these techniques do not work with integration tests/UI test as the test and the applica... |
I'm building a simple RESTful API for a web-based application I'm working on, and I'm wondering about the best way to go about exposing my domain models.
Let's say I have a User class and I want to provide a JSON response with the various user properties. I obviously don't want to publicly expose every property of my m... |
As Go seems able to performance match C and with Google obviously biased towards Go, I feel that it would be great way for Go to gain more traction.
The way ChromiumOS/Chrome has jumped from an Ubuntu base to a Gentoo base, while they have the ability to avoid both and create exactly what they need from scratch, leads ... |
I've noticed a lot of programming introductions (almost any language) usually include a heavy barrage of string manipulation quite early, such as:
Count the number of "xx" in the given string. We'll say that overlapping is allowed, so "xxx" contains 2 "xx".
Reverse the given string and remove all vowels from it.
N... |
I work for a company whose point-of-sale service uses IIS servers tied to static IP addresses at each of our stores. My boss wants a better real-time stat tracker than what the point-of-sale service provides.
I would like to connect to these servers from a central location and retrieve the data. If possible, I'd like t... |
I have recently started working for a pretty big bank writing internal apps. I am being subcontracted out by the company I work for (who I have also recently started working for).
This bank has recently upgraded to Windows XP, they previously used Windows 2000.
I have been tasked with re-writing a report viewing applic... |
I'm currently managing and re-factoring a piece of software that has been used at my company for over a decade now. One of the elements of this application is a sort of admin or power-user mode which provides things like some additional/internal input as well as the ability to turn off input limits.
Historically this ... |
Here's the situation. I have an enterprise application that uses EF Codefirst to map POCOs to an existing database. This has been working fine so far. In fact I would say that it's been working really well.
A situation has been introduced (out of my hands) that involves adding new tables to the database and/or new colu... |
I'm a Java programmer, but I want to program in Jython. I've never coded in Python before, but have been looking through some tutorials and I'm fairly confident I can grasp it.
My question is clarity over Jython. I understand with Jython you have the joys of writing Python code with the added bonus of accessing Java l... |
Doctrine offers three ways to define the object mapping properties: in XML, in YAML and as inline docblock annotations in the code. The Doctrine documentation doesn't give any advice on choosing among them, but I'm specifically wondering if there is a generally accepted for best practice with regard to keeping mapping... |
In the past couple of years, I've worked on two projects.
The first one, we used a very agile methodology. It was very much developer driven. As such, changes were very quick and rapid. Code quality was high becuase it was a new system. There was an emphasis on group ownership of the project and knowledge sharing. Most... |
I'm programming in Objective-C. I want to include a camera library, DLCImagePicker, in my project. There is a variable I need to change, but it is private and I have no access to it.
I've thought of a few way to get around this, but am not sure on the best practice way to do it.
I can just copy the code into my own cl... |
I just started using GitHub to socialize some projects for simple chat and peer-to-peer apps. With respect to coding, is it customary to omit exception handling, error checking, logging, etc., to promote easy-to-understand and 'clean'-looking code, if those additions are not completely necessary to actually run the cod... |
I want to create an application which is dependent on .NET Framework 4.5.
If I am binding the framework with application setup the size of application increases to much but I need to bind the .NET Framework 4.5 with my setup.
Is there any other option to bind the framework with application setup besides downloading it ... |
This is part of a series of questions which focuses on the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. There is a sister project to Abstraction called OILexer, which aims to construct a parser from grammar files, without the use of code injection on mat... |
I am working on a project where class internal calls are usual but the results are many times simple values. Example (not real code):
public boolean findError(Set<Thing1> set1, Set<Thing2> set2) {
if (!checkFirstCondition(set1, set2)) {
return false;
}
if (!checkSecondCondition(set1, set2)) {
return false... |
I'm developing a Java desktop application. I'm planning to use MVC architecture described at Oracle site: Java SE Application Design With MVC.
I need to store data in database so I decide to use Hibernate as it is very simple
but there is any tutorial that use Swing+MVC+Hibernate.
It is possible to use them together? ... |
My program interacts with another application via a socket communication. The current public version of this application does not support a specific command while the newest trunk does. To be compatible with the current public release, I just need to re-write few lines of code. From the current point on, development mu... |
I'm a Games Design Student, aware of the frequent advice that I should be good at something else as well (Programming/Art) so I'm useful when a designer is not required and also for the sake of being more useful - generally as a wish to increase my employability, value in group projects and make me capable of individua... |
I do not understand the following example. It says that a function X will be executed if either of A and B variables will be lower than 5. The go on and explains that there are three valid equivalence classes for inputs:
A<5, B<5
A=>5 B<5
B>=5 A<5
Why there is no class for A>5 and B>5? Is it because this would not be ... |
I am designing an enterprise solution which consists of modularized products within a product range using Entity Framework code first to define the domain model and provide the data access.
e.g. Solutions:
ProductRange.Authentication
ProductRange.Gateway
ProductRange.OrderSystem
ProductRange.MarketingSystem
Each of th... |
I found this quote in "The Joy of Clojure" on p. 32, but someone said the same thing to me over dinner last week and I've heard it other places as well:
[A] downside to object-oriented programming is the tight
coupling between function and data.
I understand why unnecessary coupling is bad in an application. Also ... |
Background info and what I've tried
Within each of two mostly distinct environments, say 'Research' and 'Production', there is a need for a structured parameter file. The file contains things like database connections, tables, and some other parameters, nothing unusual.
The current approach is to have two distinct para... |
Say I have a class User and an interface Administrator. Some users are administrator and can thus implement the interface. Most aren't, however, so it's false to say that "User implements Administrator".
How can I represent that in a class diagram? Should I use the classic implementation arrow, or is there an existing ... |
I have a list of properties, that are bound to some string expression:
property z, expression '[x] + [y]'
property x, expression '[y] + 1'
property y, expression '1'
So to solve z, I need first to solve x and y.
My current approximation is this:
var solved = new List<string>();
while (properties.Count() > 0)
{
... |
This seems an extreme question probably but I'm wondering anyhow:
Can all business logic be decomposed as a (declarative) state diagram on simple crud operations and conditionals?
Already a lot of lower-level domain logic can, and ofen is declaratively defined with ORM-mappings for instance, handling things like:
do... |
It seems like a lot of university-level computer science programs and programmer job interviews focus heavily on algorithms and data structures. I'm curious as to why universities and employers put so much emphasis on the theoretical aspects of computer science rather than on specific languages and technologies, which ... |
Competition description:
There are about 10 teams competing against each other over a 6-week period.
Each team's total score (out of a 1000 total available points) is based on the total of its scores in about 25,000 different scoring elements.
Most scoring elements are worth a small fraction of a point and there will ... |
If the question appears to be off topic then please migrate to some other suitable domain on stackexchange.
Q.why to have GUI along with CLI, when you already have command line interface?
I'm currently developing an application. As of now application has a command line interface.
The target machines for application wil... |
I have HTTPS based webservices (not REST, rather old code). I am generating Java client stubs using Axis & using that to call the webservices. There are around 20 different APIs on the webservice.
I have 2 servers hosting the webservices (identical - 2 servers are being used for redundancy) and data is synced between ... |
Designing a programming language, I'm including the ** exponentiation operator. In Fortran and Python, the two languages I know of which have this operator, it binds more tightly than unary minus, which makes sense for practicality as well as tradition.
It should bind more loosely than the prefix increment operator ++ ... |
I manage to create a circle inside triangle with this code, but circle inside other polygons are not maximum size:
var p1 = board.create("point", [0.0, 2.0]);
var p2 = board.create("point", [2.0, 1.0]);
//var pol = board.create("regularpolygon", [p1, p2, 3]);
var pol = board.create("regularpolygon", [p1, p2, 4]);
//va... |
I'm programming a plugin for a software under GPL v2. I'm using an unique name for my plugin, but I'm considering to rename it. I would like to take another plugin's name which has been abandoned and isn't currently being developed.
Am I allowed to take up that name without asking for permission from the author beforeh... |
I want to refactor a webapp that consists of very distorted JSPs and servlets. Because we can't switch to a web framework easily we have to keep JSPs and Servlets, and now we are in doubt how to include pages into another and how to setup the use:bean-directives effectively.
At the first step we want to decouple the co... |
Many literature references suggest that the binary labeling problem can be converted into a graph cut problem and solved with the max flow/min cut algorithm. I'm trying to understand the formulation given in Xiaowei Zhou's presentation of the reduction.
The binary labeling problem consists of partitioning n items (here... |
For instance, a class like:
class Dog { } //never mind that there's nothing in it...
and then a property like:
Dog Dog { get; set; }
I've been told that if I can't come up with a more imaginative name for it, then I must use:
Dog DogObject { get; set; }
Any thoughts on how to name these better?
|
I have a number of (large) test files that need to be maintained. This means access to their history is a requirement.
Benefits
Any new developers get the entire test suite with just a git pull.
The history of the files is backed up.
The files themselves are backed up.
Drawbacks
Huge increase in size of repository.
... |
I am intern learning tons about the industry outside of academia.
One thing I thought about today was trimming input.
On one side of the coin I don't want the user/implementer to constantly receive unexpected results because their input had too many spaces, thus I need to constantly trim user input after every functi... |
In C# you can construct methods with the return type of IEnumerable<T> and use yield return and yield break to control the flow. Here is a simple example that uses both controls:
public IEnumerable<int> GetEvens(int start, int end) {
if(end < start)
yield break;
if(start & 2 != 0)
start++;
... |
Background:
Our team develops a solution and it includes a number of projects. Most of the projects are built as DLLs and those DLLs are used by the rest of the projects.
Currently we uses Subversion for our code management and I ask others to remove DLLs from Subversion because we do not need to keep the history of t... |
Most unit testing tutorials/examples out there usually involve defining the data to be tested for each individual test. I guess this is part of the "everything should be tested in isolation" theory.
However I've found that when dealing with multitier applications with a lot of DI, the code required for setting up each ... |
I have been programming in BASH for a while now and the scripts that I write are starting to get more complicated.
I realized that I started to bring in some habits from C/C++ and wanted to get confirmation on if I needed to break my current habits or not. The reason being, not all programming languages are the same an... |
On http://en.wikipedia.org/wiki/NME_%28framework%29 there is an info:
NME is an open-source game and application framework that supports
iOS, Android, BlackBerry, Microsoft Windows, Mac OS X, Linux, Flash
Player and HTML5, with legacy compatibility for webOS.
On OpenFL website ( http://www.openfl.org/about/overvi... |
I have gone through many articles and I am still confused whether to use the Unit of Work pattern or not. I use generic repositories (Repository Pattern) but if my understanding of the UOW pattern is correct, most persistence tools today offer a unit of work pattern already implemented (DbContext, ObjectContext, DbSet)... |
PROBLEM
We have various tasks in our system which can take up to 20 minutes. These tasks are generally started from the web interface and run on a new thread. This is obviously a terrible solution because the task could be recycled by IIS and it hogs up precious resources on the web server.
POSSIBLE SOLUTION
Hostin... |
Suppose the following type is defined (C++ syntax, can be conceptually applied to any statically typed language.)
class T {
int val;
friend bool operator<(const T& lhs, const T& rhs) {
return lhs.val < rhs.val;
}
// Ideally, if we should make them "friends"
// Also, this doesn't make them belong to... |
I have a couple projects that depend on additional files, like images or config files.
When compiling and installing a programs like Okular with cmake, I can specify an installation directory and let make install install to that. Somehow, that program will figure out that all its dependencies are within that folder, no... |
Looking at Euclid's algorithm for the "Greatest common divisor of two numbers", I'm trying to divine the big-O cpu time for numbers K, and N. Can anybody help?
This is the algorithm as I understand it..
Where:
max(A,B) = the greater of A or B such that: min(10,3) = 10
min(A,B) = the smaller of A or B such that: min(10... |
From my experience in web development, I know that languages like PHP,Java,Python..etc are used for backend development stuff (software that running on server), and for front end languages, JS/HTML/CSS are used.
But I see many companies say that they use, for example, PHP for front-end development, and python for the b... |
Sometimes when I create an API that should enable getting a single value or all values I use the following pattern (passing NULL to the API, means get all rows):
@Usernames - comma separeted list of users
CREATE PROC GetUsers (@Usernames VARCHAR(100) = NULL)
AS
BEGIN
SELECT *
FROM Users
Where @Usernames IS ... |
In my company, a single task can never be completed by one individual. There is going to be a separate person to QA and Code Review each task. What this means is that each individual will give their estimates, per task, as to how much time it will take to complete.
The problem is, how should I approach burn down? If I ... |
My (first and current) workplace (a .NET shop) suffers from an over-abundance of anemic domain models, to the extent that I don't really know how validation and data persistence should be handled in a proper domain model.
Data Persistence
One option would be to give the domain model a way to do persistence itself. You ... |
On an application I've been working on I have a function, connecting to a virtual machine, that can be performed two ways. The user can either select a machine from a list and click the "Connect" button. Or can double click on the machine in the list. Currently they are two separate event handlers because they function... |
Let's say I have a JavaScript web application which entirely uses a RESTful API for data.
Let's say this application has a data form, and let's say I'm editing a record at /product/12345. When building the form, I make a RESTful request to /product/12345 and get JSON data:
{
"id": 12345,
"name": "Some Product",
"... |
I've been working with akka for 7-8 months now daily.
When I started, I would be working on applications and notice that actors would be used basically anywhere once inside the actor system for communicating between most objects. So I did the same - spin up another actor for x/y/z.
It seems to me that this may be too i... |
I am doing work for a company that is wanting to put all their .Net applications (web applications, Windows applications and console applications) together in a single Visual Studio solution.
I am looking for experience from developers who either structure their own applications this way or who work in a company that ... |
In terminal based scripts (Shell, Bash, Python, etc), if you prompt the user "Do you wish to continue?" and the user chooses "No", what exit code should the script ideally return?
On one hand, the script executed as the user expected it to (the user wanted to quit, so it quit), so it should give an exit code of 0. On t... |
I have an abstract syntax tree which I want to compile down to different representations. I am now struggling to arrange the classes in a way that new representations can be added easily.
The easiest way to achieve this is to add a method for each representation, e.g. compile_to_foo, compile_to_bar. Additional represen... |
This would seem to be a pretty basic question, but I can't seem to find appropraite guidelines for it. What is the "restful" way of POSTing a relationship between two entities that are not necessarily parent/child. As an example, consider customers and orders.
One could create a customer with a POST to /customer. Howev... |
I'm playing with the idea of learning Scheme but I have a few misgivings.
From what I understand Lisp makes heavy use of macros that allow programmers to drastically change the language itself. I understand why that's useful, but how does this affect collaborative projects? How much confusion can this cause if other de... |
I'm just getting started with Git. I'll be doing PHP development and was wondering if I should initialize my repo within my server root folder, or any directory on my hard drive and publish my changes to the server root. Does it really matter, any pros/cons?
For now, this is just to keep track of personal projects I'... |
I need to implement a serial protocol to communicate with a device using .NET (C#). This implementation should be a library (.dll) to be used in different projects.
I have the datasheet that describe the protocol (baudrate, stop bits, message protocol, commands, etc.) and I know that I need to use SerialPort class from... |
I am working with a native class that represents a 2D image as a 1D array. If you want to change one pixel, for example, you need to now how to derive the index from the x,y coordinates.
So, let's say we have a 1D array array1d like this:
array1d = [ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, ... |
If you were to accept a role as a full time web app developer responsible for creating a new application from scratch, how much of a defined specification and design would need and/or expect to start development?
What tools/software is even used for this (for web apps built with something like RoR)? I would expect a mo... |
I develop on iOS, and I'm switching from a PHP backend to Ruby on Rails. The interchange format is JSON.
A quick Google search for 'save images in Rails' has nearly every result talking about saving image data as blobs to the database. I might be mistaken, but I'm under the impression that saving image data in a databa... |
I'm deciding on how to generate the code to allow users generate an embeddable widget (much like the StackOverflow badge) into external websites.
The content of the embedded widget will periodically change, but it doesn't need to be communicating in real-time with my server after a visitor has loaded the page where it'... |
I got to see many designs that normalization wasn't the first consideration in decision making phase.
In many cases those designs included more than 30 columns, and the main approach was "to put everything in the same place"
According to what I remember normalization is one of the first, most important things, so why i... |
I'm implementing what's basically an event log system for a larger system. I used Single-table inheritance to build out the table.
The problem I'm having is figuring out how to build out the classes from the database. It's easy enough for me to figure out what they are to load them into the database, but to pull them... |
User Story captures what the user wants to do with the system at a high level. I understand that the user story would further drive a number low level requirements. Is user story same as high level requirement for the system?
|
I am working in a small company with around 15 people (dev and qa). We are trying to practice Agile in our company. We are doing daily stand-up meetings. We are also doing a weekly project status meeting with our CTO. There we report our CTO regarding last week task and overall project status. My question is whether d... |
I am building a donor database for a non-profit organization and one issue I'm mulling over is how to store some of the donor data. There are some families for whom we capture the names of both spouses, hence each spouse gets its own record in the DB, and naturally they share the same address. Because it is likely to... |
I'm currently building an object model library for use in a project. It wraps our internal concepts - Servers, Folders, Items - in an object hierarchy (IFolder, IItem, etc), and we have several implementations of these abstract objects, using a database or an Exchange server as a back-end, so that an IFolder object in ... |
Since the GNU project is celebrating its anniversary, and the initial announcement for GNU is linked to (http://www.gnu.org/gnu/initial-announcement.en.html) all over the place, I reread it and I stumbled upon the plan for a lisp-based window system:
and eventually a Lisp-based window system through which several Lisp... |
I'm working on a project that involves records with fairly large numbers of fields (~15-20) and I'm trying to figure out a good way to implement deduplication. Essentially the records are people along with some additional data. For example, the records are likely to include personal information like first name, last na... |
This is a followup to my question here.
I have to make a web GUI for a library that manages remote clusters via SSH.
The main point is that this library spawns threads and subprocesses (Popen) internally (for the SSH connections), so I think I am I/O bound by these SSH connections. I want to prevent my server from goin... |
I need to write a simple API for a project I'm working on. This API will be used internally to perform some server side actions that were triggered by AJAX calls.
To make things easier for me, I thought of using the Chain-of-Command/Responsibility pattern.
Here are more details about what I want to do:
I am creating a... |
Working on Plone projects our team tries to achieve full test coverage at least for important products. The kind of tests we write are unit tests, functional tests and integration tests. (Also stress-tests, but those aren't in the scope of this question). The goal is two fold at least: to facilitate upgrades and to cat... |
Before I'm flamed, I'm just a beginner in programming. I have been learning Python for about 1 week by myself.
I have a real problem to solve:
Goal: The fastest route through a pathway.
Problem:
Walk forward to get to the goal. The pathway is 128 steps.
Walking 1 step increases the danger value by 113
If the danger v... |
I am building a hobby marketplace (comic books). Users are able to list comic books they own for trading with other members. The problem I'm running into is that I would like to standardize the listings so I can display multiple options per title. Like this:
User 1 lists: "Amazing Spider-man #4" on site.com/amazing-spi... |
I'm trying to use MQS to create a Gantt chart of 5 processes (P1-P5) as well as their waiting, response, and turnaround times (and averages of those metrics) within a CPU task schedule. Here's the basic table of arrival times and bursts:
Here's my actual work version after ticking off the finished processes. The time... |
The Software Setup:
I am currently planning on creating a new software product. I have never commercially launched an application, nor am I doing this for a company. It's more for fun than anything, but it may bring in some cash too. :P Anyway, there are going to be two "core parts" of the software:
Part Number One: T... |
Here's something I keep struggling to figure out the best solution to. I've had this problem while working with PHP and Java so it's a fundamental understanding of OOP issue. Examples are in PHP.
Let's say I have a few object's here. Song, Artist, ArtistProfile, User.
So in some instances I want the ArtistProfile and a... |
When compiling C code with gcc, there are compiler optimizations, some that limit code size and others create fast code.
From the -S flag, I see that the -O2/03 generates more assembly than the -Os code. How is more assembly still faster than less assembly?
|
In his famous The Free Lunch Is Over article from 2005, Herb Sutter predicted a Concurrent Programming Revolution as big as Object-Oriented Revolution. Has this revolution really happend in years 2005 - 2013?
Key points in the article:
Processor manufacturers have run out of room with most of their traditional appro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.