instruction stringlengths 34 36.1k |
|---|
I'm developing an enterprise web application, hosted on site and managed by the corporate IT team. I do not have remote access to the server, and the only way in is through the web interface. I'd like to install the phpMyAdmin-like Adminer (https://www.adminer.org/) so I can do database maintenance remotely.
How do I ... |
As someone who hasn't really gotten into large-scale corporate software development--I'm 17, I wanted to ask a question about programming practice.
If you encounter a bug in an application, and you apply attempts at fixes, before realising the actual fix to the bug; should you revert your original fixes, if the applica... |
I have been tasked with writing unit tests for an existing application. After finishing my first file, I have 717 lines of test code for 419 lines of original code.
Is this ratio going to become unmanageable as we increase our code coverage?
My understanding of unit testing was to test each method in the class to ensu... |
My team doesn't write tests for generated code (e.g. some POJOs). An engineer that I greatly respect recently wrote this on the subject:
Research over the past 10 years has revealed that generated code is as
prone to bugs as other code, and in many cases the bugs in generated
code are far more costly to triage. He... |
In our code base, I see a lot of code like this
var error = ValidatePhoneNumber(userId, phoneNumber);
//if validation fails, return error
if(!string.IsNullOrEmpty(error))
{
return error;
}
If I were writing this, I would have just had ValidatePhoneNumber(userId, phoneNumber) throw the error and call the method in... |
I'm trying to wrap my head around OOP when building simple CRUD systems, using the Repository Pattern to handle object retrieval/saving to persistent storage.
I've already designed and implemented a system that doesn't use OOP, just straight up get, insert, update and delete functions that contain SQL queries.
Non-OOP... |
Let me introduce you into a minimalistic and made-up case with real-case chronological order, updates and problems.
User with ID only
I had a system, and it had User entity with ID column only. So, there was a class User and SQL table Users:
[Table("Users")] // database table
public class User
{
[Key]
[Column("... |
I plan to write a library in Java, consisting of packages A, B, C and so on. Every package encapsulates a part of the big picture. B relies on A, C on B and so on. For this purpose every package offers a single class to the next package. However, every package is optional in that the user can decide to substitute their... |
I have been adapting poor-man's CQRS1 for quite some time now because I love its flexibility to have granular data in one data store, providing great possibilities for analysis and thus increasing business value and when needed another for reads containing denormalized data for increased performance.
But unfortunately ... |
I've got a set of immutable POCO objects that reflect database content. These have a one-many relationship:
Property has one PropertyType, which has many PropertyTypeMetadatas.
Because Property has only one PropertyType, and it holds information that is frequently going to be used by the consumers of Property, I've add... |
I am building a repository that will request data from an API.
Originally, I had multiple methods in my repository such as GetOrders(), GetOrderItems() etc.
The majority of these functions had almost the same method body except they:
Had a different end point URL
Deserialized the JSON into different objects
Have a dif... |
I got one project which contains JavaScript code. No unit tests were written for JavaScript code.
So it is feasible or beneficial to write unit test cases using Jasmine Framework for code?
What are benefits or challenges may I face while doing this?
|
I've encounter yet again this situation where programmers are using autogenerated models (from LinqToSql, EF, nHibernate, whatever) as view models.
Usually the architecture is very simple :
Some kind of DAL containing only EF or LinqToSql
Some modules for very specific stuff
MVC project
It may or may not contain a ... |
I would expect any build that I ever pulled from a repository to just compile, along with any dependencies that are required. Likewise, I would never commit anything that didn't at least compile. That is to say that there could still be known bugs or errors in the build, but at least it compiles. But this is how I do t... |
Looking into incorporating ideas of Domain Driven Design into an application however our data model is not really a good fit for ORM like Hibernate. Very old database / data model, lots of compound / natural keys, lack of foreign keys, etc.
The item I am struggling with is how to design the domain layer without ORM si... |
I'm fiddling around with OOP in building simple CRUD systems.
I've decided to focus on using the Repository Pattern for separating Object business logic and Object data persistence (actually saving the object in a persistent data store, i.e a database).
Saving a simple object is straightforward
class Customer {
setD... |
I have multiple ASP.NET Core web applications that need to share an employee database. I want to be able to write the Repository and Models once and use it in multiple projects.
What is best practice for this and how can I achieve this with ASP.NET Core?
Using VS2017, SQL Server and IIS right now.
|
Let's say we have the classic Invoice object.
This Invoice object has various properties, including a Product and Customer object.
The Product object has a minimum of 15 properties.
Now say i have a list of invoices of customers who all bought the same product. When I serialize this data to the client, the size of th... |
For some rest resource, there are two fields connected. There is, if one field is POST/PUT it gets the value of the other field.
In this example we have a amount and amountWithVat(with tax or Value Added Tax).
If you POST or PUT a null for amountWithVat the default value will be from amount.
Example 1
POST
amount=150
... |
So I am reading Clean Code. In the Meaningful Names chapter, they lay down a rule of no verbs in class names. However in the Adding Meaningful Context section of that chapter, on page 29, he uses a class name GuessStatisticsMessage.
How can we validate the use of Guess in a class name, even though it is a verb?
|
So I am reading Clean Code and I want to write my class names with the proper amount of context, but how does .NET namespaces play into the concept of Meaningful Names?
Do I forego context in the class name that has been provided in the namespace?
For example, If I have the following namespaces
MySolution.Event.Regis... |
I've written some python code that is using a module which is distributed under an MIT license. Three questions.
Do I have to release my code as open source?
Can I distribute my code commercially?
If I cannot do any of the steps above, is there a license that will allow me to do that?
|
I have some code in process A that needs to wait until work completes in other processes that can be running simultaneously under multiple users.
I'm uncertain what is the appropriate synchronization mechanism. I naively thought a global named semaphore would be the answer but semaphores are signaled once anyone relea... |
I'm creating an interface to record navigation history.
First thing is, we have three types of records: Recordable (the default behaviour), Revisitable (a user can look at their history and revisit that item), and Traversible (the user can simply "go back"). Traversible records are, by definition, Revisitable which are... |
I'm working on a project with an AngularJS app that talks to a RESTful API. We've just started writing E2E tests for the app in Protractor. I'm fairly comfortable with unit testing but new to end-to-end testing.
We're writing a test that tries to send a message. Currently the test fills out the form, clicks the send bu... |
I recently got into a debate with another developer regarding the below class:
public class GroupBillingPayment
{
public void Save(IGroupBillingPayment model)
{
if (model == null || UserInfo.UserID == 0)
{
throw new Exception("GroupBillingPayment object or Current User Id is NULL , P... |
I am starting a new project, which will take two existing projects, use part of the functionality of each, and will add new functionality.
As usual, both projects don't use standard C types, preferring to typedef their own.
All code is in C, not C++, so obviously, both projects wanted a boolean type, and both have typ... |
I want to design a system where people use a house.
People in a house can walk around, sit in chairs, eat food, watch TV, cook, clean up, poo etc.
So I wanted to start off with the smallest room in the house. The toilets.
This is what I did.
So this doesn't look this bad right now, but I'm scared about adding another... |
I have a web application the mobile app users are connected it by using websocket.
The server has data A that can be changed in time. And the clients (mobile app) have data B that also can be changed in time.
When user emitting a message (a request to get data D) to the server by using websocket, I have to apply loops ... |
I am working on a themable website, meaning the administrator can pick primary/secondary colors to customize the UI.
The website is build in .net and the style rules are written in less.js. The current implementation uses a homemade webpack plugin that bundles the less files together. Some less files contains undefined... |
Why would someone develop his own language to use it only inside that firm when you have XY other languages that can help you with their libraries, logic etc.? Isn't it way much simpler to go with the flow with anything else rather than developing your own language?
|
I am going to build a simple asp.net web api application which will send request to 3rd party service and then return back the response to client.
Before sending request to external service,
I need to prepare request payload from DB and also need to validate it.
After validation I will send this payload to 3rd party s... |
If I look in python code and sometimes maybe also in C codes, there is often two variables with the same name except for the underscore. For example two variables
variable1 data;
variable2 _data;
Why is it like that and what is the background?
|
When I look at at some PHP applications, they typically have hooks. Drupal and Wordpress are examples. When I look at an application from the .NET world like Orchard or Umbraco, one subscribes to events.
On the other hand, I saw Drupal also has events, https://www.drupal.org/docs/8/modules/simple-fb-connect/eventsubs... |
Per MVC design pattern as in GOF, "a view can be disabled so that it doesn't accept input simply by giving it a controller that ignores input events". That means, we decide a view first and then pick a suitable controller to that as the scenario needed.
But iOS storyboard based development is primarily driven by Contr... |
There is a quite a bit of information about the time complexity of inserting words into a Trie data structure, but not a whole lot about the space complexity.
I believe the space complexity is O(n**m), where:
n: possible character count
m: average word length
For example, if the available characters are a and b, then n... |
Assume the following:
/// file.ts
var x = "hello";
x = 1;
console.log(x);
/// file.ts
function transpile(fileName) {
...
}
What steps would typescript take to transpile the file?
How and when the typescript safety check cause the second line to become an invalid assignment? (Edit: in Visual Studio designer this ... |
Are we supposed to write code differently to handle running through a system proxy for Http requests?
I have developed an application which uploads many files from a clients network over the internet via a REST API over a long period of time. I run it on a PC in their domain.
However, when I run it on one particular c... |
I am trying to understand the goals of Java EE specification.
I suppose Sun could just build a software package offering all those functionalities? Kind of like Spring.
Instead they thought it was better to build a specification and allow other vendors to implement it.
Why did they think so and what exactly is achieved... |
I am investigating ways of making my bundle of python network-requesting processes more efficient and became interested in the likes of Go and Julia for their apparent strong concurrency support and green threading model.
As I read into user level threads it sounded like what I was actually interested in was kernel lev... |
In order to visualize some concepts in a Git repo for other developers,
I want to put there some vector drawings.
Of course they should not be binary.
If minor changes occur, the file change should be minor as well.
Up to this point I think about the flat XML odf format. Is this a good idea?
|
I am using a Java to connect to MySQL database. I want to iterate through this data and store it into a data structure. This data structure will be
JSON.parse()
and converted from server side to client. Can anyone recommend an appropriate data structure?
The database contains 4 columns. One int, two doubles and anot... |
ive had a look around and I cant seem to find an answer or how to work out this question, its a tutorial question for my operating systems course and ive looked through the notes that come with the question and i cant get an answer along with looking at the Ritche and silberschatz OS books. the question asks:
Demonstra... |
According to Wikipedia, the term "bootstrapping" in the context of writing compilers means this:
In computer science, bootstrapping is the process of writing a compiler (or assembler) in the source programming language that it intends to compile. Applying this technique leads to a self-hosting compiler.
And I can und... |
Normally we link to CSS via the <link> tag. However, this leads to the browser making a network request for the stylesheet, which is slow.
What if, in the build process, we took our CSS file and inserted it into the HTML using <style>? For example, suppose we have:
app.css
p {
color: red;
}
index.html
<html>
<head... |
Let's say I have a database with users, groups and messages at the groups.
And I have 3 views:
Profile view: Where all the details of the user is shown.
Groups view: Where all the groups are shown.
Group view: Where all the messages are shown.
Now whenever the user goes to a view, the view connects to the database to ... |
First a disclaimer: I don't really know if this question fits this website, but I still find it a relevant question not just to me but for other people which are beginners. If the question can be improved to fit here, please point out int comments. If it doesn't fit, let me know also and if possible let me know where t... |
I know how to actually do the linking, but I'm not sure what the best practice is for actually getting those libraries downloaded and into my repository. Should I just straight-out include them using Git? Should I use git submodules (but what if the library in question doesn't use git)? Or should I provide a shell scri... |
I am performing a function point analysis (FPA) for a project. I am completely new to this process and have started with only the login and authentication modules to validate the results I get.
I think I have understood data function well and my count of internal logic files and external interface files is correct. I n... |
I have a question in regards to the implementation of a program that I am trying to do. I have a MySQL database with numerous users, and each have a task executed at a certain time.
For each user they have a time for the task to be executed, and a time zone for the task to be executed (each seperate colums in the MySQL... |
I recently read an an article about Functional Specifications by Joel Spolsky (if his name sounds familiar, its likely because the good Mr. Spolsky is one of the StackExchange founders). In the article Joel mentions how Microsoft used Program Managers as the persons who manage the software design during development (ok... |
I am trying to design a public facing website and would like to experiment with a WebAPI backend and one of the popular front end javascript frameworks.
Now, this application is not going to require users to login so there is no authentication process involved.
To be honest most of the rest applications I have develop... |
Let's say I have a UserRepository. It has the basic CRUD methods. According to the Repository Pattern, should it contain methods like IsAdministrator(user) to check against the database if a user is an admin? If not, which pattern is relevant?
|
There's lots of stuff out there comparing the HTML elements SVG and Canvas, but I'm still a little confused.
I'm looking for a way to draw an arbitrary shape (like, I have a description of a shape, in coordinates, or in lines and circles, etc.). I want to be able to generate the shape with Javascript (taking inputs fro... |
I am trying to improve my MVC projects and I read a few articles about DI, IoC containers, Constructor Injection and Service locators. I wanted to go with Ninject to help with the dependencies, but got puzzled with some of the stuff I read.
The most controversial would be the widely discussed one here http://jeffreypal... |
We are having a set of selenium UI tests for our application. We are deploying the application in our test machines in our QA environment. We are using TFS 2015 for continuous integration and deployment.
I am building the selenium test scripts using Maven and creating the JAR file in build definition. Now should I copy... |
I've been reading quite a bit, but I can't find any articles that fit our use case (maybe I'm blind), I'm after some suggestions or articles to read.
We have a couple of outsource teams who currently use SVN and I need to get them using our source control (Mercurial -Kiln) to enable use of CI/CD -AppVeyor. So there are... |
I recently joined a team of developers that has been working on a software project for several years. I have been asked to create a unit testing test process to improve their output and suggest new test cases and test strategies.
I have been working before as a black box tester with a programming backgrounds; I am not ... |
Ever tried to sum up all numbers from 1 to 2,000,000 in your favorite programming language? The result is easy to calculate manually: 2,000,001,000,000, which some 900 times larger than the maximum value of an unsigned 32bit integer.
C# prints out -1453759936 - a negative value! And I guess Java does the same.
That mea... |
I've been reading through Mark Seemann's book on DI, and have a specific question with regards to implementing a Local Default.
The book advocates for property injection in this case, but I wanted to ask if the following is a simpler yet as versatile alternative: assigning a null default argument in the constructor par... |
I am struggling with how to organize external references in a C# program in order to minimize code repetition.
I have application "A1" for which I want to use Microsoft's Unity IoC/Dependency Injection system. So I use NuGet to pull down the Unity package and install it in A1. This pulls down 2 projects and 4 DLLs in... |
I am the author of an iOS framework and I know for sure that an app uses it, but the app's author is not attributing it.
How can I prove this in a way that also a judge would accept it?
|
I have seen similar questions and answers here but my situation is a bit different from those.
I am building an application which gives users infinite canvas space to draw something. The canvas space is open to all users and anyone can draw anywhere.
User will make drawings and whenever there is any change to any of th... |
Are there any tips that can help me create clean code when I'm working with something poorly documented and completely new to me?
It is easy to write a clean code when we are writing something for the second time. However usually problems we are approaching are new to us.
Let's say we're working with a poorly documen... |
For many IT people, including myself a few years ago, the ideal software development process would involve the creation of detailed design documents with lots of UML diagrams before a line of code gets written. (This looks like a description of the waterfall model but it's the same with agile, except that the iteration... |
Suppose we have a functional language where objects don't have explicitly defined types, but where named properties can nonetheless be accessed on objects. Is it then possible for the compiler to trace throughout the program which properties could be accessed on which variables and do full type inference on the program... |
GCC is the C compiler. Glibc is the C library. However, isn't it an absolute necessity for a compiler and the standard library bundled together as a C implementation?
For example, the C library contains ABI and compiler specific stuff like <limits.h>, <stdint.h>, etc., which differs between compilers and APIs. And deta... |
As I have recently started using ES6 in production, I was going through an ES6 style guide (having more than 350 stars on GitHub). This guide mentions at least three times that "Tabs are evil. Don't use them!"
Also, another very popular JavaScript style guide by AirBnB also recommends using 2 spaces for indentation ins... |
Member variables of a class are typically hidden from the outside word
(i.e., the other classes), with private access control modifier.
Access to the member variables are provided via public assessor
methods. This follows the principle of information hiding. That is,
objects communicate with each others using ... |
I need to ensure high availability of my 3-tier architecture system. Currently I have the database mirrored by using MySQL Master-Master. All app boxes talk to the primary DB server
In case of primary DB hardware failure then the application needs to be switched to the secondary .. and that is manual. I want to make t... |
In this example, TItem.GetKeyType() is what I'd like to achieve.
Base CRUD repository interface definition:
ICrudRepository<TItem> where TItem : BaseItem where TKey : TItem.GetKeyType()
public Tkey Id { get; set; }
Base Entity definition:
class BaseItem<TKey>
this.GetKeyType = Tkey.GetType()
Entity implementation:
cl... |
I am building a software where I have users who are responsible for managing contracts. Each user can only see the contracts that they are responsible for.
Now, I want to implement a share functionality where a user can decide to share some of the contract details with another user, so the other user can now see in his... |
Where does it make the most sense to debounce events? Consider the resize event of an internet browser. The browser can fire a myriad of resize events as a user clicks and drags to resize a browser window. However, usually, you end up debouncing handling the resize event listener callback because you usually only ca... |
First project trying to use MVVM and Xamarin Forms, so please be gentle; however, I am at a lost on how to differentiate between the logic that belongs in the view model and model/service layer.
I am working on a simple app that shows a list, has a detail page for the list object when selected to change one field, and ... |
I am building a software which has two types of users in it: main users and admins.
I am still building the class diagram for this system. For the main user's relations I have things like: user manages contracts; user has roles; contract has SLA; etc.
And for the admin part, I have relations like: user created contract... |
I am trying to follow the role bases access control model to restrict what users can or cannot do in my system.
So far I have the following entities:
users - People who will use the system. Here I have usernames and passwords.
roles - Collection of roles that users can have. Stuff like manager, admin, etc.
resources... |
Question is: What is target-dependent code and how does it effect portability of a software?
Motivation to ask this question
In a CS class, I'm told that the more target-dependent code software has, the more portable it will be.But it feels wrong to me, actually I think the opposite.
Justification was that target-dep... |
I have to design a database in a Rails application, where I have users (who can login), companies and jobs.
Each user belongs to a company, and each job belongs to a company, so when a user logs in, the application would search it's company and show him every job assigned to his company. The diagram is here:
However, ... |
I am building a website and in it I am trying to follow the rbac (role-based access control) model.
Now, the thing is that managers need to send their contract proposals to approvers
(people who will see if the company can go with the contract or not).
But, because I have the rbac model where the admin can create many... |
Which is the better name for a method that returns a boolean?
IsSupportContentType
or
CanSupportContentType
|
I'm working in an architecture, it is going to offer a rest api for web client and mobile apps. I'm using Spring(spring mvc, spring data jpa, ...etc). The domain model is coded with JPA specification.
I'm trying to apply some concepts of clean architecture (https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-arch... |
Please help me to explain the concept of static vs non-static variable and method in terms of memory state diagram in Java. Or give me some books explaining this concept!
Also in terms of memory, When an object in created (without static keyword), each object will have its own member variables. But how about methods, ... |
So the scenario is we are going to develop a web app. It will primarily consist of:
API
Front End stuff (HTML/CSS/JS)
I am considering two approaches:
Package API separately into a *.war and deploy on the server. Write front end stuff and call those API. (This is what my previous company followed as we had API in h... |
This is quite a general question.
I want to design a set of classes and interfaces so I can swap between messaging systems without changing code, probably between RabbitMq and Kafka.
My main concern is how to abstract the events they handle, as both systems require event handlers but, of course, event handlers on both ... |
I have 2 third-party providers, both do a similar function(this could be logging, messaging, etc), and both have events that the client must subscribe to.
I want to know what design patterns or methods I need so that I could swap out one with the other without changing any code. My main concern is how to abstract the e... |
I am following the rbac model in my system.
I want to know if I should prepopulate the resources and permissions table?
I have resources like contracts, contract_drafts, SLA (service level agreement), etc.
And permissions like create contract, modify contract, approve contract, etc.
Now, I want to know if the system ... |
We are working on a project to develop a solution with a large number of modules in which the client wants a website as well as mobile application.
As a team we're working using ASP.NET MVC and Web API. So we can create a MVC website and an API for mobile applications, in Web API. In that case we can create a separate... |
My web users can choose among zero, one or more services (i.e. selectable with checkboxes). The choices should default to only service1.
The list of possible services is available via REST API. It could expand/change over time.
In a DB, I need to store the users choices (json format). But ideally, a "null record" there... |
I have a fairly straightforward multi layer c# application, with different presentation tiers in ASP.net MVC (2 different websites and a separate API) as well as a desktop application. The desktop application is installed on 20 end user machines.
The data (EF), entities and service layers are shared by all of the pres... |
Today's TDWTF article starts with a confession from the author:
I didn’t know what the For-Case anti-pattern was until relatively recently, when there were a spate of articles condemning it as an anti-pattern. I’m sure I’ve probably used it, at some point, but I never knew it by name. It’s thought of as a textbook ant... |
I work as a release manager in a company with 15 internal developers and 10 external developers.
Setup
Code base is a heavily modified Magento (PHP)
Test suite is almost non-existent but is improving every day
Development is done on each developer's laptop with Docker containers
We have 3 environments
preproduction
... |
I am building a web application with NodeJs and Angular.
Now I have a routing setup with Angular and an API with NodeJs so Angular can communicate with NodeJs.
But when I set GET routes in NodeJs. They "overwrite" the routes from Angular, or they show plain data.
For example:
In NodeJs I have a GET /authorized which si... |
I have a class called Process, which is extended by some different process types called ProcessA, ProcessB, etc.
class Process{}
class ProcessA extends Process{}
class ProcessB extends Process{}
//...
class ProcessN extends Process{}
There is also another class related to the data of A, but not the Process. I call it... |
I have a function in C language which takes 3 matrices as arguments; It performs matrix multiplication of first 2 matrices and stores the result in the 3rd one.
My question is what should I return from the function. Should I return the resultant matrix it self (rather the pointer to it) so that function calls can be ch... |
I'm defining coding conventions for Progress OpenEdge in our company.
In this language one can use symbols or keywords for operators, both work the same. For code quality purpose (code review, code readability, ...) it's a good idea to select one preference.
I consulted code conventions from other companies. They all h... |
I come from a "monolithic" SOA API mindset where, lets say, there would only be one RESTful service for persistence (persistence-app). Now that I'm developing in a microservice environment, I believe it's best to further decouple the big monolithic service into several independent microservices such as:
DAO layer (eac... |
Reading through a scathing article on the downsides of OOP in favour of some other paradigm I've run into an example that I can't find too much fault with.
I want to be open to the author's arguments, and although I can theoretically understand their points, one example in particular I'm having a hard time trying to i... |
I want an object that will spawn a daemon thread that will continue to run for the lifetime of the process. Let's say, just for the sake of the argument, that it's a thread in an embedded system, and it waits to receive and handle commands on some diagnostic port. But, it could be anything really. The main idea is t... |
The domain is more or less straightforward — I have an article (or rather several types of articles) that I want to edit and publish. Published article is exposed through an API to public. The thing I have a problem with is further editing of a published article. Versioning, revisions, etc. are irrelevant at the moment... |
Basically, title.
This is just me trying to clarify part of the GPL for myself.
Let's say I'm developing a program that compiles and runs on a non-free runtime engine.
I'm perfectly willing to share and license my own source code under the GPL, but I do not have the source, nor the license/copyright to, the runtime eng... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.