instruction
stringlengths
34
36.1k
Moving data in assembly language: MOV B, A If I move content from internal register A to register B, what happens to content of register A? Is it deleted? Stays unchanged?
Does an OOP design that uses a Design by Contract mean the designer is using interfaces to create a "contract." The term "contract" is used quite often when discussing OOP interfaces, so I didn't know if these were talking about the same concept when using the word "Contract." What I want to do in one of my designs is...
I want to sole this problem: Write a method to return all valid combinations of n-pairs of parentheses. The method should return an ArrayList of strings, in which each string represents a valid combination of parentheses. The order of the strings in the ArrayList does not matter. Examples: combParenthesis(2) ==> {...
How do I find the O - notation complexity for the following? int sum = 0; for (int i = 1; i <= n*2; i++ ) sum++; I read the guide on Big - O and other posts on Big -O complexity, but I'm still lost.
RAII is by far the most useful idiom in c++. However there seem to be two common pitfalls associated with it that I believe need to be formally addressed. Failure to release a resource in the destructor and resource invalidation prior to deconstruction. What are your thoughts on solid pattern extensions to incorporate ...
Hi I have a programming project where I'm basically using a Binary Search Tree to implement a min/max priority queue. I'm having trouble with the popMin/popMax methods. I get how to get the minimum/maximum node and remove a node, but I'm having trouble doing both with a single recursive method. I don't understand how I...
What i got now is low level object that has bunch of methods and its difficult to navigate trough i want to break it down, however functions logically have same functionality just different implementation class HTMLManipulator { function findElementById($html, $element) { ... } function setElementById(...
Last I encountered a SOAP based service was during my internship in a financial firm in 2013. That was the time when I started my career in IT. I remember having some study material about SOAP in one of my engineering course. Outside of that, I haven't used SOAP much during my career. I am asking this since the questio...
I have this task of modelling a system where given a group of users each can keep track of their expenses. The basic requirements are as followed: To be able to give credit to an user. Find all the transactions of a given user. Filter out the transaction where either user is borrower or spender. Create a group and put...
I have a news service that has thousands of users. Each user can subscribe to a set of tags and sites that they individually would like to follow. A tag or site has articles attached to it. A user can potentially have 1-500 of these they want to follow. Each user should have a page where these articles, based on the ta...
Lets say I created a webapp that I want to make it more scaleable. How it would work now If I want to "sell" the webapp I have to do the following: Rent a new hosting Copy the code to the hosting Create a DB and the tables and change the names in the db The users table will be used to check the user that wants to lo...
Say I have a database for storing cars data. Each row is essentially a car and I've a class that takes a row of the data and builds my car object. I now want to build a dashboard that can tell me all the types of cars e.g. Type Amount BMW 12 Ford 7 I'm trying to figure out how best to design ...
We are currently building applications that will run in house and not be rolled out to any customers. We are the only customer. We are using c# and the latest .Net platform. We are also using Team Foundation Server with a git repository. I am looking for information on build and deployment strategies. I am finding i...
Just for clarity, the stress test I have written steadily increases the load on the system until it reaches a breaking point. It theoretically runs indefinitely, but as the system resources are finite, it is expected to fail after some point of time. I have an expected load for the system, but this is tested separately...
I was reading nginx article regarding Inter-Process Communication in a Microservices Architecture, and I found this diagram. What surprised me is the second BC, where trip management BC actually leaves its BC in order to get passenger info from a different BC. I know it is strictly a business logic if a trip management...
Reading source code of the early release/version is very helpful for beginner to digest complex project. There is less line of code and learner can see the progression of the project. However, finding those early version is not easy. Those early work may be deemed as "useless" and not get publish online or include in v...
I've seen a few build tools in my career, and they've all had their quirks. I'm just now looking into Maven, and came across the idea of "dependency exclusions" for the first time. I honestly don't understand which legitimate problem this mechanism is trying to solve. Let's take the POM of Apache Pig, for example: <pro...
Should Authentication Use Cases be represented in a UC diagram? Should there even be a use case describing authentication or, as it is usually common-sense, can it be hidden?
I have a built a toy server framework that provides very extensive configuration options. In configuration, one can for example define instances of modules with each providing generic options, such as logging level, path, format, module-specific options such as listening port for a http daemon etc. I've used a big JSON...
I just wanted to ask you guys if this CQRS architecture is too complex or am I doing something wrong? So just to explain picture below: After one bounded context emits event (SomeEventHappended = DTO) that something happened, this event is received in another bounded context. After Event is received in another bounded...
I'm working on this project which, for certain reasons, will need to read the data that's persisted by a DBMS (*). The data is not serialized objects with class information, representation of pointers etc, it's much more "plain": Mostly arrays of integers or floats, and a more involved persistence scheme for strings an...
If I have a function where I am operating on a specific offset within a string, and the exact location of this offset depends on a previous test within the function, is it "bad practice" or "ugly" to use the boolean in the arithmetic in which the offset is calculated? Here's my function: #include <Windows.h> #include ...
This is question about class relationships not class functionality. Currently my DBConnection and DBQuery classes are two separate objects class DBConnection { public $dbh; __construct() { $this->dbh = ... //Establish Connection to db } } class DBQuery { private $dbh; __construct(PDO $dbh)...
I am designing a REST API and facing a choice of formatting my POST methods to absorb parameters free-form via query string or content parameters: POST /my/api HTTP/1.0 paramOne=XYZ&paramTwo=ABC or expect that a rigidly formatted data message (XML/JSON) be posted which encapsulates parameters: POST /my/api HTTP/1.0 ...
I've worked on various systems, all well-coded and well organized, but even still, what "gets the data" and "saves" it were never really defined. So I hunted the past month for architectures that "solved" that problem. What I found was EBC, in particular it had a Controller object that went from raw entity and then pa...
I'm studying for a final exam and I came across this question which I found pretty interesting. I was wondering what the stackExchange community who are more experience in scripted languages than I had to say. If you were asked to design a scripting language which was compiled, how would you achieve this without losi...
I joined a Devops Team of 6 in a Large Software Development programme (100 Developers in the program). At the time the scope of work was: containerisation of the Java server App scaling up automated web testing using selenium grid and containers hosting and rapid-deploying the JavaScript SPA on Amazon S3 Continuous in...
I'm currently at the design phase of my program (hence no code). It will be written in WPF in C# using MVVM principles. I'm going to have a multifunctional Drag & Drop control, that will act similairly to a Facebook's Post on the Wall. To make this clear, imagine it could be a calendar event, an important note, a produ...
I need to create a flowchart for one of my algorithms and one step is calling a function (that I don't wish to explain in the flowchart) and assigning the returned value to a variable. float x = get_random(0,1); I am wondering if I should use rectangle or (non 90 degree) paralellogram in this case. On wikipedia I find...
I'm trying to figure out the best use of Git for my development team. We work on multiple C projects that share some common modules, each one varying a bit in each project. A module can be a hardware driver, a sensor driver using a hardware driver, an algorithm library, a task using a library with a sensor module, etc....
I have a small python application (about 6000 loc), where I keep my settings in a seperate module, settings.py. As the application grew, I started to add tests. Now after having more and more tests, and trying to test with different settings, I find that the module approach was not such a great idea, as its not very fl...
When deploying to Flexible Environment using the default runtime (e.g. python), we just need to specify different app.yaml files with different entrypoint: values. But what would the 'best practice' for custom runtimes be for this case? Multiple Dockerfile's with different CMD values? But that would mean that each ser...
I wanted to know how do people generically think of, in a data base table: Columns that people are expected to use mostly for grouping expectable of groupability. Columns that people are expected to use mostly for actual business data that not. For instance, let us consider a quick example of a school. I would say th...
I wonder if project structure and naming convention which I use in ASP.NET MVC and Web API projects are ok. These technologies are quite new to me, so I don't have my own standards yet. I don't change default convention in controllers and views. I change Models directory name to ViewModels. Every View has it's own View...
I am creating a system that allows an admin to login, manage items, customers, reservations and many more. But as I have asked my professor, he told me that before the admin can access the managed items, customers etc., the admin should go through the login process in the data flow diagram first. But how can I illustra...
The question is self explanatory, just to add my thoughts : As far as I have read, The presentation layer in Clean arch has the same responsibility as in MV in MVP. How one decides to choose one pattern instead of the other?
I use a third party library for speech recognition. This library give me access to some classes ( SpeechRecognitionEngine, SpeechRecognitionConfiguration etc) which give me access to some events (OnSpeechRecognized, OnSpeechRecognitionStarted etc). So as I could want to reuse this library any day, I created a project ...
I know that Scrum rules in daily standups say that team should only talk about what they did yesterday, what they're doing today, and anything blocking them. Nothing else. But the problem is, sometimes developers spend their day doing work irrelevant to their tasks, and then talk about it in the standup. It's what they...
We have a RESTful API that allows for creation of users by POSTing to a particular endpoint, api/v1/users In the system, when a user is created, an email is sent to the user with content along the lines of "{Authenticated user} just added you to the super cool system and you can now do all sorts of things" However, in ...
I'm searching for best practices for versioning software from a process (technical) standpoint but can only find conversations on numbering schemes. Basically, I want to see if my planned update process meets "standard practices". The application checks an API and compares the result with it's own build number. If the ...
I'm working on web application, which gets Wikipedia data from Wikidata (such as description, image, Wikipedia link) and shows them on the page. I see 2 ways of making this: Upload requested data from Wikidata to my database and then get them from it. In this case my application will be working when Wikidata is not av...
Where is the figurative line drawn for using static services in a project? I am a coop student working and learning how to write .net MVC projects. I've been developing trying to stick to TDD. In my project I'm using ninject for dependency injection. I have written an abstract and a class implementing that for making A...
I worked in many companies, and whenever the dev process is tracked by the ticket system, there is a big related issue: quality and perception. When a developer finished 12 points, he or she will be viewed as a super star of the team, but there is way more that is overlooked: there will be 6 to 8 points for other peopl...
I still consider myself as an apprentice programmer, so I'm always looking to learn a "better" way for typical programming. Today, my coworker has argued that my coding style does some unnecessary work, and I want to hear opinions from others. Typically, when I design a class in OOP language (Usually C++ or Python), I ...
We're about to embark on helping with a new-to-coding boot camp at my work, where people from other departments can come learn how to code from the IT folks. While this is great and all, I'm in a pickle. I've been requested to come up with a way to physically demonstrate the concepts of inheritence, polymorphism, has...
Following the recent incident on reddit (viz https://www.reddit.com/r/The_Donald/comments/5ekdy9/the_admins_are_suffering_from_low_energy_have/dad5sf1/) where the CEO of Reddit changed content of certain posts without any notification to anyone. Is there any way to secure a forum database so it's tamperproof even when ...
I'm writing a little GUI system for my game in Go. So far my structure is kind of like this: type Component interface { Update() Render(ctx) Translate() GetComponent() []Component AddComponent(c Component) AddInput() GetInput() } And then I would have say a Panel which implements these, ...
The following code is given: class Warren { private const int MaxRabbitsInWarren = 99; private Rabbit[] Rabbits; private int RabbitCount = 0; private int PeriodsRun = 0; private bool AlreadySpread = false; private int Variability; private static Random Rnd = new Random(); public Warren(int Variability)...
Background: I am developing a messaging framework. This framework will allow: sending of messages over a service bus subscribing to queues on the message bus subscribing to topics on a message bus We are currently using RabbitMQ, but I know we will be moving to Microsoft Service Bus (on Premise) in the very near f...
I am stuck at how to classify Dropbox and other cloud storage services within the ISP (IaaS,PaaS,SaaS) model. At their core, such services provide a cloud-backed file system which can be read and written to from any location as long as there's a connection. A file system is sort of Infrastructure in that it's an esse...
Good morning. I'm developing a media player software with MVC pattern. My question is about the reproduction of media elements. I think we need 3 software classes in order to do the design. These classes are: PlayerRegister: A class in Model package that for each user we have a unique instance of it saves media element...
I'm working on a project where I got an architecture with multiple "Microservices" communicating with each other by using an event bus (RabbitMQ). I got an Web API-project set up for each service so the outside world can send commands using REST-calls. When my Web-API receives a call, it sends the command down to my do...
These days a question popped out in my mind: Does the way we Javascript go against almost everything that is considered a good practice in traditional Software Development? I have a series of question/observations related to this statement, but in order to respect StackExchange's format, it will be better if I split ...
In our company several teams will work on different components of several projects at the same time. For example, one team might make make specific kinds of software (or hardware) for some project(s), another team another specific kind of software. We use Jira projects to host issues for specific projects and Jira boar...
I have the following setup: An object A running as a separate service with its own address (implemented via Pyro package in Python). An object B running as a separate service with its own address. Object C used as a vehicle to transport data between A and C. Use case: A creates C and sends it to B for processing. W...
I am using GitFlow for my development conventions. Generally speaking, I create a user story and an matching feature branch off my develop branch and work on that. Once the story is complete, the feature is complete and merged (rebased) back into develop. However, I am now running into the issue where my feature is r...
I have one design issue and can't seem to find a good answer by my own. I am required to build application with some specific features which doesn't really matter because I implemented most of its business logic and behaviour. My problem is that at some point, this applications needs to read some data from the database...
I'm working on a JavaScript utility where I'm trying mix two colors in different ways. I basically want to cover the blend modes provided by Photoshop / the W3C spec on compositing and blending (which are essentially the same). The algorithms provided in that document aren't too useful for me tough. First, I want to us...
This might have been covered in another thread. I didn't find it though.. Today, with Sass I have 2 options of styling my website. Lets see examples Example 1 <button class="button main center">Submit</button> I have 3 classes, each is quite abstract.. collisions may occur. For example - bootstrap has a selector .clo...
At my workplace, we use an SVN repository for the source code, which holds the main application and some other projects, and for the main application it is structured like this: - trunk - app - tags - app - 16.2.0 - 16.3.0 - ... - branches - app - 17.1.0 - 00_master - 01_feature ...
There's this application whose official website requires that people provide their email and agree to a EULA before they send you a download link. The EULA forbids redistribution and publication of derivative work. Still, you find many derivative versions of that application in GitHub projects, some of which have made ...
Enterprises are increasingly adopting DevOps methodologies for development of software. A couple of common outcomes of this are that: Application teams are more cross functional in nature, with operations and support staff working in self-contained teams alongside developers. Developers have an increasing support role...
Before release a new version of the software, which is a web application, my company creates a release branch. The QA team tests that branch and reports some issues. Should developers commit the fixing code to that release branch or a new bugfix branch that is merged to the release branch later? For more details, my co...
I'm working on web app that communicates with a locally installed desktop application to get certificate information from the user machine and perform digital signatures. Currently it's possible to auto generate keys and perform digital signatures with these auto generated keys in javascript using window.crypto. Howev...
I was checking out the App Service on Azure and in one of the tutorials two API apps are created, one for data and one to be accessed by external apps. It's not clear to me from the tutorial what the real benefit is to having this separation. Since I'm assuming all the Data API is intended to do is talk to a database,...
I have a problem with the handling of an order once it has been confirmed and has already been shipped to customers. Suppose our initial order is as follows, and we don't know which customers will shipping products Once the order is confirmed the order is sent to different customers: Now Suppose that once the product...
I'm working on the creation of a software and product documentation in a wiki format. It will include the documentation for all the company products. After some research, we decided to use the MediaWiki platform and create a private wiki accessible from our internal network. This documentation will include mainly softw...
Following the article Programmers Are People Too by Ken Arnold, I have been trying to implement the progressive disclosure pattern for an API. Basically, the idea mentioned in the text is to break the API into categories and only present the user with what he or she needs. The rest is hidden, reducing complexity for so...
What is the best approach to testing a service when you add a new configuration? For example my service offers a service to a customer and based on the customer configuration, it will offer a different type of service. E.g. if the customer selects a particular currency they are offered a 20% discount compared to anothe...
When I first saw this meme: I thought to myself, yeah right, but now I am not sure any more. So was template meta programming in C++ discovered by accident as the meme claims or was it intentional? Did Bjarne & co actually make it without realizing the potential?
As far as I understand, the big idea behind CQRS is having 2 different data models for handling commands and queries. These are called "write model" and "read model". Let's consider an example of Twitter application clone. Here are the commands: Users can register themselves. CreateUserCommand(string username) emits U...
Basically, I was debating in my head how an API and a protocol are different. After thinking about it, I come my newbie conclusions that I believe they are pretty much the same, except that protocols are more like an API that is widely accepted and used. For example, both API's and protocols define criteria and specifi...
I'm currently toying around with a very large project. A interpreter for a simple scripting language. After weeks of planning, I decided that the best course of action would be to prototype part of the interpreter in Python, and then port that code into C. I started off by writing a simple lexer based upon some EBNF I ...
I'm a beginner in programming and I don't have a good grasp on terminology. I'd like to know if source code written in a compiled language like C or C++ is considered a program? If not, can anyone explain why?
I'm dealing with a lot of functions like the one below and I'm unsure of what kind of unit tests should be written for them. public void UpdateEmployeeClockIn(int employeeId) { var sql = string.format("Update Employee set ClockIn = GETUTCDATE() where employeeId={0}", employeeId); db.ExecuteNonQuery(sql); } I'm thinki...
I want to just say that it's time O(n) and space complexity is O(n!), but I am not certain. Can anyone confirm this or tell me what it is? https://docs.python.org/2/library/itertools.html#itertools.permutations
In this scenario. I have an application targeting two countries, however same language. The code is the same, at least, in this stage, can't predict the future. Each country has an isolated database. The distinction is made through the subdomain (e.g. pt.mywebsite.com) Currently I am thinking about using the same cod...
I have been developing software for the past three years, but I just recently awoke to how ignorant I am of good practices. This has led me to begin reading the book Clean Code, which is turning my life upside for the better, but I am struggling to get insight into some of the best approaches for writing my programs. I...
I'm on a software development programme in financial services - with 100 developers, plus testers, BAs, PMs and other support staff. We've read through Implementing Lean Software Development, and The Phoenix project, which both talk about identifying the bottleneck in your flow, and optimising it away. (Some similarit...
I have been wondering what it is that makes the Iterator special when compared to other similar constructs, and that made the Gang of Four list it as a design pattern. The Iterator is based on polymorphism (a hierarchy of collections with a common interface) and separation of concerns (iterating over the collections sh...
I am currently working a REST API design and I am looking for a way to add an advanced ACL management, beyond what Let's consider for instance that I have a route which is the following : /profile/{user} Let's say this route might be call with GET or PUT methods. The GET method have to a controller to display the us...
If there for example is an object "SoccerTeam" with a TeamView and a TeamController, and that team has a list of "Players". So there exists also an object "Player". Does this object also need a "playerView" and a "PlayerController" ? If yes, should "TeamController" use "PlayerController" ? And should "PlayerView" upda...
I currently work on a hobby project which I use to learn more about Android/Java programming and programming in general. Recently, I decided to integrate jUnit into the project. Just getting it in there wasn't much of a problem, but actually using it was. I've read that a unit test should be the definition of what a me...
I'm building a Web API. To give meaning to my controller methods I want classes that specify what properties are used for each particular operation. This would make the code easier to understand, and auto generated api docs would also be more meaningful. Is there an existing pattern or at least semi standard that can g...
These articles explains how to give credit for CC-licensed work, but I can't information on where to give credit. Suppose I want to use an icon on my commercial website -- I can't exactly credit the author next to every 16x16 icon I use throughout the site. Is it fair/legal to have a sort of licenses/credit page linked...
There is a lot of optimism around Blue-Green deployments, particularly from luminaries like Martin Fowler. The challenge with a financial services application, is that to make a blue-green deployment work, you have to guarantee that the old app will still be able to transact whilst the new app is being deployed - whic...
I have a class like this: class X { X (databaseconn, httpclient) { this.httpclient = httpclient this.databaseconn = databaseconn } public func1(a, b) { // ... } public func2(x, y, z) { // ... } // ... public funcN(p, q, r) { // ... } } There are very few methods in the class t...
In use case modelling, if I have functions that have to be done by the system itself (without actors), how can I represent them? For example, sending SMS message, compute bus route, or notify someone when a change occur.
I have read this in many project description - like here or here. Looking for an explanation of what this means, I simply get more pages that discuss a project's "Y-O-Y commits". What does thie metric mean? What is the use in reporting this metric?
I was reading Why are websites (even this one) sometimes "Down for Maintenance"? , and it dawned on me that my industry accepts planned downtime asa given despite the disruption to staff and the (mostly hidden) cost to the business. What strategies can I use to achieve zero (planned) downtime in a database-backed web a...
Due to these answers, I've decided to implement MVC (or a variation of it) into my application. But the more I read the more confused about this topic I get. Some people say the business logic belongs to the model, some say the model should only holds data/a state, some say the logic should be entirely in the controlle...
What is the difference between Bridge and Factory Pattern? both the pattern seems to instanitae the class depending upon the logic from the client side. Factory Pattern interface IFactory { void GetProduct(); } class Germany : IFactory { public void GetProduct() { Console.WriteLine("germany"); } } ...
So I've been learning DDD and am attempting to refactor an old project using this approach. It is a fairly small app to register employees for events. These employees are initially populated from the DB, registered, and saved. One business rule says that if an employee is marked as CannotAttend = true and they show up,...
How can I disclose the source of a software with Mozilla Public License? Do I have to give a link to the source code from the software? Is there any problem to give the source of original repository (my software is copied) instead of modified version (changes made by me)?
I would like to store history of changes in table and also remember author of change. I created temporal table. This table contains ChangeAuthorId column which value I update every time when table is updated. I would like to display every changed value separately in one log row with date, old value, new value, author o...
What data structures and algorithms are suitable for event stream correlation? Specifically, I am looking at these two use cases: X occurrences within t seconds grouped by some variables (v1,v2). For example, 5 failed login attempts within a minute grouped by service such as SSH or FTP and IP address. Event A is follo...
I have a project in Angular1.x using a lot of SVG files. I have no idea what to do to SVG files to prepare them for production. I don't want my page to invoke 50 calls to different SVG files. So what are my options and which tools do I have to accomplish them? I use npm scripts to build my project.
The question seems to be quite vague, so let me give some background: I have given the concept of design patterns some thought and stumbled upon the classification used by the Gang of Four: Creational Patterns Structural Patterns Behavioural Patterns Since design patterns are intended to be solutions for common desig...
I am about to release an Android app into the PlayStore. Currently my about dialog says: Application Name Copyright © 2016 All rights reserved Owned by My Name myEmail@address Used LGPL3 Library: MapsForge Version 0.6.0 Used Icons from: https://icons8.com Is that sufficient or are there more things I have to put in ...
I just wondered why most people use the .h extension in their C++ Projects, even though the standard is actually .hpp? Isn't this a little stupid? I always thought precision in differencing between those is important?