instruction stringlengths 34 36.1k |
|---|
I have been asked the following question in an interview: "What is the need of an interface when you can have an abstract method within an abstract class?"
Which I did not know the answer to.
Could you provide an example why and when it may be useful?
|
I have a class that I use to render GUI elements on the screen, this class has a tree structure (with children, parent, and siblings). I created an additional class which allows me to interpolate some values of a GUI element (alpha, and rotation for now), each instance of the class is linked to one GUI element (which i... |
From my understanding, ARP translates an IP address into a MAC address, and then the computer uses the MAC address to establish a direct connection.
If I already know the MAC address of the computer I want to connect to, is it possible to directly connect to it (without a router)? Is there an example of this?
|
I have a bunch of plain-text like this:
1 MILE, PACE, PURSE $1,100.
FILLIES & MARES N/W $541 L5 STARTS AE N/A $301 L5 & N/A $60 PS
IN 2015-16 DRAW INSIDE
Last
Horse HV PP 1/4 1/2 3/4 Stretch Fi... |
By consulting various scattered tutorials and books, I've been able to learn that the 64-bit Linux "exit" system call is 60, and the status value is moved to edi. Similarly, "write" has call number 1, and the file descriptor must be passed to edi, etc.
However, it seems very hard to find information about the other sys... |
I'm more or less teaching myself big O notation, so please forgive me if this is a duplicate of a question which applied to my question without me having the wisdom to realise it. For my own amusement/personal development, I'm trying to express the complexity of a function which works on 2 different datasets which rela... |
I am trying to create a simple sentence generator that uses templates and a database of words. It will be a website where essentially a user could click a button to generate a sentence.
For example: The {animal} is on top of the {large_obj}.
would choose a item from animals and then choose another item from the list th... |
I'm searching for strings matching the pattern [A-Z]\W*[0-9]+, so that in
V-2345
35A235
Q252
the V-2345 and Q252 would match. In another list, I want to find equivalent items that fit the same regex pattern, so that potential matches would include:
V ++ 2345
Q 252
but not
V-252
Q//2345
Basically, if an item matches... |
Background:
We are using agile project management and follow sprints to do development. We are using a single repository in bitbucket.org that uses mercurial. Repository is hosting 3-4 products. There are many projects with 4 solutions for each product. There are some product specific projects and there are some shared... |
I am working on a C# programming project in Visual Studio. I have created various VS library projects inside the VS solution containing the various components of the solution. Without giving it too much thought, I have put the factories for these components into their corresponding VS projects.
I have now needed to reu... |
I am looking to get some input from some more experienced testers than what I am. :)
I am trying to make my node modules testable, allowing for dependency spying/stubbing/mocking without the need to use a magic library such as rewire or mockery to intercept my module import/require statements.
I was thinking of using a... |
My current coding style is to use single-quoted strings as a default, and use backticked template literals whenever I need to concatenate a value into a string.
But I'm now wondering what's the point in having two kinds of string at all? Maybe it would be better to stick to template literals for everything, for simplic... |
Here's a silly psuedo-object to illustrate the point:
public class Testing
{
public object MyUnderlyingObject = new object { Property = 44 };
public MyPropertyWrapper
{
get
{
return MyUnderlyingObject.Property;
}
set
{
MyUnderyingObject.Proper... |
I like implementing service classes as stateless. However, I also like to decompose my logic into more, simple methods or functions. In some scenarios it seems like the two are somewhat against each other. Consider the following two examples.
I have an entity object called House, implemented something like this.
public... |
When working on a fix or a feature, I sometimes stumble over other tiny issues that can be improved on the fly in a matter of seconds. When I do them immediatly and then commit the finished feature/fix, the commit includes more than one thing. For example "add feature X and code clean up" or "fix bug X and improved log... |
I have these two questions:
Can deployment diagrams have components in UML?
Can component diagrams have nodes in UML?
I've seen many diagrams mixing diagrams elements and is making me confused.
|
I am about to submit my new app to the iOS App Store.
It's very simple. The app generates a random motivational quote and displays it onscreen. I have a database of 500 quotes now, stored in a plist file.
I will add more quotes bi-monthly, essentially just adding text to the existing plist file.
How should I approach t... |
I've been studying databases and rest APIs lately and I have a question about the relationship between the two.
Imagine I have a database with three tables, STUDENTS, ENROLLED, and CLASSES.
STUDENTS and CLASSES denote the entities students and classes, whereas the ENROLLED table denotes their relationship.
If I were to... |
Are there any programming languages that are available and extendable in more than one natural language?
For instance, an english version with a do..while loop, a Spanish version with a hacer..mientas loop, a French version with a faire..pendant and a Dutch version with a doe..terwijl.
The only 'programming language' ... |
I'm aware that linked lists, sets and arrays can be used to create stacks by themselves. The theory behind it is this
linked-list: In some languages, a linked-list is substitutable for an array. Stacks are First In First Out operations.
array: The push and pop methods invoke a stack like behavior.
set: A set is exactly... |
If an organization develops their own software internally (with no license agreement) but uses other software frameworks that are open source that we modified to those frameworks work for us internally, and then we decide to share this source code with other organizations, what does this organization need to do before ... |
I am working on a Spring Boot and Angular application which has a requirement to search based on any number of the available filters being applied to a list. For example, a user searches on 'Title' and 'Author,' but not 'Edition.'
I am comfortable with how I'll accomplish this at all layers except for the ORM. In m... |
We have a sprint planning every sprint which takes 2 hours. In this little time we discuss 10 user stories, write them down and estimate them.
Very often after the estimation (during sprint) I realize that the estimation was bad because the technical solution takes more time as we did not really and exaustively talk ab... |
Say I had a software algorithm (for example, an FFT), and I need it to process (n) amounts of data in (t) milliseconds. This is a real-time task written in C. There are a lot of CPUs out there, and you could just select the fastest one, but we also want something just right for the job while reducing cost.
FFTs are O(n... |
I dont know how to reduce the size of jar file.
When we normally code in Java Swing the jar file is created, is there any way to reduce the size of jar file? I can't remove the images and other stuff which I have included as it's necessary.
I tried to unzip the jar file and and tried to remove the stuff which is not ne... |
My team uses a Kanban style approach to development where feature and bug fix stories filter through to Production as and when they are ready. We currently are using SVN as our VCS and take a feature branching approach to developing each story. A very simplified version of our workflow would be this:
Branch, develop s... |
In many cases, there are different kind of forms in an application's user interface, and these forms are use to collect all the data - that is needed to update (or create of course) domain object (e.g. Person entity in Person Register application).
When the entire Person entity's data is transferred as DTO to backend ... |
I'm writing an application in javascript where given a word, I need to get all the possible versions of the word with the suffix being the difference between each form. For example:
"sponsor" should return "sponsorship", "sponsoring", "sponsors", etc
"spy" should return "spies", "spying", "spied", etc.
I thought of ha... |
I was reading the UML specification (http://www.omg.org/spec/UML/2.5/PDF) and I found here an there some "code" of this type:
body: if alias->notEmpty() then
alias
else
importedElement.name
endif
for example at page 87. Where I can find the specification for this language?
|
I have a web page with wizard format. The submission button to the API will be in the 4th step of wizard. However I want the data entered to be stored in database before moving to the next step in the wizard. I also want the REST API to be working for the pages having single tab.
So I designed the API to take a query ... |
I generally like to organize classes I make into modules by using namespaces, and I also don't go more than 2 namespaces deep but it's still painstakingly hard to fully qualify everything.
I've thought of using using directives but I don't want some headers polluting other headers. For example:
MyHeader1.hpp
namespac... |
I see ring buffers are very useful with their speed and if you have a known maximum buffer length they make a lot of sense. Let's say in the scenario where you have streaming data, but the playing stream is paused and caching continually in the background.
What do you do with a ring buffer when the data that needs to b... |
I'm trying to categorise products based on various fields of data. I've had some success just matching search terms in the product names, but this naive approach doesn't work when it comes to larger bodies of text such as descriptions since a description tends to contain a lot of additional info that isn't relevant to... |
I am planning an app which allows users to complete surveys/forms. I'm having trouble planning the data schema for the forms.
I really want to have a data structure which can be mostly automatically serialized and deserialized into classes.
I'm not sure where/how I should store answers either. I was thinking they could... |
Why is it more difficult to perform a heap based buffer overflow than a stack based? (regarding x86 architecture)
I thought it could be the fact that heaps are allocating memory dynamically. But is there more than this?
|
I have a couple of scripts (two in Python, one in Java) that use Selenium to drive a browser and download files from a website.
I need to do some major refactoring before I do a major expansion, so I want to start by writing tests, but I don't know how to go about doing it. All my search results lead to articles about ... |
I am attempting to determine the best way to handle actions that must occur in passes. Many of these actions use objects that were created in a previous pass. The solution I have come up with is to implement a computation builder.
let actions =
passHandler {
let myObject = pass1Action()
do! waitFor... |
I am working with a Laravel project and I am looking for a way to solve the issue of bloated models and cross referencing between them.
I had started extracting higher level methods to a repository but this doesn't solve the issue of one method needing to know about another method.
For example a task lookup method need... |
An app I am working on (iOS) is being distributed to different businesses and each business needs a few customizations to said app before it is distributed to users on the app store.
Most files will stay the same but quite a few will change based off the businesses needs. Should the app be built in a way that booleans... |
I am wanting to have/ or make a program that runs on a (raspberry pi)computer cluster with one pi executing only video content while the other only handles music, etc under a main program like an AI. Am I in the right direction? Isnt this parallel computing?
|
When it comes to OOP where an external database is being read from and written to, is it necessary to have attributes/properties within the objects to store the data? Or is it enough to simply read from the database, display it immediately, and later on directly insert any posted data back into it?
If it is necessary t... |
Earlier, when images were to be added to staging/production, they were committed to the git repository and our deploy script used to take care of uploading the images to CDN (S3 in our case).
But as we improved our design, the number and size of images began increasing. It was then decided that we will not be uploading... |
Often, to simplify testing, I add UI controls that are only visible and enabled in debug build only. Or prepopulate mandatory input fields in debug build. Is this a bad practice? Assuming the release is tested too.
Main reason is to simplify fixing bugs - when the problem is in depths of your program, it's quite a pain... |
In order to run complex simulations, I need to do preprocessing of data from various data sources. This is done by a bunch of Postgresql scripts. However, having only these is unsatisfactory, because they are not very intelligible, maintainable etc. I want to express the data preprocessing using BPMN/BPEL, which would ... |
I'm currently developping the website of my company, which is located in France.
I always pay attention to giving explicit generic english names to my variables. For obvious reasons, and of course, in order to be able to ship the same code over other countries one day.
For instance I called french "Régions" and "Départ... |
So I have a Signal class and a client class which manages a list of Signal objects.
The class provides a bunch of interfaces, one of them is an update()-function.
The update()-code is completely different for each signal. Thus, one would assume that's a job for derivation.
However, the client manages tens, maybe even a... |
A little background first. I have been tasked with rewriting our gun software into VB.Net (converting the code from BBJ). This software incorporates many different inventory management functions, such as performing stock moves, stock inquiries, changing stock statuses, picking goods to put into cartons, and a multitude... |
Why did old BASICs (and maybe other languages) use line numbers as part of the source code?
I mean, what problems did it (try to) solve?
|
I am using Swift and am wondering about the concepts of Extension and Delegation. Recently I found a case where either one of these two concepts could be applied. This reminded of the "composition over inheritance" principle, which teaches that a "has-a" relationship may be preferred to a "is-a" relationship.
I encount... |
I'm working on a product that requires a large amount of interactions with different external data providers. These data providers uses a number of standards (primarily xml-based) which are all governed and agreed upon. Some of these standards aren't that great and can be open for interpretation.
Now, once in a while, ... |
I just hit the very basic problem in OOP and I cannot see any working solution except postponing appropriate check until run time.
It is pretty clear notion of an action "do something with value of the same type" no matter what means given language provides. Consider Equals in C# which in simplest form is "is this obj... |
This is not about whether or not getters/setters are wrong. I understand its impact to encapsulation and that question has been raised here and SO several times already. I also do not want to just ask for an example of how to change object state as all the examples I've seen are so naive that they're only practical f... |
I am developing an application with Sprintboot + REST + Angular. While I am working on the REST API, I am trying to design as RESTful as possible. I'm encountering certain pages where the Angular UI must send multiple requests to the service to display the page like a User Approval page. I'm worried this would slow dow... |
We have a web application which currently operates like this on a typical view/page:
the front has to display 100+ "previews" (in the form of base64 images)
each of this preview is built on-demand by the backend when the front requests it
a pool of 8 standard ajax requests are running in queue until all previews are l... |
I have been thinking about this a few days already, doing diagrams, started programming, reverted, started again, still can't decide which is the best approach.
The problem is about sharing groups of items with other users, where they can get/add/edit/remove, in real time.
My items specifically are "list items" which ... |
I am new to NOSQL and Cassandra. I am not sure if I should store usernames and password in Cassandra. If I should, what is the best way to do that? I am getting lots of conflicting ideas from research. I want to set it up to accommodate a large number of users and be able to quickly access it. Think of it as for hostin... |
Static typing in a programming language can be helpful for enforcing certain guarantees at compile time- but are types the only tool for this job? Are there other ways of specifying invariants?
For example, a language or environment could help enforce a guarantee regarding array length, or regarding the relationships b... |
I'm making an activity diagram and I'm using activities instead of actions because I'm not going into much detail in the steps being described. I want to separate the activities in the partitions but all I've been reading about partitions says that in partitions I can place actions. But it doesn't say anything about pl... |
Most Github repositories I'm aware of use the following workflow for pull requests: one or several users with "contributor" privilege review the suggested changes and then one of them merges the pull request which most of the time requires just two clicks - "merge" and then "confirm merge". Here's an example in CoreFX ... |
This is the common sequence of two distributed components in our Java application:
1 A sends request to B
2 B starts some job J in parallel thread
3 B returns response to A
4 A accepts response
5 Job finishes after some time
6 Job sends information to A
7 A receives response from a Job and update... |
Rewrite of the Question: Is there a technical reason why we are not using static methods instead of instance methods.
Technical reasons are for example: Performance or added type-safety.
I reason that with static methods and only pure data classes you will get better type safety and more maintainable code.
Why do we... |
I read about JWT and how they can provide secure authentication for calling api routes over http. I naively implemented it and here is how it goes :
a client posts username and password to a login route
the server checks if the credentials are ok, creates the token and sends it back
the client keeps the token and adds... |
I have a very simple app that lets you log in and then displays a dashboard. The design process with React and Redux is very simple :
I have two React components : Login and Dashboard
I store a boolean isAuthenticated in my state tree
Now some remarks :
The Login component can only be seen if isAuthenticated is fals... |
I'm working on an application that's supposed to have a web based GUI where you can insert some data. That data will be saved in persistent storage and a hex number generated and stored alongside. This number also needs to be stored on a smart card accessed through a reader on the user's device, using user's credential... |
I have two classes (A and B) that are both complex to construct, with multiple properties that must be validated at construction time. I want to use the Builder pattern to construct these objects, but among the constraints on construction of these objects are:
An instance of A must contain multiple instances of B
Each... |
I'm writing some code that I've decoupled off into a module of its own, and even though I'm most likely the only person who will use it, I'm trying to think as if I might not be. The functions in this module perform operations on objects in an array that's passed in, and right now, I'm doing a bunch of safety checks to... |
I often see myself trying to follow my own code to find out where the exception came from.
The typical example is when some parsing fails, and I catch the execption. Then I spend a ridiculous amount of time using breakpoints and step-in / step-out / step-over to see the exact parsing that failed. Because many methods a... |
I have been developing a GPL GUI application for many years by myself in my free time. I have been approached by a company who want to use my code as part of a propitiatory product. This would require the project being re-licensed under a more permissive license (e.g. LGPL).
In return they will help contribute to its d... |
In, for example, the Bash scripting language, the following creates a string called $VAR which begins at the first " quote and continues until the next unescaped " quote.
$VAR="
hello
world!
this string preserves all
whitespace"
This makes it very easy to write multiline strings without concatentation or a mi... |
I recently started using UtilSnips, a Vim plugin allowing for a certain level of automation while coding by using template-like code snippets for common code fragments (class and function definitions, for example).
When using a popular snippet pack with Python, I noticed that snippets used when writing a class use a pa... |
I have bounding boxes the key type.
Box {
double mins[2];
double maxs[2];
}
And I want to have Box as the key type in the D programming language, so I have to implement:
size_t toHash() const @safe pure nothrow {
size_t hash;
for(size_t k=0; k < 2; k++) {
// do something here
}
return hash;
}
S... |
I'm currently working with some code that IMO has abused ruby's mixin features. Given that I'm new to ruby, I wonder if MO in IMO is correct or not.
My primary question is what makes more sense (and if there are any major technical differences between them):
E.g.
1
to create Helper singleton classes (or Modules with cl... |
This is sort of the complementary question to How to best protect from 0 passed to std::string parameters?. Basically, I'm trying to figure out whether there is a way to have the compiler warn me if a code path would unconditionally try to call std::string's char* constructor using NULL.
Run time checks are all well an... |
We had a bug caused by ruby workers (4 processes, 1 thread each) doing batching records using a legacy mongodb as the store. The race condition was around whether the batch was full or not; with one to three records sneaking into a batch. This was solved by correctly locking (although it did slow things down a bit).
Fo... |
So, I had to create a class that had a member of it's own type. I looked into why this was possible, which is fascinating. Reading the answer, I find that a lot of work had to go into making this work, and so it probably didn't exist in older languages. So my question is, just as the title says, What was the first lang... |
A colleague was asking me to explain a system information flow, as they are having problems with the wrong information being presented. It seems that what they have created is a custom built website, with it's own database, which gets it's data from SAP via a JSON based dataset.
SAP is the live information, the custom... |
In my app I want the ability to continually check for Internet, Bluetooth and GPS status (if one is off/on). I need each of these to be on at all times for my application to work effectively.
For the Internet, I use a Handler which checks if internet is off/on
every x seconds, and I create Settings.ACTION_SETTINGS in... |
Currently, there are only 3 possible publishers. I might want to add some more in the future:
interface NewsArticle {
enum Publisher { NYPost, ChiTribune, LATimes }
Publisher getPublisher();
}
I like the rigidity of using enum, but when might I get tripped-up if I treat the publisher as an enum instead of a S... |
I'm using a lot of implicit any in TypeScript. I don't quite understand how to decipher a TSD file in order to get the correct type when building off a library like express or angular. Is there a way to learn what the type of something is at runtime, so that I can go back and fill in the type later? Or is there another... |
I am building a service for pricing options of a product and for pricing the product itself when product has various options.
Example
User selects some X options out of Y options available, where X <= Y. The service then computes the pricing from selected options using cost for those options.
Using Pseudocode, it goes... |
Given the following scenario:
Teacher entity
{
"id": "1234",
"name": "Mr. Didactic",
"Subject": "History",
"Classroom": "1A"
}
REST API endpoint:
/teacher/id/1234
Let's say I submit a POST (update) request to the endpoint with this request body:
{
"id": "1234",
"name": "Mr. Didactic",
"Subject": "Hi... |
I am actively working on a two person project with very few longstanding feature branches (longest existing branch is 3 weeks).
I have spent the afternoon trying to understand merge vs rebase and what the advantages and disadvantages are. I've made some progress and plan on incorporating rebase to clean up my local com... |
Let's say I create a Collection in an instance method. I do not assign that reference to any instance variables. Rather, I just return it to the invoker. Then, I exit.
Now, the only thing with a reference to that Collection is the invoker.
So, as the method writer, why do I care what the invoker does with the returned ... |
There is a problem using ON DELETE CASCADE on foreign keys in a SQL database if there are multiple paths from the root foreign key to the leaf. The way around this seems to be to replace the ON DELETE CASCADEs with INSTEAD OF DELETE triggers.
However several Stack Overflow posts (e.g. here, here), and here suggest usin... |
I've been digging in covariance and contravariance in C# and there is one thing I could not manage to understand. C# (AFAIK, as of 4 version) allows one to declare the covariant or contravariant interfaces and delegates using out and in keywords. However, the declaration of the abstract class with such keywords is not... |
Suppose you develop an interpreter or file system. There are objects, like variables, procedures and files in some environment. They have a name and content (variable has current value, procedure has the body of code and file has some data in its body). You can request vbl1.value, proc2.execute and file3.content to get... |
And is there any danger to making my own INotifyCollectionChanged implementation that doesn't?
I'm trying to make a class library contains a Log class, which in turns contains some sort of observable collection. But if I try to actually add anything to the log from anywhere but the UI thread, the app crashes saying I'm... |
We have UI automation test framework based on selenium web driver. We are in the early stages of building out load tests and are wondering if it is possible or recommended to use a browser based UI Automation framework for load testing vs the more traditional approach of simulating client requests at the HTTP layer.
W... |
I'm writing a path class which currently has a method called Combine which works like the .NET Path.Combine. If an argument is an absolute path (roughly because it begins with \), then it replaces anything to the left, so:
Combine("c:\folder", "two"); // produces "c:\folder\two"
Combine("c:\folder", "\two"); // produce... |
In the Zen of Python, I can understand most parts of it, except:
Now is better than never.
Although never is often better than *right* now
So I think doing it now or getting results now is better than never. But why "never is often better than *right* now"? Or what does it mean?
To see the above 2 lines in context,... |
I wrote a Slack bot which must connect to Slack teams through websocket connections. Since the bot might be used by thousands of team, I will eventually need to distribute the teams across multiple servers. New teams are added through an HTTP server which handles the initial OAuth authentication.
I'm looking for a solu... |
How do companies deal with limitations and constraints of Twitter Bootstrap after choosing to use it in a particular project?
Web designers are no longer free to design Web pages. They need only to chose from Bootstrap components and how to customise them. If we give web designers all the freedom, passing from design ... |
Due to cost I am currently thinking of using AWS for scalable hosting of the node.js backend of the application that would be nice to have monitoring,load balancing and all the goodies of the AWS architecture.
The database system (currently OrientDB,PostgreSQL and redis) would be nice to have lots of mem and SSD disks ... |
If there's a bug that triggers undefined behavior in a piece of code, is the undefined behavior consistent each time running it? and changes each time compiling it?
For example if you had some C code that does some string manipulation. You compile it, run it 3 times and the output is consistent of weird characters like... |
Our customer wants to unify his ordering system, so that all of his end-customers can use one single website to place orders. The planned site will use web services to place the order in one of several production systems.
The production systems have a lot of different orderable services, that need different information... |
I wish to supply a software product with GUI, etc. for operating it. And the software utility is research so the users will want to tweak it to some extent and implement their own preferred algorithms instead of the ones we're shipping. Therefore, we want to make the code partly modifiable but not visible.
A possible s... |
Is there an advantage to either method and/or a risk to either? Looking to upload JPG or PNG files only with a size limit of ~3mb with reduction done before insertion.
|
I'm creating a system using some DDD principles and I'm stuck with a problem.
To give a bit more of context on what I'm trying to do, let me first describe what the system is about:
The ideia is to allow an user of an specific kind of service to be able to integrate and test many of these services without integrating h... |
I'm currently modifying code released under GPL v2.0, and I'm wondering if the GPL allows release under a different version, say, GPL v3.0 or if it has to remain under the same version as the original.
|
I'm curious to know how programmer teams typically managed their software development back in the 80s and early 90s. Was all the source code simply stored on one machine which everyone worked on, or was the source passed around and copied manually via floppy and merged manually, or did they actually use revision contro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.