instruction stringlengths 34 36.1k |
|---|
I was wondering how the Thread identification works in .NET. Does it always +1 the last number and never look back? or if thread 5 stops and a new thread is created will it use 5 as it is now free to use?
|
I am creating a REST API for a weigher (to be run on a Raspberry Pi, integrated into the weigher), and I was wondering if my ideas are RESTful and correct.
I have the resource "measurement" that you can use to fetch previously stored measurements, using an ID to get a specific one:
GET http://1.2.3.4/measurement/<id>
... |
I'm working on a PostScript interpreter in C#.
PostScript has memory management. It has virtual memory (VM).
It also has objects.
Two types of objects: simple and composite objects.
Composite objects consist of other objects itself.
VM is the storage in which the values of composite objects reside.
They can either ... |
I am trying to model a data flow diagram in accordance with a requirement document. The document calls for a system with many roles that users can play, where it needs constant information exchange between different roles.
Here is an example of its functions, where 'Role A' is a reviewer or judge of some elements, and ... |
I used to code in Python a lot. Now, for work reasons, I code in Java. The projects I do are rather small, and possibly Python would work better, but there are valid non-engineering reasons to use Java (I can't go into details).
Java syntax is no issue; it is just another language. But apart from the syntax, Java has a... |
for our project, we are using micro services with API gateway pattern. One of the features that the client do is to generate a report. Client, fills a form and uploads a file and our system will generate a report. We want to process the file and the form data, store the data in the database, then send all this data to ... |
I have two types of resources: Query and User.
I am POSTing to /queries to create a new query.
and POSTing to /users to create a new user.
Which path should I post to , to create a new Query collection and a new User collection ?
As per my understanding, we POST to a resource/collection parent , to create that resource... |
I have some code in my project I personally call tests that are not unit tests. They are meant to be run and the result has to be evaluated by a human. I did this because I'm making a physics engine and during development, I needed to see what I'm doing. So I made a simulation package in my test module. It is technica... |
I have situation like this:
if (FLAG && number_of_kittens > FLAG_VALUE) {
}
The general logic of the application is that the FLAG_VALUE does not make sense to be negative.
My suggestion was to use -1 to indicate is as disabled. My main motivation was to avoid confusion... But I have no data or empiral evidence to sup... |
I have a piece of code.
struct HasName {
name: &'static str
}
trait CanGreet {
fn greet(&self);
}
impl CanGreet for HasName {
fn greet(&self) {
println!("Hello {}", self.name);
}
}
struct Person {
has_name: HasName
}
fn main() {
let person = Person {
has_name: HasName {
... |
Currently we have an application that doesn't scale well because of multiple concurrent updates to a table which gets locked. The tech stack is ASP.NET and backend is in SQL Server.
To avoid database access I am considering using NoSQL as a message queue where a producer service allocates tasks based on business logic ... |
I have an application that works with products from various external data sources (in DataSourceProduct) and it also maintains its own version of the product (in MasterProduct). Here's the DB schema:
Note: DataSourceProduct has ten other columns not shown in the diagram. The MasterProduct has ten other columns not sho... |
I read this article where it describes making a flash message in a react app:
https://medium.com/@veelenga/displaying-rails-flash-messages-with-react-5f82982f241c
They mention adding a reference in the window object to the FlashMessages object. In this way you can access the FlashMessages object from anywhere in the ap... |
What's a good robust way to query processes for their help or framework origin, especially in Windows?
I've got an automated testing module that queries binaries that fit a special name pattern with --help to see what test framework, if any, was used to compile that test binary, so it can give it special command treatm... |
I have a replicated database (not SQL, a triple store, but specifics should not matter too much) running on several hosts. Each of them holds a copy of the database which is updated by feeding from certain outside source, and the copies should be identical. However, turns out they are not exactly identical - there is a... |
Today, talking with some colleagues of mine, we were discussing the usage of tuples. The specific problem was: we have an API returning a list of some kind of objects (let's say POJO instances)
public List<Pojo> getPojos()
we decided to use pagination in order to prevent enormous responses
public List<Pojo> getPojos(i... |
Modern Javascript implementations like V8 (Chrome), SpiderMonkey (Firefox), and Chakra (IE/Edge) all have JIT compilation, and a number of other optimizations to improve performance.
Why doesn't Python have these?
I have been looking at PyPy and IronPython, which both claim speed gains. PyPy I don't understand how a P... |
I am writing a software documentation and I need a antonym to "legacy code". Is there any established word for the antonym to "legacy code"? I'll need this antonym to describe that code which was written by myself.
Example: The main focus is to replace legacy code by [antonym] code.
|
I have an application that measures that continuously. (About every second - it depends on the device)
For example sake, let's say that data is CPUTemp (as used as an example in an answer to a related question: Clean Architecure: Creating an entity from a set of other entities)
Each measurement's data is written to the... |
I am using a class (let us call it ClientImpl) which listens to a socket for messages and then updates a listener to let ClientImpl know that a message have arrived to the socket. The listener is not implemented inside ClientImpl, but is passed from the classes using ClientImpl. Let us call my class ClientUser to make ... |
On Azure, Session Management can be done using Redis Cache. But this is not truly stateless.
Is there a way to make a Web App in general, truly stateless?
If yes, what pattern to follow specific to Azure cloud?
|
At the beginning of a project, writing things up as user stories is a great way of getting a handle on the functionality of a project. Stories at this stage tend be conceived and written relatively broadly, to cover a bucket of functionality. A couple of examples from my current project:
As a sales person, I want to b... |
I decided to take the plunge and add the first set of integration and units tests to the projects I work on (yes, we have dozens of internal applications with no automated testing whatsoever...).
I really like the so-called behaviour driven conventions for naming: Given-When-Then, although the resources online are quit... |
I am reading on Coding Complete book the following statement:
To name a procedure, use a strong verb followed by an object A
procedure with functional cohesion usually performs an operation on an
object. The name should reflect what the procedure does, and an
operation on an object implies a verb-plusobject name... |
I'm working on code which will provide a generic C++ interface to relational datasets. Some of the data will be in tables in memory (e.g. std::set or std::vector), but some of it will be computed - either produced by a function computing results of a logic program, or by joining memory tables. Other datasets will be ... |
The problem is a kind of scheduling problem, I would like to identify what kind of problem this is or, at least, what kind of problems it relates to?
Let's say we have n sets of events S1,S2,...,Sn, where an event has the duration of one day.
Each event set has only one repetition per week.
Each event set has an event ... |
There are a couple of examples from a simple game based on two players putting X and O on 2d array
First method should return true if element filed[y][x] is ok;
public boolean yxInField(int y, int x, char[][] field) {
return field != null
&& y >= 0
&& x >= 0
&& y < field.length
... |
IN scrum , everything is written in terms of user , They are called user stories. For starting new projects in scrum , should one write SRS document ? Or just go directly for user stories . I did not find any relevant source that points SRS in scrum environment ? Am I missing something ?
|
A little background on the system I’m dealing with:
analytics platform --comprised of--> OSGi plugins --comprised of--> Java package(s) --containing--> unit(s) of functionality each with independent MVCs (called “nodes”)
The plugin I would like to augment is called “base”, and all of the analytics platform end-users us... |
I'm not sure what SE site to ask this on, but I figure this is something somebody in the SE community has the answer. Feel free to move this question if this is the wrong place.
Recently I launched the game Vainglory on my iPhone for the first time in a while. The first thing I noticed was the pop-up saying that the ap... |
I want to use a gitflow-like workflow, but with two servers. That is, regular work happens on server A and the release branch is hosted on server B, from where the release tags are created. Commits to server B should only happen when a new version is ready.
So, the question is: how can this be done, preferably with the... |
I have an application built in C# using the MVVM pattern that will have 40-50 different tests that need to be run. I want to show each test as a list item with a progress bar of how far each test has progressed. I want to run multiple tests at one time and at some point in the future there may be dependencies where c... |
I am currently developing an HTML5/C# web app to replace an older ASP.NET forms app and after reading many blogs and posts I still do not understand the objectives, purposes, and weaknesses of the built in authentication schemes in ASP.NET. So if I implemented my own authentication/security in the following way, what w... |
I came across an architecture for a .net application where there are 3 layers
Repository layer (edmx and their classes)
^
|
V
Domain layer (Model -> Interfaces and their implementation)
^
|
V
Web layer (Model -> View models)
Communication between the web and the data layer takes pla... |
Recently I learned that standard Fortran does not support unsigned integers. Fortran is a language with a very long history. I suppose that when Fortran was first designed, there simply wasn't any notion of unsigned integers, and they have never been introduced after that.
Do signed integers predate unsigned integers... |
I have an application built on ASP Classic & Microsoft Access (for the Database) which I have been maintining for a long time, but now I want to upgrade it to PHP for the betterment.
Maintainence Procedure (3/4 times a day)
I download the live Access file from the server.
I run the UPDATE queries that update records ... |
We have a transaction database for our application. We are designing a solution for budget automation. Budget are heterogeneous in nature. As Sales budget have different attributes and expense budget have different attributes but ultimately figures will map to accounts in our accounting system. budget consumption will... |
Java artifacts are often staged through different "quality levels", named like alpha, beta, releaseCandidate, release etc. They enter the next stage if they have passed tests (automatic or manual ones).
We have an old, primitive staging software in our company. This should be replaced. Before we opt for getting some ex... |
Models for the database (using EF6) have certain attributes like Key, NotMapped, or Required (which will set the column in SQL Server to not null) while models which interact with the MVC portion of the website have their own attributes. An example of that is also Required which I use for data validation when a user is... |
From man 3 assert_perror:
The purpose of the assert macros is to help programmers find bugs in their programs, things that cannot happen unless there was a coding mistake. However, with system or library calls the situation is rather different, and error returns can happen, and will happen, and should be tested for. ... |
Suppose you're building a web application in ASP.NET MVC, and you have to display some formatted text. A very simple example might be:
Click any of the links below, or click here to cancel. Contact Customer Service with any questions.
What do you store in the resource file, and what do you code inline in your view?... |
Personally, I call this the Blueprint Pattern; however, I am sure someone else must have already named it. Static members, are in most cases, not a good thing. In languages such as C# and Java, they remove polymorphism and encourage poor class design. However, many times, there are properties that all instances share.
... |
This is sparked by this where an OP did not want to add a string he was using for a key lookup because he did not consider it property of the class.
To me the fact you are using it a for a lookup means it is a property. To me anything you search on would be a legitimate property of the class.
Could a lookup key no... |
I am a sole developer responding to a Request for Quote. The project is significant, and will take me more than 6 months to complete, (if I am the successful bidder).
One of the questions that I need to answer relates to 'knowledge transfer between employees', which is obviously difficult to answer for a sole develope... |
I am designing BC for Promo Codes. They work like this:
Admin can create promo code by specifying
Details (like Code and Description)
Benefit (interface for ValueObjects, for example MoneyDiscountBenefit)
Usage Restrictions - collection of AbstractUsageRestriction, each
restricting use of promocode, for example:
Pro... |
In my API library (C++) I am wrapping a shell process (spawned using popen) with several classes to manipulate a file system.
The base class ProcessFileWrap wraps general filesystem tasks and executes other custom tasks from its derived classes. It looks like below in pseudocode:
// ProcessFileWrap base class methods
... |
I am using c# but the question was more towards software engineering principals so I am asking the question here.
There are so many questions here but mostly they say :"How to use global variables in c#?" and "Are global variables are bad?". But my question is about "How" to avoid global variables in my scenario.
I've ... |
I have a resource that accepts transaction details as a subresource.
GET /resources/{resourceId}/ # get resource
POST /resources/{resourceId}/ # create resource
POST /resources/{resourceId}/resourceTransactions/ # post a resource transaction
Now when posting a transa... |
I work on a large software program in financial services. (15 project managers, 20 technical leads, 15 environments, 150 people on the technical side).
We do lots of Bankwide integration to hundreds of systems (insurance, bill payment, mutual funds, insurance, tax reporting, equities trading etc), which are frequently... |
If I understand correctly, REST was formalized by Roy Fielding as a descriptive model of the architecture of the web. AFAIK Fielding didn't claim REST was any good, he was just describing the de-facto architecture of the web. The web had already at this point proven an enormous successful distributed hypertext system, ... |
I have school project where me and my team have to build a health care system. It consists of different modules including :
A module for doctors : It allows a doctor to access the medical records of his patients, send indications to them, consult his agenda...
A module for patients : A patient can take an appointment w... |
I'm looking for architectural anti patterns / bad smells, and just wondering how to do this? Is there some sort of detection strategy, some way to find potential places or object-oriented metrics, suitable for finding these problems? This approach should be applicable on extracted / recovered architecture (from source ... |
I have a view controller with a mapview (Apple Map), on top of that there is a view with a button and a textfield.
The view is compacted around the search button, when I touch it it expands revealing the textfield.
I want to use the MVVM pattern so here are some questions:
Who should be responsible of the animation? T... |
I have a Session object, of which a single global instance session holds the current session, which can persist itself to the server, handle undos redos etc.
The session holds an instance of Objects which is in this example basically a set of Cars objects. When user changes e.g. a marker on a map representing a car's ... |
I believe it shows that I never worked on any major closed-source project so sorry for any misconceptions on my part.
Say a company is developing some software and needs to hire a contractor to help out. The contractor obviously has no right to take that software and start to compete with his employer as well as no rig... |
Current and common processing units are 8, 16, 32, 64, 128, etc bit. Why are their datapath multiple of 8 ? Is this all linked to the fact that the industry has settled with a 8-bit byte ?
The PDP-7 was 18-bit.
Pentium Pro address bus was 36-bit.
Many amd64 processors only implement 56-bit address space.
Is it a bad de... |
Background
I've designed and implemented a server app - a stateless REST API that mostly deals with customer CRUD operations.
As it is now the server is designed to use modules for each functionality instead of OOP concepts - although the 2 share some analogies AFAIK.
As an exercise, I'm trying to model some aspects in... |
My Rest API returns a tree structure like this:
[
{
"name":"test old",
"id": 1,
"type":"a-object",
"spend":13,
"status”: “active”,
"children":[
{
"name":"test women old",
"id": 2,
"type":"b-object",
"spend":13,
"status”: “active”,
... |
Why do many software developers violate the open/closed principle by modifying many things like renaming functions which will break the application after upgrading?
This question jumps to my head after the fast and the continuous versions in the React library.
Every short period I notice many changes in syntax, compone... |
I'm working on a project which has the following development strategy:
Frontend: Angularjs
Backend: NodeJs
DB: Mysql
I'm bulding a REST system with nodejs and I was wondering how should I handle the user session, exactly? Should I store the tokens in mysql?
Because I'm assuming this will be a delay in processing and ... |
I am fairly new to the microservice architecture. I am trying to build a web application in this kind of way. After some research online about microservices and having experience with Spring and Angular I want to build a web application with a separate front-end and multiple (separate) back-end REST API's.
How i want t... |
I am looking for an adjective; one that describes the opposite of "mutating". I want to use it to mark functions, methods and method parameters (including the receiver) as "not being mutated" by the function, similar how the D language does it.
Ds approach works pretty well for parameters:
class X {
void foo(const ... |
I am wanting to build a generic middleware software for my company that can access various vendors API's to pull out orders and then import then into our ERP through its API.
I want to make this as generic as possible whereby in theory, to connect another vendor, I just have to build out their implementation to conform... |
A little background of me - I'm a manual tester for almost 2 years within an Agile environment using SCRUM (1-2 weeks sprints). So I'm wanting to introduce automation testing in my work using Selenium WebDriver (with Java).
My question is during when should I test the functionality manually and when should I convert t... |
I am developing an application that will read excel files from disk and then process tests based on the data in the files. In order to keep the user interface from locking up when loading files and running tests, I have implemented the async/await with Task.Run() to handle the loads and tests running. Right now I onl... |
I have hard time wrapping my head around and finding a solution on how to design a working database structure for this situation:
We have a system that should collect data from Google Analytics & Search Console API - The connection works fine.
What I am stuck with is figuring out how I should structure the database to ... |
I'm developing a web application which stores sensitive information, which the user can access after a check that I built. This function then returns a download url to the user which leads to the FTP Server.
My concern is that it might be vulnerable to exploitation, people could alter certain url's to download files fr... |
Currently I have been working with speech recognition in java, and more or less have tried out sphinx where in I have been able to successfully get the word the person is trying to speak. So functionally I am trying to automate a software where in a person will speak, and my code will do the required action in java.
B... |
When a program is compiled, the code eventually ends up as instructions that can be executed by the processor. When for example a C program that writes data to a file is compiled, what code is in the executable file, is it just the code to call the OS write?
I have seen the comparable question that refers to use of Fra... |
I have the following database models and its properties:
User (id, role_id, name, email, password)
Role (id, name, description, active)
User2Role (user_id, role_id)
Customer (id, name, user_id)
A User has many roles.
A Customer is a User. But a User is not allways a Customer (e. g. Admin)
Now, how can i represent i... |
I recently found out that circular dependencies exist between some .Net assemblies from the following question and I'm looking for some explanation of why these exist:
https://stackoverflow.com/questions/43505621/circular-reference-in-net-assemblies
I've seen plenty of reasons to avoid circular references but are there... |
Following uses JavaScript code but F# is tagged for input from functional programmers.
I understand that in functional programming we shouldn't mutate the state or incoming parameters but I'm confused about formal request pattern when it comes to functional programming.
Formal Request pattern consists of an Object hav... |
For example:
scala> val a: String = "5"
a: String = 5
scala> val b: Int = 5
b: Int = 5
scala> a == b
res5: Boolean = false
I expect a TypeError, like in Java:
class MyClass {
public static void main(String[ ] args) {
int a = 5;
String b = "5";
System.out.println(a == b);
}
}
I wonder... |
When designing a framework API is it better to have something that accepts Promises or have executor functions and have the framework build the promises when needed.
The Promise API is defined by the syntax:
new Promise( /* executor */ function(resolve, reject) { ... } );
I have tried both and I am leaning towards ha... |
Quite simply, I was aghast when I discovered one of my unit tests was failing because -Integer.MIN_VALUE == Integer.MIN_VALUE!
Why would the language designers choose this, what is the mathematical advantage, and what are some alternatives I might consider in the future when dealing with edge cases?
|
Copied from stack overflow due to feedback
So I want to teach someone how to do dynamic memory allocation using the block padding model. What that means is every memory block is prefixed and postfixed with 4 bytes holding the length of the block in bytes along with a bit (held in the leftmost bit as that one should nev... |
Lately I've been interacting with a handful of SOAP APIs from different enterprise systems and I'm somewhat puzzled that oftentimes the WSDLs seem to indicate that they should be receiving XML data as a "string". For example a WSDL indicate the service expects data conforming to the following snippet of XSD for some op... |
I am a new lead developer that has recently started at a new company, I have been assigned to a project that is trying to consolidate functionality from lots of different applications already in widespread use in the business.
The problem is that their software development/project management are in the dark ages. I hav... |
I have multiple artifacts (applications) deployed on different hosts (let's call them A, B, and C for simplicity) and I am currently looking for some kind of integration pattern, because I need to reduce the number of calls to the backend, so that I don't need separate calls to A, B and C, but rather one call to D whic... |
I am developing C++ based multiplatform app. Core is in C++ and GUI layers are in native languages (Swift, Java, C# etc.). How should I handle localization for this? Should I use native solutions for platforms or create C++ based localization and pass strings via C binding API
const char * localized = CLocalize(const c... |
An empty array in PHP is considered falsey. That means the following will not print anything as the array is empty.
<?php
$myArray = array()
if ( $myArray ) {
print "My Array is NOT empty";
}
What is considered better practice in this case when determining if there are elements in the array:
To use if ( !empty( $... |
I have been working on Asp.net (Classic), where I need to render the lot of data in Telerik - grid.
During loading, its taking too much time. My doubt is which one is causing the impact.
Whether the compilation of server side to html controls.
DB calls which generate the data.
If compilation takes time means, then in ... |
Just like the two opposing mirrors are enough for infinity, most of design patterns can be applied repeatedly producing any amount of LOC desired. We can always create a factory for any factory or wrap a delegating layer around any class that already delegates.
This is of course somewhat artificial example, but I hope... |
Coming up to speed on the MVP design pattern and I have a gap in my
understanding. The consensus seems to be to design a 1:1 relationship between
Presenter and View. This makes sense -- but how would this work when state must be passed from one view to the next.
For example, imagine the following two View application;
... |
We have a few team members that have been working at software for a very long time and are not used to the idea of a version control system. These people are fairly good at what they do but can't get past organizing all of their work into files and folders. This wouldn't be so bad if there was at least some sort of nam... |
Given the official tutorial of angularJS,
https://docs.angularjs.org/tutorial/step_07#testing
It is apparent that it only tests the controller's states (e.g. its model) when events happen (e.g. http server response). However, this kind of tests cannot tests if the HTML correctly calls the appropriate methods of the co... |
I have a IItemProcessor class which takes each item from a list and send it to a web API (IApiService). The processing is done asynchronously, on another thread.
If web API responds with 'user not authorized', app needs to logout. For this, I have an IApp which has LogoutUser() method.
Currently, the ItemProcessor impl... |
Note: Still learning Haskell, not reached Monoids, studying Applicative Functors.
I saw this implementation and I am not entirely clear on it:
instance Applicative ((->) r) where
pure x = (\_ -> x)
f <*> g = \x -> f x (g x)
This is what I think:
Now I get what (->) r a is but I am not entirely clear on wha... |
Assume, I have a relatively large and complex application (100 MB .war file) with multiple dependencies. Some part of the code is defining an object factory, where similar objects (all inheriting from the same base class) are instantiated.
My goal is to convert these hard coded objects to plugins that can be loaded dyn... |
According to Martin Fowler's article,
https://martinfowler.com/bliki/TestPyramid.html
It is advisable to write more unit tests than integration tests. Does this mean ideally that every unit of work must be written with unit tests including all the edge cases? How about if there seems no point in unit testing, for inst... |
I have the issue that I want to be able to capture a set of SNMP messages, and some of them I want to parse to create an instance of a user-defined class. I may for example want to identify whether an SNMP message is a TRAP message, and if it is I want to identify the type of TRAP and create an instance of this type.
E... |
I'm using a repository pattern design and I've hit a stumbling block when writing a unit test for one of my methods. I'm fairly new to writing unit tests, so I would appreciate any help!
Let's say I have a method which creates a product and uses setters to set the data.
public function addProduct(array $data)
{
$ne... |
We have a Ftp server implemented. The manager wants to add reliability to it. He wants me to write incoming streams into some fast and reliable system (like hbase or redis) before writing them to server's hard disk. His point is if server has crashed (e.g power failure) before storing file, we have one copy of it in re... |
I am implementing the repository pattern in my application.
The repository will connect to an API to download orders from an external API.
The API that I am connecting to has a separate endpoint to get the list of Orders and a separate endpoint to get the Items against that order.
Where should the marriage of OrderItem... |
I have a small side-project of about 3,000 sloc. I'm experimenting with building a DDD-like domain model into it, so I have more experience with this style for work. The project is centered around reading and writing a specific file format which has not changed for 20+ years. And I'd like others reading my code to be a... |
Yesterday, the deployment of a financial website on a client was replaced with an older version which created unexpected issues and a downtime of almost 12 hours.
We came to know that two guys from their IT are creating problems for each other and it was done by one of them, don't want to go into the details.
This coul... |
I think that I know the answer, but I would like to be sure.
When jax-rs is used to implement a REST API, a @GET method should return an interface, implementation or an abstract implementation ?
If it returns an interface, sometimes it won't be obvious to know what it is really returning: for example, the json serializ... |
I was asked this question in interview, but could not find answer anywhere:
Lets say a application has feature which will unlock to different feature to diff customer lets say addition, deletion, edit allowed only for user1 user2 and user3, so I have already written code for all features and created exe, but when some ... |
I am currently writing a parser which, given a source file, turns it into an AST of some language, respecting the idiomatic process of lexing and then parsing using well-known parser generators (think lex and yacc). However, I am unsure as how to properly distinguish which steps should happen during lexing and which du... |
I’m coding a Hash-Life implementation in C++14 and working on a multi-threaded implementation. It has obvious potential for multi-threading. The task can be broken down into essentially 13 sub-tasks. 9 of the tasks are largely independent and the other 4 depend on 4 of the 9 but not each other. One one makes 9 (paralle... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.