instruction stringlengths 34 36.1k |
|---|
Context:
I'm creating a WPF application using MVVM. I have a Page which displays a status informing what task the app is performing on Background.
I have a container, and bind its Content to an property on the ViewModel.
For an illustration, take a look at the following code:
<StackPanel x:Key="Status_Success" Orienta... |
There is a current project which has many lines of code and written for Java 6-7. I want to migrate it to Java 8 and use lambda expressions wherever I can.
How can i scan the project and report that an expression can be replaced with a lambda equivalent?
|
I am creating a simple application where users will be shown random quizzes one at a time and they have to answer them. Each quiz has a category and many tags, right now I have stored quizzes in a single flat file but it seems that I may need many quizzes in near future and hence my solution isn't scalable at all.
What... |
I am working on writing a code for Hilbert algorithm to solve a Traveling Salesmen Problem. Although there are several efficient methods out there, I am just curious about the implementation of Hilbert Space filling curve.
First we create a Hilbert curve and divide the entire area into a number of squares.
Then usi... |
First, I am not sure if I'm asking this within the correct Stack Exchange community, so if this question belongs somewhere else, please let me know. It didn't seem appropriate for Stack Overflow.
I am developing an audiobook app for iOS that uses a navigation controller to navigate between two TableViewControllers. Th... |
I have an enum with > 10 items each having 8 static properties. Contrived example:
enum JavaTypes {
INTEGER,
BOOLEAN,
STRING,
...;
boolean isPrimitive() {
}
boolean isNumeric() {
}
...
}
I am trying to find the most readable and maintainable (easy to add properties) style.
The st... |
My client has a nodejs SDK that fetches entries using a client that makes http requests. Their api looks like this:
var Query = Client.ContentType('blog').Query();
Query
.where("title", "welcome")
.includeSchema()
.includeCount()
.toJSON()
.find().then((response) => resolvePromise ... |
How would one implement a multi tenancy application structure with the following technologies:
Multiple SQL Server Databases (One per tenant)
Asp.Net
Entity Framework
Active Directory and possibly custom role providers for authorization.
|
What are the steps taken by the CPU to sum 2 numbers(2+2) from the keyboard input to the display in the screen?
example: reading the ascii code .... convert the typed number to binary ... send to cpu .... printing on screen?
|
I have a pattern that's something like this:
Create a database model UsagePlan which stores how many usage tokens a paid customer receives in exchange for its respective monthly fee. Through my ORM (Django), I override the save method to not allow any writes to this table from my code.
I create a fixture that specifie... |
Our organization has been clamoring for a more organized spec-making process. At the moment, we use a combination of UX Specs (created in a wireframing tool and published as PDFs), and Functional Specs (created in a writing tool, either a client such as Word or a hosted tool such as an internal Wiki). The two documents... |
The question is in the title. Here is the context:
Some people think that the null pointer is a big mistake. Tony Hoare famously apologized for inventing it. Since version 2.0 C# has had nullable value types (int? foo;), which introduces more of the null badness into the language. To confuse the issue, the C# team is c... |
I'm designing a tool in my organisation to help me with release management. The organisation is composed of several small teams that manage their own repositories in git. The release manager is responsible for cutting branches across all development lines in each of the repositories and then hand it off to QA processes... |
An internal API I've built will soon be consumed by a third party.
Should I open the current internal API to the public, or should I create a new API endpoints for external access?
|
Map (or HashMap) takes Constant time for Insert, Remove and Retrieve. While all other data structures which I know so far, do not take constant time and their time for above operations depends on the size of input.
So, why do we need all other data structures ever ? Isn't HashMap is universal data structure ?
|
I am working at translating a github repo, which I do not own, from Python to Java. The logic will remain the same, which is significant, as this is a Neural Network application, but I need to be able to deploy and run this in a more platform agnostic manner, and Python simply doesn't offer that.
My question is this: ... |
When designing an application I usually stumble upon a problem I've never quite managed to handle properly.
Suppose you have Products and Orders. Usually in my data-access layer I have repositories that can return back lists of these object already filtered based, for example, the logged user that made the request. Whe... |
I come from an object oriented programming background, therefore, I am pretty curious about the core philosophy of functional programming? Why does it exist at the first place, and what types problems it is trying to solve?
|
In functional languages without type checking, is there any substantial disadvantage (apart from readability) to limiting all functions to take exactly one argument - that is, replacing multi-argument functions with functions that take a tuple as an argument?
(I saw some comments about it being somewhat more difficult ... |
I have been doing some research in to java servlets and I am having trouble understanding why it more efficient then a cgi based solution.
The reason for my lack of understanding is that java servlets run on the thread per request model, meaning that a new thread is spawned or taken from a pool of threads each time a r... |
I have a python module dataProcessor.py which initialises a large amount of data into memory (approximately 3GB) I want to use this module in different processes which are running simultaneously.
But the problem is there is not enough Memory on machine to run everything at same time due to dataProcessor.py loading dat... |
I have a method for reading data from file. The problem is how to handle files that are too big for a simple read and save to database? I was thinking about reading a chunk of it and saving it to database, but I don't know if having an asynchronous method with callback is a good idea.
Basically I think that a reader cl... |
Consider this example of polymorphism. I have two different API, IWrite and IRead, and then a single implementation of these.
interface IRead
{
Entity Find(int id);
}
interface IWrite
{
void Persist(Entity);
}
class SomeRDBMSRepository : IRead, IWrite
{
public void Persist(Entity entity)
{
...persi... |
SFML, in this case, has a Git repo and a download page. Until now I have always downloaded from the download page, which came (at least for the compiler I use) with .a and .hpp files and could easily be used with MinGW with -l and -i tags.
When I wanted to use this on Github, though, a couple of problems arised.
When... |
I've just finished up a project in which I created a visual simulation of the life cycle of an ARM instruction in a single cycle processor. I used the MVC pattern in this project and ran into a design crossroads when I thought about how I was going to handle a specific part of the data being passed between the model an... |
We had two major dependency-related crises with two different code bases (Android, and a Node.js web app). The Android repo needed to migrate from Flurry to Firebase, which required updating the Google Play Services library four major versions. A similar thing happened with our Heroku-hosted Node app where our producti... |
Background
I'm a huge fan/believer of Jeff Patton's user story map. I'm currently reading his book..
I find using story maps a very effective way in convincing clients to use the lean start-up principles, by forcing them to think long and hard about what features are mvp and which should be released first (ie by visua... |
I've come across a few cases lately where a package on NuGet has a name that starts with "Microsoft" but is actually uploaded by someone else. Take Microsoft.TestApi for example. Ostensibly this is a NuGet wrapper around the TestAPI project on CodePlex. The CodePlex project is from Microsoft as there are blog posts hos... |
I have a requirement where user selects a ReportType from a dropdown and hits download button. Based on his type chosen, the system should generate a report. Right now I have only report type that is QuoteReport. In future I will have other report types like PolicyReport,ClaimReport. Right now I have no idea what will ... |
Assuming an IReader interface, an implementation of the IReader interface ReaderImplementation, and a class ReaderConsumer that consumes and processes data from the reader.
public interface IReader
{
object Read()
}
Implementation
public class ReaderImplementation
{
...
public object Read()
{
... |
I have an endpoint returning single-element collection (I didn't return just object-instance to keep consistent with resource-as-collection convention, so only get-by-id returns single instance)
GET /devices?serialNumber=12345
[
{
"id": 1,
"serialNumber": "12345"
}
]
And the new requirement s... |
I've been bothered by this line of code I've written and I've been a bit confused into what should be written instead.
class SomeClass
{
IBeneficiary _latestBeneficiary => new Beneficiary(Iban, Name);
}
In context, the field represents the latest version of a beneficiary object that is about to be created, and I ... |
I have an application that involves processing packets of IDs from a variety of sources. Some of these sources contain the information I want, some of them constitute, effectively, noise. Currently, whenever my application receives a data packet, it checks the database to verify that the received IDs match internal dat... |
I've spent the last few days working with tensorflow for the first time as part of a natural language processing assignment for my degree. It's been interesting (fun isn't the right word) trying to get it to run on a GPU but it got me thinking.
The recent advances in deep learning have come about as GPGPU technologies ... |
This question may be a bit subjective, but I have tried three different solutions and none of them has felt right. I will provide some context and the solutions I have tried. The issue I am facing seems to boil down to whether or not I should split an interface into multiple interfaces / sub-interfaces, or maybe make i... |
For example, say I have a service that kicks off some operation, such as running a cron-job. Then, it returns whether it not it was successful.
The code might look something like
var service = new MetricSyncWakeJob(...);
var jobStarted = service.performSyncJob();
if(jobStarted) {
notificationService.notifySuc... |
As a common practice followed by agile team members using agile methods(scrum, kanban etc), they volunteers/sign-up/pick-up/self-select tasks from the backlog using Jira/Trello/etc.
What I am interested in is knowing is that what are the challenges associated with this approach of self-selection.
I'm sure agile practit... |
When I want to implement axis aligned 2d rectangles I always go with {x, y, w, h}, because that is the natural approach to it. With 3d axis aligned rectangles you need {x, y, z, w, h, d(depth)}. For a 2d triangle I need {x1, y1, x2, y2, x3, y3}. But what do I need for axis aligned right triangles. How would you store t... |
Background
I m reading the "Clean Code book", and, in paralel, I m working on calisthenic objects Kata like the banker account, and I m stuck on that rule :
The 9th rule of calisthenic objects is that we don't use getter or setters.
It seems pretty fun, and I agree with this principle. Moreover, at page 98-99 of Clean ... |
One of the client for whom I had worked has a MVVM architecture for web application.I dont know why they incorporated instead of MVC. is this a feasible idea because as far as I have gone through all MVVM tutorials if they are concerned with XAML or WPF ,they are going for MVVM.Can anybody explain in detail ?.
|
I'm developing a physics simulation, and as I'm rather new to programming, I keep running into problems when producing large programs (memory issues mainly). I know about dynamic memory allocation and deletion (new / delete, etc), but I need a better approach to how I structure the program.
Let's say I'm simulating an ... |
I'm just discovering the Go programming language.
(FWIW, I am fluent in C++, Ocaml, C, Common Lisp, Scheme, I know well Linux, and I have designed & implemented GCC MELT; I am considering a rewrite of some MELT monitor in Go, but have not decided it yet)
I am a bit confused about the required layout of some Go workspa... |
I'm reading about Angular on their website here: https://angular.io/features.html, and I see the following:
Cross Platform
Progressive web apps - Use modern web platform capabilities to deliver app-like experiences.
High performance, offline, and zero-step installation.
Native - Build native mobile apps with strate... |
I inherited a project that includes a database (MS SQL Server) that was filled to the brim with bad data. I've manually cleaned it up, which was a painstakingly tedious process and am working on modernizing the application (ASP.NET MVC w/ EF6).
One of the tables is for tracking an item as various processes are perfo... |
I've been writing a lot of time related code recently, and in various files, I always end up re-defining things like
var SECOND = 1000;
var MINUTE = 60 * SECOND;
This gets frustrating quickly. So I'm considering two possibilities:
Getting rid of the constants and instead letting things be inferred from code like 60 ... |
I am designing a delivery app where a Requester requests a thing from his mobile and the request is sent to multiple Agents on the field. When one Agent accepts the request, he will be assigned to the Requester and is expected to make his delivery.
I want a few Suggestions for Architecting this system. I am using the .... |
In my application I have a class, and each instance of this class shares part of an unmanaged resource. Sharing is facilitated by a manager object.
When an instance is destroyed, the manager should be informed so it can re-purpose the allocated resources.
While I could make the programmer responsible for destroying the... |
I'm building a web application wherein users CRUD their own private data.
Can I safely expose API endpoints?
Despite years in-industry and endless web-research, I'm not clear on the best architecture and how to most efficiently ensure security of the user data. The most basic requirements include: user authorization... |
I am running into a wall mentally when trying to think of a way to solve this problem. At my work we process customer data through some complex reasoning logic. Sometimes this logic will cause infinite looping. We actually know how to just remove some of the logic that will cause this but for political reasons we aren'... |
I'm trying to get my head around the concept of event-sourcing based architecture.
From my understanding, the projection is the representation of a state in a given point of time; in fact - it's an aggregation of events which led to that state. The projection is being stored in a data store for purpose of querying.
Si... |
I'm interested in creating a web service endpoint in C#/.NET that is fully configurable. To keep it simple assume there is no GET/query/retrieval requirement. I just need some guidance on how to get started here.
The goal is to have a a core solution built, tested, and deployed that can then be configured for new objec... |
I am developing SPA in angular and backend API in laravel 5.3. I have integrated Laravel Passport for oauth.
I have to make roles and permissions implementation using views on tables from other database which is maintained by other system. In this system user has 1 role. And role has self reference so there is hierarch... |
If I have an API and I am the one consuming it, should the front-end be a separate project? I'm using Visual Studio ASP.NET Core 1.x.
|
Definition of the lazy loading pattern from Wikipedia:
Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program's operation if properly and appropriately used. The opposite of lazy l... |
My team currently has a WPF application that runs on PC just fine. It utilizes Entity Framework 6 with the Repository/Unit of Work pattern that talks to Azure for the database store.
We service a little over 300 clients currently. But, we're wanting to expand our footprint for the app and transition to mobile devices.... |
Say, I have an agent whose state includes position and facing_direction. I need to check whether it can move in any direction or is completely stuck (due to various obstacles). Agents have a method can_move() that checks if the agent can move forward, i.e., along its facing_direction.
I can modify the agent's facing_di... |
I have been tasked with helping our HR department create some new interview questions for candidates applying for development positions. As part of the process, I would like to assess their ability to both understand code without the help of a compiler and spot potential future problems.
As such, I have devised a basi... |
Is a total, impure function considered to be Referentially Transparent (RT)?
Example:
// Given an 'id', try to retrieve an optional Person
// from the database, i.e. side-effect.
// Note that 'String' is a poor choice for the `Left`,
// but it's not important for this question
def getPerson(id: Long): Either[String, Op... |
I have below constructor, where it creates a workbook in constructor. I read that, ideally, we should not create objects in Constructor, instead, we should have just assignments which are passed.
public ExcelWriter() {
workbook = new HSSFWorkbook();
//other code
}
Is it okay to create fixed object... |
The .NET CLS (Common Language Specification) allows a programmer to write code in one .NET language and confidently know that all other .NET languages can safely interact with and even utilize data and methods from the original project.
In Troelsen and Japikse's, C# 6.0 and the .NET 4.6 Framework, the authors write tha... |
I would like to initialize my variables at the top of my file, to prevent any Undefined variable notices. But what do you guys think is considered to be best practice (in PHP), in case of a string type variable?
Initialize the variable with a value false by default?
$variable = false;
Or perhaps just an empty string
... |
Is there a name that is commonly used for functions that are only called in one other function?
(I'm not asking whether it's a good practice; I believe it can improve readability in some cases.)
Right now I'm commenting them as "local shorthand functions", but I'd like a more standardized name, if available.
Example:
... |
I am in a situation I cannot decide which approach is the most optimal (performance wise) while being maintainable at the same time (in the sense of having a clear logic).
The question is laid in the context of a Django web app, but I figure it applies to any related scenario.
In my scenario we are visiting a particula... |
I've been teaching myself Object Oriented Programming(Ruby) for a while. However, I still don't quite understand some of its core principles, specifically, instance variable. Could somebody please explain to me why do we need instance variable? What is the problem that it is trying to solve in object oriented programmi... |
From my experience I think that having classes/models without behaviour only in my application, next to their repositories is not good OOP. But, this was the way I implemented the repository pattern. I just make everywhere I need an repository instance, to perform some actions. The result of this approach was that all ... |
In our company I started to develop an ADDIN for a drawing application. The first results of this ADDIN were reviewed as successful by the direction and they want to increase the workload on the application. So they assigned 1 colleague (and possibly 1 more in the future) to the project. Currently my coworker isn't cod... |
I'm working on a project where requirements are rapidly changing, therefore some functionality is built then rapidly replaced by other functionality. I'd like to remove some functionality from the project to keep it tidy, but also be able to find it reasonably fast at a later date.
My project folder structure is like t... |
I'm having a bit of a philosophical argument with one of my colleagues regarding the "right" way to do unit tests (in this case with PHPUnit). I'm of the opinion that you should write one test method in the unit test per test you want to run.
// Obviously a very contrived example!
class AdderTest extends TestCase
{
... |
I have an existing Java architecture that uses a basic proprietary framework.
I want to start developing new functionalities in a framework, ex Play.
In that way I will not lose existing functionalities, I will replace them slowly and I will probably end up seamlessly with a rewritten application.
Is this wise to do? O... |
I'm basically attaching a listener to an event that's triggered when a controller action completes. Said listener has a dependency that calls a 3rd party API client and do some action. I.e: creates a new document in google drive).
Following the example, if the user hasn't authorized through OAuth2, the system should re... |
Since Git is licensed under GPLv2, and, to my understanding, GitHub interacts with Git, shouldn't the whole GitHub codebase be open-sourced in a GPL-compatible license?
|
I want to consume the Tumblr API in C#. Every request to the API returns a JSON-encoded object with the same general outline:
{
"meta": {
"status": 200,
"msg": "OK"
},
"response": { ... }
}
meta is always the same but response is specific to each request.
I would like to have all my methods... |
I'd like to ask for some help in understanding how event-sourcing systems are used when it comes to web applications and POST requests. I understand how events are stored and the event-driven architecture of eventual consistency. I understand CQRS etc, but I cannot imagine how an event store mechanism handles something... |
Usecase: End user places an order on the company website, the order needs to be pushed to company admin's screen with small latency.The company has multiple branches(identified by compId and branchId combination) so the order must be pushed to correct admin.
What I have so far: A REST API that takes Order, persists it ... |
I have a complex system which I have done a pretty good job at separating concerns with microservices. All data is passed around through queues, and the result of the system are messages to update a database model owned by a single agent. I don't have any shared code among the agents of the system.
The problem I am... |
I wonder whether a method in a functional programming language should receive all variables from the argument list, or whether it is ok to use variables from the outer scope?
But let me explain the context firts: The enviroment where I'm working is focused on programming (or better: scripting) Scala in the Scala-REPL /... |
I have read about connected model and disconnected model in the main ORM of Microsoft EF . And found that the default behavior is the disconnected .
Then i read about the relationship between these two models and the software architecture .
1-tier vs. N-tier
1-tier applications like WPF use connected model.
N-tier ap... |
For ex: Two machines have the same compiler and the same operating system. But the two machines have different processors (different assembly instructions).As the compiler was downloaded with respect to the operating system, how does the source code get converted to machine language of each processor?
|
I'm a software developer, and the kind of developer we call "front end developer". I'm working on stuff like Angular, React, Vuejs and many others.
I wanted to know how we can organize our front end code so that we can fit a microservice architecture.
Actually, we scale services across units, each service is "independe... |
Say you are creating some module or service, which is responsible for creating certain ratings, i.e. you're creating a rating service for e-books and you are trying to judge how romantic a book is. And for that service you create some test, where you use real books, which you have read and know how you would rate them ... |
I am developing a Human Activity Recognition android application. Currently, I am at the Design stage where I am designing the architecture of the app. I am using the MVP architecture pattern. I have to note that I am learning how to develop a software architecture while thinking about the design of my app so please ta... |
I am trying to decouple a dependency from Book Class to BookStorage, but got confused how to do this right. Can someone tell me how to decouple this correctly? Here is my code:
public interface IBook
{
string Execute(Guid bookId);
}
public class Book : IBook
{
public string Execute(... |
Recently I've tested the limit of a stack on three devices with different OSs (by limit, I mean the maximum number of levels that can the stack have), and I noticed that every time when I hit 2^16 levels it gives me overflow error, and when I put 2^16-1 it works properly.
So my question is - is that true? Does the stac... |
This had probably started way back when Microsoft created ASP.NET Web API library, at least that's when I remember it if I am not mistaken. Anyway, since then, its HTTP packages started depending on Newtonsoft.Json library for data (de)serialization to and from JSON.
Why would a company as large as Microsoft would add ... |
We have a web api c# project that was build using database-first several years ago. Now there is a need to make a transition to DDD architecture for this same project. The main reason for this is to put emphasis on business logic (that did not change a lot) and application design so it has a room to expand with new fun... |
I'm building a Spring-Boot API that will serve a system that requires synchronous behavior despite the API doing async operations. I'm not too familiar with threads and I'm thinking this might be the right place to use them. I'm eager to hear some input.
Here are the restraints:
1. API will write to queue when reques... |
Building an android app that displays a list of of Dog objects in Activity A. When you a tap a Dog in the list, that single dog is accessed by Activity B, Fragment B, and 3 other classes.
After that Dog is modified, it gets passed to Activity C and Activity D that all modify it, before finally making a network request... |
A page I'm working on has seemingly random anchor tags showing up all over the place, which is causing significant formatting issues. Those tags are showing up in Chrome DevTools but not the page source, which suggests that they were added via jQuery.
How can I track down where those mysterious tags are coming from? Th... |
I was reading Death of for-loop article, and I thought maybe I should timeit the codes. I created this benchmark at jsperf which clearly shows that map-filter approach is about 90% slower.
So, why is FP code here is slower? and also, why be functional if it is slower?
The author was only talking about readability when ... |
Introduction:
I've been a procedural PHP programmer. For a few months I've been following OO tutorials and watched a lot of videos on this subject. It's 100% clear that the OO method is way more efficient programming, especially because my project sizes are growing.
So what i want learn the way of object oriented think... |
I am writing a wrapper for a REST API and I have run into something I have never had to ask myself before.
This API is for E-Commerce transactions, it has SALE and RETURN endpoints (and some other endpoints that aren't critical to this discussion).
The SALE and RETURN requests are nearly identical, with the exception t... |
I am working on a large project in python that has lots of imports.
Some imports are system imports - these are easy, usually just absolutely imported.
Some imports are third-party. These can have long, clunky absolute names, but clearly named single functions (requiring from ... import statements). Finally, some have... |
Say I have a computer vision system capable of tracking multiple colored blobs. Further, assume I want the blobs to represent "fingers" in a multitouch system. Now, I have many examples I can look at to see how to make multitouch gestures. However, I cannot seem to find a clear explanation of how a "touch" event is def... |
So let's say you're writing software for some company. Best practices, as I understand them, would dictate that for dev purposes, you populate your DB with fake data. There are a number of benefits to this.
If you're going to be using, say, Vagrant to manage your dev environment, most of the pre-built images have HDD'... |
When several persons work together on a project shared in repositories in github, it happens quite often that I feel that someone else's code is hard to read, and want to change and reorganize his code and add more comments.
It is for improving readability just for my own purpose, and I don't want to ask others to ch... |
Say... you're trying to write a networkCallback code in java:
public interface NetworkCallback {
void onNetworkResult1(Object object);
void onNetworkFailure(Object object);
}
you want to use it, but you sometimes have two network results:
public interface NetworkCallback2 implements NetworkCallback {
void ... |
At the moment of writing I have let's say 4 micro services interoperating in order to build a bigger system.
Every microservice has its own repo.
What I'm thinking is that it would be useful to have parent repositories that group the children microservices, adding them as git submodules.
So if a developer needs to wor... |
Situation:
There's a remote team of 6 developers in 4 different countries. It uses CI, version control, Slack and has a weekly status call. They do code reviews on each pull request (always same reviewer). However there are no formal rules on code organization, style and layout. Some of the team members work part-time,... |
We have two modules: D and S. S has a Web Service interface, which is being used by D.
S's responsibility is managing a domain of objects held in a folder-like structure. So, it contains a method like: object Get(Path path), where Path DTO represents a collection of strings, which are components of a path (i.e. to get ... |
SITUATION
Let's assume we want to generate an excel report with the data from microservice A and present it in microservice B. We can obtain the data with some scheduled task or so.
POSSIBLE SOLUTIONS
Simplest
We add a report functionality to microservice B and generate reports there.
Pros:
Pretty strightforward, on ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.