instruction
stringlengths
34
36.1k
This is a design question. I am building a mathematically oriented blog, where I can discuss various areas of statistics. Now with math comes the importance of visualization--in particular interactive visualization. I like the convenience of a static blog generator like nikola or others, but I also want to be able to i...
So I'm confused on how exactly we as the programmers talk to devices on the computer. Now I'm not talking the big ideas. I know that there are device drivers that sit atop the hardware so that different programs can use there features. But in general who exactly talks to the drivers? Is the programmer writing the appli...
I have N buckets. I have M users. Each user can buy anywhere between 1 and N tickets to an upcoming lottery. I would like to distribute the tickets more or less evenly between the buckets, with the additional constraint that a user can't have more than one ticket go into the same bucket. It would also be nice if when I...
I'm building a wpf application which interacts with a sql database. I'm confused about adding children of children in my window. For example.. I just created a fishing trip so my fishing trip doesnt have a primary key yet. I add fishes in the window which when saved will get assigned the primary key of the fishing trip...
Let's say I am to design a JIT interpreter that translates IL or bytecode to executable instructions at runtime. Every time a variable name is encountered in the code, the JIT interpreter has to translate that into the respective memory address, right? What technique do JIT interpreters use in order to resolve variable...
https://en.wikipedia.org/wiki/Rule_of_least_power Does it mean that if you can do an animation with css you should do it with css instead of using javascript. Or if you can do an application in javascript you should do it with javascript instead of other languages like php or java?
I have a wall mesh that is divided into destructible pieces. As it gets destroyed, the wall can collapse into separate objects with physics that can be destroyed as well. (Cut the wall in half horizontally and the top wall becomes a separate object with its own physics). I already have the adjacency info to know neighb...
I recently set up my staging and production server environments on Heroku and everything is working great. Through Heroku, you can deploy from a Git branch - e.g. master or my-feature. This got me thinking - should I have a dev branch? The dev branch would essentially function as the current stage in development; branc...
I'm designing and application that spawns another processes to handle some specialized work. The application and the process it spawns will communicate through standard input and standard output (and standard error too). I've been given this same task again and again and I never know how to handle it. The question is s...
I've been hearing lately more and more about serverless architectures which are based on products such as AWS Lambdas, Azure Functions, Google Cloud Functions, etc. I understand the advantages of using such architectures, but what eludes me is how small business logic components can be efficiently shared between those ...
In a library project, I see numerous warnings suggesting that I reduce the visibility of public classes and methods. (Or in the case of methods I haven't written tests for, warnings about them being unused.) I'm using IntelliJ IDEA, but I assume that similar warnings would be seen if my project were imported into ano...
From: https://en.wikipedia.org/wiki/Event-driven_architecture Considering: Events do not travel, they just occur. Are the following statements valid? Event channels are conduits in which events are transmitted from event emitters to event consumers. ... An event can be made of two parts, the event header and the even...
Does anyone know that Facebook mobile application is using their Graph API directly? or they create another layer specifically for handle their mobile application? Thanks.
I have got a responsibility of designing an app which allocates time slots for doctors booking. The scenario is like, there'll be entry for doctors and their time slot for each days. For E.g. Doctor1 | Mon - Fri | 10:00 - 20:00 Doctor2 | Wed - Sun | 18:00 - 20:00 Now, when people will search for doctors, I need to sho...
I'm an intermediate C++ programmer. Do I need any math knowledge in order to build computer applications using openCV?
I am looking for a concise way to refer to the phenomenon of a unit test failing to clean up one or more artifacts, which affects the behavior/outcome of subsequent tests. Is there a standard term for this?
Consider a BDD scenario with some given steps that refer to existence of a set of data in database. For example consider the following scenario steps: Given there is an active customer When as and admin I change the email of the customer to 'xyz@gmail.com' Then an email verification message is sent to the customer My q...
I have a number of custom 'server' applications that run on Windows, and I want a way of improving their 'availability' without significantly recoding any client-side (or, ideally, server-side) code. My understanding is that Windows Failover Clustering allows a server IP address to 'float' between multiple systems, but...
This is in the continuation of Small classes and methods, but code still difficult to maintain and follow as I have matured the problem and will rebound on people's answers. Here are all the elements that should be modeled: 1.Model (in this case a link directory) 2.Validations (of the model fields from user submitted f...
I have a type Bound as a sort of "alias" for an array of three numbers (working in TypeScript with: type Bound = [number, number, number]). I did this basically to help readability by specifying in the name what the array is used for. However, sometimes in my app I need to convert a number to a Bound and vice versa (f...
I am currently looking into developing a new system utilizing hexagonal architecture and the commandpattern facilitated by a commandbus like tactician (it's a PHP system). Now I really like the idea of the commandpattern but what I don't get yet is how to get back the actual result of what the command has done. Lets sa...
Strategy to display value for a html select I have a spring boot, application. On the client side, I use JQuery I would like to know the strategy to display "static value" for a html select. Example In the table communicationType I have: 1 - mobile 2 - fix 3 - email Actually, I put directly the data in the html select...
According to GNOME guidelines, how sentences should be written in Git messages? Should sentence in git commit message start with upper-case letter and end with a full stop, or lower-case without a full stop? What is the recommendation? Btw. I'm asking about English, not Chinese.
Im new to RESTful API's and would like to find some info out. Currently we run a daily digest of eHealth material for the public to read and get up to date content regarding that topic. Which is powered by Laravel 5.2 and a MySQL Database. We have a linux based server which is hosted with an ISP currently runs 8GB Ra...
I am having some issues trying to incorporate jQuery UI into my project. I cannot use Nuget or anything else that goes to the internet, so I have downloaded the development package from the jQuery UI website, and have been trying to include the files from the download into the MVC 5 project in visual studio 2015 as fol...
As a freelancer say for example you developed a web or mobile application for a client as a one time fixed price paid project. You send them the code, install it on their server, and they begin using it for themselves. Now, normally I'd give my clients 30 days of free bug fixing, before I start charging them for my dev...
I am trying to improve my programming skills and knowledge and I have been doing some reading about various design patterns and youtubing videos etc. One subject I thought was interesting was about Singletons being an Anti-pattern which has lead me on to a problem that I am not quite sure how to solve. Allow me to exp...
As Docker became a very popular tool I read a lot of information about it but I can't get - do I need it as single full-stack developer? I develop web application that has 2 backend services written in ASP.NET Core and C++ talking to PostgreSQL database and Angular 2 frontend part. All webapp is routed using nginx. To...
I work often with data-bound applications with WinForms; records are pulled from a database and updated in a client application that I write. Stored procedures are used for all database transactions in the client. I need to programmatically refer to columns from the database - for example, to format a dollar value. res...
I'm working on a series of small projects (~1000 LoC each) on my own in C++. My background is in Python, where I'm used to being able to test out small changes in my code in by loading it into a jupyter notebook. In C++, every time I change something, I have to rebuild the appropriate files and re-link, which can take ...
I have looked into several message queues as referenced in this link. Several of the larger and more popular ones are in memory only. I can understand the need for this in some situations however in a large architecture this makes little sense to me. For instance if I have a series of work that needs to be performed su...
I'm writing a simple console app to rename a bunch of files/folders, and I want to design this console app to be as modular as possible. The console app is as simple as it gets: Ask the user what the source folder path is, what they want to rename the folder to, and the user presses enter. The app then finds the folde...
I've been working on a project for a couple years now, and I'm starting to gather a decent user base. I've created a project page with some basic documentation, but it's really not much more than a FAQ at this point. I know that I need to improve it so that it's more informative for both new and power users, and that's...
I have an XML document like this: <?xml version="1.0" encoding="utf-8"?><root><a>1</a></root> I sign this document using a DLL-library, provided by crypto provider, and get a document like this: <?xml version="1.0" encoding="utf-8"?><root><a>1</a> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:Signed...
I am very new to workflows, and trying to understand why workflows are used. While surfing internet, I haven't found any strong point for using workflows. Please explain me the scenarios where workflow based development has advantage in comparison to usual programming based development. my project is using BPMN 2.0 di...
I always try to adhere the semver spec when I commit changes. This time though I was wondering what to do when I update my tests: I'm working on an API client that includes a simplified API server running locally for testing the client (since many API methods are irreversibly changing data). Now, what to do when I add ...
We have a problem at our org where we have the need to know "with very high certainty" what specific versions of each app/web service/etc. is deployed to a given node and/or environment at any given point in time. Some ideas have been kicked around, such as: A custom deploy tool that is backed by a DB, and on each dep...
My current scrum master is a true believer who is not willing to budge on the official forms of scrum. I don't want this to sound ranty, I am really asking about the orthodox solution to this issue because I have been successful resolving issues with him in the past by recasting things in official terms. The current e...
A recently-published article demonstrates a way to make "typo-squatting" attacks on popular programming package managers. It singles out Python's pip, Ruby's gem and Node's npm systems, and shows that they have two things in common: Packages can be submitted and accepted automatically, with no manual review or human ...
I am wondering if there is anything wrong with creating generic actions in redux which dynamically change different properties in the store , so that i can reduce boilerplate code. For example: //GenericActions.js function replace(data, property) { return { actionType: GenericConstants.ADD data, ...
Given the problem... Given a String comprising of non-alhpabetical symbols, and a Lookup Table where a subset of those symbols may equate to a single alphabetical character, output all possible Strings. ...is it possible to compute in polynomial time? I can only think of exponential solutions similar to... getSt...
When coding software, should the architecture always be best practices or practical practices in regards to the application being built? If I am building a two page web application that might live 5 years and have 2 enhancements over that 5 years, should I code in dependency injection, design patterns, model-view-contr...
I've written in PHP before and when a user connected they get an individual instance of the code which is then closed when the code has finished executing. In node, I set up my first server to console.log("hi") on every request. When I refreshed I didn't expect the "hi" to be logged again, but it was - I get its being ...
When I design the architecture of an application, I usually think about the nature of the objects and the interactions between them. The way I currently think about mutability is to ask myself if changing a member changes the object altogether. A car can be repainted, but if you change the manufacturer it's another car...
Correct me if I'm wrong, but if I have an operating system that makes a context switch, then that context switch is in practice a switch from one thread to another, where one thread was running one task and then switches to another task and the reason the threads needs a stack is to save the variables of the task to be...
I've been thinking about practicing with a simple Microservice (oxymoron I guess) application and I found an issue I was not able to resolve. I'll go with a concrete example since the definition of cross-cutting concerns is kinda vague. Let's assume I use some of the cloud MQ providers to set up a communication for at...
I'm a solo developer with a pretty time-constrained work environment where development time ranges usually from 1-4 weeks per project, depending on either requirements, urgency, or both. At any given time I handle around 3-4 projects, some having timelines that overlap with each other. Expectedly, code quality suffers....
Our system has users but we want to perhaps allow some users to be able to use our API service. I'm looking at using OAuth2 for authorization. As it's going to be (trusted) machine-to-machine access I also thought to use client credentials. So, for example, when we create an article through our API we want it to have a...
I'm working on a project that requires assigning ID numbers to records about people in a database. Each person may have many records associated with their ID number. There was a discussion about whether it was desirable to have information about each person encoded in their ID number. For instance, the ID number could...
When I want to call a constructor on aggregate root class Task, I am interested how can I check if a passed taskType exists in TaskType repository (enforced later in DB on ORM level). I want to enforce this relation so only predefined task types can be actually used to create a Task. Is that something that is done in c...
<?php error_reporting(E_ALL); //ini_set('display_errors', 1); $db_server = "localhost"; $db_name = "2"; $db_user = "root"; $db_passwd = ""; $connection = mysql_connect($db_server,$db_user,$db_passwd); $db = mysql_select_db($db_name,$connection) or die("Couldn't Select Database"); if($_POST['text']){ $result=mysq...
Not so long ago I talked to my colleague and he was definitely against using bit masks because it is hard to understand all the values that are stored in the database. In my opinion it is not always a bad idea to use them, for example to determine the roles of the current user. Otherwise you need to store it in a separ...
I have posted a question regarding Ubiquitous language and maturity level in REST API. Ubiquitous language and maturity level in REST API? After some extensive coding I realized that further questions can be derived from this post. For example, if I am using resource based API, so the API endpoint looks like http://dom...
I'm practicing with dynamic programming and I'm trying to solve this exercise http://www.geeksforgeeks.org/collect-maximum-points-in-a-grid-using-two-traversals/ But I can't understand how to use dynamic programming. My reasoning is to use a table T[n][m] to store the results and in every cells to find the max value to...
We've recently started to use the Scrum framework and we gradually went from 1 team to 5. I am doing the Scrum Master role. In the last months, each Development Teams worked on their Definition of Done (DoD) with the Product Owner. Each Teams have negociated their own DoD. There are some differences between each Do...
Recently I signed up for new account for a service provider's web site. I entered the usual the name, email , password (strong) , repeat password and I was signed up. Great everything works well. A few days later I had some trouble logging in, I did the 'forgot password' process and yet my new password (strong) did no...
While researching the subject matter - lock-free and wait-free data structures - I'm seeing a worrying amount of mention of patents with this area. I've hobby-researched compression algorithms years ago and by comparison the situation seems worse as hard as that is to imagine. Background I have a project in progress th...
here my Question it is said that "Java is not actually a pure object oriented programming language since it needs primitives" I want to know that how data types can affect to java be an pure object oriented Langugae ?
I have no prior USB integration and about 8 months of learning embedded systems on Atmel devices. I am trying to use an Atmel SAM L series to connect over USB to a computer. The use case is for data transfer. Specifically, the MCU will be gathering data from it's sensors and packaging it for USB transfer. I have search...
I have a basic unit test (for the sample) that involves this code: void testShouldCreateACar() { Car car = someone.createFerrari(); assertTrue(car.name == "Ferrari"); // can't access name since name is private } I can't access name since there's not a getter in Car (or Ferrari) class for it. I don't want to creat...
i've been wrapping my head around this and I want some ideas. How would I go about making a remote shutdown program for one computer to shutdown another? Would I use http or another protocol? I was thinking like a direct message from a computer to another and a listener program on the computer to get shutdown that woul...
I have some enums in a concrete API/library that will be publicly used by application projects. My problem here, is that I cannot write an interface to these enums (that I know of). I should have thought of this before starting the project, but I did not. What really complicates this is that some of the methods accept/...
Is Super.someMethod() a good practice to add clarity to the code by explicitly stating that someMethod is not a method included in the current class but in the parent class? For instance, would this make sense... private void someMethod() { super.someOtherMethod(); // this is in the parent class otherMethod();...
Does anyone know if there is such a thing as a run-configuration launcher for the JVM for "production"? Where you can set environment variables and arguments, just like in an IDE ?
Currently I have a model class that represents a user. This class has a constructor that takes an object with all user properties, used for example, when creating the user. In this case I instantiate the model passing it the necessary information so it's constructor can do the job, then it will use its own "createUser"...
Can some let me know how does maven internally manages package dependency? Is there any architecture diagram available on the net for the same? I also asked this in Quora and maven user mailing list but did not get any response their nor I am able to find any suitable resources in the web that explains the working of m...
I'm working with a small team that creates a proprietary web application and UX isn't much of a priority since our own people will be the ones operating it, but we do try to make their jobs easier. Should I, as a developer, create a UI mockup before I start creating a new screen? Nothing too fancy, mostly the general ...
My company is planning to integrate 3 in-house libraries into all of our applications (with possibly more on the way), and I'm wondering what the best way to go about this would be. My initial reaction is to put the code of all 3 into a single library and use that in all of our applications, but it seems like that woul...
Are there any real alternatives (i.e. non-customized software license agreement) to the AGPL license if you want to share your source code and make money selling software licenses?
Why doesn't Object.prototype.toString return a string representation of an object? I don't see any use for the current output and it seems that it would be more useful for the toString function to be the equivalent of JSON.stringify. Is there a particular motivation or reason as to why ({ val : 1 }).toString() produce...
I made a program that connected to the microphone and captured wave_format_ieee_float data from it. I noticed that if I made a really loud noise the data seems to fluctuate between -1 and 1 (when I cast the buffer pointer into float*). What is the significance of this? How do I connect this to deciBel Sound Pressure Le...
I wouldn't call myself a superstar dev, but a relatively experienced one. I try to keep code quality to a high level, and am always looking to make improvements to my coding style, try to make code efficient, readable and consistent as well as encouraging the team to follow a patterns & methodologies to ensure consiste...
I am creating a simple MiniMax implementation in the functional programming language Elixir. Because there are many perfect-knowledge games (tic tac toe, connect-four, checkers, chess, etc), this implementation could be a framework for creating game AIs for any of these games. One problem I am facing, however, is how t...
I have built a small Windows desktop application that I intend to sell and distribute copies over the internet (not as SaaS). The application in question uses ImageMagick library, which has a free licence (see here), if I understood it well. The problem is that my application uses ImageMagick components who depends of ...
I have an application that reads a large binary file (1GB on average) and compresses into a bzip2 archive. I started out at first compressing these files synchronously, as I didn't want to impede performance on a client machine. Sometimes however, these files come in bursts and I'd like to handle these files as quickly...
How does slow internet access affects the response time of a web based system hosted on local server that is being access by other clients from the local server? I'm accessing the web based system on a local server through the ip-address of local server. ex: 190.168.1.110/local_system/login
So for the past year or so, I've been trying to self-teach myself programming. The problem is, every time I start to try and teach myself (like on Codecademy and such) I start off great and then proceed to get lost. I've tried a few different langs (Python, Java, C) and all end with the same result of me struggling to ...
For example, I have a clan and a character. There's a character that is the leader. To give the clan a specific feature, some money from the character is required. I don't want to have too much tight coupling. Right now I have a member in the clan class like this: bool clan::give_rank(character* chr, int rank) { i...
I am having trouble thinking through what best-practice dictate I do in this situation. Say I have the following class structure Class A { public: bool isCompressed() { return compressed_; } private: bool compressed_; } Class B { private: ClassA *a_ptr_; public: /* Accessor here */ } If I needed to ge...
I've been asked to write a mobile app for a business I have connections with, and I've been trying to decide what I should charge. One thing I came up with was to research what other companies would charge for such a service, but all the ones that have the 'online estimators' are really over-the-top expensive and the c...
Have been hired to modernize an old binary compiler that has been forgotten since a few years by people who have died already. The compiler has a parser, an objectmodel and a generator of bytecode. The main problem is now that the generation-part built the binary from top to bottom in one step. while linkage w...
This side question bothers me: Has_This_Case_A_Name? Here is what I could find, but This_Case_Is_Missing: +---------------------------------------+---------------+ | Names | Example | +---------------------------------------+---------------+ | camelCase, lowerCamelCase ...
I'm writing a social app in Django where all users sign up through Facebook using Python Social Auth. All content that a user sees will be content created by her Facebook friends. Initially, I planned on creating individual users with no database relationship to each other, and relying on requests to Facebook to determ...
We have a requirement for a new feature which requires some seed data to be present in the database (basically some default values) for the feature to function correctly. We have this in 2 different scenarios at the moment, and the best method of generation / insertion of the seed data seems to vary depending on the da...
I am promoted to team lead position in my organization. Previously I was working as senior software developer or senior software engineer. Now company want to build their own product which is a website. Requirements and technologies selection are established as well. They want to hire team for this project. Senior so...
Recently I've been dusting off my knowledge on how Monads work. I've also been introduced to the concept of a 'Comonad', which is described as the inverse dual of a monad. However, I am impossible to wrap my head around it. To understand Monads, I made the own analogy for myself: Monads can be seen as 'a blueprint to ...
Java has an automatic GC that once in a while Stops The World, but takes care of garbage on a heap. Now C/C++ applications don't have these STW freezes, their memory usage doesn't grow infinitely either. How is this behavior achieved? How are the dead objects taken care of?
I have the following structure in my Outlook Public Folders. -Public Folders --1001_RandomProject --1002_AnotherProject --1003_Yetanotherproject ... and so on, basically there's a couple of thousand(!) subfolders each corresponding to a project and prefixed with the project number. Now I'm trying to create a Macro whi...
The AngularJS documentation mentions that it considers one-way data binding to be 'bad' and two-way data bind to be 'good*'. However, on looking over the definitions of two-way data binding used, all it seems to be is an auto-sync put in place between the view and the model. Diagram Surely this has a performance hit ...
I was working on a C program and i just noted that i can execute my program even if i didn't declared the required libraries, this is the code: #include <stdio.h> #include <string.h> int main(){ char x[999],y[999]="copyme"; strcpy(x,y); printf("Output: %s",x); return 0; } After i undeclared the string.h li...
I am looking for solutions for a field where I think I don't know the adequate terminology. The problem is that I have a central SQL database in the cloud. Then I have child databases only containing a defined part of the central database. The child database will not always have connection to the main database but as s...
I have heard this term many times, and it makes sense in theory. That app is doing many things and it'd be easier to manage, scale, test and improve them if they are not completely connected to each other and work like functions instead. This way you could have option to even easily replace components of app with diffe...
I process a lot of tweets in real time using python and for each tweet I need to assign it in to a specific bucket. I have about 50 buckets, each with their own rules. The majority of them are simple like so bucket_one = ['test', 'foo'] if any(x in tweet['text'] for x in bucket_one): tweet['bucket_one'] = 1 So the ...
Is there some historical or practical reason why SQL (or more specifically T-SQL in my case) does not support the closure property in many areas where many other language families like C do? (That is, the closure property as seen in math, where a real number time a real number is always a real number; nothing to do wit...
Which construction is more readable: someVariable == null ? SOME_VALUE : someVariable; // avoids negation someVariable != null ? someVariable : SOME_VALUE; // normal situation first I have to use such expressions very often, but I was never really sure which one is better.
I see all websites (THE big ones) make both PHP and HTML in same page .. Do I need to make all my website pages as PHP and embedded HTML inside it ? Can't I make the website all as HTML Pages and PHP pages separate and the required output of PHP page I make a separate HTML for it ? i need an explanation or advice for ...
Java garbage collection takes care of dead objects on the heap, but freezes the world sometimes. In C++ I have to call delete to dispose a created object at the end of it's life cycle. This delete seems like a very low price to pay for non-freezing environment. Placing all relevant delete keywords is a mechanical task....
I program as a hobbyist. I mainly code using an online tool (a website) that allows me to write, run, share, and debug code online. The website I use does have version control built in. Quite frequently, I forget to save my code. I close the tab accidentally, and lo and behold, hours of code are gone. This is really...
On page 45 of Robert C. Martin's Clean Code: A Handbook of Agile Software Craftsmanship, Martin writes that output arguments should be avoided. I'm having trouble understanding the meaning of "output argument" and why they should be avoided. Martin's example for an output argument appendFooter(s); calls the function p...
If I remember my compilers course correctly, the typical compiler has the following simplified outline: A lexical analyzer scans (or calls some scanning function on) the source code character-by-character The string of input characters is checked against the dictionary of lexemes for validity If the lexeme is valid, ...