instruction stringlengths 34 19.9k |
|---|
I have started to learn c++ for some time ago. It is a big subject and I am not very use to it yet. Thus is this question asked more of curiosity, than something else.
In the book that I read to now learn there is a discussion about portability. I agree that the discussion comes quite earky for someone in the beginning... |
I have developed software that I would like to sell commercially. I don't know which license I should use. I've never used one before. I don't I think need/should to write one myself. Basically, I want to restrict end-used from doing these things without contacting me first:
share binary program with others
(re-)sell ... |
Lets say I'm building a site similar to this or Quora (or some arbitrary blog-like site). I need a real-time component that will be using web-sockets/long-polling to notify the user of new posts, questions, etc. depending on what page the user is viewing. That real time component will essentially be the site's API impl... |
We have been building custom software for one of our customer for a few years now. Everything is going well so far.
However the customer always has an attitude that when they find a bug in the software, then they are getting really pathetic and complain that they are now really disappointed with the quality of the soft... |
I've run into some code (C# if it matters) that has classes which have the same name, but differ in their namespaces. They all tend to represent the same logical thing, but often are different "views" of the same object. The different namespaces are at times part of the same solution, and even the same dll.
I have my ... |
I found myself creating child records that require a master record to exist, first, so that they can reference it by the master record's primary key (if that's the right term).
To accomplish this using EF 6 I tried to call SaveChanges() twice - once to create the master record so that its identity key gets generated an... |
ASP.Net is Active Server Pages using .Net Framework
Wikipedia says
It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology.
While answering this question following thought came to me – why Microsoft named it’s Web API as “... |
I already understand that Elastic Search is supposed to be deployed in a distributed topology, in that you can have multiple nodes for a cluster of ES instances.
I like the API, and it looks promising. But I wonder how Elastic Search solves some standard problems in distributed computing. My "architectural" questions a... |
Here is a copy of the Boost software license.
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare de... |
I am currently in the process of writing a (custom) Minecraft server application in C#. I figured it's a good way to teach me a lot of important things like concurrency and especially memory efficiency (due to simply the vastness of the object space in Minecraft).
While on the train yesterday, I was finding it hard to ... |
I was wondering which architecture/patterns to choose for the following problem divided into three steps:
Import TestScript Description from File (e.g. .xls, .txt)
Process Described TestScript
Export Description with processed Results as .xml
Here is what I got so far:
Importer that reads in xls and creates a hierar... |
I am confused about the notion of immutability. Consider the following structure of a simplistic calculator:
Here are the interfaces:
interface IOperationalInterface {
int Sum(int a, int b);
}
interface IAuditInterface {
int SumInvocations();
}
IOperationalInterface.Sum should compute the sum of two integers... |
Is object oriented programming always the good way for all types of projects? Is this methodology the best suited for large projects like compilers, interpreters and other large systems? Most of the compilers are written in C so I can't see any compilers written in the object oriented method. I think OOP benefits the m... |
You are given 2 queues, Q1 and Q2. Q1 is already filled with n elements. Q2 is empty
You have to reverse all the elements in Q1.
You cannot use any other space apart from Q2.
only operations permitted would be Q.enqueue() and Q.dequeue()
Time complexity - O(nlogn)
i found this question on a less popular website. http:/... |
Iv'e been programming for 15 years now and I often read online that it seems like a lot of people will plan out their objects and how they interact and the data they need and that seems to shape the exposed interface. However, I find my brain works from usage backwards to the structure and data. I'm wondering if this i... |
Ok so I am setting out to consolidate some learning I have been doing. What I am going to do is create a small game relating to a game I enjoy called Persona.
For reference a persona you can think of as a pokemon.
Basically I want the flow to be user chooses a character, a weapon, and a persona (from a list of predefin... |
So, unfortunately, I'm stuck with code where I'm doing this:
@Override
method A{
//calls private methods 1-8
}
private method 1{
//copy/pasted
}
And so on for all of the private methods. I'd have preferred if the developers of the method I'm overriding had made the private methods protected, but I can't chang... |
I'm trying to build a new application using the Repository pattern for the first time and I'm a little confused about using a Repository. Suppose I have the following classes:
public class Ticket
{
}
public class User
{
public List<Ticket>AssignedTickets { get; set; }
}
public class Group
{
public List<User> Gro... |
I have an uncommon problem. There are 2 3D objects, which are represented by arrays of vertices and triangles (.stl files). Each of them contains a big enough amount of vertices: 1-10 mln ones. The surfaces of these models are rough, and can contain different spikes or hollows.
The aim is to determine path of one the... |
What is the difference between an API and an embedded Domain Specific Language (DSL)?
Is it just syntax?
Consider an API like OpenGL. How is that different from a graphics DSL?
In other words, if an API is sufficiently complex, can it be considered an embedded DSL?
|
I have an ongoing discussion with some colleagues on how to manage the views to our model.
We've got a model which may be represented by many views. Let's say we've got some data that is stored in an array and we'd like to display the data in a table and in charts.
A certain chart is unique but you're able to duplicate... |
I would like to perform a permutation test on a particularly large data set, i.e. around 4 million entries. Basically, I need to get some number of random permutations of this data set. Usual way to do this, is a Fisher-Yates shuffle, but it's pretty much limited by period of a PRNG. That is, to a sequence no longer th... |
I am trying to learn the theory of node.js but can't seem to figure out how node.js knows whether to pre process it on the server or send it to browser for execution.
|
Basically I'm expanding a literate program in Haskell. There are two things I need to look for to expand. Here's an example file:
program.c.lit:
==============
Some comments in the source file that I can ignore
<main>=
code.. code ...
code..
<a>
Some comments in the source file that I can ignore
<... |
We recently tried to correlate the hours spent on a sprint against the stories assigned to the project (to try and get an idea of velocity and hours per point). However our recording system only allowed us to put time against a project and so included time such as:
Customer meetings / phone calls
Scrums
Development /... |
I have a Java app with three classes: Foo, Bar and Baz. All three depend on a bunch of what are currently constants defined in each class in order to determine how to run. On top of that, Baz interacts with a number of builder classes that need to be set up in various ways.
I'd like to refactor out all of the configur... |
The plan is to develop generic solution for long running task initiated in web site by users such as:
1. upload large file and do some custom processing and then insert in the database.
2. export large amount of data
But we do not want to run these tasks on web servers and instead run on dedicated other sever. I have a... |
I'm building my own JET Parser and one of the things I am trying to do as per the JET specifications is to allow changing of the start and end tags from the default <% and %>. Right now I have a parser handler modeled after javax.xml.parsers.SAXParser and org.xml.sax.ext.DefaultHandler2.
The handler can take handle a... |
Generally speaking, I'm fairly opposed to the use of anonymous types in real-world code (except in LINQ and some other specific scenarios), but I'm looking right now at a situation where I need to bind an ASP GridView control with a collection of tuple values and they're looking pretty tempting.
Basically, I need to sh... |
I started working in a relatively big company that unfortunately has its share of quite a lot of legacy code and I ended up spending an extra ordinary amount of time in maintainance and bug fixes.
I would like to switch project as on the surface there are other project that "seem" interesting. The issue is I am not r... |
I hope this kind of question isn't off-topic on this site.
I'm finally getting the hang of what a stack based machine is, and how to compile code for it. For example, the following code: 2 * 5 + 1 would compile to this bytecode:
push 2
push 5
mult
push 1
add
However what I want to understand is, the fundamental differ... |
I am going to be launching a small web service soon and was wondering if it's a good idea to upload the code to a public github repo.
The code will not be licensed for commercial use but the public could download the code and hack around with it.
Is this a good idea?
Would it help produce more secure/bug-free code?
Or... |
I just recently started learning C++, and as most people (according to what I have been reading) I'm struggling with pointers.
Not in the traditional sense, I understand what they are, and why they are used, and how can they be useful, however I can't understand how incrementing pointers would be useful, can anyone pro... |
I wasn't sure how to ask the question. But basically, it's a textbook scenario. I'm working on a site that's article based, but the article information is stored in a database. Then the page is rendered with the information in the database based on the requested article id:
For example: http://www.mysite.com/articles/9... |
I want to know if a license exists that is similar to GPL but allows only source distribution (that is no binary distribution).
Why do I want this? The idea is that I want fellow programmers to be able to have the benefits of open source software BUT also retain control over the consumer binary distribution. Specifica... |
Lately I've been asking a lot of questions here about VMs. Here's another one:
I understand that often stack based VMs use only one stack - the call stack - for everything. E.g. it is also used for evaluation of arithmetic expressions.
What I don't understand is, how doesn't this complicate things a whole lot? I'll dem... |
If you have a constructor that takes a lot of parameters, like this:
public OrgUnitsHalRepresentation(List<OrgUnitSummaryHalRepresentation> orgUnitSummaryHalRepresentationList,
int count, int providedCount, int total, int page, int filterLimit, boolean hasNextPage, boolean isDefaultCount)
You can use a separate cl... |
We develop an application involving a lot of ajax. Such as showing users notifications, updating what they see via ajax while they are on the web page. This update is due to the actions of other users in the application.
In the code base we are generating a query inside setTimeout
function of javascript. This makes an... |
From Java I know that the signatures of methods that can throw exceptions contain a throws block, that contains the Exception(s) that might be thrown.
In C# there is no such thing and it is also not common practice to include such info in the XML-Header.
Is there a generally accepted way of drawing attention to potenti... |
Once you create separate components that need to communicate with each other you enter the realm of systems programming where you have to assume that errors could originate at any step in the process. You throw try-catch blocks out the window and have to develop robust alternatives for error handling yourself.
We have... |
I am a programmer with a number of years of experience. I realized I got a certain habit. I'm not sure whether it's really a bad habit or not.
I get a list of tasks to perform for a solution, even small small tasks, for example,
Change resources of this user control
Change size of another one
Add some HTML and coding ... |
How would you statically type the following JavaScript program
function c(str) {
c = eval(str);
return c(str);
}
I'm not trying to start a flame war but I'm genuinely curious. I've always assumed that dynamic languages allow more programs to be written because of examples like the above. But if a statically typed ... |
Here is my code:
public class StrategyDemo {
public static void main(String[] args) {
Phone ipPhone = new IPPhone("1234", "ProviderA");
Phone tdmPhone = new TDMPhone("4567", "ProviderB");
ipPhone.getRecordingResource();
tdmPhone.getRecordingResource();
... |
I'm learning about unit tests, and have a doubt for a test i want to do,
to implement an "AND" logic gate
A B A^B
0 0 0
0 1 0
1 0 0
1 1 1
how can i test for a method that works like AND gate?, is this what a mock object is?
or stub?
Thanks,
Please provide pseudo code,
|
I'm creating a system where there are config keys and values. So for example:
config.key = 10
Is an example of a configuration key and a value. These keys can also have overrides based on "dimensions". So for example, if we wanted to apply config.key to applications with the dimension foo, the overridden key would ess... |
I have multiple segmented Rails apps that are connected to each other:
App A
App B
App C
While I try to keep the design, such as header and footer, to look similar, but each app has its own stylesheet, javascript and images in the asset folder. Some of these assets are duplicate, like CSS for footer. It makes mainten... |
We use Chef for both config management (making sure a "DB Node" has the right version of the right DB on it; that an "App Server" has the right version of Java and env vars on it, etc.). as well as deployment (chef-client --once) of our apps to the appropriate app server nodes.
To me, personally, I feel like deployment... |
In Java, there is a method called System.gc(), which calls the garbage collector (or rather, "suggests" to the JVM to run the GC).
Are there valid reasons to call this method? I'm thinking that it would be evident of bad software design.
|
In an effort to improve my coding skills I am trying to make use of the MVP pattern in one of my first Android applications. It is going well but I have hit one issue that I am not sure what is the "proper" way to deal with.
I have a View class that contains a Google Map object. It also contains a "spinner" that allow... |
I need to learn a notational language, so I can express and possibly prove the correctness of what I believe to be a complicated algorithm that distributes a credit adjustment across multiple water bills in issue date descending order. But I cannot tell what that notational language should be.
Each bill has three consu... |
I'm just now learning about C.
I find it odd that the creators chose the asterisk (*) as the symbol for pointers rather than a symbol that actually looks like a pointer (->).
Considering how confusing dereferencing and function pointers can be, is there a historical, or even practical, reason for using the asterisk?
|
I'm a Delphi pascal programmer, I use the latest Embarcadero delphi XE, and I would like to take advantage of design patterns such as Model view controller and model view view-model.
However, there doesn't seem to be much on the web about the best practices for doing this in pascal. Most of the examples that I can fin... |
Learning Django MVC and the way I thought of it is:
Models are the database tables represented in Django as Python classes.
Views are the HTML returned from function in views.py.
Controllers are the actual functions themselves in views.py invoked from a HTTP request.
However I read on Wikipedia (at the time of writi... |
Let suppose we have 2 classes, Pilot and Plane, being in an optional one-to-one relationship. So a Plane might have a pilot when it's flying, but when it's standing in its hangar, it has none. Similar for the Pilot.
It would be just logical to hold a pointer to the Plane in the Pilot and a pointer to the Pilot in the P... |
Each user has multiple sites they can access reporting data for in an application I am working on. To prevent having to go to the database on every single request, I validate that they have access to the site only when they change sites and I then store the the current site id in the session.
I am trying to eliminate ... |
Often open-source software projects have a folder called "contrib". For example, Django has one. What is it for?
|
Questions in bold:
I've read the Apache Software License 2.0... What I gather is that all a person needs to do when redistributing the licensed software is include their name in all the parts they've modified(if any), include some notices and whatnot, and you're away. You don't even need to follow along with the licens... |
I'm planning to implement a simple VM/interpreter kind of thing for a simple language I'm making. The compiler of the language emits mostly stack-oriented instructions to be executed by the VM.
The structure of the program will be something like this:
The execution part (for lack of a better term): interprets the
opco... |
I'm trying to simplify our unit tests with hand written DSL's. So far I have DSL's that walk developers through processing a service after setting up all preconditions and the construction of an monster object that has a huge constructor and setters that conflict. The monster is one of the many preconditions of proce... |
I'm trying to build a modular notification service in a ASP.NET MVC web application. The application generates notifications and the service is responsible for delivering the notifications to the right users. When creating a domain model for the notification service, inheritance naturally comes to mind.
One of the req... |
In Java specifically, but likely in other languages as well: when would it be useful to have two references to the same object?
Example:
Dog a = new Dog();
Dob b = a;
Is there a situation where this would be useful? Why would this be a preferred solution to using a whenever you want to interact with the object represe... |
I stumbled upon a specific instance where it seems that modularity and simplicity are at conflict with each other. Usually that's not the case, so I was really unsure how to resolve it.
Suppose I would like to make a queue interface:
template<typename T>
class queue {
public:
virtual ~queue() {}
virtual void enque... |
Recently we had a discussion with my colleagues caused by my intentional attempt to generate user friendly message about occurred error (business logic) at the server side.
They insisted on putting all string localizable resources inside web client assembly and not server one. The argument is to let client decide how t... |
I have a couple questions with regard to the GNU GPLv3 license.
My application is closed-source and I do not intend to actually release it to the public. However, it does generate commercial items. The use of dlls licensed under the above license are used and linked to the software that generates these commercial produ... |
I'm working on building a website using the F# MVC 5 template, and I noticed that the template creator uses formally declared types for the route defaults. In VB.Net and C#, this is typically done with anonymous classes, but these don't exist in F# my current work around is to use an Expando Object, like this:
[<Requir... |
Currently I'm working on a C/C++ code-base which is fairly portable, it can compile on most Unix like systems as well as MS-Windows (MSVC), using various popular compilers.
Previously I've found testing on different OS's and architectures can help find obscure bugs or bad assumptions.
I worry with the dominance of x86/... |
I've been reading up on MVC and I had a doubt. The example where the Model, View and Controller are all individual classes whose objects are created and used to deploy the application in another class. A GUI I've designed treats the Model, View and Controller as separate classes and for the most part changes can be mad... |
Reading SASS basic features on their website, I stumbled upon the @extend feature.
The example they give is the following:
.message {
border: 1px solid #ccc;
padding: 10px;
color: #333;
}
.success {
@extend .message;
border-color: green;
}
.error {
@extend .message;
border-color: red;
}
.... |
I am not really sure about what is the best way to deal with operations executed in background threads in an application I am writing.
I am writing it in C# and I am following the MVVM design pattern. Some user actions are expensive and I'd like to run them in a background thread, which is a quite straightforward appro... |
In ReactJS tutorial you are guided in the building of a commenting system. It's a very useful tutorial to understand ReactJS library, but there are some design choices I can't fully understand.
So let's start from the initial setup:
The system is composed of three components: CommentBox, CommentList, Comment and Commen... |
After a short discussion in the comments here I have come to wonder whether or not a baseclass like Animal in the traditional OOP example should be marked as abstract or not.
Personally I believe it should: there is no such thing as an "animal", it is merely a term that groups certain subtypes based on what they are. ... |
While in most cases its not necessarily, recently I have taken to reading the generated assembly of my C code every so often, when I'm curious as to the kinds of optimizations my compiler is making. Especially for low level code or functions which are called many times.
Examples include:
Checking if a change to the C ... |
A friend of mine has shown sometime ago the name of the below boolean technique/law but I forget that name unfortunately. Does someone know what it's called?
example in C language:
!(a || b)
It's a short to:
!a && !b
|
Only one or two years ago, I remember reading Python constructs that would be removed from Python -- reduce was one of them -- and other constructs that would be emphasized like comprehensions and generators. I saw a very nice description of how Python could be made more functional here, and I was wondering on which li... |
I have an idea for a game map and have researched some into it. What i'm going to do is have a 2D map(s) that a GM can pick from, or they can create their own using predefined images or images of a particular size they can upload.
From what i've seen, people are using a 2-Dimensional Array, but this is for tiles.
So wh... |
I've run into an interesting conundrum while coding my own implementations for the basic sets of mathematical numbers (Natural, Integer, Rational, Irrational, Real, Complex). I'm doing this mostly for fun, but also because I want properly represented numbers in code.
It started off with RationalNumber. I added two fiel... |
I am presently working on an AngularJS-based chat webapp, and it polls the server for updates, and then renders them in what is pretty much a straight shot in AngularJS. The result looks appropriate for the maturity of the project, but it completely shuts down clipboard copying from the dialogue because it redraws the ... |
Many VMs execute a language of binary form, knows as 'bytecode', which is assembled down from a human readable 'assembly' language.
For example the assembly instructions push 1 push 2 add are translated (I think) to a series of ones and zeroes, which is then executed by the VM.
Why? Why don't VMs, and the JVM as an exa... |
I'm trying to implement dynamic proxies in PHP and I'm running into a problem of implementing interfaces.
My current approach to building a dynamic proxy is by having a class which uses the __call magic method. The issue is that this class implements no interface and/or extends no other class. So if I have a method whi... |
By non-contractual parameters, I mean parameters that are not interfaces or service dependencies, something like class Person(string name).
I am writing a webpage scraping application, and so far I've written it in the wrong order (hence the creation of this question). I made a class to parse HTML documents (from stri... |
We're starting to develop many small web projects in our company, where mostly they will have one shared resource with some code pieces (SDKs, utilities and etc...)
Our team is small (~5) but is growing and is expected to grow x2-x3 in several months.
We're discussing what would be the right way to build our source con... |
In this book, the author is using avro to serialize data before it is being processed by pig. What I don't understand is, why we need to do it using a serialization framework like avro? Why don't we just use json as the serialization data format? This way we can just use serializer/deserializer library in a language e.... |
I have a maven project which contains some entities which are stored in a database. The purpose of this project is to manage personal information, users, locations, etc. This project can work on its own.
I also have a project which depends on the first which imports data into the database. But it's more than a simple i... |
I'm having troubles getting my head around the active-state handling of a menu when the menu isn't used for routing.
I come from Drupal where the menu system handles the routing as well. so setting active state and active-trail state is handled by the route (that acts as a menu rendering system as well).
Now, a lot of ... |
When creating the grammar for parsing a list (something like “ITEM*”) with a LALR(1) parser, this basically can be done in two ways:
list
: list ITEM
|
;
or
list
: ITEM list
|
;
What are the pros and cons of these two possibilities? In general, can an advice be given which one to choose, or do... |
My team is developing a WEB based finance application and there was a bit of an argument with a colleague where to keep the calculations - purely in back-end or keep some in front-end too?
Brief explanation:
We are using Java (ZK, Spring) for front-end and Progress 4gl for back-end. Calculations that involve some hardc... |
Requirements Management in the short term for Agile projects seems like a solved problem to me.
From the Scrum angle new requirements or changes to existing requirements are delivered through User Stories. And User Stories grouped under an Epic or Feature facilitate the delivery of larger more complex requirements.
Of... |
What is the verb for "to make something into a plugin"?
Example use: "Developer can you make Module Foo into a plugin?". "Yes sir, I can some verb Module Foo".
Terms I have considered: pluginify, pluginize, make pluggable
Criteria for Acceptance: A single verb which means "to make something into a plugin" or "to create... |
I recently stumbled over the following C++ Code which confused me a bit:
class One {/*definition*/};
template<class Base > class Two : public Base {/*definition*/};
template<class Base > class Three : public Base {/*definition*/};
template<class Base > class Four : public Base {/*definition*/};
class Five : public Four... |
Today I had a discussion with a co-worker about the naming of final fields in Java classes.
In his opionion final fields should also be considered constants since their values won't change after the creation of the instance.
This would lead to the following naming convention for final fields:
public class Foo {
pri... |
I know that it's possible to call .NET code from your VBA code, but why does VBA continue to exist? The only reason I can think about is legacy.
I just had to sort a Scripting.Dictionary and the amount of code needed was frightening.
The IDE looks like Visual Studio 2003. And there are many little details, that drive y... |
I have been working with laravel (PHP) recently, and there is an option when using their fluent ORM to define where clauses using closures. This gives us two, functionally equivalent, ways to specify a where clause that should only be added in certain cases:
Example 1
$query = App::make('Vendor_Orders')->
w... |
I am somewhat new to C# and just found out that: in C# all of the fields and methods in a class are default private. Meaning that this:
class MyClass
{
string myString
}
is the same as:
class MyClass
{
private string myString
}
So because they are the same should I ever use the keyword private on fields and metho... |
I'm having trouble trying to design a class structure for some search functionality. It's quite possible that I'm approaching this incorrectly altogether, but putting that aside I'm curious how other people would approach a situation as follows:
We need search functionality that allows users to access parcel informati... |
I'm kind of new to programming and i have a question that's been bothering me for awhile.
Why is the JavaScript-language different in different programs/sites.
I've used Codecademy to practice and i've noticed it's different from Eclipse and Unity.
For example, in codecademy, you use: var blabla = "something" to declar... |
I try to represent in a UML Class Diagram the following object and features:
The Object: A System (e.g. an electronic device) that can be of Type A, B or C
If the System is of type A, it has a specific extra attribute (let say "sub-type", which values can be A1 or A2)
I created a Class named "System" and:
Created a... |
I am trying to understand the difference between different rounding methods: Our application offers two different types of rounding:
IEEE
USP (GMP) rounding. http://www.usp.org/sites/default/files/usp_pdf/EN/USPNF/USP34-NF29General%20Notices.pdf
In our unit tests, they seem to do the same thing for the cases being t... |
I am about to start implementing a change request on my companies internal website, that will check a bunch of fields and highlight them if they match certain guidelines. For example, if the date of birth is today, that field will be outlined and the tooltip will say "Wish them a happy birthday!".
The specs ask for th... |
I have a Python script that counts the number of file in a folder, and if the number of files exceeds 10 then it creates a popup window to ask the user to clean up the folder (I use tkMessageBox).
How can I have the program run in the background so that it consumes only minimal resources? I tried running it as a daemon... |
So I am just getting started with .Net WebApi and one thing that I am noticing straight away is that there is no Contract defining how the API looks and should be consumed (Request/Responses from each Action), this is usually in the form of a WSDL for WCF/Soap.
It seems to me like this is something that would be very v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.