instruction stringlengths 34 36.1k |
|---|
As a web developer I have very little understanding of binary data.
If I take the sentence "Hello world.", convert it to binary, and store it as binary in an SQL database, it seems like the 1s and 0s would take up more space than the letters. It seems to me like using letters would sort of be like using compression, w... |
I wanted to move my program into a class or classes because most of the form post I read say it makes the program easier to read, understand the flow of the code, and improve maintainability.
Realizing at some point I would be adding more and more to my code until its over 1000 lines I decided to move my GUI into a cl... |
I am very interested to learn the HTTP protocol in depth as well as understand the working of NodeJS streams up-close. I figured out that the best way to do this would be to develop an HTTP server in Node.
My question is, as the HTTP protocol itself is based on TCP, would it be possible to use the Node's net module an... |
I'm working with an SQL database right now, and this has always made me curious, but Google searches don't turn much up: Why the strict data types?
I understand why you'd have a few different data types, for example like how differentiating between binary and plain text data is important. Rather than storing the 1s and... |
What is the commonly accepted enterprise standard for Exception management?
Consider the project has three layer structure.
- Controller
- Service throws ServiceException
- Dao throws DaoException
Is it right way to catch the DAO exception in Service layer and convert them to a Service exception?
Again catch the Se... |
I developed 2 games in C++ using SDL. Without using any wrappers. I literally loved and enjoyed every part of the journey. Complex algorithms, how 2D works, rendering, audio, input etc. But i am not too good at maths and specially physics.
PS: There are drag and drop tools and IDE available for game development, i am ... |
This question was inspired by MessagePack, but I'm looking for a general answer about the advantages of in-app vs. external compression.
For network I/O, doesn't the transport protocol (at least optionally) provide some sort of compression? If so, what makes in-app compression better?
For file storage, what makes in-a... |
I've seen Facebook's APIs that will sometimes start with resource id. Also, if the URI is for a business process as opposed to a fine grained resource, would it be acceptable to start the endpoint with an ID, e.g.
/{fine-grained-id}/businessProcess
So the ID does not represent an item in a list of business processes, ... |
I am building a middleware integration that will pull orders from various 3rd party API's and push those orders into our system, as well as synchronize stock and send off shipments. I want to build this in such a way that I can add various retailers later on without having to modify the Core project.
I've built this in... |
BACKGROUND: I've been developing in PHP for two years - self taught, and beyond the most basic editing, really just a year and a half - but my experience is limited to a small number of environments. For the last three years, aside from random side projects, I've basically spent all my time developing custom solutions ... |
I'm writing a toy compiler targeting on x86-64 machines. But I confront several problems when implementing register allocation with linear intermediate representation. I use NASM and GCC to generating executable file.
In intermediate representation of the origin code, we assume there are infinite registers(memory is re... |
I'm trying to figure out the most efficient way of maintaining a sorted ArrayList. I'm inserting items into the array one at a time. I'm deciding between two methods: inserting the item at the sorted position or inserting the item at the end of the end of the list and using insertion sort to sort the data because of it... |
I've got a class Shop which contains a collection of Item objects. You can create a shop in two different ways:
Create a shop filled with test data (for debug purposes);
Create a shop by reading the data from file
I also need to write the shop back to file.
There is any pattern that can elegantly wrap this behavior?... |
What is the meaning of separating interface from implementation in C++? And also what is implied by interface and implementation?
|
Let's say that I have an ArrayList of class Person and I have two objects that are generated from two different classes which read and write to this ArrayList.
For example,
public class Main {
public static void main(String[] args) {
A a = new A();
B b = new B();
}
}
What, in your opinion is the ... |
I have a simple example of two setups of the same block of code, but i am not sure what would be considered the "better" option, although subjective, i read about methods often doing too much than which they describe.
So example is where i want to add data and do a sanity check first... the two choices would be:
public... |
I'd like to ask what, in your view, would be one preferable and robust software design for implementing continuous processing of records in a time-aware manner. A problem overview of the problem to solve follows:
There are records added to the database. Each record is an event with signed up participants. Each event is... |
I am learning about device drivers, and based on what I know so far, if your application wants to communicate with some device, it cannot communicate directly with the port that your device is connected to (for example: a serial port). But rather, you should create a device driver that is allowed to communicate with th... |
What kind of UML diagrams can describe how a new feature will impact/affect an existing system?
For example; my usecase is we have an existing web application (system) that uses framework specific user login & authentication. We need to change the system to use OpenID to login and authenticate users.
We also want to d... |
In most Java code, I see people declare Java objects like this:
Map<String, String> hashMap = new HashMap<>();
instead of:
HashMap<String, String> hashMap = new HashMap<>();
How is it possible (i know it is but why) to create instance of a Map interface when we know that we can't create instance of an interface.Pleas... |
This is part of the answer about stack and heap in Java:
So, why have the stack or the heap at all? For things that leave
scope, the stack can be expensive. Consider the code:
void foo(String arg) {
bar(arg);
...
}
void bar(String arg) {
qux(arg);
...
}
void qux(String arg) {
...
}
The paramet... |
I am very confused in implementing MCTS for a connect 5 game.
According to Wikipedia:
Selection: start from root R and select successive child nodes down to a leaf node L.
Lets say it's the AI's turn. The current board state is R. There should be no child nodes of R, right? Then, how can you "select successive child ... |
At one point or another you might come over functions with a lot of arguments. Sometimes it makes sense to combine some of the arguments into super-arguments. I've often done this with dicts, but now I'm looking at better ways of doing it.
I'd like to turn ...
def do_something(ax, ay, az, bu, bv, c):
# Do something... |
For this question, let's assume the following:
OOP design principles are being followed.
Modules generally do not consume more than one general concern, but different business purposes.
Hybrid application (multiple platforms).
Covers single business concern. However, this single business concern has several smaller co... |
Say I have a device that is connected to the computer through a USB port, and I created an application to communicate with this device. In this application I used the USB driver to communicate with the device.
Then later I decided that I don't want my application to communicate directly with the USB driver, so I remove... |
Based on what I know so far, if I want to create a driver, and want the driver to send data on some port (for example: serial/parallel/USB), my driver will communicate with the port driver, and the port driver is the one that will access the port directly.
Assume that my driver will run in kernel mode.
Now my question ... |
What is the "simplest" operating system or platform upon which we can do Software Engineering in this day and age? Or, in other words, are there "minimum requirements" for OS & platform for doing Software Engineering?
I believe a single-board Linux computer is not too small. I first learned about software engineering ... |
I'm a newbie on web development and I've heard about MVC.
If I'm right, it's the Controller that take charge of fetching data from DB.
So I have a question:
In the pattern MVC, how many objects to interface with DB should I use?
For example, in my web project, there are two controllers: ControllerA and ControllerB. I h... |
Consider (using Visual C++ as an example):
cl /EHsc a.cpp b.cpp c.cpp
versus
cat a.cpp b.cpp c.cpp > unity.cpp
cl /EHsc unity.cpp
Why is the first variant slower given a modern compiler? I've seen people say that unity builds avoid headers being parsed multiple times. But then why doesn't a modern compiler cache its ... |
So here's my dilemma. I've sort of read up on how to design 2-way relationship APIs but I haven't found an answer to my question yet.
Say I have 2 entities, one is called 'Event' and the other is called 'Person'. Now, if I want to add a person to an event, I could either choose something like POST events/{event-id}/per... |
It is a widely held position that checked exceptions as implemented in Java are a bad idea. If you mark a method as throwing, calling code has to either catch the exception, or be marked as throwing, too. For this reason, it is said that exception specifications are contagious. Consequently, they are being removed f... |
Can you made secure, multi-user, client-server application with multiple clients (1-5) directly connecting to database? Or you have to make custom server application and connect them via WCF or something similar?
Right now I have connection directly to DB but didn't implemented authorization yet. Using SQL Server Authe... |
Disclaimer: I am going to write in Python and in the context of web development with Django, but this question is not language nor framework specific.
Let's say I have a PizzaManager class that serves as a utils tool to select pizzas in a Restaurant menu. The pizza manager uses data the restaurant has to perform its di... |
I want to make simple authorization & authentification server (with proper audit logging).
I used to see on my job or in many examples classic CRUD approach for this purposes.
But now I'm thinking about try to use CQRS (+ ES maybe) approach for my simple web-app. But this app requires authorization & authentification (... |
I have a rather simple application which consists of an angular frontend and a REST API done in C#
For the frontend I use WebStorm and for the backend Visual Studio.
Now we need to introduce a new version control and it has been decided to use Team Services (Git).
There is no code or any assets shared between the front... |
A while ago I was investigating dependency injection frameworks for a project I'm working on in Python (part of a full-time job, moderately large and complex). I found some projects such as dependency_injector that look interesting but many of them look somewhat abandoned. The examples from those projects make dependen... |
Whenever I write a piece of functionality from scratch, it's a good and robust code.
But often times my assumptions about how the code should work evolve over time. After I reflect those changes in the code, the whole system suddenly loses its quality.
It seems to me that the best approach is to drop the old code and ... |
I have an Android app which I am refactoring to use MVP. I have an Activity that has two Fragments.
Scenario 1 (one presenter):
The presenter "knows" each view. So, if one view receives input a presenter method is called and it could call a method of any of the views.
Advantage: flexible
Disadvantage: the presenter m... |
Background
I'm working in a team that's looking to implement zero-downtime deployments. We're planning on using a blue/green deployment strategy in order to achieve this. One of the things I'm realising in doing the research is how complicated it becomes to make database changes. A simple operation like renaming a colu... |
I am tasked with implementing a web-based gambling system that's operated on site. The requirements given to me by the company co-founder and designer for user login give red flags in regards to security, which surprises me because all of the other roles are required to be secure (cashier, site owner, admin, etc. all h... |
I have a Symfony project.
I want to make this project API based, but also with a Web UI.
So, I have 2 Bundles, ApplicationBundle and WebUiBundle.
In Application Bundle, I have application, domain and infrastructure (tiers?), where application has the public API (presentation layer).
Now, I need to access an API from th... |
I am studying about Memory-Mapped I/O from here. I have read the following:
From the CPU's perspective, an I/O device appears as a set of
special-purpose registers, of three general types:
Status registers provide status information to the CPU about the I/O device. These registers are often read-only, i.e. the C... |
The application this question is about is basically a transpiler which contains a lot of logic. The transpiler is written in C++ (which should not be much of relevance for this question), and it transpiles a special language (which we developed) into a different language.
For error handling (errors originating in inval... |
I have a Webapp that schedules events to happen in the future with, hopefully, milliseconds accuracy. I'm currently using a backend process that checks the database (kind of an anti pattern) and triggers the event when the time has just passed .
This system has its faults:
database polling
poor performance on multiple... |
I have an architecture front-end / back-end, specifically an Android app and a backend. I want that the app user can see different prices and currencies depending on their geo-localization.
So my Android app has a mechanism to know in which country the user is (based on geo-localization), then it queries the backend us... |
I have class Foo, its first line reads package com.bar.something.baz. Its file is in /com/bar/something/baz/.
Why do I have to declare the package in the class file and then put the file in the same path as the package I declared? Isn't it redundant? Couldn't the compiler infer it from the path?
|
According to David West, Object Thinking involves identifying Objects in the problem/business domain that mirror real-world objects; the interface would then reflect the behaviors of that object.
What would happen if we had an object class with alot of different behaviors. How would that not violate the Single Responsi... |
I'm writing a web app that is basically facebook events, but more impromptu and real time. A user can create an event, and other online users in the area (30 mile radius) should immediately see the event. Users can sign up for events, and the host should see the invites. The host can cancel the event, and all participa... |
So basically I have an object with a few properties in it:
public MyObject
{
public string Name {get;set;}
public bool Complete {get; set;}
}
List<MyObject> myList = new List<MyObject>();
myList.Add(new MyObject("Page1", true));
myList.Add(new MyObject("Page2", false));
myList.Add(new MyObject("Page3", false));
Ima... |
this is similar, but no the same as this post, which was the closest question I could find on this. I don't even see that answer as satisfactory for the question asked in that thread let alone TDD. If I'm writing my tests before I write my actual code, how am I supposed to come up with "special" cases if I can't even... |
I have thought for some time how to integrate microservices. I like events a lot, but I don't want to make any coupling between services so I got an idea that I'd make some kind of adapter-microservice, which only purpose is subscribe the first service's events and then delegate call to another service's api (and maybe... |
Im studying about requirements but Im with some doubts. I read that it is common in a project to divide the requirements into user, functional and non functional and I studied about the three types.
I have two doubts below but they are related.
First is about the difference between the functional requirements and user... |
My understanding is that a major point of contention with reading a file during a unit test is that it is slow. There may be 1000 unit tests and we want the build to complete quickly so the unit tests must be fast. Disk I/O is known to be slow, therefore a good practice is to avoid unit tests that read from a file. Is ... |
I am a student that will finish his degree in like 7 months. I have a side job where I am the only programmer for a small company. The web application is for invoices and employee working hours. This application (with legacy code) uses an old framework (cakephp 2.0) and is just too old and has too many redundancy code ... |
In SQL, what's the standard convention for what rows and columns should be used for? For instance, if I need to make a table of users and their data, which axis (rows or columns) should be the users labels and which axis should be the users data labels?
EDIT: The Free Heroku plan only allows a maximum of 10000 rows on ... |
I am currently working on an Android project that I have concluded needs refactoring done for a core part of the app experience. Let's call this part of the experience "Search".
From looking at bug reports, static analysis tools, and the code itself, Search should be prioritized in the refactoring.
Since Search is a co... |
As seen in the main question. It is not a syntactic problem that I have, or
some error in the code. I would like to know what is the correct way to name the parameters variables in a stored procedure. Is there documentation on this topic?
I ask this, for example: I have a database containing a table called "orders" a... |
My current workflow is this (it's basically a feature branch workflow):
1) I have two main branches: release and develop.
2) Development is done using TDD methodology using JIRA/Bitbucket. An issue is created, which consequently creates a Git feature branch.
3) Active development is carried out in a feature branch, and... |
I am learning about IO devices, and so far I have only seen examples of IO devices that have registers and no memory space. For example, this is a printer that have three registers and no memory space:
If you want to print a character, you would put the ASCII code of the character in the Data register.
But what if you... |
This is an example of Memory-Mapped I/O:
So basically you access the device controller registers through memory.
Now my question is, when you for example write to the memory location that maps to the command register, will the value you write to this memory location gets copied to the command register in the device co... |
After reading this Stackoverflow question I have stumbled upon an MSDN article Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application.
There is a proposed implementation of a repository:
public virtual IEnumerable<TEntity> Get(
Expression<Func<TEntity, bool>> filter = null,
Func<IQu... |
I am learning about OOP principles and realized that on iOS view controllers become massive because we tend to stuff all the view responder methods in them. A lot of stuff happens in the viewDidLoad method.
Can anyone elaborate how to fix this, and provide a nice architectural design? Why did Apple design this in such ... |
I often come across the following pattern.
while(GetValue(i) != null)
{
DoSomethingWith(GetValue(i++));
}
Here GetValue is executed twice. It would be much nicer to use a pattern where we can evaluate AND store the outcome of GetValue. In some case (streams) it is impossible to get the value twice (see alternative... |
I got a class "WorkOrderTaskCreator" that creates objects of the type Task and adds them to third class called WorkOrder. It goes like this
class WorkOrderTaskCreator
{
ParentWorkOrder ParentWorkOrder { get; private set; }
public WorkOrderTaskCreator(ParentWorkOrder parentWorkOrder)
{
this.ParentWor... |
Normally when I have some data to store, I do something like
Model model = new Model();
Notifier notifier = new EventBus();
Store store = new DataStore();
model.updateTitle("new title");
store.save(model);
notifier.notifyAboutChange(model);
I have read a lot of posts about putting the logic into the models, but people... |
I'm writing an interface to bundle two underlying APIs into one new. The APIs provide data about archived invoices.
All three APIs (the two old ones and my new one) have different data structures.
For example: <INVOICE_NO> (old XML), "number" (old JSON), "formatted_number" (new JSON) all mean the same field.
I've cre... |
I need people opinions on how to improve a code I've written. Let's assume we have an application cataloging movies (~3500 of them) and actors (~1000, but I need to double-check this).
Both actors and movies are POJOs. An actor has a picture, stored on disk and its path in a database, along with the person others attri... |
I am looking for a design advice for the following scenario:
Three layer application:
MVC Portal (just frontend app really)
Business logic WebApi (all the magic happens here)
Connected services (just the file processing services here)
Portal is not aware of any database, processing services etc. It only communicates ... |
Let's say I have my web shop and database have multiple tables like Products, Product prices and similar.
I'm selling my software solution to my affiliate partner. He gets its database, it window application for entering data and I want all he's products are available on my website also.
So, I have my products and sel... |
There is a database-based application at work with an authorization system. If a user is not logged in, the only system accessible to them is the authorization system where they must provide a valid username and password that are stored in the database.
The login function has the following comment in it:
// NOTE: This ... |
I am currently working on a Bloom filter implementation. I was wondering how can I test such a data structure since a Bloom filter is probabilistic in nature, I guess . I want to unit test and also test for false positives. in particular how can I unit test the filter methods (add/contains) and how can I verify that fa... |
For example,I had seen some codes that create a fragment like this:
Fragment myFragment=new MyFragment();
which declares a variable as Fragment instead of MyFragment , which MyFragment is a child class of Fragment. I'm not satisified this line of codes because I think this code should be:
MyFragment myFragment=new MyF... |
I'm converting some code that formerly wrote structs directly into storage, to use serialization. This is because it is pretty annoying having piles of code to unpack structs that were laid out differently in older versions of the code that have been upgraded.
At this stage I am hand-writing the serialization code, I'... |
Based on what I know so far, when you plug an IO device into an IO port (for example, when you plug a printer into a parallel port), the printer will be represented to the CPU as just another RAM chip.
So if you want to create a device driver that communicates with the printer, the instructions that the device driver w... |
Today in UML class our teacher told us that it is very important to create uml diagram of our java code and use design pattern before starting to program any application.
I find that weird because usually I just start write programs directly I don't design uml for my code because I don't know what I will use in it.It c... |
Is it common practice in the software development/engineering profession for engineering change orders (ECOs) to be used for or in conjunction with software version control? Is this a good idea? Are there any pros or cons?
|
Let's suppose there is a base object class - let it be called Object - and a list<Object> container. There are many child classes of Object - Child1, Child2 etc.. They all are stored in the container.
I need a way to iterate over subsets of objects of some particular class. Say, over all Child1's or Child2's, while hav... |
I am considering splitting a project from monolithic to server side REST API plus isolated web-based front end (or, also, any other third party consumer) that can be hosted on a distinct server and domain.
How should I approach user authentication and authorization? Forms authentication is basically gone, and all call... |
In college I am doing an assignment about the differences between (non-)functional requirements. The problem statement is as follows:
Space Invaders is a single player game. After starting the game, the
player selects a level of difficulty and starts playing the game. The
player can steer a space ship to the left ... |
I am trying to understand, at a high-level, how single threads run across multiple cores. Below is my best understanding. I do not believe it is correct though.
Based on my reading of Hyper-threading, it seems the OS organizes
the instructions of all threads in such a way that they are not
waiting on each other. Then ... |
What are some techniques that you can use to prevent over-engineering among the Software Developers? Meaning, how do you keep them focused on creating solutions of only the current requirements? Without trying to anticipate all future changes.
|
I am building my first serious API. I am trying to decide how users should POST data.
I could allow them to POST variables, which is what HTML forms do.
param1=foo¶m2=bar
Or I can let them POST JSON, which also makes sense because I will be returning a JSON response to the user.
{"param1":"&","param2":"bar"}
Is t... |
I am working on a project where I am importing data from 3rd party sources. Often certain data is missing (usually older data), which is detectable from the data that I do have. Obviously I cannot reproduce all of the missing data, but I can actually reproduce some of it; specifically delta values.
So my plan is to cre... |
I have a medium sized Python program (12 KLOC) organized as a single Python package with multiple subpackages:
proj/
setup.py
proj/
__init__.py
projfile1.py
subproj1/
__init__.py
subprojfile1.py
...
subproj2/
__init__.py
... |
State machines, for example UML state machines, statecharts or other finite state machines, allow actions to be executed when a state machine takes a transition between states or is within a state.
In programming languages with exceptions, exceptions can occur within such actions, even if you disallow checked excepti... |
I'm looking at building a message queuing library in Go, which will be used as part of a larger application. A doubly-linked-list seems like a sensible approach for an in-memory data structure, but let's say this list grows to be 4 million items and each item is 10k, things no longer are guaranteed to fit in memory, pl... |
Similar question was posted here https://stackoverflow.com/questions/21064164/clean-code-how-to-design-this-class
I still don't find an answer though, I'm confused!
I read the book "clean code" too.He is saying in some part you shouldn't mix data structure/Object, whether data structure with no behaviour or an object ... |
I've been running into code (new code) that uses what I call 'Parallel Arrays' or Lists. Meaning there are 2 arrays that contain related data and are linked by their position (index) in the array.
I consider this confusing and prone to all sorts of errors. The solution I normally propose is to create an object called C... |
I'm working on getting a handle on Graph Databases (using Neo4j) and am trying to wrap my head around where "the line" is between what makes a good fit for GraphDBs and what should be strictly RDBMSs.
Particularly, I'm looking at a graph model to store manufacturing BOMs, as well as related information such as inspecti... |
As I am looking more and more into Continuous Delivery for our organisation, I struggle to understand how we can effectively incorporate manual QA testing before a release is pushed out into production.
I have found multiple approaches, such as the branch-per-feature one explained by Adam Dymitruk or git-flow and the l... |
I want to crawl websites and write output to Solr with my application. My crawler uses Kafka to put crawled website object on a topic and Flume will redirect output to Solr. There are multiple crawlers which produces data into Kafka.
My problem is that: when a crawler wants to crawl a website, other crawlers should no... |
I have a daemon process, written in Java, which I would like to be configurable at runtime via an HTTP-based API.
For a number of reasons, I'd rather keep the admin API separate from the daemon process itself:
resilience: if the admin API fails, the daemon must continue running.
separation of concerns: the admin API a... |
Let's say I have an interface called ParentClass. ParantClass has two implementations, ParentClassA and ParentClassB. There is also the ChildClass interface, with a ChildClassA and ChildClassB implementation. The ParentClassinterface has a function called createChild, which returns a pointer to a ChildClass interface o... |
I read bytes from a socket. The data consists only of two types of structures:
struct A
{
unsigned char type_id; //0x01
unsigned char sequence_id; //Incremented in successive packets.
//Some other fields
unsigned char checksum;
};
struct B
{
unsigned char type_id; //0x02
unsig... |
This is my situation:
Models can contain properties which can be models themselves. Each property can have custom behavior, this behavior must be selected through its name (for example: Versionable, Authorizable or something else). Developers must have the ability to add their own behaviors to the list with available ... |
I’m struggling to come up with a design (pattern) for an application/service which will hit multiple web services (external 3rd-party APIs), parse, combine and return them in a single response.
The application will have the following behaviors/steps (in no particular order):
Search hotels
Fetch details of selected ho... |
I see the benefits of making objects in my program immutable. When I am really deeply thinking about a good design for my application I often naturally arrive at many of my objects being immutable. It often comes to the point where I would like to have all my objects immutable.
This question deals with the same idea bu... |
As I was working with this piece of code today, I got curious if there are any significant differences between these two or is it just personal preference when it comes to creating objects.
Exhibit A
private MailModuleStatus createMailModuleStatus(Project project, Team team, Account account){
List<MailStatusCount>... |
I have three functions which act on a matrix and kind of find a minimum sum path (Note dim = 80, See https://projecteuler.net/problem=82):
-- f is the minimum cost from x, y by taking only up and right (up and down doesn't make sense)
f :: [[Int]] -> Int -> Int -> Int
f arr x y
| y == dim-1 = arr !! x !! y
| ot... |
I have been trying to build an MVC structured RESTapi.Since it's going to return JSON only,is it right that my View will just have a header and that the view will output the JSON also?
I planed to implement JsonSerializable than to do some magic with it in the controller/model part, than to output it in the view.
Is i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.