instruction stringlengths 34 36.1k |
|---|
I have decided to start a personal project using Python since I have used it for several years now and I would like to know if the approach that I have considered is good or not.
Description
It's really simple if you know Alexa / Siri / etc. I have a device which will interact with it's owner given a single area: Musi... |
I'm a junior software developer and I was wondering when would be the best time to optimize a software for better performance (speed).
Assuming the software is not extremely large and complex to manage, is it better to spend more time at the beginning optimizing it or should I just develop the software that executes a... |
I want to generate a GUID/UUID for my web app to use but I'm not sure if I should generate it on the client or server or what should be the preference.
Basically, I'm working on a web app similar to e-commerce app.
Here are the steps:
1) User logs into the web app
2) User can create a new transaction or search for an e... |
For example, consider I have constants VOL_MIN and VOL_MAX, which is used inside 1 function only:
public void setVolume(int val){
final int VOL_MIN = 1;
final int VOL_MAX = 10;
val=Math.max(VOL_MIN,Math.min(val,VOL_MAX));
//some other code
}
Originally I think everything should be accessible only when ... |
This is for one of my personal projects. I want to store a table of data in a BLOB/TEXT column in the database. I don't want to store the data in its own database table because the schema of this data will often change, and I don't really need to query it.
So I am searching for a data format that would be:
Suited for ... |
I study computer science and I learn about sign extension. I wonder: Are sign extension and padding referring to the same technique?
|
I am working on an project for development of an Embedded system with following requirements.
Should be able to receive a text in English language from a Host device. Interfaced over Modbus.
Should be able to convert a given text into a bit pattern which would be later processed to be displayed on a fixed-dimension L... |
I use laravel with repository pattern.
My project strucuture is:
I have an Entity class(POPO) which implements an Interface and has a repository class related to it.
For example for a User Entity, I have:
App\Entities\User - Entity class
App\Repos\User - Repository class
App\Interfaces\User - interface
Most of the acti... |
I've joined a new team of great colleagues and a difference of opinion has come up concerning including //given //when and //then comment blocks in unit tests.
For example
public void mapToitemList_MapsCarsToitemsCorrectly_ForSingleFurrari() {
// given
String commercialProductName = "Furrari";
String produ... |
This link (http://www.taimila.com/blog/ddd-and-testing-strategy/) says: "Feature tests should depend only on the application layer" i.e. presentation layer.
I am trying to understand how BDD fits in when using Onion architecture and TDD to develop a system. I have bought a book, which should arrive at the weekend.
My u... |
I've read that when using the Strategy Pattern, you should stick to composition rather than inheritance. But does this mean that any inheritance at all is bad practice? If there is functionality to be shared between similar strategies is it anachronistic to implement a base class to encapsulate that functionality? Belo... |
When developping a project I follow the OOP principles and break my code into classes and most of the time I go for one file = one class.
Now I dont know how to organize my code into the class and even into my own functions/methods I'm still looking for ways to improve the readability.
I think the general consensus is ... |
An open source project licensed under BSD, MIT or another permissive license accepts code contributions from the community.
How can I prevent someone from taking GPL-licensed code that they don't own and submitting it to my BSD-licensed project? I do not know that the contribution was stolen from a GPL-licensed project... |
Currently we find we have a lot of code that sometimes overlaps an end user feature, in some cases only contributes to a tenth of a feature, or it even looks like shouldn't be there anymore
The codebase is quite big so we don't feel confident enough to rip things out without a solid reason.
Is there a recommended appr... |
I'm developing a module that should be able to interact with other modules such as numpy or PIL. To accept parameters and test if, for example, a parameter is an numpy.ndarray, I'd need to import numpy first.
What I used to do on previous projects is
numpy_exists = True
try:
import numpy as np
except:
numpy_exi... |
Our current business process is that the domain experts will write down the business logic in a Word document, and developers will try to reflect those logic as closely as possible with the implementation.
This process violates the DRY (do not repeat yourself) principle, and thus creates many problems that are associa... |
I want to add some example projects to my repository. However, I have some files with copyright notice. The disclaimer says owned by Xilinx, use at own risk, don't delete copy right notice.
It confuses me, it says it is confidential so I cannot use it? At the same time, if I use it, it is my responsibility. The notice... |
I developed c# winform application which monitors database and I want to license it.
License will be concurrent based. Standart license 2 concurrent users, Premium users 5 concurrent users.
I want to check license in online. Which means that users need internet connection to use my application.
However this will be dat... |
Please check this in sqlite :
agents may make bookings for performers, and performers may also make bookings for themselves. It is only possible for agents to make bookings for functions that involve performers. An agent may be responsible for making bookings for more than one performer. If a performer is represented ... |
I recently started learning about OOP, and I have read that OOP is a different programming paradigm than procedural programming. But I didn't find any examples that shows in what way they are different.
I mean say that I am using OOP and I created a Car class with a moveForward() function and then I called this functio... |
I just completed a research project in computer science for a college professor and I wanted to upload it to github so that people can use it and possibly benefit from it for free. What do I have to write at the top of my code so that no one can steal it and claim that they created it?
I am not sure how licensing works... |
In evaluating the work of an outsourcing company, I have found that they have a propensity for dividing work into as many classes as possible, each one being testable. In some ways this seems commendable, but they are taking it to an extreme and no one seems able to control them.
Recently I found what should have been... |
Is it possible to compress true random permutation using low order polynomial interpolation? If yes, how it can be achieved?
|
For example, given node types User and Post, and expressing that a user posted something on Twitter, what factors would I need to consider in deciding between:
(u:User)-[posted]->(p:Post {platform: 'twitter'}),
(u:User)-[posted {platform: 'Twitter'}]->(p:Post)
and
(u:User)-[posted]->(p:Post)-[postedOn]->(twitter:Platfo... |
I'm making a plugin in maxscript to detect mesh self intersection.
At first I just looped all edges vs all triangles (excluding pairs with shared vertices) but that was horrificly slow (1h+ on 6k vert test mesh)
Then I tested the bounding boxes of all the edges and faces first, that cut it down to ~3 min
Then I sorted ... |
I am a fresh frontend web programmer. and I recently programmed few types of web based mobile applications(means originally developed on web using angularJS and I have used a tool to create .apk file) basically for myself .these apps are including " Creating Shopping List" , "Price Comparison" , "Things To Do" and "M... |
I want to display the product, and the product card has a lot of information about the product and the owner. How to deal with Law of Demeter in this product - owner relationship?
In controller I currently have:
Product product = productRepository.get(1);
And in template:
product.name
product.description
product.owner... |
Sometimes, ex. when using common mocks (same for data access layer as for presentation, I use often xunit ClassData), I come to the moment when I either copy common code to new unit test library or create "UnitTestsCommon" project.
I cannot find definitive answer which one is better, though I tend to rather duplicate ... |
In a CQRS/async microservices context, I have a command handler e.g. SendOrderConfirmationEmailCommandHandler implemented in a communications service.
This depends on information from the orders service, which can be retrieved via an GetOrderDetailsQueryHandler.
The sequence of messages for this process is:
SendOrderCo... |
I'm trying to follow MVC concepts when i develop my application ,but I'm confused between Using String or StringProperty in Model classes.
Example one :
public class User{
String name;
String password;
public String getName() {
return name;
}
public void setName(String name) {
thi... |
So basically, it is a web server that is hosting a php project. The project accepts some inputs from the users and send them to the server via ajax for validation each time the check button is clicked. Then the result is coming back to the client via json.
What happens if multiple users send requests to the server con... |
Following on from my previous question and the comments under the accepted answer: One Acceptance Test project per layer or one Acceptance Test project per Bounded Context
I have done a lot of reading into BDD recently as I try to decide whether it is applicable to a project. I have come across the term Honeycomb (htt... |
We have created an LMS using Angular JS 1, Python(Django ) API and mongoDB as a database. Now we want to extend the LMS to make it a job portal. We have decided to create another front end project and keep the database as same. We decided to change the front end as we want to create the new project in Angular 5 and get... |
Let there be a static web application.
Let the following be a priority:
First loading time (ignore cache etc)
User experience
Search Engine Optimization (meta tags & bot friendliness)
When writing a web application, there are two broad approaches:
Single Page Application (AngularJS, Vue.JS, React, ...)
Benefits:
... |
It seems inefficient to go through the whole HTTP process. But I can't really come up with an alternative solution that doesn't involve coupling the code for the API with the code for the public-facing website, which seems to defeat the whole purpose of "dogfeeding" in the first place. So is it possible to skip the ove... |
I am redeveloping an application with the aim of going along with the more modern techniques. That is how I came across Socket.io, which I integrated with express.js.
I implemented live searching with datatables using socket.io for the filtering & fetching part. Users then can click on individual records and go to a pa... |
Is there any fundamental difference between to using an action and a list of actions? Seeing that action is a delegate and therefore is a list itself. For instance:
List<Action> technicallyRedundant = new List<Action>();
technicallyRedundant.Add(() => { Console.WriteLine("Action 1"); });
technicallyRedundant.Add(() =>... |
For example, suppose I have a class like that:
public class PlayerInfo{
public loadDataFromDB(){
//some code about DB framework
}
public string name;
public int age;
//other methods
.
.
.
}
I found many classes would use PlayerInfo, but loadDataFromDB() is called only when the ... |
I'm building a location based REST API using Spring Boot, and I have run into a bit of a testing philosophy question. I have an object called Location that, among other things, requires a Google Places id to function. I've exposed the CRUD of this resource at /locations which delegates its work to LocationService.creat... |
This past year I took the leap and learned a functional programming language (F#) and one of the more interesting things that I've found is how it affects the way I design OO software. The two things I find myself missing most in OO languages are pattern matching and sum types. Everywhere I look I see situations that w... |
For a web app I am working on I have a pretty basic relational database. I access this database through a RESTful API and generate the markup in React once the data is retrieved.
If I find myself constantly manipulating/processing these JSON responses on the client-side just to structure these objects into more friend... |
I'm looking for a known design pattern or algorithm that can be used to effectively determine a set of available options to be presented to a user based on previous decisions.
An extremely simple example of this could be Year > Make > Model where Model and Make are dependent on the prior selections the user made.
I'... |
We are using Janrain in our app, but I have to create an interface to make this service easily replaced (because Janrain is so custom!, it does have common things in Oauth however)
However, I'm getting a hard time trying to achieve this.
What I don't want is to have, in my main UserManager service, a JanrainClientInter... |
EDIT: This question led to another, namely Representing handlers on UML diagram.
I'm trying to create an Activity Diagram that shows that a collection of objects is handled by a collection of handlers. Something along the lines:
Objects objs = { ... };
Handlers handlers = { ... };
for (o in objs) {
for (h in handl... |
We faced an issue with an API "init" method, and trying to understand if we must use GET or POST http method in context of REST.
Preconditions: SPA on the frontend which communicates with our backend using REST API. SPA is meant to work with a 3-rd party service through our API.
Description: When user loads the SPA, f... |
In learning the merge sort, the examples show the list of items being split in half over and over again and then merged again.
Why not just start with iterating over the individual item pairs in the list sequentially if the initial split action always splits the list into single individual items?
I understand that it i... |
I have a performance issue with a few methods in my Service Layer. Methods that are causing me troubles have some logic, but it's db connection that takes over 95% exec time. The problem is unfortunately hardware, the machine is just slow. But, let me explain the software problem first:
The scenario goes like this (sim... |
One thing I always struggle with, when designing software, is to find a good way to keep track of an object's status.
For example, let's say I wanted to keep track of a car being built. It could have a status of "Paint job completed". But from a different perspective, this status could also be considered "Ready for as... |
I have a mobile app who consumes a api service. I have a class to manage all the operations (get, post, put) who throws exceptions if the result is not 200.
The app was originaly designed to be mostly offline so my services where like this:
public async Task<bool> GetMailList(int idUser)
{
t... |
I am working with huge point clouds (1 billion points). I need to process and display them but because of the size of the data, I can't have it all in memory at the same time.
First of all, I am not asking for a tech that does that (CloudCompare, Potree, Terrasolid, etc.). I'm asking about a file format solution to thi... |
Naming things
There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton
Naming things seems so trivial, before I read this quote, I would have thought this whole question to be off topic here. However, a well chosen name can make such a huge difference in readabil... |
I am developing a project that uses serial communication to interface between a micro-controller and my computer. I want to be able to pass what variable I want to change as well as the data to be assigned to the variable. Would this instance require use of a pointer or an "address-of-operator"?
Function
void xyz(int... |
I'm trying to learn more about the DevOps trend and what DevOps actually is, and how it could apply to my situation (recently fuelled by the Stack Overflow survey results starting by mentioning DevOps). All my research so far points to things like under DevOps, developers assume responsibility for deployment and automa... |
A useful principle in computer programming is DRY (Don’t Repeat Yourself). I am trying to follow this rule as I am refactoring a large .NET Framework MVC project by breaking it down into separate solutions.
One problem that I am still unable to resolve to my satisfaction involves a set of C# libraries (static function... |
It makes sense to me that .gitignore should only include files that the project has to produce inside the source directory when you run some configuration or build step. All else that pertains to personal workflow should go into .git/info/exclude.
Let's say I'm starting a new project using, say, CMake so that there is ... |
This question is a follow-up to Representing multiple actions for sequence of objects on activity diagram, but isn't strictly related. The question boils down to:
How to present in UML patterns that behave differently depending on how network of handlers is configured.
In simplest case I have the following:
<cfg>
<... |
Why do some developers in C for example chain together assignments of variables like this:
i = j = k = 0;
or sometimes formatted like
i =
j =
k = 0;
Is there some underlying complier optimization here? Do hardware registers overflow into the next loaded variable or something? Or is this syntactic sugar?
|
I have done a lot of BDD reading since the beginning of the weekend. At the moment I am reading about the imperative style v the declarative style. The imperative style is often described as an anti pattern like here: http://fasteragile.com/blog/2015/01/19/declarative-user-stories-translate-to-good-cucumber-features/... |
I have a data-driven legacy system (has a Java Swing client and a JavaEE application server) in my workplace, This system uses a single database for querying and modifying data.
Recently we've been asked to write a new web application that implements some of the already-existing features of the legacy system.
The appli... |
Are there any implementation or support differences in element.style.setProperty(property, value) and element.style.property = value?
Are there any compatibility/browser support issues with one form or the other?
What are the differences of each syntax?
Is either form considered a "best practice"?
|
I'm creating a website which will collect posts from facebook's pages to show to the users posts they are interested in (as my graduating project).
I'd like to be able to rank the posts that contain the words which are queried.
Hence, I use (solr)for full text indexing which allows me to effciently get the posts conta... |
I'm writing a slack bot that interfaces end users with an API.
That API only method of identification is the raw "login:password" encoded to base64 (it doesn't answer back a token) ...
Currently in test mode, I'm just asking users to send their credentials to the bot and then the server can make requests to the API wit... |
I am working on a Xamarin.Forms PCL social media app project. People can like posts and comment on them which is saved in MySQL. I would like to add an activity page.
What is the best way to calculate users activity, I don't think UNION will work since the comments table has a different structure than the likes table.
... |
It's about trying to understand the architecture behind how updates to web application is done.
I've been working on a non-public website that has bunch of records displayed in a UI, now the intelligent part of this application is that if I delete something in the database through API's without touching any button with... |
I'm writing an API server. The framework we're using is Rails + Pundit + graphql-ruby, but I guess this question is framework-independent.
We have authentication + authorization implemented on the resources on each different endpoints; and we want to make sure that the endpoint which requires login, are properly protec... |
Imagine a simple drawing of let's say a duck. And you have an photo of it in your database.
Now a user takes a second photo of the same drawing of the duck. What approaches exist to check if both photos show the same drawing?
Is it possible to extract the vectors and compare them afterwards? I'm completely new to this ... |
What is better solution? Eg. an object has a lot of single settings. Keep all these settings in one table or divide these features and store in separate tables with relation 1:1? Some features are required for all objects, other only for specific types of objects.
One solution could be store all required fields in tabl... |
There is a dictionary in my class with informative, short string constants as keys that identify certain parts of the solution, like "velocity", "death_star_power_output". My colleague suggested that I use VELOCITY="velocity" and DEATH_STAR_POWER_OUTPUT="death_star_power_output" to index into this dictionary throughout... |
In my previous Java job, we tended to avoid defining interfaces for everything unless we genuinely had multiple implementations for it. This may just be my opinion, but if there is only one implementation, I don't see the value in an interface - we're not really writing generic code, that might be used as a library.
Ho... |
So I like test-driven development and frequently I have wanted a programming language to assist with the creation of test routines. I have wanted to define the domain of a function and then have some test 'buddy' generate some random test input based on the domain, some test data deliberately inside the domain and so... |
I have a DTO like below
class OnlineProfileDTO {
@JsonProperty("likes")
SummaryDTO likes;
// lots of other complex fields similar to above
}
class SummaryDTO {
@JsonProperty("count")
int count;
}
Now whenever I need likes count in a DTO to DBEntity converter, I need to check if onlineProfileDTO.getLikes() ... |
This question is a result of an internal debate involving R&D, DevOps and Automation departments of the company I work for. Here's the nutshell of the debate:
automation: We need SSH access to all and every container during and after tests to automate (at least partially) RCA, if we don't have this, a lot of test fail... |
Modern webapps have multiple microservices that may be on multiple domains (e.g. subdomains) and providers (e.g. both AWS and Google Cloud; or Google Container Engine Google App Engine within the Google Cloud).
Yet there are reasons to present these together. For example, Content Distribution Networks and security serv... |
I was wanting to create a program consisting of 3 elements:
A central component with no UI which will work on HTTP traffic and trigger one or more “worker” elements as needed
A monitor component which is an optional frontend to the central component which will read logs and send data to a central component through a m... |
I'm currently developing a Python program with a GUI based on Qt 5. I use a MVC template I found on Github.
Let's assume that a single check box was checked or unchecked and the model was updated. Changing the model causes the view to update itself because the view is an observer of the model. Updates of the view are d... |
I am working on a small application trying to grasp the principles of domain-driven design. If successful, this might be a pilot for a larger project. I'm trying to follow the book "Implementing Domain-Driven Design" (by Vaughn Vernon) and trying to implement a similar, simple discussion forum. I've also checked out th... |
In the spirit of minimising state I always have a desire to mix data types for a given state property. For instance, if I were creating a React page that rendered a list of items that could either be the entire list of items, or a filtered list of items, I might want to have a state property called itemList and another... |
I am working for the consumer oriented company which has mobile app as main product.
Our mobile app has 100K monthly active users and is developed using Cordova + Kendo Mobile + Telerik Appbuilder (which will be discontinued in couple of days). We are thinking about migrating our code to native solution (either real na... |
I'm currently developing a minor project for school and I'm supposed to use a three layer architecture in the project.
I'm working with C# in .NET and I'm also working on Windows Forms, and with the help of Entity Framework i've made a database (Model First) connected to the project in a separate solution. After the da... |
I want to expose my business logic via WCF service in the intranet environment. I have N-tier architecture, pretty simple:
Database -> .Data (DAL) -> .Business (Service Layer) -> WCF
So, far I have 4 services in Service Layer, but only one WCF service. I here comes the problem. My WCF service uses all 4 services. I'm u... |
How can I name an abstract class that has a common part of view of my two panels? One of them is for creating an object and the other one is for updating it. I want to keep these view in different classes to maintain SRP.
|
Is it normal for a DAL to have actual logic? For example, my Repository implementation is in the DAL layer (IRepository in BLL), if the data it needs isn't in the Local DB, it needs to scrape various websites to gather the data (and cache it into the DB). Is this normal? Or should the DAL just be a go between the DB... |
I'm storing some temperature, voltage and current data every 10 seconds to a log file. This file is supposed to be retrieved later so we can read the data and display it. Time requirement is 6 month worth of logs and the space requirement is under 6 MiB.
The protocol I came up with looks something like a fixed record o... |
In order to avoid a confusion within a method signature comprised of the same types, a class can be introduced to make it distinguishable from others.
Let me support a text description with an example in Java.
E.g., from:
public void foo(String bar, String baz, String qux, String quux);
to:
public void foo(Bar bar, B... |
I have a scenario as following (you can think of it as a distributed Wireshark system):
For a single capturing session, there are about 1 ~ 10 traffic capturing nodes distributed in a LAN network. Each capturing node will capture raw message data at speed about 1 ~ 1000 records/second for about 1 ~ 10 hour. In the mean... |
This is regarding designing a search api. We have 3 tier architecture now using Spring MVC. All communications are via REST api.
UI <-> Business <-> Data(sql).
Now to implement faster search, we are planning to index data from sql. So any write to data-layer, will be indexed in es as well.
BL (writes)-> DL(writes)->El... |
In a recent 1 on 1 w/ my team’s product owner, we had a disagreement about how much work should be done on a project or feature before presenting it to the team.
The PO is used to creating specs up front as the starting point and presenting that to the team. Furthermore, he feels as though external (at least in our org... |
I made WPF application for a client-side and hosting database in a server side ,
I know there is something called REST API to transfer data between a client and server
I don't know this method and also i don't have a time to learn it because the project should finish less than one month,
I am thinking to make client a... |
Well I am newly graduated and placed in a small scale project based company. When I joined , the boss (project head) gave me project code for understanding what work I will be doing hence forth. I got stunned by looking at the code because it's hefty more than 10 thousands lines divided in between multiple functions ... |
We have ServiceA with these endpoints defined:
/devices:
get:
queryParameters:
make:
type: string
repeat: false
required: false
model:
type: string
repeat: false
required: false
responses:
200:
body:
schema: Devices
... |
I am developing a new desktop application from scratch using C#, before opening the visual studio and start typing in the keyboard I want to prepare a solid design for my software. The main challenge for me is how to handle errors and exceptions. I know that .Net Framework provide a good error handling but in addition ... |
Let's say I have objects that have relationship references. These relationships could be parent-child, siblings, actor-reactor, publisher-subscriber, etc. but I don't want to restrict the relationships to any particular type of relationship. I want to allow the user of the framework to provide any number of relationshi... |
I'm facing the following issue: I have a very simple aggregate root Product, and a product contains Image entities.
Right now in code this relationship is expressed as a Many to One relationship like this:
class Product:
Image[] images;
Now it happens that I need to make that relationship a Many to Many relationsh... |
When is it more appropriate to use asynchronous calls from the view to get data vs prepopulating it server-side when creating the instance of the viewmodel?
For instance, if my view has some dropdown menus that need to be loaded with values for the user. When might it be better to add List to the viewmodel vs making a... |
Is there a feasible way of testing SQL queries that contain things like CURRENT_DATE and NOW() in a unit test?
For example:
public function deletePastEntries(): bool {
$sql = "DELETE FROM queue WHERE period_end < NOW();";
return $this->db->query($sql)->execute();
}
And in my unit test:
class QueueTest extends ... |
I'm creating an application which's architecture is based on Uncle Bob's Clean Architecture concepts and DDD. Note that it is BASED on DDD, so I gave myself the freedom to differ from strict DDD.
To create this application, I am using C# with .Net Standard 2.0
One of the principles of DDD relates to Value Objects. The ... |
With OOP what is the recommended way to pass an instance of a class which is restricted - such as read-only properties or less methods available.
Below is a Vector2, which contains multiple methods for manipulating it's properties such as the setters or the add function.
class Vector2 {
private _x: number = 0;
priv... |
I am taking a software engineering course and got an understanding of basic concepts used in designing solutions for businesses.
We come up with requirements, do use cases and user scenarios and it all makes sense in the business context.
However, I am more interested in video game design and I am wondering what sort o... |
Let's say we have a registration system that finalises the creation of an account by SMSing the user their new account details.
This system could be used by people all around the world, so let's say we're using an online API that can send SMSs internationally regardless of the recipient's carrier. Because we want to ma... |
I have a system that interacts with a REST API as the data source. This system is based on DDD and all of my current models are CRUD models. There is one model that the REST API is only able to query as a full aggregate, but only able to write as entities within that aggregate. The reasoning behind this API design is t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.