instruction stringlengths 34 36.1k |
|---|
I have a Symfony project.
I want to make this project API based, but also with a Web UI.
So, I have 2 Bundles, ApplicationBundle and WebUiBundle.
In Application Bundle, I have application, domain and infrastructure (tiers?), where application has the public API (presentation layer).
Now, I need to access an API from th... |
I am studying about Memory-Mapped I/O from here. I have read the following:
From the CPU's perspective, an I/O device appears as a set of
special-purpose registers, of three general types:
Status registers provide status information to the CPU about the I/O device. These registers are often read-only, i.e. the C... |
The application this question is about is basically a transpiler which contains a lot of logic. The transpiler is written in C++ (which should not be much of relevance for this question), and it transpiles a special language (which we developed) into a different language.
For error handling (errors originating in inval... |
I have a Webapp that schedules events to happen in the future with, hopefully, milliseconds accuracy. I'm currently using a backend process that checks the database (kind of an anti pattern) and triggers the event when the time has just passed .
This system has its faults:
database polling
poor performance on multiple... |
I have an architecture front-end / back-end, specifically an Android app and a backend. I want that the app user can see different prices and currencies depending on their geo-localization.
So my Android app has a mechanism to know in which country the user is (based on geo-localization), then it queries the backend us... |
I have class Foo, its first line reads package com.bar.something.baz. Its file is in /com/bar/something/baz/.
Why do I have to declare the package in the class file and then put the file in the same path as the package I declared? Isn't it redundant? Couldn't the compiler infer it from the path?
|
According to David West, Object Thinking involves identifying Objects in the problem/business domain that mirror real-world objects; the interface would then reflect the behaviors of that object.
What would happen if we had an object class with alot of different behaviors. How would that not violate the Single Responsi... |
I'm writing a web app that is basically facebook events, but more impromptu and real time. A user can create an event, and other online users in the area (30 mile radius) should immediately see the event. Users can sign up for events, and the host should see the invites. The host can cancel the event, and all participa... |
So basically I have an object with a few properties in it:
public MyObject
{
public string Name {get;set;}
public bool Complete {get; set;}
}
List<MyObject> myList = new List<MyObject>();
myList.Add(new MyObject("Page1", true));
myList.Add(new MyObject("Page2", false));
myList.Add(new MyObject("Page3", false));
Ima... |
this is similar, but no the same as this post, which was the closest question I could find on this. I don't even see that answer as satisfactory for the question asked in that thread let alone TDD. If I'm writing my tests before I write my actual code, how am I supposed to come up with "special" cases if I can't even... |
I have thought for some time how to integrate microservices. I like events a lot, but I don't want to make any coupling between services so I got an idea that I'd make some kind of adapter-microservice, which only purpose is subscribe the first service's events and then delegate call to another service's api (and maybe... |
Im studying about requirements but Im with some doubts. I read that it is common in a project to divide the requirements into user, functional and non functional and I studied about the three types.
I have two doubts below but they are related.
First is about the difference between the functional requirements and user... |
My understanding is that a major point of contention with reading a file during a unit test is that it is slow. There may be 1000 unit tests and we want the build to complete quickly so the unit tests must be fast. Disk I/O is known to be slow, therefore a good practice is to avoid unit tests that read from a file. Is ... |
I am a student that will finish his degree in like 7 months. I have a side job where I am the only programmer for a small company. The web application is for invoices and employee working hours. This application (with legacy code) uses an old framework (cakephp 2.0) and is just too old and has too many redundancy code ... |
In SQL, what's the standard convention for what rows and columns should be used for? For instance, if I need to make a table of users and their data, which axis (rows or columns) should be the users labels and which axis should be the users data labels?
EDIT: The Free Heroku plan only allows a maximum of 10000 rows on ... |
I am currently working on an Android project that I have concluded needs refactoring done for a core part of the app experience. Let's call this part of the experience "Search".
From looking at bug reports, static analysis tools, and the code itself, Search should be prioritized in the refactoring.
Since Search is a co... |
As seen in the main question. It is not a syntactic problem that I have, or
some error in the code. I would like to know what is the correct way to name the parameters variables in a stored procedure. Is there documentation on this topic?
I ask this, for example: I have a database containing a table called "orders" a... |
My current workflow is this (it's basically a feature branch workflow):
1) I have two main branches: release and develop.
2) Development is done using TDD methodology using JIRA/Bitbucket. An issue is created, which consequently creates a Git feature branch.
3) Active development is carried out in a feature branch, and... |
I am learning about IO devices, and so far I have only seen examples of IO devices that have registers and no memory space. For example, this is a printer that have three registers and no memory space:
If you want to print a character, you would put the ASCII code of the character in the Data register.
But what if you... |
This is an example of Memory-Mapped I/O:
So basically you access the device controller registers through memory.
Now my question is, when you for example write to the memory location that maps to the command register, will the value you write to this memory location gets copied to the command register in the device co... |
After reading this Stackoverflow question I have stumbled upon an MSDN article Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application.
There is a proposed implementation of a repository:
public virtual IEnumerable<TEntity> Get(
Expression<Func<TEntity, bool>> filter = null,
Func<IQu... |
I am learning about OOP principles and realized that on iOS view controllers become massive because we tend to stuff all the view responder methods in them. A lot of stuff happens in the viewDidLoad method.
Can anyone elaborate how to fix this, and provide a nice architectural design? Why did Apple design this in such ... |
I often come across the following pattern.
while(GetValue(i) != null)
{
DoSomethingWith(GetValue(i++));
}
Here GetValue is executed twice. It would be much nicer to use a pattern where we can evaluate AND store the outcome of GetValue. In some case (streams) it is impossible to get the value twice (see alternative... |
I got a class "WorkOrderTaskCreator" that creates objects of the type Task and adds them to third class called WorkOrder. It goes like this
class WorkOrderTaskCreator
{
ParentWorkOrder ParentWorkOrder { get; private set; }
public WorkOrderTaskCreator(ParentWorkOrder parentWorkOrder)
{
this.ParentWor... |
Normally when I have some data to store, I do something like
Model model = new Model();
Notifier notifier = new EventBus();
Store store = new DataStore();
model.updateTitle("new title");
store.save(model);
notifier.notifyAboutChange(model);
I have read a lot of posts about putting the logic into the models, but people... |
I'm writing an interface to bundle two underlying APIs into one new. The APIs provide data about archived invoices.
All three APIs (the two old ones and my new one) have different data structures.
For example: <INVOICE_NO> (old XML), "number" (old JSON), "formatted_number" (new JSON) all mean the same field.
I've cre... |
I need people opinions on how to improve a code I've written. Let's assume we have an application cataloging movies (~3500 of them) and actors (~1000, but I need to double-check this).
Both actors and movies are POJOs. An actor has a picture, stored on disk and its path in a database, along with the person others attri... |
I am looking for a design advice for the following scenario:
Three layer application:
MVC Portal (just frontend app really)
Business logic WebApi (all the magic happens here)
Connected services (just the file processing services here)
Portal is not aware of any database, processing services etc. It only communicates ... |
Let's say I have my web shop and database have multiple tables like Products, Product prices and similar.
I'm selling my software solution to my affiliate partner. He gets its database, it window application for entering data and I want all he's products are available on my website also.
So, I have my products and sel... |
There is a database-based application at work with an authorization system. If a user is not logged in, the only system accessible to them is the authorization system where they must provide a valid username and password that are stored in the database.
The login function has the following comment in it:
// NOTE: This ... |
I am currently working on a Bloom filter implementation. I was wondering how can I test such a data structure since a Bloom filter is probabilistic in nature, I guess . I want to unit test and also test for false positives. in particular how can I unit test the filter methods (add/contains) and how can I verify that fa... |
For example,I had seen some codes that create a fragment like this:
Fragment myFragment=new MyFragment();
which declares a variable as Fragment instead of MyFragment , which MyFragment is a child class of Fragment. I'm not satisified this line of codes because I think this code should be:
MyFragment myFragment=new MyF... |
I'm converting some code that formerly wrote structs directly into storage, to use serialization. This is because it is pretty annoying having piles of code to unpack structs that were laid out differently in older versions of the code that have been upgraded.
At this stage I am hand-writing the serialization code, I'... |
Based on what I know so far, when you plug an IO device into an IO port (for example, when you plug a printer into a parallel port), the printer will be represented to the CPU as just another RAM chip.
So if you want to create a device driver that communicates with the printer, the instructions that the device driver w... |
Today in UML class our teacher told us that it is very important to create uml diagram of our java code and use design pattern before starting to program any application.
I find that weird because usually I just start write programs directly I don't design uml for my code because I don't know what I will use in it.It c... |
Is it common practice in the software development/engineering profession for engineering change orders (ECOs) to be used for or in conjunction with software version control? Is this a good idea? Are there any pros or cons?
|
Let's suppose there is a base object class - let it be called Object - and a list<Object> container. There are many child classes of Object - Child1, Child2 etc.. They all are stored in the container.
I need a way to iterate over subsets of objects of some particular class. Say, over all Child1's or Child2's, while hav... |
I am considering splitting a project from monolithic to server side REST API plus isolated web-based front end (or, also, any other third party consumer) that can be hosted on a distinct server and domain.
How should I approach user authentication and authorization? Forms authentication is basically gone, and all call... |
In college I am doing an assignment about the differences between (non-)functional requirements. The problem statement is as follows:
Space Invaders is a single player game. After starting the game, the
player selects a level of difficulty and starts playing the game. The
player can steer a space ship to the left ... |
I am trying to understand, at a high-level, how single threads run across multiple cores. Below is my best understanding. I do not believe it is correct though.
Based on my reading of Hyper-threading, it seems the OS organizes
the instructions of all threads in such a way that they are not
waiting on each other. Then ... |
What are some techniques that you can use to prevent over-engineering among the Software Developers? Meaning, how do you keep them focused on creating solutions of only the current requirements? Without trying to anticipate all future changes.
|
I am building my first serious API. I am trying to decide how users should POST data.
I could allow them to POST variables, which is what HTML forms do.
param1=foo¶m2=bar
Or I can let them POST JSON, which also makes sense because I will be returning a JSON response to the user.
{"param1":"&","param2":"bar"}
Is t... |
I am working on a project where I am importing data from 3rd party sources. Often certain data is missing (usually older data), which is detectable from the data that I do have. Obviously I cannot reproduce all of the missing data, but I can actually reproduce some of it; specifically delta values.
So my plan is to cre... |
I have a medium sized Python program (12 KLOC) organized as a single Python package with multiple subpackages:
proj/
setup.py
proj/
__init__.py
projfile1.py
subproj1/
__init__.py
subprojfile1.py
...
subproj2/
__init__.py
... |
State machines, for example UML state machines, statecharts or other finite state machines, allow actions to be executed when a state machine takes a transition between states or is within a state.
In programming languages with exceptions, exceptions can occur within such actions, even if you disallow checked excepti... |
I'm looking at building a message queuing library in Go, which will be used as part of a larger application. A doubly-linked-list seems like a sensible approach for an in-memory data structure, but let's say this list grows to be 4 million items and each item is 10k, things no longer are guaranteed to fit in memory, pl... |
Similar question was posted here https://stackoverflow.com/questions/21064164/clean-code-how-to-design-this-class
I still don't find an answer though, I'm confused!
I read the book "clean code" too.He is saying in some part you shouldn't mix data structure/Object, whether data structure with no behaviour or an object ... |
I've been running into code (new code) that uses what I call 'Parallel Arrays' or Lists. Meaning there are 2 arrays that contain related data and are linked by their position (index) in the array.
I consider this confusing and prone to all sorts of errors. The solution I normally propose is to create an object called C... |
I'm working on getting a handle on Graph Databases (using Neo4j) and am trying to wrap my head around where "the line" is between what makes a good fit for GraphDBs and what should be strictly RDBMSs.
Particularly, I'm looking at a graph model to store manufacturing BOMs, as well as related information such as inspecti... |
As I am looking more and more into Continuous Delivery for our organisation, I struggle to understand how we can effectively incorporate manual QA testing before a release is pushed out into production.
I have found multiple approaches, such as the branch-per-feature one explained by Adam Dymitruk or git-flow and the l... |
I want to crawl websites and write output to Solr with my application. My crawler uses Kafka to put crawled website object on a topic and Flume will redirect output to Solr. There are multiple crawlers which produces data into Kafka.
My problem is that: when a crawler wants to crawl a website, other crawlers should no... |
I have a daemon process, written in Java, which I would like to be configurable at runtime via an HTTP-based API.
For a number of reasons, I'd rather keep the admin API separate from the daemon process itself:
resilience: if the admin API fails, the daemon must continue running.
separation of concerns: the admin API a... |
Let's say I have an interface called ParentClass. ParantClass has two implementations, ParentClassA and ParentClassB. There is also the ChildClass interface, with a ChildClassA and ChildClassB implementation. The ParentClassinterface has a function called createChild, which returns a pointer to a ChildClass interface o... |
I read bytes from a socket. The data consists only of two types of structures:
struct A
{
unsigned char type_id; //0x01
unsigned char sequence_id; //Incremented in successive packets.
//Some other fields
unsigned char checksum;
};
struct B
{
unsigned char type_id; //0x02
unsig... |
This is my situation:
Models can contain properties which can be models themselves. Each property can have custom behavior, this behavior must be selected through its name (for example: Versionable, Authorizable or something else). Developers must have the ability to add their own behaviors to the list with available ... |
I’m struggling to come up with a design (pattern) for an application/service which will hit multiple web services (external 3rd-party APIs), parse, combine and return them in a single response.
The application will have the following behaviors/steps (in no particular order):
Search hotels
Fetch details of selected ho... |
I see the benefits of making objects in my program immutable. When I am really deeply thinking about a good design for my application I often naturally arrive at many of my objects being immutable. It often comes to the point where I would like to have all my objects immutable.
This question deals with the same idea bu... |
As I was working with this piece of code today, I got curious if there are any significant differences between these two or is it just personal preference when it comes to creating objects.
Exhibit A
private MailModuleStatus createMailModuleStatus(Project project, Team team, Account account){
List<MailStatusCount>... |
I have three functions which act on a matrix and kind of find a minimum sum path (Note dim = 80, See https://projecteuler.net/problem=82):
-- f is the minimum cost from x, y by taking only up and right (up and down doesn't make sense)
f :: [[Int]] -> Int -> Int -> Int
f arr x y
| y == dim-1 = arr !! x !! y
| ot... |
I have been trying to build an MVC structured RESTapi.Since it's going to return JSON only,is it right that my View will just have a header and that the view will output the JSON also?
I planed to implement JsonSerializable than to do some magic with it in the controller/model part, than to output it in the view.
Is i... |
I am building a web application which is meant to help display prices of products. The web-app is centered around showing prices in a custom bar chart. I am thinking it should be composed of a Model View Controller architecture. I am looking for input on my design plan, there is more than one question here.
The model w... |
I'm a quite a junior programmer, but happy to learn! :) I put together a WebApi based application and I sent it to be reviewed by my colleague. I got it back with the opinion the way I use partial classes hide controller complexity and size. I'm really happy to hear his opinion (he has been a developer for more that 15... |
I am wondering because if it is, why does Entity Framework not offer logic to create a new object with the same properties to transfer data between layers?
I use the entity objects that I generate with the entity framework.
|
Context: I'm working on a Windows console version of the board game Sorry. In Sorry, each player has four pawns. Based on drawn cards, a player moves their pawns around the board. These moves can impact other players' pawns, like bumping another player's pawn back to Start.
Problem: Along with human players, I want to ... |
I am trying to understand the difference between these two terms. In some contexts that these two terms have been used interchangeably. What is the exact difference between these two terms ?
|
Inspiration here
Let's say I have a big, wonderful set of integration tests for my product. It tests anything and everything that we need to test. And after the product passes all these tests, we take a look at the source, decide it's complete garbage, and start from scratch. Is this a good business decision?
I full... |
I have read about authentications and become confusing about types classification.
Let's start from Cookie-based authentication, If I understand it right, the key point is that all data, needed for user authentication, is stored in cookies. And this is my first confusion: in cookies we may store
session id and so it... |
After years of cowboy coding, I decided to pick up a book on how to write good quality code. I'm reading Clean Code by Robert Cecil Martin. In chapter 3 (functions) there is a section on dyadic functions. Here is an excerpt from the book.
Even obvious dyadic functions like assertEquals(expected, actual) are problemati... |
I have an application that manage absence of students.
I asked everyone who will use the application (teachers , administration ...) about their needs and feature they want to see in the application.
Now I don't know what steps I should follow before creating the software?
should I draw a sequence diagram & use case ... |
I am developing a project that uses the Electron framework which is released under the MIT license, but my question is not necessarily restricted to this one case: If an open source project comes with a license file, it is my understanding that I have to include this license file as well under most open source licenses... |
I have an upcoming interview for a position at a company that deals with multi-petabyte scale data volumes. They're going to grill me about standard database design questions, but what are the best things to focus my revision/prep work on? How does database design change when you get to really gigantic scales?
I curren... |
My question is at a high risk of being a duplicated one, but that is not for lack of investigation. I've been around with this issue for long, and found nothing to solve it, but it seems such an obvious and common problem, that somebody must have answered this already.
The thing is, i have two related tables, say produ... |
I have to load certain object from the DB, and propagate it through few state and save after each state propagation.
Let us illustrate this with the example of an Order entity.
I now have to load few pending orders from DB and Cancel them based on few criteria. If these criteria don't match I should not cancel them.
I ... |
I've created a website for a tennis league. The two main pages are standings and schedule. When a user accesses the site, I'd like to have them select the league and season first. For example, the site could host standings/schedules for multiple leagues. So the user could select league ABC and season Fall 2016.
For eac... |
Our client has a software, where tickets come in. Multiple employees are responsible for answering these tickets (via phone), in a short amount of time (call back within X minutes).
What would be the simplest way of preventing 2 employees calling back the same client / working on the same ticket?
The client suggested, ... |
In my code, sometimes there's a long function, to avoid messed up the local variables, i would use a pair of braces to embrace the details so the local variables will not be visible to the rest of the code, e.g.:
bool pricing_deals()
{
//prepare deal type lookup table
vector<DealType> deal_types; // deal type looku... |
When I first played with a NoSQL database I become aware of the impact of UUIDs in a distributed system.
MongoDB defaults to ObjectIDs, but I've always questioned in which cases UUID (RFC4122) would be a better choice.
I found out that ObjectIDs are great. Not only they are smaller than UUIDs saving disk space, but the... |
I wrote a FillSomeData(ParameterData param, Result res) method, which populates res with some data (just like it says on the label).
Result is a class, not a struct, so FillSomeData actually affects res.
Following a code review, my colleagues insist that I add a ref to the method signature (changing it to FillSomeData(... |
I'm developing my first application using DDD and event sourcing.
From what I understand, aggregate encapsulates specific domain functionality with one or more associated invariants. The invariants are translated into consistency constraints - at any point in time the state of the aggregate must be consistent (invarian... |
I often create programs both for myself and others using various object-oriented programming languages. When doing so, they are usually relatively small (a few thousand lines at most). Recently, however, I have been attempting to get into making larger projects, such as complete game engines. When doing so, I often see... |
I am relatively new to microservice architecture and I was never before involved in a project where the architect insists on having a circular dependency between services.
I am in a position without a choice to design two microservices with circular dependency. Is my natural reaction against to do so - a real one, or I... |
I'm currently writing an audio application using WASAPI, which is a really great learning experience, however I have this odd problem, I don't really know what to do about all these HRESULT codes in a good way and im looking for alternatives to my current approach which is if_else chains.
Since the MSDN documentation m... |
What is the major benefit of having pure POCO models? I get that Models should be clean and simple, but I tend to like to keep the maintenance of child objects within the model classes. For example if I have a ClassA and ClassB defined as follows:
public class ClassA
{
public string MyProp { get; set; }
publi... |
In swift the compilation time is really slow the amount of code in your project increases. So i was looking for ways to reduce that time. One approach maybe is to use language keywords like final or static to change the way the compiler handles the code in this case using static and dynamic dispatch.
But as far i read ... |
We have two products let call them X and Y. Product-X is established and has numerous clients over continents whereas Product-Y's development was started a few years ago and it has yet to enjoy any client.
We came across a scenario where we have to sync data and actions between both systems. This can be done at any sta... |
I'm currently building an interactive game which has a very special use case : The game is displayed on a giant screen on stage in a theatre, and the audience can play it with their smartphones (http://www.augmented-magic.com/)
My tools are :
A desktop app made with Unity, displayed on stage
A web server (RoR) who pro... |
I'm making a physics engine and its becoming quite hard to keep track of the whole thing. Often when I get back to my code after a break I just don't remember why that's not working. Most of the issues aren't simple programming mistakes but design flaws in my physics engine. That's why I should just finish designing it... |
My current web app provides a service to clients on a single site.
It is NOT eBay, but I will explain using eBay as an analagous service we can all understand.
A client sets up a page, and other peer users can go to the page, do business, and the site charges for the service, the trades done.
Currently my site is monol... |
Generally I use private methods to encapsulate functionality that is reused in multiple places in the class. But sometimes I have a large public method that could be broken up into smaller steps, each in its own private method. This would make the public method shorter, but I'm worried that forcing anyone who reads the... |
I'm not sure if this is the right site to ask this question. This question is not a duplicate of this one.
So a few months ago I discovered project X on Github. Some info on project X:
X has a lot of stars on Github (~3k)
X has not been actively maintained for almost a year
X has a new version being developed seperate... |
I'm new at writing professional code (the bulk of my experience is with personal projects) so excuse me if this is trivial. When I write code I find myself being a little inconsistent with how much functionality I include in one function. If I know it's code I'm going to reuse later I'll make a separate function, but w... |
I'm planning to design and set up a database to store dictionary entries (usually single words) and their meaning in another language. So, for example, the table Glossary must have entry and definition and each table record has a reference to the id of a record stored in Tag (Each entry must have a tag or category).
Si... |
I normally have a laissez faire attitude on method naming conventions but now I am working on a module in JavaScript that will have some methods that can return the value directly (immediate / plain function), and others that must be asynchronous and work through callbacks / promises / etc.
I think it would be preferab... |
I'm a Sr. front-end dev, coding in Babel ES6. Part of our app makes an API call, and based on the data model we get back from the API call, certain forms need to be filled out.
Those forms are stored in a doubly-linked list (if the back-end says some of the data is invalid, we can quickly get the user back to the on... |
I have a class that would highly benefit from Unit tests, but few methods that call remote web server must be replaced by something delivering mock results. The probable solutions I see are:
Test the derived class that overrides problematic methods (no test-related code in production, just methods must be non-private ... |
I'm really only looking for pseudo code here.
I'm trying to write a binary search algo which finds the location of a value in a series of values (or the location of where a value should be in a series when the value doesn't exist).
I'm getting hung up on rounding when the amount of values in a series is odd. I'm not su... |
I'm working with an MVC framework to build a simple Q&A web app, and I am trying to grasp the idea of controllers acting on the app.
For instance, say I have a home page with the following links:
Home > Login > Home > Profile
Home > List of questions (updated dynamically) > (new view showing) One
question
Home > List ... |
How to identify when to use an user or a system definition of a requirement?
In the example below:
Use case: List Posts by status
Pre-conditions: The admin is
authenticated. There are items registered in the system.
Trigger: The admin wants to list the posts according to its status
(published, draft)
Ator: Admin... |
I just want to know if its possible to create an app without data storing all of its user data, instead each new user’s mobile device becomes a new server.
Is this possible? if so, how to do it? How can I accomplish this?
This ideia came from the movie "Nerve". I let the movie details down below.
Nerve IMDb
Nerve trail... |
I'm trying to get past all the hipster, pie-in-the-sky buzzwording and address a very simple, fundamental question:
What is a streaming application?
According to the Kafka site
"Kafka is used for building real-time data pipelines and streaming apps"
Streaming apps...hmmm. OK, so what is a "streaming app"?! According ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.