instruction stringlengths 34 36.1k |
|---|
I have been trying to find a proper way to represent the above data flow (this is just a small case), and I'm not sure if I found a good way to do it. Our current implementation just evaluate all the previous data like:
(if user.isMarried && user.age > 23 & ....), so is very hard to maintain.
Basically, what I need is... |
I must set a bool to be passed down from a controller to a view in my MVC solution as well as do something (as part of an if). I thought, in order to keep the code concise, I could kill two birds with one stone here:
if (model.MyBoolean = ([Some condition])) { // Do something }
The language permits it, but is this in a... |
I'm working on a project in which a user can create tables to save some data. What would be the best way to implememt this? Right now I'm doing it like this:
Table 'tables' - contains stuff the user setup like a name.
Table 'rows' - contains an id and relation to 'tables'.
Tables 'cells' - contains an id, value, positi... |
I'm looking for a quick way to split strings containing individual JSON payloads. Currently, I'm using newlines and searching for the newline ASCII character, but I figure if I start using utf-8 this could easily break.
Is there any quick single byte character that I would be able to use besides a null terminator that ... |
I'm struggling with a DDD concept in designing aggregate roots. I have a Client, which has multiple Projects, Projects have multiple Project assignments, which has multiple Employees. It seems natural to have a ClientRepository, which would manage Project, and not expose a ProjectRepository. After all a Project has to ... |
First some background of the problem. I have a transmitter and a receiver, by the way, the transmitter already exists and I have to develop the receiver.
The transmitter is constantly transmitting some data and it does so by transmitting once every minute. It transmits just once per channel and it is hopping in a pseud... |
So I recently started a new job for a small software company. They've got some old technology which I was aware of during the interview process.
However, I've been digging into their code-base, and I'm kind of horrified by what I'm seeing:
Swallowed exceptions
Servlets generating HTML instead of sending data to JSP f... |
Ok. My question is confusing, but what im asking is how could i create my own file with my own encoding representing data. sorta like my own database file with my own encoding ,headers, and info.
|
We have an existing software product that is being transitioned over to a agile process.
New requirements will be captured as user stories, but this has inspired the question around what to do with existing requirements and what the relationship is between user stories and product specification/documentation.
I can see... |
I have a set of structures in an API for reading data inputs and writing data outputs. For ease of processing, there is an intermediate structure that is used for holding data as it is processed. This intermediate structure is poorly named. Is there a simple, easy to remember name for such a structure that I am over... |
So I've read through Short circuit evaluation, is it bad practice?, Is it bad practice to use short-circuit evaluation instead of an if clause? and some other related questions, and I get that it is generally considered bad practice to use short-circuit evaluation for flow control.
I'm trying to write warning-free, ROC... |
I have a WPF view which contains 2 mutually dependent properties; a change in one might trigger a change in the other. How do I write code that cleanly updates both?
More specifically: I have WPF view which makes it possible to export data. That view contains a list of "channels" (that's how I call my data), and for e... |
I implement table data gateway on data access layer and transaction script on business. Is it possible to make table data gateway with non static methods and therefore create DAL objects in BL to calls gateway methods?
Now I do
var result = myGateway.SelectAll(p1, p2, p3);
with non-static methods it would be
var MyGWO... |
You enter the URL in the address string of your browser. It takes long time to appear in the client area. You are bored and type another address instead and click enter. Which page will be rendered in the browser, first or the second?
A similar issue raises when you update the outline of your document while typing you... |
I'm working for a software development company. The question that I have is whether should we present a user requirements specifications document for the customer/s before we start developing the actual system from scratch?
|
In 8086, mapping of logical adderss to physical address is done with the help of segmentation.
Segment registers : offset, and you get the physical location in a 2^20 byte RAM, even though you have 16 bit registers.
Now, my questions are:
When logical address are genereted? (When program starts to run? before? are the... |
I have just brutally terminated Skype installer, which now gives me error 1603 whenever I try to restart the installaion. This brings be back to the issue that bothers me for a long time: how do you design a reliable installer? It must be reliable because it makes modifications to your system (as opposed to app that wo... |
I have a few requirements of the type
"the system shall be as modular as possible (to allow distributed installation and reduce cabling)"
"to reduce development and maintenance costs, the same hardware shall be used for different subsystem's when possible"
I see these as ambigous. Can anyone think of a way of writi... |
I have added video calling functionality to my android app using sinch, I was wondering, what kind of technology-infrastructure is needed to do such a thing without using any 3rd party services? Assuming I have a server with a public IP which I can install any server software on, to provide signalling etc., whatever is... |
I've seen some serial numbers that have been disclosed on the net and can be used to activate any number of copies of software. How is that possible? Doesn't the software provider check the serial numbers against their database, so that every code can be used limited number of times?
|
I have a large class consisting of properties that are kind of (import) options. They are stored in one bundle class, so that it's easy to serialize them (or set eg. from environmental variables during the unit tests). It's something like :
class MyImportantAppSettings {
string Dbo;
string User;
int BatchSize;
... |
Is it possible to produce a web service based on SOAP and on JSON simultaneously?
For what I know it seems that only RESTfull services may use JSON
|
My apologies if my question is not gonna be clear as I do not have experience in the domain of versioning products/projects. And starting: I have a project which has multiple libraries and data sources dependencies and each library depends to another library or data source. For example:
<-- L1 <-- L2 <-- DS1
P1 ... |
We currently have a complex and inefficient build system consisting of many SVN and Git repos (about 50% each), including one which is a git submodules repo.
We also have homemade scripts that manage more or less well the whole thing.
A major point of our (closed-source) codebase is that it is tightly coupled, and ever... |
I am looking for some logical explanation of how software development fits into a Plan, Build, Run model of an organization.
I am struggling to find anything which explains how software development projects fit into this structure. In fact the body of writing appears to be over all very small on PBR.
What I do see is... |
I'm struggling to really understand memory segmentation.
It's the topic of memory segmentation related to segments like heap,stack,code in an object file?
Maybe they're for sure, but I still can't find a link and would love if someone can shed light on how the're related if they are.
I've read in my book that... |
List specific programming concepts that should code adhere to that it will run in parallel. For example, if a block of code does not change shared state, it should be able to be done on another thread. What other such attributes exist? I would imagine there only to be a small number of such concerns by which to evaluat... |
I have the following two inheritance chains:
BaseQueryBuilder BaseApplication
| |
| |
AppQueryBuilder Application
BaseQueryBuilder is an abstract class, which AppQueryBuilder extends by adding additional query builder methods that a... |
I am currently writing a ASP.Net web application that has a section for out IT department to manage users. One of the things it will do is give a checkbox list of the active directory security groups and email groups a user can be a member of. I was easily able to work out the code needed to add a user to a group when ... |
We're designing a major refactor in my company system's codebase. One of the refactor points, is the (actual) definition of the business logic/domain model. Right now, every repository in the codebase will just fetch every possible piece of data related to the entity, and to "optimize" it, everything is being fetched i... |
Today I received a rejection letter from a company where as part of the interview process they gave a a couple days to respond to the following question (paraphrased):
Let’s say say you have instances of class UserReview and need to save
them somehow, using a storage service of some sort.
Please provide pseudocode,... |
I am looking for best practice principle here. As part of my REST Api, I am returning some basic info for a user. Lets say the user can be an "owner" of a company, in which case they have full access to every resource of the company. Or they could have been given delegated access to certain parts of the company. Now I ... |
I hope people will indulge me a potentially obvious question. I've worked in a number of organizations that have daily scrum meetings. Some organizations are really strict about only using the scrum for check-in (the "three questions" - what did you do yesterday, what are you doing today, do you have any blockers?) but... |
I'm creating a python module at work, and I have a config file with variables that change for dev or prod (i.e. S3 buckets). What's the best way to do this? Right now I have dicts in config with DEV or PROD options, but selecting this every time in the classes seems tedious (i.e. S3_BUCKET[DEV] etc).
|
I'm working as a programmer in a load cell manufacturing company.
We develop our own software for load cell manufacturing and testing purposes.
Quality Assurance Department of our company has requested to perform periodical verification and validation tests (once a year) for our released software which has been already... |
Games written using OpenGL are relatively easy to port to many platforms, and look and feel the same everywhere implementing their own UI. Web browsers have to solve a very similar problem. So, why don't we have web browsers written using the OpenGL specification?
Would not having the same specification for the graphi... |
I am working on some Linux kernel drivers for a specific embedded system (NVIDIA Tegra X1). I am using the kernel source provided by NVIDIA (L4T), which has its own default kernel config files. My goal is to make some modifications to NVIDIA's kernel config file to support my new drivers.
The complication is that when ... |
I could not find any official recommended indentation for the following idiom (straight from http://effbot.org/zone/python-with-statement.htm):
with open(path) as f:
data = f.read()
do something with data
or:
with open(path) as f:
data = f.read()
do something with data
IMHO, the first version is better at... |
Semantic versioning encourages using suffixes to indicate pre-releases: alpha, beta or rc builds. Their purpose is well known and documented.
It's also a given that once you create a build or version, its name should not change. All package managers or repositories that I know hence don't support this (NuGet, NPM, Bowe... |
I was reading a wiki article about DRM, and I found in the Development paragraph this:
Torvalds, as top maintainer of the whole kernel, holds the last word on
whether a patch is suitable or not for inclusion in the kernel.
So, how is it possible that one man holds the last word whether a patch goes in? In a project o... |
I recently completed a black-box refactoring. I am unable to check it in, because I can't work out how to test it.
At a high level, I have a class whose initialization involves grabbing values from some class B. If class B is "empty", it generates some sensible defaults. I extracted this part to a method that initiali... |
Our company code base still has some code that will create the database, tables, stored procedures and the like.Coding the SQL stored procedures line by line in Java, in string format is a real pain.
I was wondering if those out there using alternative methods are willing to give me some pointer in case I'd like to opt... |
When designing a RESTful Web Service should the API be designed to work ID for Strings for values passed back and forth between the server?
Here's an example: Let's say I have an Employee resource, which has a status and gender attributes. In the database Status and Gender and separate tables and thus separate Domain o... |
As an example below, should the isClient() function be part of the Attendee class?
import Foundation
///A Node that can be used with the CriteriaEvaluator to determine if clients are present in a Meeting.
class ClientCriteria : Node {
/**
Calculates a score from 0..1 to identify the likelihood that a list of Attend... |
We have 3 different systems which exchanges data on a regular basis. There are
Some standard mappings between fields (Ex: field Category= A or B depending on input).
Indirect mappings between fields. (Ex: field Prio= A or B depending on input along severity)
Filling Mandatory fields (Ex: Summary)
Standard Workflows.... |
I have a table, each row can spawn a model with additional information. Is there a best practice for displaying tons of information like this?
I've considered the following options:
Save all information as JSON and leave in html element for JS to populate the modal with when clicked.
Render a separate modal for each t... |
I sometimes see the term "Gating" or "Gating bugs" in scrum development.
I felt like it is something needs to be fixed before the next sprint.
Am I right?
|
I am posting because, first of all, I want to make sure my understanding on these 3 methodologies is correct. Secondly, I would like some clarification on how they could all fit in together. I see they are approaches used to tackle on different problems, and to me, it seems like they should all complement each other qu... |
Is it bad practice to autowire and call a repository from within a mapper class? I have a mapper class that maps a model to an entity for JPA. In order to keep repository calls within my service, it requires additional loops/code in order to get inside the right data, whereas my mapper already loops in through my model... |
In ActionScript the URLLoader class that has seven separate events than can occur after you call the load() method.
In the HTTPServive classes there are two events, fault and result.
In one of the classes I've wrote there is only one event, result. In the result event I have property success that is set to true or fal... |
Im using C# as my development language. However I have some confusion over HTTPListener and a web service. Can you please explain what are the differences and advantages and possibly a situation in which you would use either
|
When developing an application using the MVC pattern, I often find myself adding a new model, a new controller, and a new set of views for the actions in the controller.
These changes are pretty atomic, as a new model is no use without changes a new controller (or at least changes to an existing controller). Similarly,... |
In my course work I developed the same game for a few operating systems independently. The game can be played both offline (with a bot) and in multiplayer mode (I have a server for that). Now I write documentation, and I cannot choose a term: it is not an application, nor a software suit. I would like to call it an app... |
The case in question:
The sprint is almost over and one of my Scrum teams did not finish some tasks. (The reason for this is not essential for this question and will be addressed accordingly.)
One of them is a classic "90% done" case with a rather large number of story points and will be part of the next sprint - like ... |
Currently I am making a console application. Is that right that the Main method of a .net console application is a facade? Is any console application entry method is a facade?
|
I have an interesting question about string and delimiters.
There is a random string str.
There are some symbols (OR SEQUENCES OF SYMBOLS) that are predefined and should be temporarily replaced within that string by replace function.
The operation should be like the javascript replace
Step1:
var str1 = str.replace(/... |
I am learning the 12 factor rule. I cannot get my head around the difference between storing configuration into environment and Backing service. Also how would u store properties into "Environment"?
Ex: I have a configuration for connection to orcale sql, with jdbc.
Should I consider it as a config. or a backing servic... |
While writing a library for a large project I'm working on at work, an issue came up which required a token to be sent to an email address, and then passed back into the code where it can then be used for further use.
My colleague says to just read from STDIN (using Python: code = input("Enter code: ")) and then have a... |
I recently started working with a shiny new version of a codebase that uses interfaces all over for... basically everything. I think all of our concrete classes implement interfaces.
The problem I've noticed is that the project doesn't appear to code to the interface! Items passed using interfaces are consistently cast... |
We got multiple devices that communicate over different protocols (rs232, tcp, http, etc.) and we want be able to send requests from multiple interfaces (as well get responses from each device to multiple interfaces).
We are wondering how to properly manage the communication between interface clients and device clients... |
I need to make ability to reorder records, storing in DB (I use MS SQL, but seems it's no matter).
I see possible 2 solutions:
Add Order column. Then if we want to reorder 2 records, we need to change values of Order column for these 2 records. Value of the first record set to the second and vice versa. Problem - we s... |
I have an object called SecurityServer.
It is created using SecurityServerFactory.
I need to serialize SecurityServer to disk/hardware token/ or some other storage.
Which is more correct:
securityServerInstance.Save()
StorageAbstract.SaveServer(securityServerInstance);
Both?
Neither? Use injection?
I have a feeli... |
In our TFS (Version 14.102.25423.0) I can click Browse on home page, then under Browse Server, pick my project and hit Navigate. Once inside my project, I see tabs like
Home Code Work Build Test RELEASE
Question: Sometimes I need to update code with no prior plan - no user stories, test, release plan ... |
SDL 2's installation page contains the following comment on static linking:
However, we encourage you to not do this for various technical and
moral reasons
I totally get why they would mention technical reasons, and the document linked in the same paragraph makes some very good points about the advantages of dynam... |
I ran into a problem on the project I'm working on right now. It is basically an app that stores a path based on GPS coordinates. The app runs on android an saves the GPS location every second and then sends it to on API. I think if I insert a record for every location saved there will be to many records in the table v... |
I have a module object, that consists of several parameters and an algorithm.
A parameter consists of a min, max, step, label and value.
The module's algorithm is regularly making a calculation based on a value on each the parameters.
In my application each of the parameters is represented by a slider on the GUI.
I... |
Design for Testability is a well-known topic in digital logic. The idea is that it is difficult to exhaustively exercise some hard-to-reach parts of complicated combinational logic unless seams are created, and then test vectors can be injected (where these seams are called "boundary" in electronic design).
(Disclaimer... |
I'm reading Tanenbaum's Modern Operating Systems and I really can't grasp the following concept: how does a program make a system call? I mean, i got the very basics down (correct me if I'm wrong): the OS is just another program running on the machine (the difference being that it can run in kernel mode having complete... |
Since I am new to programming, I just want to understand the format the built-in functions is represented in the documentations. This is the one from python
bytearray ([source[, encoding[,errors]]])
Why all the square brackets are terminated at the end? The brackets are nested. There is comma immediately after the sq... |
Within a Java shop, we are using Spring MVC, some HTML output and some JSON/Rest output as a service. Our client side is more familiar with jQuery for ajax messaging to the server. We have been able to build Ajax applications but the approach is cumbersome with just jquery and java code. What are some approaches for... |
In a PHP CLI software, we are facing serious memory leakage due to a lot of rotten code, both accumulated in our own software and third-party plugins for our software.
Currently, the object references look like this:
class Server{
// the central singleton object
/** @var Level[] */
public $levels;
/**... |
I want to build an embedded device which will take its current location (in latitude, longitude) and output custom serial data about a number of the nearest few points in a list.
Current location and the points holding the custom data are represented by latitude and longitude, although could be projected to another co... |
So I'm very comfortable with version control, and just thought to start tracking versions of my bash profile: ~/.bash_profile with the added benefit of being able to share my various aliases and such on GitHub.
Assuming that my .bash_profile file needs to stay in my home directory(I can't wrap it in a directory to tra... |
So, I have following code:
public class CQRSQuestion {
public static void main(String[] args) {
//received command for algorithm run
AlgorithmAR algorithmAR = new AlgorithmAR(111);
algorithmAR.runAlgorithm(1,"2");
//after a while we receive another command to actually save algorit... |
Here is my use case:
I have a two dimensional grid and each grid space is either open or blocked. I know the entire grid beforehand and as I traverse the grid I explore in a radius of 10 units in all directions that are not obstructed by an obstacle.
I would like to 100% explore the grid in the shortest amount of time.... |
I just stumbled over an interesting problem with naming.
I am writing automated tests for an Object-Relational mapper.
This involves using super-generic classes that exist solely to exercise certain relationships.
My test first involved composition: One object held another object which held a collection of objects:
Ent... |
I want to test the performance of some code snippets in JS using:
function perf() {
var start = new Date()
// the snippet codes
var end = new Date()
return end - start
}
then i wrote some sample code:
HTML:
<section>
<button>insert list item</button>
<ul></ul>
</section>
JS:
function insertListItem() ... |
In the book "Agile Project Management with Kanban," the author Eric Brechner defines "current task estimate" as the sum of pending, active, and done tasks.
I do not understand why "done" tasks are included in this metric. Ideas?
|
I'm trying to do a performance testing with my application under a load balancer.
That makes me curious If we test an application under load balancer Is that mean we are testing load balancer or our application?
Since our load testing request will send to load balancer first not application.
Could you help me clarify t... |
I recently needed a function to deep clone an object. I started with the code given as an accepted answer to this question: https://stackoverflow.com/a/728694/1253156
However, our SonarQube complained that the function was too complex, because of the multiple if statements. So I refactored the code to this:
function ge... |
One of my (open source) hobby projects is a backup tool which makes offline backups of repositories from GitHub, Bitbucket etc.
It calls the hosters' API to get a list of repositories, and then it uses Git/Mercurial/whatever to clone/pull the repositories to the local computer.
So I have integration tests where I'm cal... |
Heres my issue. I have different types of methods which make HTTP requests to a REST api. To keep things clean, I have methods that take different types of request objects as parameters. Example below.
Task<IEventResponse> FindEventAsync(IGetEventsRequest data, CancellationToken token);
So everytime my controller call... |
I have several types of events, for example:
abstract class Event {
static class KeyPress extends Event { ... }
static class KeyRelease extends Event { ... }
static class KeyHold extends Event { ... }
// ...
}
And many listeners which respond to some of the above events by registering them in an event ... |
During our current build process, we have C code that gets compiled and archived together with some Python code in a tarball. That tarball represents a commit (that can be or not be a release commit).
In some of our Jenkins flows, the code is being tested and in some it isn't. But the information regarding to each spec... |
I'm currently developing an application which relies on multiple sockets listening for chat messages. When the messages come in, they're passed off to a bot that's associated with their channels. Because of the large number of channels this bot is associated with, it's highly inefficient to create a thread for each bot... |
As I understand it, it's generally recommended to package by feature rather than by layer. This promotes higher levels of abstraction and modularity between classes.
I can understand how this works in regular non-utility applications where it has clear features (registration, security, etc), but it is hard to apply thi... |
I don't understand the difference between an accumulator-based CPU architecture and a register-based CPU architecture. I know x86 is register-based but it has an accumulator-like register. I only ever hear people asking the difference between stack-based and register-based, but not register-based and accumulator-based.... |
I'm designing a system that like the majority of social related application has posts, people can like the posts and comment on them.
And also like the majority of the applications the users can see how many like/comments a post got.
The problem is that to show these numbers I would have to count all the likes and comm... |
I find myself difficult to remembering the definitions of software engineering terms such as domain layer, entity object, busines logic and etc.
I mean when I read a definition of something let say the definition of "business logic" I find many other terms related to it in the definition that I don't know the meaning ... |
In my application there are some predefined expression templates that can be used to filter data. One of them is "between x and y". A QA engineer claims that there is a defect in its definition, because "between 100 and 200" gives different results than "between 200 and 100". The expression is internally translated to ... |
Is it true that one doesn't "implement a programming language"? I was told that in some comment around here several years ago and I read that actually you do "implement a programming language".
The background is that I was trying to check if it is true that python is a "programming language" and not a scripting langua... |
Problem: We have to develop a CMS for our sites. The sites are kind of different, but they have common parts. We need to use our external user system and permissions, the menus are different for each of the sites, the forms are posting to a 3rd party system, and we have many other very custom features.
Dilemma: Should ... |
Let's say I have a form with a black label. I have a button that is supposed to change the label color to red.
This functionality has nothing to do with the data layer (the Model), but only with the View. So should the button click event be handled in the Controller or in the View itself?
|
Given a situation like this:
where the position of the triangles is given (it does not need to be calculated by an algorithm). I would like to find clusters of circles around the triangles. Each cluster should contain a given number of circles (in this example every cluster gets 4 circles) and the clusters should be f... |
I've read online that MIT is a permissive licence which allows for the code to be used in propriety products, but the licence texts seems to conflict with that, which I'll quote below:
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software... |
I'm going through the code of the biggest program I've ever created from scratch and seeing if there are things that I can improve in the design. When I first created the program, I was using Singleton everywhere, but since then I've removed them completely and instead switched over to using Dependency Injection. One t... |
All tutorials on GADTs that I've seen (in Haskell, Coq and Idris) use one same exapmle of a well-typed interpreter to show how GADTs can be useful, where you use the type index to encode the type of the term in the object language.
What are some other examples and general rules for when we should think of GADT as a sol... |
I have tried looking at various design patterns to solve a problem that I am having. I want three objects to be loosely coupled and encapsulated.
Object 1: Spring Data Repository:
An object for exposing the persistence layer.
Object 2: Rest Template Service Object:
An object that performs actions on a REST API and co... |
I am confused about the difference between the branch and the predicate in a code. Can someone explain the difference with an example?
|
My client has a process which iterates over a number of actions that may or may not apply to a users portfolio. Quite frequently, processing of an action may give up and jump to the next action or portfolio without the process stopping (i.e. straight through processing).
Sometimes the decision which lead to the action ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.