instruction stringlengths 34 19.9k |
|---|
Continuous deployment require a lot of effort, beyond what is needed for continuous integration.
Since every change corresponds to a release (more or less), there is far less time and resources available for manual testing. They need to be almost entirely replaced by automated tests, which in some cases can be very di... |
While writing a data mapping function (import from csv (using TextFieldParser) to table), I used the sql table structure to generate the boilerplate C# code that creates the datatable and populates it (4-500 lines of code) reading from the string array that the TextFieldParser returns. Now I am considering creating a ... |
C# dictionaries are a simple way to find if something exists etc etc. I have a question though on how they work. Let's say instead of a dictionary I use an ArrayList. Instead of using ContainsKey (or an equivalent method in another language) I loop through the ArrayList to check if something exists there (or performing... |
What does this part of GPL3 mean in simpler or more readable terms?
If I decide to enhance a GPL3 Program in which some snippets of the codes I could add are generic (may it be on a separate file or as part of a GPL-licensed file) and could be applied to other future softwares as well, would I be free to have it (the g... |
I was trying to debug my code which uses a HashSet and searching through the SO, I found out that I needed to override the hashCode method as well. The strange part is, checking the related API, I did not see any part in it mentioning about the hashCode method. Quoting the definition of the add method of HashSet as see... |
I need to create a database in which several tables have images.
For example, users have profile pictures and uploaded ones and products have many pictures, as well.
Is it better to have one SQL table "images" or add "images" to every table that contains them?
Also, how would you add many images into one column?
I've r... |
I recently made a pure (didn't use Bootstrap or anything else) HTML 'website' (didn't actually give it a url) on my laptop, but when I opened the website on my desktop, it looked horrible and nothing was formatted correctly (elements were too small, margins were too big or too small, etc.). What should I do to make sur... |
Lets say that I want to develop a website where all pages will be dynamically generated and 'printed' into static HTML files. I will then serve these HTML files from a container (such as an Amazon EC2 instance) that has no server side languages or database running in the background.
I will make a script to have the ... |
I have been tinkering with the idea of creating a routing system as a learning experience and not for some production purpose.
I have trying to decide what features are a must have and what features are best handled elsewhere in a system. I have come up with a short list of features and I would like to get some feedbac... |
I would like to know if there is a way —maybe with AOP— to extend table/entity definitions so that I can add functionality across the board that requires persistence.
Let me explain what I want to do with a concrete example. Let's suppose we have a simple ecommerce system:
User
id
name
password
Item
id
name
price
s... |
Background:
Visual CSS regression testing is where you screenshot (part of) one version of a webpage in a browser and compare it against a screenshot of the previous version of the same webpage in the same browser. This prevents unintentional changes from happening due to browser version upgrades or changes in the page... |
I have a Color class. It has a property model which is a class that implements ColorModel interface, this property could be a RGB, Hex or HSL classes which implementing ColorModel interface.
// Color.php
class Color {
protected $model;
public static function factory (Model $model) {
return new Color(... |
While reading a paper in the context of Aspect Oriented Programming, I encountered following statement:
Aspects enable scoping variations in space (with a rich variety of
static pointcuts), in time (with dynamic aspects), and in the control
flow (with the corresponding pointcuts). Scoping a variation to the
dyn... |
Suggestions on a good pattern to follow to add elements to a dictionary where you want to add an element if it does not exist, else do nothing
The 2 approaches I can think of are
if(!dict.CcontainsKey(i))
dict.Add(i,true);
And
try
{
dict.Add(i,true);
}
catch (ArgumentException e)
{
//Do Nothing
}
In the case ... |
We are working on an MVVM application. Jersey (backend) exposing a REST interface and AngularJS (frontend) being the only consumer of this interface. The application uses a complex database model (data model), which is different from the model presented to the user in the browser (view model).
Currently we have came ac... |
It seems that writing Declarative SQL is very popular in Imperative Programming. However, it also seems that writing Declarative Prolog could save a lot of complexity but this is not very common.
Is there a historical precedent for this apparent preference of SQL over Prolog?
If the reason is lack of native support b... |
So, essentially, the question is, to develop a PHP back-end to an iOS application, would you implement an MVC architecture on the PHP side? Or no, since the client side (iOS) already has an MVC architecture?
Or, since we're just passing happy little JSON packets in between front / back end, both server and client shoul... |
I've recently been taking a course on Software design and there was a recent discussion/recommendation about using a 'microservices' model where components of a service are separated into microservice sub-components that are as independent as possible.
One part that was mentioned was instead of following the very often... |
I have a question about business rules and Business Intelligence tools.
The team working on Business Intelligence report tries to re-implement business rules in their report. Our application does calculation, transformation of raw data, and implement complex business rules .... I think the BI team doesn't need to re-im... |
I work on a lot of projects with different teams. Every project has its own conventions, including what to call arbitrary classes that don't lend themselves to obvious names.
As a counter-example, it's usually pretty obvious what you should name your models (UserModel, AlbumModel, etc.). The same goes for repositories,... |
I will design a REST backend that will work with my database. I want users to access this data by viewing my webpage (I will work with an MVC JS framework) without logging in.
At the same time, I want to prevent users making direct API calls to my backend so they can't take advantage of my data. (I am gathering some ki... |
I recently read this article about Clean Architecture, as I'm trying to get out of some usual OO habits (interface design everywhere, but what does it do???), and program something that describes what the system does instead of how the system is built (to paraphrase "Uncle" Bob).
Once that article gets to the use case ... |
These are two classes, the first one I inject an instance of type IEngine while the second one I inject owner's name, tickets and engine.
Version 1:
public class Car
{
public Car(IEngine engine)
{
// do something here
}
public void PrintOwnerName()
{
}
}
Version 2:
public class Car
{... |
At the beginning of a project I tend to finish tasks quickly. However, after a while I start getting bored doing the same thing over and over again. It feels like I am stagnant.
How do you keep enthusiasm running for a never ending project?
|
some of you should know what a login queue is. You start your game, like world of warcraft, league of legends, ..., type in your username and password, klick "log in" and then it happens: Login Queue, position: x.
What i want to ask is, what actually is a login queue on the serverside? I mean, if you take league of leg... |
Is it possible to run a small and simple game on android using only CSS/JS/HTML?
E.g I have built a small game using the all too known 3 folder stucture and I was wondering if there is any easy way to run it on Android tablets without using Phonegap or Cordova.
The scenario I am imagining is this:
I drop the folder in... |
I'm writing a very basic custom class for coupons and I've come up with a basic layout for the class, which consists of a number of small methods as I generally understand is a best practice.
What I'm unsure of is how the flow of a class should be dictated. Right now the code looks something like this:
public function... |
When programming a simple game as an example. I always tend to get left with a large GameLogic class somewhere which is reponsible for gluing together all of the other portions of the software.
A Common example of the GameLogic class I talk about contains functions such as these.
startNewGame();
showAd();
prepareLeve... |
I'm looking to setup CI. I only own one Mac. I do have a copy of OS X 4.0 Server (free with my Apple Developer Program license). I currently use Git for source control. I would prefer something with tight Xcode and Git integration. I will buy a second Mac with Yosemite if I have to.
Do I have an option that will a... |
Please note: although I'm talking about Java in this question, what I'm asking about here should really be language-agnostic.
I am dabbling in OR/M for the first time, and have cooked up the following "update strategy" for all of my entities:
All entity POJOs extend an abstract base class BaseEntity that has a Long id... |
I want to setup a comet/web-socket server for a forum sitting in front of a message queue i.e. rabbitmq, that will maintain client connections and update them about relevant events (i.e. new posts, topics, etc.)
The popular way to go about this is to use some async server that does this in one thread and hands off the ... |
This is a "technology/concept identification" question.
I have a rather large project in a DCVS repository.
Build times are loooong (about an hour) from a full clean.
The project is already divided into subprojects, with incremental building. But it still takes a very a long time when switching branches, etc., since I'... |
Graphics processing units (GPUs) are very common and allow for efficient, parallel processing of floating point numbers.
PPUs (Physics Processing Units) used to be a buzzword several years ago but never really caught on and this kind of calculation is now handled by GPUs as well.
Both of these types of hardware are spe... |
I'm a beginner in learning programming. I ask about using the string array in main method as a parameter. Why not writing the Main() method without the string array? What is the point of having this array in Main method?
For example:
public static void Main(string[] args)
{
Console.WriteLine(args.Length);
Console.Wri... |
Swift allows optional prefixing of method calls and property references to the current object instance via self. Removing these prefixes can declutter code but, depending on the length of the method and number of parameters and local variables, it can also make variable scope ambiguous.
Perhaps the answer is to refacto... |
I have smaller unit tests that use small snippets from real data sets. I would also like to test my program against full data sets for a multitude of reasons. The only problem is that a single real dataset is about ~5GB. I haven't found any hard numbers for what Git repositories can store but that seems like too much.
... |
I'm trying to come up with an online database that my clients would have partial access to. This is for an artwork storage company. We have about 40 clients and would like each to have access to their collection. Is that possible?
|
It seems to me that a lot, if not most, compilers treat enumerated types as int underneath. In C/gcc, enums are compiled to int. In C#/Visual C#, you can change the underlying data type with something like:
enum Days : byte {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri};
but the default is int (second paragraph) if you don't c... |
I am trying to build back end for college ERP system. The system will be based on LAMP.
These is the scenario:
Colleges have 5 branches
There are 4-6 classes in each branch.
There are 80 students in each class.
Each class has almost 6-7 subjects.
There are around 250 Faculties.
Each of them teaches one or more subjec... |
I am developing an application, where I have to send lots of emails for user account creations, validation, invites etc.
I have implemented a static class EMailUtil which has different methods like
public static void sendInvite(from, to, Subject){...}
public static void sendVerificationCode(from, to, subject, code){...... |
I'm working with a JavaScript canvas, and I'd like to recreate quite a common effect I've seen where moving particles create lines between them when then get close to each other.
My issue is that I'm essentially performing two loops inside each other. Please see pseudo code:
var particles = [ /* array of particles with... |
I want to gather several sub-projects in a single GitHub repo for the convenience of the users. But I wonder if it's actually possible to have folders in a single repo each of which is covered by a different license (all of them are BSD-license variants, with small differences), or do I need to split the project into m... |
Defining a magic pointer or counter inside a program / class and checking for a fixed value before executing critical commands is a way to generate a barrier against wrong execution.
This check is supposed to be used on an embedded system which runs a program written in C/C++. Imagine a situation where the program coun... |
Consider the following example:
The user wants a program to calculate a few fibonacci numbers.
Sounds easy enough. pseudocode:
stdout.write("How many fibonacci numbers do you want to calculate? ")
int count = int(stdin.readline())
while count>0:
stdout.writeline(calculate_next_fibonacci_number())
count--
Even ... |
The function definition below comes from the itertools recipes page
(https://docs.python.org/2/library/itertools.html#recipes).
def random_product(*args, **kwds):
"Random selection from itertools.product(*args, **kwds)"
pools = map(tuple, args) * kwds.get('repeat', 1)
return tuple(random.choice(pool) for p... |
We are looking to implement a load balancer that will serve requests between 2 IIS servers.
I have been tasked with the project of making sure that it is a seamless integration, but I don't have load balancing myself on my dev machine.
How can I simulate a round-robin load balancing scenario on my dev system using IIS?... |
If I want to save and retrieve an object, should I create another class to handle it, or would it better to do that in the class itself? Or maybe mixing both?
Which is recommended according to OOD paradigm?
For example
Class Student
{
public string Name {set; get;}
....
public bool Save()
{
Sql... |
I and a friend are having an argument on what is the better technique to use in the following scenario:
An application we need to test has a number of components (lets call them Eggs); each component is a bag of predefined sub-components. These components are the input to our application, there is no way we can change/... |
I currently have an interesting situation occurring with my code, and after hacking away at what turned out to be a dead end for the last two weeks, I'm here asking those smarter than I to educate me on where I went wrong, and how I can perform my intended task correctly.
The setup:
We have a set of classes that perfor... |
I want to track a series of scored questions in a single number (the total score). Is that possible? and how?
For example, I have 30 questions with either 3 or 2 choices. For any given question, the user makes a selection and the score is incremented/decremented. Simple addition and subtraction is enough for that, but ... |
I'm slightly confused over the following:
ProjectA
-------- GetUsers (Implements IDBConnector)
-------- IGetUsers
-------- UserModel
ProjectB
-------- Main
I have two projects one main project (project B) and another which gets data from a database (project A). Project A has an interface which the main class makes... |
HTTP allows for multiple representations of a resource. The Accept header allows the client to choose the representation of the resource.
GET /foo/bar HTTP/1.1
Accept: application/pdf
GET /foo/bar HTTP/1.1
Accept: text/html
GET /foo/bar HTTP/1.1
Accept: image/svg+xml
If the response is 200 OK, the entity is expected... |
Let's assume an application that deals with meetings where some users will participate.
What is an efficient way to achieve this use case:
3 hours before the meeting should start, one reminder mail should be sent to each participant.
It's pretty easy to trigger a notification based on an Event, let's say a creation, o... |
I'm looking for a way to use a collection of Java classes in a servlet, which would provide some services to clients, but the classes were not designed with multiple sessions in mind, which seems to make that more difficult. To be specific, I want to load a language interpreter (ignoring security problems -- it will be... |
We've just started putting linting in place at my workplace, and a lot of the devs didn't realize our standards called for double-quotes everywhere. About 50% of the codebase uses single-quotes, so it's no easier to change the rule than to make the older code conform. Is there a tool or utility we could use to automati... |
I am planning to start a small project with a friend. I will be developing the GUI using JavaFX in the MVC pattern and he will be responsible for the model/logic.
My question is: how can we achieve a save parallel developing, how do companies do that? Would we just write an interface for the model together, that specif... |
I was wondering if there are some good ways to encourage people to read error messages when the compilation fails.
People (especially) the junior ones usually ignore the error messages and just ask for help. I want them to be better and have run out of ideas. These are what I have tried.
I tell them to check error mes... |
I'm currently writing an RTOS for microcontrollers. The whole thing is written in C++11 - if anyone is interested, and the link to the repository is at the bottom.
Currently I'm writing a class that is a simple data queue for passing objects between threads (or between interrupt handlers and threads or interrupt handle... |
I'm working in a shape recognition project where it is supposed for me to develop an application that receives two images: an original one and a sketch made by a user. I am supposed to detect contours of the two images and find the best match in the original image corresponding to the sketch made by the user.
I already... |
Is it a best practice to always store strings in ASP .resx resources files, even when the application is not localized according to the user culture ? (Web pages will be displayed in french.)
Is there reasons for using resources other than provide pages in different languages easily ?
In favour of resources, something... |
It seems like List<T> in C# can do everything an array can do and more, and seems also just as efficient in memory and performance as an array.
So why would I ever want to use an array?
I'm obviously not asking about cases where an API or other external constraint (i.e. the Main function) requires me to use an array.... |
I've implemented a Builder Pattern in a project I'm working on.
I'm using this design pattern to created Fields and Components (div, tables, panel (boostrap)).
So I have a Director Component class. It makes a order for a Builder (in this case InputComponentBuilder)
class @DirectorComponent
@builder = null
@ma... |
I am building a wizard and the first step of this wizard is to let the user select a file. In the following steps I need this file to display some data from it and as a final step I have to import some content of the selected file.
How can i preserve this file along the steps?
I can save the file on the server in a tem... |
for example) would it be possible to be able to use the key of an item to access the item stored in a file out on disk (without searching through the whole file)?
I'm looking fora general example of how to do this (assuming it's possible), as I don't actually need to do this, it was just a question from an old exam.
|
How do you go about deciding which of the following two representations (in F# syntax) is the right choice in a particular situation?
type Choice = A of string | B of string
Or:
type ChoiceKind = A | B
type Choice = { Kind: ChoiceKind; Value: string }
I'm deliberately avoiding giving a more specific example, as eithe... |
This is a review question but I can't find anything in my book about it. What I did find online is contradictory and confusing.
|
Our company is moving from IBM mainframe environment and coding, to an OO environment. Is it possible...or is it correct/plausable to NOT have any standard whatsoever with regard to the server side language of the OO environment we move to? Is it normal to say "Dave works in PHP" so all things he does will be in "PHP".... |
If I want to do file encryption in a desktop piece of software I'm assuming I'll have to hardcode an encryption key in my compiled code. Is that assumption correct and if so what precautions can I take to protect the key?
|
I'll be handling 300,000+ users. Each user (after logging in) will be able to create lets say "folders", in each folder, users will create "name=value,name2=value2,name3=value3" entry pairs. Each name won't be more than 260 chars and each value won't be more than 1024 bytes. All readable characters.
My ideas for possib... |
If I understand the concept correctly the goal, which functional languages are trying to achieve is to eliminate any side effects from functions and to eliminate a state. The rationale behind this is to obtain referential transparency, which leads to more predictable execution.
However, nothing prevents me from writing... |
For Research and Development (R&D) project, what type of software development method / model more applicable/suitable?
For example, my recent R&D project has several parameters:
Requirement changes based on output of research.
Need to maintain High Level Documentation, Detail Level Documentation and others.
Need to de... |
I am wondering if WPF will fit in my case:
We want to refactor an old legacy application written in a 4GL language with about 1500 forms\dialogs. We want to do that in .Net (desktop application), now we have to consider using WinForms or WPF to accomplish that.
From my point of view, WinForms fits better because the U... |
Since the Garbage Collector is part of the language implementation (not OS, etc.), does the compiler has to attach the GC to the final executable? Or is it like a dependency that has to be already available on the target machine?
If it's attaching the GC, then should I think of it as a Wrapper around my application tha... |
Please bear with me as I find this tricky to articulate exactly what I am after (probably not a good sign..).
I have several services set up which can be combined in a particular order to create workflows. For example, imagine I have the following services:
1) HTTP -> File Store (takes a file over HTTP and stores it)
... |
I'm working on a build process, that is called manually over the command line.
To check if it exited unsuccessfully during the build I want to set a lock file (symbolic link) and remove it on successful exit.
But: I don't want to rely on the existence of build files and the absence of a lock file to signal a successful... |
I want to start a new asp.net mvc5 Personal Appraisals web project. Now I will have a module inside the system for managing users, and adding info such as primary role, secondary role, main skills, rating for each skill.
As the users are already inside the active directory so I do not want to store duplicate info such ... |
I have a service where certain other services can report their status to. By status I don't mean whether they are running or not, but whether they have received data. The point is that other services can ask if data they need has been received.
I have two possible options of implementing this.
One is as follows:
public... |
Virtually any book dealing with software testing mentions that user acceptance testing (UAT) is an ultimate validation activity, often quoting Boehms informal definition: "Validation: Are building the right product?"
But how come that Boehm himself considers UAT a verification?
GUIDELINES FOR VERIFYING AND VALIDATING... |
I've realized that since I've been more and more strict about the SOLID principles, my code tends to consist of more pure data objects and a lot of "operator" classes which seems to go against oop-principles. Specifically I often end up with "type dispatchers" that maps a specific object type to a suitable operator cla... |
I work for an organization that has lots of databases containing person information. The data quality is poor. One case was a surname I found like this (this is the worst-case scenario):
Mark "Dunno his surname, but it sounded like Lion 'RAR', Ha ha"
There is a date of birth of: 01/09/1499
This is a worst-case scenar... |
Let's say I am modeling a music event system.
I have:
music events
listing events (the items in a lineup) - a listing event has acts (the artists playing in an item in the lineup - these can be collaborations)
artists (the artists that make up an act)
If I were to say that each of these were an AR - they indeed have ... |
I want to sell a closed-application that depends upon a certain command line tool. Am I allowed to distribute my software including this command line tool?
For example, as a separate binary accompanied by the proper NOTICE file and if needed the source code.
Do I need to explain how I call this binary, so the user coul... |
While working on a Python project, I realized that during my editing I had left a string floating around in the middle of my code and it didn't generate an error. For example, these few lines execute just fine:
print("Starting")
"This string does nothing"
["Neither does", "this list"]
print("Done")
Output:
Starting... |
I am new to actors and trying to implement a very sequential protocol handshake (over websockets). This is in Scala/Akka.
It goes something like this:
HTTPs connection is established then upgraded to websocket
Client says HELLO
Server responds HELLO
Client says I want to use subprotocol X or Y
Server says I support Y ... |
I am writing (recursive) code that is navigating a dependency graph looks for cycles or contradictions in the dependencies. However, I am not sure how to approach unit testing this. The problem is that one of our main concerns is will the code handle on all the interesting graph structures that can arise and making sur... |
I'm working on a user management "pseudoframework" in PHP, and I'm trying to implement fine-grained rule-based authorization. I'm using a combination of SQL and condition-checking functions written in PHP right now, but I'm not completely satisfied. It works, but it is not very elegant and suffers from some limitatio... |
Imagine a sorted deck of N cards that has been cut K times by moving X cards from the top to the bottom (X is a different / random amount each time, X is always < N) - what would be the best way to sort this, knowing that there are "chunks" of sorted cards?
I am thinking something along the lines of going 1 by 1 until ... |
I'm working on a JavaScript port of a red-black tree implementation in Java from the book Algorithms 4th Edition, by Sedgewick and Wayne. I believe that my JavaScript port qualifies as a derivative work. It's not nearly a line-for-line copy, but the core logic for RBT manipulation is quite similar.
On the book site, it... |
--------------------- ----------------------
| FLIGHT | | STEWARD |
--------------------- ----------------------
| Arrival time | | Steward ID |
| Departure time | | Name |
| Flight ID | ----------------------
--------------------- | Call(... |
I am just being picky and really wanted some of my code to look, feel, and be used a specific way but am not sure if its possible.
I have a class I created that can be used like this
Query("ServerName", "TSQL").Run()
sample:
class Query
{
public string serverName { get; set; }
public string tSQL {... |
I've recently come to discover there's actually a strong amount of criticism towards what people refer to as "modern OOP" - often comparing it to either functional programming or Alan Kays' OOP.
Here's the question which got me thinking: https://stackoverflow.com/questions/2409494/some-solid-oop-criticism
Wikipedia ha... |
Since 4.8 release, the C++ compiler GCC (the G++ part of it) is written not in C anymore, but in C++ itself. I have a hypothetical question on this.
I wonder how to compile the C++ code of GCC on a new platform that has no C++ compiler yet. Of course, you could use prebuilt binaries compiled on other machines. Or you c... |
Below I've produced what I believe to be a summary of the standard $ like operators for various classes in Haskell. There's some gaps however. Following the applicative pattern, you would think those operators would be $$ and <$$> however I didn't see operators like that on Hoogle or Hayoo. Could someone fill in the ga... |
In the code below, I believe it would look more appropriate to make the method argument be of type Comparable[] instead of Object[].
The first reason it would be more appropriate is that one can be safe from runtime exceptions because every passed object has to implement interface Comparable. Second, every object in J... |
We are developing an application that goes through many testers before reaching our client.
Finally, when it reaches the client, they find some more bugs and report to us, and this has become a tedious process. There are some bugs which I personally can't fix, because it requires me to modify most of the inner code, an... |
According to Wikipedia a single version of the truth is described as "is a technical concept describing the data warehousing ideal of having either a single centralised database, or at least a distributed synchronised database, which stores all of an organisation's data in a consistent and non-redundant form"
A single ... |
I work from multiple locations quite frequently, and there's times (16:59 on a Friday for example) when I need to leave quickly with potentially unstable code. Right now I tend to commit and push the days work to my branch and work on it from home/elsewhere, but this feels a little dirty. Would others consider this acc... |
I am making an application for a card game, with a standard 52-deck playing card. For now, I am writing a solitaire game with for learning purposes. I've had some experience making platformers and arcade games, but none with card and turn-based games.
I am trying to implement some sort of MVC pattern, separating the ga... |
I'm just trying to figure out what makes the Signal/Slot (Pattern?). Wikipedia tells me not so much and calls it an implementation of the ObserverPattern* while I would think it has much more resemblance to the DataBusPattern**.
Can someone explain in an abstract way what Signal/Slot is? Do the participants in Signal/S... |
I realise it is probably overkill for what is a occasionally connected client app, but the construction of aggregates roots is bugging when thinking about it from a client perspective.
For the purposes of providing domain visualisation, let's just say that whole system is concerned with arranging and editing meetings w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.