instruction stringlengths 34 36.1k |
|---|
I have a communication class that incapsulates all the apis of a remote application.
This class happens to be a delegate class because it is interchangeable with another one (the remote application has two different channels).
This class has a number of topics (eg: acknowledge, people, invoices, duedates, payment metho... |
I read on node.js's official site that Node.js is a JavaScript run time built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O mode and highly scalable for network applications. And some thread I read that it is not for CPU intensive tasks. Is that mean that its not a good idea to use no... |
Recently, i got the task of doing some research into the data encryption at the cell level. I tried using the Symmetric key (by passphrase) & second option i took is Symmetric key (by Certificate). I need the encryption to be performed only on 3 columns inside the customer related data table.
Example:-
ColumnX1 - Cha... |
I just let my brain run wild and the results are again chaotic. It is kind of bothering me how in the very basics, programming itself can be pretty redundant.
Let's look at this snippet of code and analyze what it does
public function __construct($data = array(), $strict = false, $prefix = null) {
if (!$data) {
... |
I have an issue with shared code in a MVC application. Application controllers/views ABC are different classes but use a common framework. It is a single class reused multiple times.
Let me introduce exhibit A, which shows a mock-up of the application's A's main window.
There are two main points of interest. To the l... |
I've seen that it's possible to extend the default Exception class in PHP, enabling one to throw an IncorrectParameterTypeException exception, or a ValueOutOfRangeException exception (maybe these are bad examples of custom exceptions... I'm still learning).
But I'm just wondering, why would I want to do this? I would i... |
I have a complex web application that manages stores and their customers.
The application follows a basic MVC architecture and I should migrate it to a multi-tenant application:
- I should go from one store to more stores belonging the same company
I will have a db for each store (one db with tenant_id is not an opti... |
Everything I've read says that they should be used when something that simply "shouldn't happen" does happen. But the thing is, there's a lot of things that could go wrong.
For example, if I'm accessing an object's property via the magic __get($property) method, it's possible that there would be no property called $pro... |
Whilst implementing our API, the issue of datetime and timezones came up.
All dates are normalized to UTC in the database. Currently, in the non-API application, all datetimes are converted based on users preferences first before presented.
Now the same question came up for the API: should the the API be able to return... |
What was the first programming language to support convenient user-land recursion?
I know that early languages did not support it, but can find no specifics on when it was introduced.
|
How does one begin to design an abstract class for the larger application that can interface with several types of databases, such as MySQL, SQLLite, MSSQL etc?
What is the design pattern called and where exactly does it start?
Let's say you need to write a class that has the following methods:
public class Database {
... |
I am wondering what would be the most appropriate method to handle translations in JSON files in terms of arrays and objects.
Considering an object has properties related to itself, is a translation a property or a completely different entity? In which case using an array would be more appropriate.
Let's take a JSON fi... |
I need to make table that seems to require two column primary key with one of the columns nullable.
But according to questions I read on Stack Overflow that is undesirable and even against SQL standards (for example: NULL value in multi-column primary key)
Yet I cannot figure out how to avoid it, and I would appreciat... |
So i am inheriting a team and a large project that should have been built with a restful back end. For the time it is only reporting and we all agree to build out a web API (separate project) with using AngularJS in the current MVC project and slowly migrate everything to the web API back end.
There is a lot of authent... |
In our game project we currently have 2 teams that work in 2 week iterations. In the past we've repeatedly had issues with larger features (bad planning/estimates, unforseen issues before code freeze causing the stories to not getting closed, etc), and we've discussed those problems in many retrospectives.
Since the fe... |
Git internally stores objects (Blobs, trees) in the .git/objects/ folder. Each object can be referenced by a SHA1 hash that is computed from the contents of the object.
However, Objects are not stored inside the .git/objects/ folder directly. Instead, each object is stored inside a folder that starts with the prefix of... |
I'll use the MobA games to illustrate what I'm asking since it's easier to explain even tho I want to apply that algorithm to time series.
In a MobA game you have more than 100 characters and every game involves 5v5 with 10 different characters. So it's 10 choose 100 meaning there are 17,310,309,456,440 possibilities. ... |
Multi-platform development tools like Unity offer us an ability to quickly deploy games to many platforms at once. However, I'm concerned about whether the final product will be any worse compared to being developed for single platform in mind.
For example, I'm creating a game with both PC and mobile device in mind. Ha... |
I'm working on a fork of a project under the GPL that hasn't been maintained for over a year. How do I handle the copyright notice?
Here is the copyright notice how do I add my copyright?
Copyright © 2013–2014 Philipp Emanuel Weidmann (pew@worldwidemann.com)
Final Term is free software: you c...
I have made a lot of ... |
Is the controller in Angular and ASP.NET MVC aimed to do the same like:
Consume services to shape the data (model) to return to the view.
Modal validation.
|
I would like to put together a system where clients obtain messages from a REST API, but with the producer being able to use the semantics of a message queue: e.g. ordering of messages, a destination mailbox, etc.
I figure I can have one message queue per client.
When a client connects to one of N stateless webserver/... |
I'm working on an application that involves very high execution of update / select queries in the database.
I have a base table (A) which will have about 500 records for an entity for a day. And for every user in the system, a variation of this entity is created based on some of the preferences of the user and they are... |
I've read quite a lot about Software Configuration Management (on the Internet and also SWEBOK), but I have no clear what is the purpose of SCM tools. Or, better said, what do these tools provide that other tools do not.
Let's say that I have an environment with the following tools:
Jenkins for continuous integration.... |
We're moving from Bitbucket to GitHub and one thing we are struggling with are peer code reviews that worked very smoothly on Bitbucket like this:
Author opened a Pull Request (GitHub: the same)
Author added his/her colleagues as reviewers (GitHub: ?? struggling here with multiple assignees)
Reviewer either:
Approve... |
What will happen if I extend a class A to a controller B, when A has instance variables (private, protected)?
I have a main controller MY_Controller(handler) which has several methods: can_modify (can the user modify think?), has_permission, success, error (to build array of error messages).
Then there are specific con... |
It seems that in all class-based or prototypal OOP languages, mixins are either an afterthought or a secondary feature. However, to me it looks like traditional inheritance is just a specific case of using a single mixin.
I am assuming this is because of historical reasons and familiarity, but maybe there is something ... |
Which ioc frameworks for .net can use concrete type attribute to choose it's lifetime? Here is a simple example
public interface IService
{}
[Singleton]
public class ServiceImplA : IService
{}
[Transient]
public class ServiceImplB : IService
{}
class Program
{
static void Main(string[] args)
{
//now ... |
Summary
Should authorization in CQRS/DDD be implemented per-command/query or not?
I am developing for the first time an online application using more or less strictly the DDD CQRS pattern. I bumped into some problem, which I can't really get my head around.
The application I am building is a ledger application allowing... |
So, I wrote a little piece of software (really little piece of software) and I want to open source it using Apache License for EVERYBODY but for a company, for that company I want the license to be GPL.
Is this possible? If so how should I implement this? I just add a License section in the github readme explaining tha... |
Some people maintain that integration tests are all kinds of bad and wrong - everything must be unit-tested, which means you have to mock dependencies; an option which, for various reasons, I'm not always fond of.
I find that, in some cases, a unit-test simply doesn't prove anything.
Let's take the following (trivial, ... |
I'm working on upgrading an application written by a former developer at my work and I've been converting all the SQL queries in the code into Stored Procedures. I'm doing this with the idea that it can be easily called whenever it is needed instead of having the SQL query string repeated several times in the code. Als... |
Is there a name for this pattern where an API offers several variations of a method (differing in number of parameters) and internally forwards them with default parameters like this:
public void doSomething(Object one) {
doSomething(one, null);
}
public void doSomething(Object one, Object two) {
doSomething(... |
I'm currently putting together a talk where I discuss the value of unit tests in enforcing the SOLID Open/Closed principle.
However beyond the obvious "the bug wasn't there when I wrote it, it's been introduced" I'm looking for a definitive study which proves that obeying the SOLID rule of "Open to Extension but Closed... |
I want to create a Graph in C++ that has directions, with directions I don't mean the direction of an edge but what I want is an undirected graph where the edges have a direction to the next vertex, for example lets consider we are in vertex1
up = vertex2
right = vertex3
down = vertex4
left = vertex5
Lets... |
There seems to be rough equivalents of instructions to equate to the cost of a branch miss virtual functions have a similar tradeoff:
instruction vs. data cache miss
optimization barrier
If you look at something like:
if (x==1) {
p->do1();
}
else if (x==2) {
p->do2();
}
else if (x==3) {
p->do3();
}
...
... |
I am working to solve interesting concurrent problem! Not sure if I understand it correctly since I am little bit confused.
The system needs to process the prices, and typically they cannot be processed as quickly as they arrive, so the implementation must sample the latest price. The external system produces prices f... |
I have discovered that reducing the arity of functions in my code to zero or one improves their non-functional characteristics significantly, such as testability, maintainability and their composability.
This must have been identified elsewhere - does this approach have a name?
|
I need to retrieve five stars from a group of stars so I can hide them by turning their visible flag to “false”.
I know the x, y coordinate value of each star I am looking for.
My algorithm opens a transaction and retrieves a group of stars whose x, y values falls within the extents of the five stars I am looking for.
... |
In UML class diagram notation, how do I denote a top-level function that doesn't have any encapsulating class or other structure?
e.g. I have a function used for retrieving data from a URL. Since it is a function (in the math sense) of only its parameters and a shared global state, the function is not put in a class bu... |
I think about if there is a pattern or another intelligent solution for that problem. I am searching for a more generalized and reusable solution.
I load an existing and still persistent row/object from a database and display this data in a editable dialog-window to the user.
When closing the window I want to know if t... |
PMD Rule LoggerIsNotStaticFinal:
In most cases, the Logger reference can be declared as static and final.
I seem to remember some arguments for using local variables for logging, but cannot recall it.
One example seems to be for an instance variable, but requires that it be a final, initialized in the constructor. ... |
I am developing COM. A factory need to be initialized first by providing a ID. I can not pass arguments to IFactory instance via CoCreateInstance. So IFactory may need add a init method to be called then. (as approach 2)
I don't want to require client to call init explicitly (they may forget). So that I add a layer nam... |
In the book Effective Java its told that:
The basic idea behind Java’s enum types is simple: they are classes that export
one instance for each enumeration constant via a public static final field. Enum
types are effectively final, by virtue of having no accessible constructors.
So, if I have an enum like:
public... |
I'm putting together a set of models for use in a Zend Framework 2 application. So, each model has a table class which acts as the interface between the model and database for querying. Using the ZF2 TableGateway means that even a fairly simple query, like getting the number of hits from a page log between two dates, e... |
I've read several articles, watched videos and read questions on here, but the more I read and learn about MVC - including MVCS or MVP in addition.. to make it even worse - the broader the pattern seems, so I apologize if the question is broad or long it is just because I really want to figure it out and understand it... |
There's a problem on hackerrank.com called Grid Walking.
Here is its description:
You are situated in an N dimensional grid at position (x1,x2,...,xN). The dimensions of the grid are (D1,D2,...DN). In one step, you can walk one step ahead or behind in any one of the N dimensions. (So there are always 2×N possible di... |
In a C# or VB.NET project, should we include the PACKAGE folder (NuGet package folder that is created in the root of my project that contains the nupkg files and other content) to our source control repository (Git for instance)?
|
Following this blog by @Tomasz Nurkiewicz we can see that 4 different approaches are available for picking the ExecutionContext, when interacting with akka actors, for scala futures to run on.
import ExecutionContext.Implicits.global
//or
implicit val ec = ExecutionContext.fromExecutorService(Executors.newFixedThread... |
I've written a linux application that interfaces with a lot of GPL software. My application is written in javascript/HTML/CSS/python and uses MariaDB on a CentOS 7 platform (it also uses jquery and a few simple third party tools); we would like to sell this on our hardware as an appliance. The GPL software we are inter... |
My colleagues insist on ploughing every bit of output data they can into subversion. I can't see the value in this practice and would much rather use a file system. The key offenders are build and test output.
We end up with folder structures in subversion like:
project repo/tags/build 1.0/binaries
project repo/tags/bu... |
I have a Resource named Company, that can have Post Resource,
I have a path for create of post as:
POST /api/company/{companyName}/post.
My question is whether, must i use a path as
PUT /api/company/{companyName}/post/{postId}
or PUT /api/company/post/{postId} for Update of post resource?
|
I was trying to find a "perfect" syncing program between a network share and a local folder, when I realised that it's probably impossible to do it right unless all the filesystem operations were captured by a log of some sort, that could then be replayed on the remote server. Of course the same thing is required at th... |
We're finally migrating our client/server system to the cloud and would appreciate help on the handling of email within the webapp. Currently we monitor the inbox/sent items of Outlook.
It seems that that some people use a bcc to an app-specific mailbox for the user that can then be logged when sending to a customer, s... |
I'm relatively new into designing databases so this is my first project and I'm trying to understand better it's structure.
I need to create a SQLite database where there will be a simple USERS table with personal information such as name, sex, age, etc.
Then, each user will Add as many Dog names they want on a List.
I... |
I have the following Ubiquitous language defined by our domain expert: A User can find UserGroups and add himself to it. A user can query a list of UserGroups where he is member of and remove himself from it. UserGroups are created by Users, where the creator is the first member. When there is no more User in the UserG... |
I want to ask some questions about best practices regarding mapping types and using extension methods in C#. I know this topic has been discussed multiple times over past few years, but I've read a lot of posts and still have doubts.
The problem I encountered was extending class that I own with "convert" functionality.... |
I am developing Node.js, Redis based chat application in php. I had an idea about chat logger structure but I required suggestions that how and what to choose proper data structure to create Redis database for logger application.
I know that Redis having lots of data structure options to implement a chat application d... |
In a discussion about static and instance methods, I always think, that Sqrt() should be a instance method of number types instead of a static method. Why is that? It obviously works on a value.
// looks wrong to me
var y = Math.Sqrt(x);
// looks better to me
var y = x.Sqrt();
Value types obviously can have instan... |
PHP (PSR-2, anyway) recommends using the vendor name as the root namespace for projects. At face value, this seems to mean we should use the current name of our company. But I work for an enterprise that has been involved in multiple M&As over the years; the name keeps changing, and the old name often still belongs to ... |
When designing exceptions should I write messages that a user or a developer should understand? Who should actually be the reader of exception messages?
I find exception messages aren't useful at all and I always have a hard time writing them. By convention the type of the exception should already tell us why something... |
Consider data modeling in Scala(the other language is the same), we often want to composite one model inside another, e.g a Post may contain an author field whose type is a User.
When we retrieve the data from db, we might want to retrieve some basic information due to the performance consideration and complete the oth... |
I have a project with an internal desktop client app and a server-side client API service talking to a relational database. I seem to have two choices:
1) shape DTOs to client views, e.g. AccountOverviewInfoDto and AccountFullDetailsDto for a master-detail GUI scenario:
+ optimal amount of data is transferred;
+ serve... |
This question is connected with my older question C# Application GUI design dependent on configuration.
I have built quite big WinForms application working in industry for a few years. It communicates with many HW devices. Application can be configured to use or not use some of these devices and GUI is modified by thi... |
Providing I have the following scenario: I have a Web application where users can deposit money to their accounts (wire transfer). When a user deposits money to their account, they should click the "Refresh my balance" button to refresh their balance.
The business logic behind the "Refresh my balance" is the following:... |
For example, the video IDs that YouTube uses are not a simple number, but instead a case-sensitive, alphanumeric string (like dQw4w9WgXcQ). Why do some websites, such as YouTube and Dailymotion use an alphanumeric string for these IDs instead of using a plain number?
An obvious answer might be because the resulting IDs... |
I was working through a Ray Wenderlich tutorial and noticed that the author uses class extensions to hold delegate callbacks rather than having them be handled in the class itself i.e.:
delegate callbacks inside class extension:
extension LogsViewController : UIPopoverPresentationControllerDelegate {
func adaptiveP... |
I am currently writing an immutable multipurpose vector class in Java that essentially wraps a double[]. The class will be part of a game library, used to calculate entity positions, physics, pixel coordinates etc. I aim to make them also usable for other (non-game related) calculations.
The vector class provides basic... |
Any Java code will always have a class which has the same name as that of the file. The whole designed program resides inside this class. However, in C++ we don't have this provision. What is the rationale behind this approach where the whole code resides inside a class? What extra advantage does this provide? Can we c... |
I have a MongoDB database that I want to properly document its schema design. I know that MongoDB is a NoSQL database and is schemaless by nature, but I do enforce a schema through my application and I want to represent it in a better way than a print of a findOne() result.
I see many people using ER or UML, but I don'... |
I have a few lists of items (which will likely but not necessarily have common elements). The lists are known to be sorted, but don't have a comparison function (they were manually put into the system in sorted order). I'd like to combine these lists into one list containing all the elements that is in a reasonable ord... |
Suppose you want to color the vertices of a graph in a greedy fashion, given a predetermined order of these vertices. The goal is to avoid giving two adjacent (linked by an edge) vertices the same color.
I am wondering if these two algorithms are equivalent:
Algorithm 1: Consider each vertex (in the given order) and as... |
Some languages and libraries can associate assertion messages with assertions. Such assertion messages are included in error messages when the assertion does not hold. Examples are Java, Class::Contract, ContractLib and to some extent Eiffel itself (labels).
If I haven't overlooked something, assertion messages can eit... |
It's unbelievable but my company is still building web app on IE 6. Although the online dashboard for IE 6 is limited in functionality, I've found extremely difficult to debug anything on it. It's probably the most challenging task in my career, and I'm considering to leave the job because it takes way too much time to... |
In the Android support libraries here the destroyItem and instantiateItem functions throw an exception if they aren't overriden:
175 throw new UnsupportedOperationException(
176 "Required method instantiateItem was not overridden");
Why wouldn't the developers just make the functions abstract? Wo... |
What time in terms of Big O will it take to merge two BST's in One?
Each having no of nodes n and height O(log n) with no common element.
Resultant should be also a BST
|
I want to design an online book reader. The first step is describing all the use cases which I have listed below:
I should be able to search a book by title.
I should be able to borrow a book.
I should be able to bookmark a borrowed book.
The system should allow one user per book at a time.
The system should allow to ... |
I have just forked a project in Github, made my changes etc. This got me wondering: I see mostly README.txt in opensource projects and the file I edited was Readme.txt. Is this some sort of standartisation or should I have left it as is?
|
I have trouble designing classes that reflect different business behaviors/rules. An example to explain my case:
- a tour has a departure
- a departure may be a guaranteed departure
if a departure is guaranteed:
- a guaranteed departure may have a date that, starting from that date:
* departure cannot be cancel... |
We currently have a large amount of custom mailboxes hosted on Lotus Notes/Domino and have been tasked to migrate these over to our Outlook/Exchange environment.
The mailboxes are basic Lotus Notes shared mailbox that a group of users have access to, but the mailboxes functionality has been extended to provide features... |
In Java the observer pattern is implemented with at least one interface (often ending in Listener or Observer). Such interfaces can be placed nested inside the class or be separate, for example:
public class FooService extends RunnableService {
// Nested interface
public interface Listener {
// ...
... |
In Java main methods often do little more than parsing the command line arguments and initializing an object that then takes over, for example:
public class FooServer {
// ...
public static void main(String[] args) {
// Process arguments ...
FooServer server = new FooServer(...);
// Ini... |
I want to implement a database driven payroll system using CSharp. I already did it once, but the implementation sucks so I want to do it again and do it right.
My first thought is to create a static class calculator which would simply hold all the formulas, one private method per formula. One main public method "Calcu... |
I might be missing something obvious here, but why does Python 2.x sorted() function work like this?
In [95]: l = [1, '5', 4, 2, '3', 'b', 'c', '-a']
In [96]: sorted(l)
Out[96]: [1, 2, 4, '-a', '3', '5', 'b', 'c']
Python 3 returns exception (TypeError: unorderable types: str() < int()), which I expect more than this r... |
I have a large object graph in .NET (F# as it happens) that I need to persist to disk and then will load again periodically for use in a calculation.
The performance of deserializing is more important (will be performed many times) than the seriliazing (will only be performed once) should that have a bearing on the ans... |
We've all seen discussions on the ideal length of a method. My favourite litmus test for code quality is to look at the "if" statements, to see whether the values being tested belong to the current class. The further removed the tested value from the context of the test, the stronger the smell of a modelling problem.
S... |
The "problem" that I am having right now its quite simple, I am creating a code with A LOT of validations, in case one of those fails it is supposed to throw an exception.
In order to make the messages explicit in favor of depicting the reason for the exception I need to write a "considerable" amount of text. This woul... |
I got a question that quite disturbs me a lot and I think it might help a lot if I had an answer to it. So I got this:
class Klasse1:
variable1 = "haha"
class Klasse2:
variable2 = "hoho"
print Klasse1.variable1
print Klasse2.variable2
and this:
class Klasse1:
variable1 = "haha"
class Klasse2:
variable... |
I am learning a bit about REST and am intrigued by the concept of a uniform interface, and the ability of a client to follow hypermedia links in order to detect service capabilities.
As I understand it, the RESTful server will return a hypermedia document "representation" of an "entity" that contains relevant links. I... |
I'm writing a Design Specification Document for a college project and wondering about the tense I should use. The development on the project has not yet started, I'm just writing the UI design section.
Should I use:
This app is built around a two column layout, with a header element.
or
This app will be built around... |
I was recently thrown into a Java web application project, and I’ve come across a number of classes that follow this type of format:
public class MyThingy {
private final int p1;
private final String p2;
…
public MyThingy (int p1, String p2, …) {
this.p1 = p1;
this.p2 = p2;
…
}
pub... |
I'm having a hard time finding information on this, but using the Amazon API (such as the ItemSearch api) provides you with data on Amazon products. In my case I am interested in books.
The Amazon API generates links to pictures of the books and details on the books.
I want to use this in my smartphone app, but Googl... |
I'm creating a new site which will have many objects, such as posts(text/photo/video), products, photo galleries, etc.
Currently my design is to put all of the objects into a posts table, but I'm starting to wonder if that might be too restrictive.
I also have a post_tag pivot table...
Would I be better off creating a ... |
I am intrigued by the Event Sourcing pattern but am struggling to design an event sourcing model and put it in concrete form.
First off, I want to make sure that I understand the main use cases of this pattern. As I understand it, one uses event sourcing is to capture state changes in your app at different points in ti... |
I was reading an article here on Mocks. I would like to conclude to make my understanding more clear.
Anything that can be placed in place of a real object while testing is called a Test Double.
Depending on the testing need a Test Double can be categorized as follows:
You need a placeholder object needed just for com... |
I found the slides of his talk there: https://meetingcpp.com/tl_files/2014/talks/executors-meetingcpp.pdf
In one of the last pages, he is talking about the "async desaster" (which I, as a non-native speaker, read as "async disaster"). What disaster was he referring to exactly?
|
I want to write application that takes Wireshark File and read all the packets inside this file.
So i want to able to support several formats.
Until now i can handle Libpcap, Pcapng and TcpDump.
So i wonder hot to design my application.
I was thinking to create abstract class:
public abstract class WiresharkFile
... |
I am curious how to deploy android native (that is, using android NDK or Qt C++) application to the end users. AFAIK, the apk files are much like jar files, so I assume native programs can't be deployed this way. Or can they?
Is there any difference between raw Android NDK application and Qt native application?
|
According to MDN Math.min accepts only numbers, and if one of the arguments is not a number, it'll return NaN. It's true that if we pass an array with multiple numbers we get NaN, like this: Math.min([1,2]), but if we use an array with just one number, Math.min will return the the number in the array, like in this exam... |
It is easy to find many descriptions of what MVC is - for instance here, here or in this video.
I'm curious, what is NOT MVC?
or more precisely - In a MVC-using app, what is everything else apart form MVC?
.
I see the tendency to start explaining MVC in a form of
Separate the application into three parts[...]
Which se... |
I am reading about internet and stuff and just learned that web pages are really just HTML files.
Also, I have learned that HTTP is just a transfer protocol.
So my question is, would it be possible to view a web page using another protocol, say FTP, since a webpage is really just a file with instructions in it telling ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.