instruction stringlengths 34 19.9k |
|---|
I am writing a parser (a parser generator for PEGs) and am trying to figure out how to report errors.
Grammar:
rule: (a b)? a c ;
Input:
a d
Question: Which error message correct at position 2 for given input?
expected "b", "c".
expected "c".
So should it be taken into account that "b" was also expected at position... |
I am very new to programming and my first task is to create a WCF service that will take an ATOM feed and expose it to my application. Now, I've read up on XML serialization and syndication but it doesn't seem to be what I need in my (lack of) experience.
Here is a snippet of the feed. It's generated by a seedlist spi
... |
Let's say that we have a structure like this:
Application
-- Modules
--Module1
-- Controller
-- PublicHelper
--Module2
-- Controller
-- PublicHelper
Whereby a module's Public Helper can provide helper functions.
In nearly every module helper, the help... |
I've done some searches for "id mapping" and "external id mapping" and I can't find anything meaningful on the site or google, so, here's my question/scenario.
I'm developing an application which will match some records from our internal system with the "same" records from an external (outside the company) system. The ... |
I work in embedded systems. Right now, my organization has two full-time programmers and two occasional programmers. It's rare that the same project is worked on by two programmers. All code is stored on a network drive. There are folders for the current production code, another folder for the source for every released... |
Here is how I see the main differences between the DAL and the BLL:
The DAL directly query the database.
The DAL doesn't create new information. It may execute complex sql requests, joining several tables, but the result of such a request never gives any information that wasn't already in the database.
The BLL applies... |
Current Scenario
Our application allows users to upload (Amazon S3) and manage their files through our interface. Currently those users can download the files directly from S3/Cloudfront through our application.
Adding a Zip feature
We would like to add a feature to the system that allows users to select multiple file... |
The hot topic in our organization is Service Design Approach.
First Approach - The team wants to design services which essentially have one operation, can take any XML and return response XML message. The operation and the parameters are in the request XML message. Once the message is received the service determines t... |
I am confused about this: what type of data can we store in register variables?
I guess logically we can store any kind of data as register variables because they are variables, but really I am confused.
I have tried to search on internet and in my book. I couldn't find the answer. By book I am referring to ANSI C's pr... |
Consider a database table of Items that have a status flag represented by an integer. A few of the status might be:
0 - Past Storage;
1 - Current Inventory;
5 - Scrap;
6 - Rework;
15 - Processing;
Now, I would like to avoid passing and querying for 'magic numbers' in my code, and in the past I have used a Dictionary ... |
So there's this desktop application.
And I am wanting to inform it's users that a new version has been released.
Is it more correct to say that a new version of a desktop application has been 'released' or 'deployed' (as with a web app)?
|
I have written software and have granted usage rights to different companies per contract. Is it possible to change the software licence to an open source licence afterwards?
At what circumstances is this impossible and how will this affect the current contracts?
Like one of the companies is allowed to modify and resal... |
The Situation
We are writing a REST API that performs validation up-front.
The code is written such that it tries to find as many errors as possible.
However, each error might correspond to a different HTTP status code.
Additionally, the client (the HTML) doesn't have a convenient way to parse/display the errors.
The Q... |
In some code I'm writing right now, I have something like this:
if (uncommon_condition) {
do_something_simple();
} else {
do();
something();
long();
and();
complicated();
}
Part of me thinks "It's fine the way it's written. Simple cases should go first and more complicated cases should go next.... |
I'm very new to git, but last week I installed it, set up bitbucket, and pushed my current project to my first bitbucket repo. All went well and I'm pleased with git as a simple, powerful, yet free way to back up my source code offsite, as well as keep track of my changes.
My next step is to keep track of actual versio... |
I'm writing a library to create and manipulate Word .docx files in Python. In general, I take a lot of influence from the Microsoft VBA/C# API for Word in designing the API, figuring they've given it a lot more thought than I'll ever be able to. Several times I've found the wisdom in designing it the way they did only ... |
I have a DevelopmentConsole class. I am making functionality to register console commands for the subsystems. I don't want the console to know about them but also I don't want them to contain a debug code (like "Console.RegisterCommand...").
I think I should make an additional class hiearachy. For an example I have Pla... |
[Normally I post on StackOverflow but as this is more a design/theory question rather than a code question I'll give it a shot here]
Most of my applications currently use a core object model that I originally wrote 6 years ago and which has just grown as needed - as with most of my stuff, it was coded as is, without th... |
If we make reference to the parent for each node in a tree, do we still have a tree (by definition) anymore?
Wikipedia definition is:
In computer science, a tree is a widely used abstract data type (ADT)
or data structure implementing this ADT that simulates a hierarchical
tree structure, with a root value and sub... |
I'm a self-taught programmer. Up until now I haven't had too much problems building things I have wanted to. Historically, given an issue, especially one I have caused I haven't had much of a problem figuring it out. This all changed about two months ago, when I was offered my first position at a company whom I became ... |
I appreciate that this question may be controversial. In a sense, it is the flip-side of the question "Business trying to make technical decisions".
In Scrum, the development team is supposed to be collectively responsible for making design and technical and code-level decisions, to fulfill the customer requirements. T... |
I have a service architecture composed of services that service common areas of the application. Examples of services would be:
AccountService (manages client accounts in the system)
BillingService (bills clients for products that are configured)
UserService (manages user and groups under a given client)
NotificationS... |
Currently my company has a Visual Studio solition in an SVN repo that's organized as follows:
SolutionFolder (~3.5 GB)
|-> SolutionName.sln
|-> .. Some source code folders... (~250 MB)
|-> ThirdParty (~3 GB)
|-> Tools
| -> Tool1
| -> Tool2
Tool1 and Tool2 are build independently (have their own solutions), but... |
When you create programs (like a socket server) that are designed to run on an operating system, such as Ubuntu, frameworks like Qt for C++ use something called a main event loop:
app = new QCoreApplication(argc, argv);
int rc = app->exec()
Now programming language like C or C++ enable a program to make system calls t... |
I've found a GitHub project I'd like to add some features to. After contacting the maintainer, the changes aren't in line with the direction he's going but he's interested to see what I do with it. What is the GitHub etiquette for using one repo as a base for another project that almost certainly won't ever be merged b... |
Is there a way to have a "critical update" for my app on the Google Play Store that would require the user to update the app to keep using it?
For instance, let say I push an update that brings a few bugfixes. Nothing mandatory, the user updates it if he wants to: that's a non-critical update.
Now, say I correct a very... |
I need to add a feature to some code in a big project and due to the complexity I find it very helpful to add detailed comments to many lines to keep track of what's happening. This is only for my own understanding however and I will delete the comments before pushing the code.
The problem however is that if I do priva... |
I have a project licensed under the GPL. However, it includes a bit of code from animate.css, which uses the MIT license. How would I include the appropriate licensing information for that CSS? I've included that bit of css (maybe 25 or so lines) in my main stylesheet, so I'd rather not have a huge stamp like what's on... |
I am developing an Android app in which I have to add chat functionality. Also, I have to save the chat history. I will accomplish this task using SQlite. But, I am not sure whether should I consider using an ORM like GreenDAO or ORMLite or I should use traditional way of persisting data in SQLite.
Actually, I am not c... |
I am working on an application that expected to the user logs in when the application is started (as for example it is in Skype: the user open the application and appear to him a login mask when he insert the username and password to start work with the application)
Now I am preparing some use case diagram and I am col... |
I'm building a new report generator for our in-house survey system. (No I can not use any off-the-shelf software. These are highly customized reports.)
I want to use Topshelf to host the generator as a service. Our current generator is a desktop-app and requires a user to be logged in on the server. I want to try to av... |
I recently interviewed with some companies that do Agile, Scrum to be more precise and there are some things that don't quite seem like Agile to me. I'll take one case that particularly interests me right now, that of Scrum sprints.
One particular project manager I talked to (yes, I said project manager) proudly stated... |
I own a web application that make use of Twitter Bootstrap 3.
This eases the design of the mobile version since it brings some responsive features.
However, I would like a really native-mobile aspect for the mobile version, but not a native for the Desktop one.
I searched..and I found this really promising framework: I... |
Our company is looking to introduce remote working as an option for its developers.
This book (Remote: Office not required) has been offering some valuable guidance.
However one issue that is not addressed is the employment and management of junior level developers.
In a remote working environment, how do you ensure th... |
I am working on an application that heavily depends on asynchronous data operations. I am dealing with those through promises.
However, while my code works, I have the feel that it is getting chaotic and hard to maintain in the future.
Assume this:
validate().then(
// success
function(promise){
$http.post('stuff.p... |
I'm actually arguing against this, but want to see if I'm out of line.
We have a PaymentQueue table and a simple UI. This table is, at the moment, primarily used by the UI and no other business logic. The UI requires data that is only in a subset of possible statuses.
One developer put this status restriction in the ... |
Background
So, I'm developing a project, and I'm writing setup.py script for it, using distutils. I'm using CPython3.3.
I use some libraries that have invalid distributions in PyPI, so they have to be installed by cloning repo and running setup.py manually (I've tried many things, both libraries help said I just need t... |
Given the class:
public class Foo : IFoo
{
private IBarRepository repository
public Foo(IBarRepository repository)
{
this.repository = repository
}
public IList<IBar> Bars { get; private set; }
}
My long standing instinct is to initialise the list of IBar in the constructor: this.Bars = new List<IBar>... |
I have my (JSON) API structured like this (which I'm pretty happy with):
API Project
/_V1
/Controllers
V1EntityController.cs // Applies to version 1 only
/_V2
/Controllers
V2OtherEntityController.cs // Applies to versions 2 and below
/Controllers/
EntityController.cs ... |
I've recently become quite taken with conditional expressions in Python. Apparently some people consider it unpythonic and whether or not conditional/ternary expressions are even A Good Thing seems to be up for debate -- but I've been digging them lately.
x if C else y
So far I've noted there are two ways Python will ... |
I previously had an issue with my node.js app on Heroku. I added the dependency into my package.json and now it is working. But, is this the best way to do it?
{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "3.4.... |
What is meant by a step-by-step refactoring plan describing how to
implement a certain design?
As little as I know about refactoring it regards improving a (UML) design model and has nothing to do with the implementation of it. Therefore I'm pretty much confused by what this question means. Does anyone know and wil... |
Consider a hierarchical structure like this
directory
[
[item_0;item_1;...;item_n]
[item_0;item_1;inner_directory[...];item_m]
other_directory
[...]
]
A directory contains
An array of strings (delimited by ';' in input data)
A map from name to sub-directories (the name ... |
I'm writing a basic web API in Java that does what almost all others do: take input, validate it, then do CRUD operations on the DB. I've written several APIs before, and I've pretty much already figured out what constitutes a good response back to the client.
However, like most APIs, there are several layers of object... |
I'm working with a framework where the fields displayed on each web page are defined in the application database. Administrators can add new fields to pages or hide/completely delete old fields. The logic for each page is in a Java class - sometimes there's a one-to-one relationship between a page and a class, sometime... |
Could someone explain this line:
In more complicated contexts, such as "+=", a rewrite is performed by
doing both get and put.
Taken from: MSDN - Property
What do they mean by rewrite?Is it a compile-time rewrite or does it induce run-time overhead?As far as I know in release mode properties are compiled to the sam... |
Right now I am using Google C++ Style Guide in my C++ code and I was pretty happy with it.
Recently I was told that this guide is very bad: it is used internally by Google (I knew that), is outdated, and promotes some very bad practices. So I want to use another coding style.
What good and fairly used C++ style guides ... |
On python I can group arguments into a tuple, something like
def func((a, b, c, d), x):
print a, b, c, d, x
I was wondering if it is possible to group arguments in the same way on C++, something like:
void func((int a, int b, int c, int d), float x)
{
cout << a << b << c << d << x << endl;
};
|
I'm planning on providing some GPL software to visitors after they interact with an advertisement. This advertisement will generate revenue for our company, so this would fall under commercial usage. I understand the GPL requires us to either provide the source or a written promise to provide the source upon request wh... |
Functional Programming in Scala explains a side effect’s impact on breaking referential transparency:
side effect, which implies some violation of referential transparency.
I’ve read part of SICP, which discusses using the “substitution model” to evaluate a program.
As I roughly understand the substitution model with... |
In this answer of mine, I used _t at end of types, which ended at best, controversial. This is the practice I use in my current projects.
typedef struct {
int x;
int y;
} point_t;
This was intended to be consistent with C types from stddef.h like size_t or ptrdiff_t. However, according to certain comments in m... |
Is it possible to rename a portion of code extracted from a Apache 2.0 licensed software, releasing it as a new repository under a new name?
|
I'm trying to chain a series of methods that are async. I have heard of promises and futures but what I'm looking for is:
obj.setup()
.do_something()
.do_another_thing()
.end()
and not:
obj.setup()
.then(...)
.then(....)
I have come across a tutorial that explains how to do this, but unfortunately... |
I have a question about object oriented design that is not specific to Python but since my code is in Python, I tagged it as such. How do I decide which of my classes should be responsible for implementing certain functionality that may affect more than one class? What are some good guidelines >(if any) or consideratio... |
Consider the following piece of code
class Foo
{
public:
//...
bool valueFirstGet(int& value) const
{
if(this==nullptr)
{return 0;}
value=values[0];
return 1;
}
//...
private:
int* values;
size_t n_v... |
tl;dr
Is it possible to include an external library (and create instances of objects represented within that library) based on some condition? This must be done at compile-time, so separate builds?
Background information
Warning: Wall of text.
If I have some code that requires a link to an external class:
using myExter... |
As I understand, the idea with Agile methodologies is that you deliver something functional and you deliver it often. The application gets into its final shape increment after increment.
But in the early iterations you might build the framework or foundations on which the application will stand so it's something import... |
I recently ran across an idea put forth by Jaron Lanier called "phenotropic programming."
The idea is to use 'surface' interfaces instead of single point interfaces in computer programs utilizing statistics to winnow out minor errors that would typically cause a "classical" program to catastrophically crash.
The two-li... |
Background info (May Skip): I am working on a task we have been set at uni in which we have to design a grammar for a DSL we have been provided with. The grammar must be in BNF or EBNF. As well as other thing we are being evaluated on the Lexical rules in the grammar and the Parsing rules - such as if rules are suitabl... |
Whenever a new project starts, it usually makes sense to start by committing straight to master until you've got something "stable", and then you start working in branches.
At least, this is how I normally do it. Is there a way to immediately start branches from second commit? Does it make sense to do it this way? Obvi... |
I'd like some input on how to keep databases that are running on different servers throughout our organization synchronized.
We have a registration system of sorts, and when user "John Doe" registers on server 1, this registration information needs to be instantly available on server 2 and 3. Currently, our network adm... |
I have a RESTful API that offers eCommerce functionality. One area I'm struggling to decide on the correct implementation is how to process payments.
Lets say I have the following URI GET .../checkout/{id}/payment. This resource provides details to the client application of what details needs to be submitted to make a ... |
If I'm giving an interview coding question in Java, I can specify the most of the question just by giving a method signature. (Made-up example follows.)
public class Table {
public String identifier;
public int seatCount;
}
public static List<String> tablesWithEnoughSeats(List<Table> tables, int minSeats)
If the... |
I was hoping someone might have some ideas on how to create a RESTful web API where models/entities are searchable by a foreign key. I see a a lot of tutorials where the functionality consist of listing all records in the entire model or retrieving a single record from the model by a primary key, but not by an arbitrar... |
I'm having trouble designing an inheritance hierarchy.
In the figure:
Base class:
This uses the Template Method.
Contains core logic/algorithm that
calls virtual/abstract methods
Derived types:
These classes provides concrete implementation of the virtual/abstract methods expected by the Base.
Conditions:
I have... |
I'm faced with the following problem:
I have an array which is produced by the parsing of a yaml file which contains patterns in the following structure.
"Programming books"
Title:
a list of titles
Author:
"Art Books"
Title:
foo
bar
Author:
Mrs. Foo
Mr. ... |
I am developing a C# windows service application, which have different configuration files for development, for production system, for test system, like:
Dev.config
Test.config
Prod.config
Now we are using SVN version control system, and configuration files stored in projects directories:
-trunk
-MyFooService
-C... |
Currently, I'm using Parse to handle my backend, and I have multiple ways to login -> via regular email/password and via linkedin.
Parse has a specific method of logging in requiring username/password.
If a user registers through linkedin, I hash a combination of his information as his password, and login through parse... |
I am trying to find out how to block a whole area/controller from being accessed by typing url website.com/area1/basecontroller/method1 (this area also contains the views that will be displayed) , while still being able to inherit said controller and use the method from original controller like so website.com/area2/ext... |
In C++ a reference argument to a function allows the function to make the reference refer to something else:
int replacement = 23;
void changeNumberReference(int& reference) {
reference = replacement;
}
int main() {
int i = 1;
std::cout << "i=" << i << "\n"; // i = 1;
changeNumberReference(i);
std... |
I'm working on a business application (C#, WPF, EF, MVVM). I need to load a bunch of items from database, create view models for them and put them in a window. Is there a way to create the view model in another thread or do something similar to speed up UI?
The approximate average time needed to fetch all items from d... |
I have to create a flowchart to a C# programm and I am not very familiar with it.
My problem is that I do not know if one should represent variables initialization in a flowchart and if so how should I do it. Second problem is that I am not sure about the correctness of my for loop.
Here is the flowchart I created tot ... |
What's the term for an error caused by executing a block of code before its relevant ajax response has come back? e.g., a timeline:
13:00:01 execute getDataViaAjax();
13:00:02 execute doSomethingWithMyAjaxData();
13:00:03 ajax data comes back, too late since I forgot to make the code wait for it...
I have a feeling I m... |
I need to design a database table that holds the data of programmers work hours.
The problem is that I have a compound type - two pieces of data belong to a category.
Specifically, the work hours are classified into categories: design, program, test, troubleshoot, etc... and each category is divided into two types: hou... |
I would like to write an algorithm which can traverse a graph and hopefully later I can implement it to use for an indoor navigation system.
The graph would come from floor plans of a building and the graph nodes represent the building objects such as doors, corridors, stairs, rooms, etc.
The navigation system will ac... |
I need to realize a database in this mode:
TABLE restaurant
with "classic" fields of a place: address, street number, phone, website, etc etc etc.
I need to indicate also the days of opening // closing. E.g. From Monday to wednesday close, saturday only evening and sunday lunch + evening.
So, I did think at another ta... |
I've read countless posts on differences between Entities and Value objects and while I do think that at least conceptually I understand how the two differ, it appears that in some of these posts authors consider a particular domain concept to be a VO simply because it is immutable ( thus its state will never change, a... |
Let's say I'm developing a web application. My first choice is to use PHP with Fat-Free Framework (F3) and MVC pattern. Next year, I might decide I want to switch to Zend Framework, or maybe even ASP.NET MVC. Does it make sense to try and design my application in such a way that it is loosely coupled to its framework, ... |
Okay, so here's how I understand IoC and DI in Web API to work when using Castle Windsor.
Note, though, that my confidence that I understand it as I should, though, falls somewhere between my confidence I could best Dennis Rodman in a one-on-one basketball game and my confidence in his sanity.
Another way to put it is ... |
I know this is common question, but why should a programmer be aware of software licenses as well as extensions and plugins licenses?
I'm working in a company which focuses on the business process (Ruby on Rails) and I'm curious as to why they are strict on such licenses in the project development.
What licenses should... |
Is this user story substantively correct:
As a system owner, I want everybody that uses the system to have
to log in using a secure password and login system, to prevent
unauthorised and random access to system data.
And then:
As a user, I want to be able to log in with my secure password, so
that only I can a... |
I am coding a Java program on my development machine. Maven packages this a myjar.jar, and I can run it from the command line using java -cp myjar.jar my.FantasticClass. It uses library somelib.jar. I use Maven, and the project is hosted on github.
When I want to run my project on the target machine, what is the best w... |
I have a JSON API that includes some discusssions. I want to build a static html site on another server, pages that are built from data on that API. I am more comfortable using Rails than Node. The API is done in Node. The idea is that I periodically call the JSON api to get the data, and dynamically build the html pag... |
In the game there are 5 players, each with 8 cards in hand. No other card is present.
Using Monte Carlo (MCTS) I run many simulations of the game from the current state to the end of the match. In those simulations adversaries play with very simple dumb rules. When generating a new simulation I assign to them unknown c... |
I am plaining to use Ubuntu for developing Android and php application which I will sell in market. As far as I understand Ubuntu falls under GNU GPL license.
In this case do I need to make my source code open for all?
|
This question is about PSR-0 autoloaded libraries and the way main configuration constants should be declared and used.
From your point of view (lib/framework developer), where/how should be declared your library configuration PHP constants (such as ESCAPE_SOMETHING, USE_DOM, API_URL, ...) in such a way that
your cod... |
In the current Cocoa app I'm working on, I've got an object, RecordScheduler, which responds to two types of notifications, "day did pass" and "quicksaving interval did pass". In both cases, the RecordScheduler tells a Recorder to do its recording job, among other things.
Now I want RecordScheduler to issue a recordin... |
Just trying to get some ideas on what people do for this scenario.
We have a system database(SQL Server 2008 R2) that has tables and every table has a field we can call "Deleted". It's basically a bit field if its a 1 the record is deleted, if it is a 0 it is not deleted. The field is not nullable and its default is ... |
There is a popular quote by Jamie Zawinski:
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
How is this quote supposed to be understood?
|
Background:
I have a CSV file, which I need to ready and validate each element in each row and create a collection of a class, having valid data.
i.e
CSV File looks like:
EmpID,FirstName,LastName,Salary
1,James,Help,100000
2,Jane,Scott,1000
3,Mary,Fraze,10000
Class looks like:
public class Employees
{... |
I won a bid on Elance and was had a request to fix some css and html issues with a WordPress site.
How do I make changes to the document without working on the live site? Do you set up a development environment for every job you get? This would be time consuming on a job that pays very little. I was offered access to t... |
Reading this article (by Eric Lippert), it has four arguments as to why you should use sealed, however, I don't understand why we actually need it. Philosophical/aesthetic reasons aside, why do we need to use sealed?
I can see how things like readonly from C# or const from C++ actually catch genuine errors. Is there an... |
We have data stored in a data warehouse as follows:
Price
Date
Product Name (varchar(25))
We currently only have seven products. Once every business day, seven new data points are added representing the day's price for each product.
On the website, a user sees this information on a page load. Analytics shows that the a... |
Is checking count/size/length less than 0 necessary in modern languages anymore? For instance, in C# I quote often will check if a collection's count is less than or equal to 0.
I assume that this was done in older languages, like C, where you could potentially have a size of less than 0.
Is there ever a case where you... |
I had worked in the past for a small company developing web applications. Back then the current lead developer, who is also one of the bosses, told me that he is incapable of making a JOIN inside a SQL query.
I was amazed how a person who has developed and maintain big ecommerce site is incapable of doing that.
Are da... |
In java, to print the date we could do either of the following:
Fully qualified
public class MyMain {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(new java.util.Date());
}
}
Using an import
import java.util... |
I am the only one at my company that is familiar with MVC and they are getting more pressure to modernize and switch to MVC for future projects, so I was tasked to create a template to use as a base for any training or as a base for new projects. This is perfectly fine and I'm glad to do it.
However, one absolute requi... |
We all use if ..else if.. else.
But still I'm confused as to why we use else if. Where if does the same thing as else if.
So why are we using else if?
Any specific reasons behind this?
Is there any algorithm where it's mandatory to use else if?
|
Why do we need the switch statement if there is the if statement? Why can't we use several ifs like
if(a==1) do this1;
if(a==2) do this2;
...
instead of
switch (a) {
case(1): {do this1;break;}
case(2): {do this2;break;}
...
}
My teacher said that the answer is built on how assembler works, but ... |
What is the difference between an ambiguity in a proposed algorithm and an ambiguity in the representation of an algorithm?
I have done some research and found out that ambiguity in the representation of an algorithm is when the representation can be understood by a group of people and not clear to another group e.g. a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.