instruction stringlengths 34 36.1k |
|---|
I've a domain class named Campaign.
Class Campaign {
public long CampaignID { get; set; }
public string CampaignName { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
}
In addition to that, i'm using Asp.net MVC, and I defined a model class.
[DataContract]
publ... |
We have an application that allows users to enter conditionals in the form bound op x op bound2, we store this as a string, and then parse it at runtime to evaluate it.
It is a decent amount of work, for a very limited conditional statement.
We are looking for a way to serialize and then evaluate complex conditions, wi... |
An example would be if you had multiple inputs, each of which effect a completely different process, (perhaps one changes a div's width, while another sends ajax request for predictive search), would you bind a single event use a switch statement to call the process functions, or set multiple eventListeners bound to ea... |
I work in a Data Warehouse that sources multiple systems via many streams and layers with maze-like dependencies linking various artifacts. Pretty much every day I run into situations like this: I run something, it doesn't work, I go through loads of code but hours later I realise I've managed to conceptualise the proc... |
At my work, we use Git as our version control system. We have a master branch, which I have direct commit access to. Sometimes I have to make a trivial fix, such as fixing a typo in documentation, and the unwritten standard in our office is that getting reviewers for that is a waste of time (please don't argue this poi... |
We are retrofitting an architecture on a fragmented landscape of about 9 software products. These products are all related to a social/community platform. These software products, consisting of webapps, webservices and smartphone apps, were developed by students with no adherence to any architecture. The apps themselve... |
From the interview with Kent Beck in a recent Java Magazine issue:
Binstock: Let’s discuss microservices. It seems to me that test-first on microservices would become complicated in the sense that some services, in order to function, will need the presence of a whole bunch of other services. Do you agree?
Beck: It see... |
I was thinking it should hold pointers:
struct Expr
{
string sym;
Expr*[] sub;
this(self, string sym) {
this.sym = sym;
}
@property auto dup() const {
auto e = new Expr(sym);
foreach (s; sub) {
e.sub ~= s.dup;
}
return e;
}
}
But then that... |
I work with a team of developers who are given choices as to what hardware and software they run. Our feeling is that this scenario lets us see a wide variety of target systems before ever hitting test. Our experience is that we find a number of strange problems in different browsers and operating systems soon after th... |
If I need to have a function do some processing in order to initialize multiple of the object's variable (I'm having a hard time coming up with a simple example that doesn't seem weird).
Which of the following patterns is preferable?
class foo( object ):
def __init__(self, bar, bar2):
self.bar = bar
... |
First, I am not a programmer (yet) and I can only understand basic algorithms written in pseudocode (+Dijkstra, which is a little harder than others, for me). I have been trough logic, set theory, relations, combinatorics. Currently, I am studying graph theory.
Can you give me a simple explanation on how Lyndon words... |
I am wondering how the apps that allow
a user to choose an item and, once the user has selected an item and checked out, give the retailer information about order that has been placed.
For example, say a takeaway has an iOS app and customer has chosen fish and chips and placed an order.
How does the takeaway kno... |
Imagine we have an integer amount (e.g. integer cents) to be allocated across a weighted set of items where the total allocated amount must sum to the original amount. For example:
Amount: $1.00
Item Weight Allocated Amount
a 1 $0.33
b 1 $0.33
c 1 $0.33
Whi... |
Von neumann architecture allows sequential processing of instructions. So, a single core within a CPU executes instructions sequentially.
Consider, OS providing 1-1 threading model(here) in a multi-core processor system,
Properties of concurrent system
Multiple actors(say, each thread assigned to a different core)
Sh... |
Let's say I want to model a phonebook.
I would like a phonebook to be maintained in sorted order by name of the person that the phonebook entry is created for. However, since it is quite possible that there are two people with the same name, I cannot use any of the sorted collections, because they require the use of k... |
In a multi-threaded environment, we must consider concurrent access to writable resources. A common approach is to use Monitor or its shorthand form lock.
Task is at a different abstraction level than Thread. A task may run on a thread of its own (and according to the logs, they do so in our application), but that is n... |
I'm currently working on a native mobile solution where I need to design a modular application.
Imagine a scenario where you have your core application and 3 supporting modules.
You can either sell your entire application or your client can negotiate and select what modules are more important. Your client might also w... |
I have added this method to a C# class:
public bool CanAddLeave(Leave newLeave, out AddLeaveResult result)
{
result = _repository.CreateSqlQuery("CanSendLeaveRequest ")
.SetParameter("employeePositionId", newLeave.EmployeePosition.EmployeePositionId)
.UniqueResult<AddLeaveResult> ();
re... |
I have a few operations to make over many similar elements.
I would like to collect data from each element firstly and next bind all the data to an object (binding is expensive operation so I need to do it once).
Is it consistent with the Visitor pattern?
Example of my problem:
class Element {
public $name;
p... |
I am working on problem where a call to reduce a counter will come to a service and if counter is greater zero then call should be able to reduce it else fail.
Pretty straightforward? huh!
For a request get the counter value, reduce and put it back
Well it becomes interesting with below Constraints:
Request is sandbox... |
When you browse for the phrase "constructors must not do work", then in various blog posts you will find the advice to not let the constructor do work. Despite this, I am having some trouble understanding why this is the case. Additionally, this popular post suggests to take such advice with a grain of salt.
I have an ... |
I'm building libraries with various small utility functions in C#, and trying to decide on a namespace and class naming convention. My current organization is like this:
Company
Company.TextUtils
public class TextUtils {...}
Company.MathsUtils
public class MathsUtils {...}
public class ArbitraryPrecisionNum... |
I was cleaning unused variables warnings one day, and I started to ponder, what exactly is the problem about them?
In fact, some of them even help in debugging (e.g. inspect exception details, or check the return-value before returned).
I couldn't find real actual risk in having them..
Examples
I do not mean lines that... |
Visual studio projects, as opposed to makefiles or other projects I know, have some quirks:
The directory structure of the project has no real connection to actual directory structure - all directories are purely virtual - this makes it harder to re-add mass of files while keeping directory structure
The project consi... |
We are designing a RESTful API that is mainly intended to meet the needs of a single client. Because of its very particular circumstances, this client has to make as few requests as possible.
The API handles i18n through an Accept-Language header in the requests. This works for all things that the client needs to do e... |
I'm developing a Cordova app and I've got the UI ready but I need data to my app from a database. For example I want my cordova app to include user authentication when the user opens the app which means, I have to access my database in some way to check the user input. I would also like to get data from the database an... |
I am working on a project that is using Thrift and as a result has auto generated code.
Firstly, what are the pros and cons of placing this generated code in SCM vs not and insisting developers generate themselves if the wish the build the dependent software package.
I feel like auto generated code shouldn't be placed ... |
Should every single class in my system have an interface?
I understand that interfaces provide an abstraction from the implementation of a class and so changes to the implementation do not affect classes that are using the interface, i.e. cross platform implementations may differ but the interface can stay the same.
B... |
I recently did a phone interview with a company. The interviewer told me that he didn't like like to get people to write code on the spot without access to stack overflow or documentation because that's not how programming works in real life.
He emailed me a small programming task to complete in the next couple of days... |
We are currently building a framework (closed source static library) that will communicate with some Smart home devices via Wi-Fi. This framework will be used by 3rd party developer to build their own applications (mainly mobile application) in order to communicate with those devices.
Currently, we have split opinions ... |
We have here a large legacy code base with bad code you can't imagine.
We defined now some quality standards and want to get those fulfilled in either completely new codebase, but also if you touch the legacy code.
And we enforce those with Sonar (code analysing tool), which has some thousands violations already.
Now t... |
I'm building a multi-tenant cloud application and actually I need a bit of help to solve a situation about the login.
My app is a webscheduler, this allow to each customer to have a certain location where store the appointment, the location is the database of my customer (buyer).
Each buyer can have multiples location... |
I was wondering if there were a set of standards or best practices for displaying information in lists for mobile applications (specifically Android applications that utilize RecyclerViews and custom RecyclerAdapters). I would be especially interested in hearing about this from Android developers who currently work or ... |
I worked on a project and found a working solution, but now I got some questions on how I solved some problems in the code. First of all, I am no expert in design patterns, but I know the (anti-)pattern of singletons and normally I avoid them. But what I use quite often, are static helper / utility methods.
So the proj... |
I was wondering what is the best way to represent a function that is passed as a parameter in UML. Because I want to create a sequence diagram of my current networking code in my Swift project and some functions pass a function as parameter to other functions. So I was wondering is their a standard way to describe it i... |
Is a multi-tenant database:
A DB server that has a different (identical) database/schema for each customer/tenant?; or
A DB server that has a database/schema where customers/tenants share records inside of the same tables?
For instance, under Option #1 above, I might have a MySQL server at, say, mydb01.example.com, a... |
Here I am in the process of scoping and estimating a relatively small new software development project. I have been through the user stories suggested by the customer and placed tasks against each, with an estimate and some brief notes on how the task will be accomplished. There are acceptance criteria. All ought to be... |
I went for an interview, and got a workload problem:
Problem: write a function to tell whether a series of workloads will exceed
the maximum workload or not
Input: MaxWorkLoad: example 10
Timeslot and workload: example [(2, 6, 3), (3, 8, 2), ... ]
The (2, 6, 3) is begin time, end time, and work... |
I am doing database programming using Java with SQLite.
I have found that only one connection at a time to the database has write capabilities, while many connections at once have read capability.
Why was the architecture of SQLite designed like this? As long as the two things that are being written are not being writt... |
I am creating object oriented design for a simple app through which users can order food from restaurants. User can browse nearby restaurants, explore menu, add items to cart, and finally checkout.
For now I am concentrating on two main classes User and Restaurant and the interaction that a user can browse nearby resta... |
So I'm writing a game and using the Google Play Services framework to send and receive data.
I have to implement the IRealTimeEventListener interface and override the functions below to receive incoming network data.
class EventHandler : public gpg::IRealTimeEventListener
private:
//IRealTimeEventListener
void On... |
I'm writing a trading framework in MQL and I'm confused how I should organise my class hierarchy.
|-- Terminal (Log)
| |-- Market
| | |-- Chart
| | | |-- Draw
| |-- Account
| | | |-- Trade (Orders?)
| | | | |-- Orders?
| | | | | |-- Order
In the brackets are the class variables wi... |
We have customers that often have varying requests. Currently, we do things such as if customer_code = ? then ... and do something different just for that customer.
I want to employ something similar to how Wordpress/Magento works where you can subscribe to events, receive the data, process it how you want and then ret... |
We have an Android app written as a Cordova AngularJS SPA which has now grown so that we need to add some work to it meaning we have to improve the synchronization part of the app. The app is mainly used offline. I can't give details of the business use but data structure and constraints can be illustrated with an ov... |
I have read the guide and they say
Query Router Sharding is transparent to applications; whether there is
one or one hundred shards, the application code for querying MongoDB
is the same. Applications issue queries to a query router that
dispatches the query to the appropriate shards.link to guide
Does it mea... |
In Chen notation multi-valued attributes are denoted by double eclipse(oval) and derived attributes are denoted by dotted eclipse(oval), but how they are denoted in crow foot notation?
Also how associative entities are denoted in crow foot?
|
All articles (example) I read till now about regular expressions and NFAs explain three operations:
sequence
alternation (union)
repetition (Kleene star)
No one talks about negation. Is the negation not regular?
Update:
@RemcoGerlich What does it mean "swap the states". Can you explain it with the Kleene closure?
H... |
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.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.