instruction stringlengths 34 19.9k |
|---|
Are there any existing algorithms which can look through a list of words and split or combine words into their more common form?
For example, I have a list of many business names in the health care industry. The word "healthcare" is often written "health care". There are also business names which might be split or comb... |
I am currently learning about design patterns.
I think most people would agree that these patterns are great tools, but should be used with moderation and not as the answer for everything. Using them too much would over-complicate the application with little benefit. Patterns should be used only where they can be the b... |
I thought both Project Lombok & AutoValue used compiler annotation processors, but from this slide presentation and this stackoverflow answer it seems that Lombok doesn't... or at least not annotation processors alone. What is the difference in the way that Lombok & AutoValue use annotation processors?
|
I'm currently developing a mobile application in Objective C for iOS devices. While doing the application I reach the point where I have to retrieve data from a database and show it on a table (the name of a specific workout routine and his description).
The way I see it I can do this in two ways:
I can select every w... |
I'm currently learning about design patterns. I learned about the Factory Method pattern.
This pattern means that in order to implement a factory to create objects, one should subclass the class that needs these objects, and have the subclass create them. This way the superclass only works with more abstract references... |
This is a pretty simple question but I'm new to java.
The linked list found in java.util.LinkedList.
I saw elsewhere that Java does not use pointers...
When I create a new list and add new elements to it, does the list contain references to the data and to the next/previous elements or does it also contain the object i... |
What is the word used to describe the type of programming languages that provide explicit syntax for defining classes and that support inheritance?
For example: "A ______ language, such as C++, Java, C#, or D."
I keep thinking "object oriented", but that also includes languages like Lua and JavaScript, which aren't qui... |
Many times I have to write a loop that requires initialization of a loop condition, and an update every time the loop executes. Here's one example:
List<String> currentStrings = getCurrentStrings();
while(currentStrings.size() > 0) {
doThingsThatCanAlterCurrentStrings();
currentStrings = getCurrentStrings();
}
One... |
From what I understand, genetic algorithms try out multiple variations and evaluate the fitness of each variation. Then they select the best variations, change them a bit and continue the process with the next generation.
But what if we have unlimited computation resources? Can we then just try out all possible variat... |
why is functions like len and max not a reserved keyword in python. Following are the only reserved words http://docs.python.org/2/reference/lexical_analysis.html#keywords
|
We're working on a new firmware for our new V2 device. The company has an older V1 firmware (and hardware). Hardwares are similar to each other (but there are some differences) so basically we could use V1 firmware with "some" modifications. Unfortunately V1 firmware is spaghetti code. We need to support both hardware ... |
I have to create a documentation structure for a legacy application, and I'm not sure of how to organize it.
Documentation goals:
List of use-Cases
Program flow for each of the use cases. (Flow-chart of all the logical steps the code does for a particular use-case).
As far as possible explanations of why a certain bus... |
I am working on an open source application which can allow users to add RSS feeds. All users of the site can read the content of those RSS feeds. It's not just for user's own feeds.
Using PHP and SimplePie library I have created a simple app. I am trying to implement category based listing.
I have a list of RSS/Atom fe... |
Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity O(N).
Another variant of the question goes like this:
given a matrix with sorted rows, and sorted columns, find kth smallest.
We can easily formulate an O(klogk) solution with minheap, but the challenge is doi... |
I'm writing a public web app to get stock data from a magento store. I've accessed the data, but it turns out that i have to query each product individually for stock data. With thousands of items this is a resource hog and takes lots of time. This cannot be avoided. It's just how their API works and I have to do it th... |
I have learnt that if there are more columns in table, then get those results using join query.
How to decide the max number of columns in table?
How feasible is "Join Operation" if too many table involved?
And if join operation hurts performance
Can we define all columns in one table to get rid of join operation?
I f... |
I'll try to further explain what I mean.
Imagine you are the boss of a company. You have to deal with the tradeoff between the quality of the code and the speed of producing it. Let's assume to measure the coding speed according to Agile Methodologies in Story Points
Let's consider the two extremes:
Our developers sp... |
In this question I asked: Is the cost of designing more levels of abstraction to allow loose coupling worth the benefits, or not?
People said that it's often worth the cost, but one should sense whether his/her application will actually be using this underlying design later on, or if it's just going to be a waste of ti... |
There are two main differences between the design patterns Factory Method and Abstract Factory.
Difference 1 is that Factory Method is mainly based on inheritance. A class in a way uses it's subclass to create objects. The objects created depend on the subclass used. While Abstract Factory is based on inheritance but i... |
In Java 8, interfaces can contain implemented methods, static methods, and the so-called "default" methods (which the implementing classes do not need to override).
In my (probably naive) view, there was no need to violate interfaces like this. Interfaces have always been a contract you must fulfill, and this is a very... |
We have a C# ORM module that generates queries. It logs generated queries and other information into the error/trace file. It is used by our web application. Most of our queries are generated dynamically (based on dynamic business rules and user interactions) which we have little control over.
Obviously the ORM module ... |
Use Case
What are the use cases for creating a one-to-one relationship where the parent points to the child compared to a child pointing to the parent? If there is no difference, is one preferred over the other?
Example
+---------+ +-------+ +--------+ +----------+
+ Parent + + Child + + Parent... |
What is better and why? (From interface-design point of view) :
a) To have two Show() and Hide() functions
b) To have one SetVisible(bool visible) function
EDIT: For example some object have visibility state and this functions is used to change it.
c) To have all three Show(), Hide(), SetVisible(bool visible) functions... |
During all my work I've been working with ORM, WS, integration services, viewmodel and so on.
The common stuff in all these kind of work is that I had to make mappings and not always the available framework are enough to help in this mapping.
The question which I'm wondering is: is a consistent part of the development ... |
We have been using SVN for several years.
Recently, we switched over to git, since some members of the organization pointed out that if our SVN server dies our team is toast.
So far, we've got something worked out with the git workflow, however some team members really do not like this git process. They want to simply ... |
To learn dependency injection in a current side-project, I am writing my own dependency injection container.
But this has lead me to wonder, at what point is it worthwhile to use a third party product vs "roll my own"? What would be the kind of questions you would ask to figure this out?
|
Background:
My collaborators and I are writing an article for an academic journal.
In the course of our research,
we wrote a simulation program in Java.
We want to make the simulation program freely available for others to use.
We have decided on hosting the code on a GitHub repository.
In order to make it easy for oth... |
I have a singleton object. It's a DAO that looks somewhat like this (pseudoish code):
class UsersDAO {
public usersDAO init(string sDSN){
variables.sDSN = sDSN;
return this;
}
public array getUsers(){
//do a query to get users, make into array
return aUsers;
}
}
my applications makes an ins... |
We have a large web site written in WebForms and have begun implementing some new modules in MVC. We have a custom CMS in place. I put the data structure to hold CMS data in a BaseModel class. Now I`m wondering where would be the best palce to put the logic which calls the CMS data manager to get data relevant to the p... |
Let's say Mr. A goes to cinema and he gets a movie schedule. There are N movies on the program today (1 < N < 50) and for every movie the time of the start and the time of the end are given in minutes. Mr. A wants to see as much minutes of movies as possible. But, there is one rule in the cinema: If a movie starts, you... |
This may be a terribly stupid question, but I can't find anything even related on Google (maybe I am not searching properly). I've been a developer for around a year now. I do desktop and web apps using Visual Studio at my day job and use a WAMP setup for freelancing. For storing data I have either used a database or n... |
I'm building a WYSIWYG designer in Ember.js. The designer will allow users to create campaigns - think MailChimp.
To build a campaign, users will choose an existing template. The template will have a defined layout. The user will then be taken to the designer, where he will be able to edit the text and style, and addit... |
I'm currently employed by a business to do website development in Wordpress. I've written a number of custom plugins specifically for a number of clients over the time of my employment.
Today, I asked my boss what I would be allowed to use as code samples because I'm quitting. My boss has forbidden me from taking any o... |
I need to make an architectural decision for developing (actually porting) my embedded solution on a tablet.
The choice comes down to Ubuntu or Android, so I have some specific questions to help me decide.
On Android, is it possible to develop applications outside of Dalvik, using Python? If yes, can I access the hard... |
Is it possible to determine the creation date of the mail account for the address supplied within the authentication process flow; Or at least determine that the mail account was/was not created the same day as signup (or specifically after confirmation)?
A use case is to flag such accounts for closer scrutiny as part ... |
I am working on a web api and I am curios about the HTTP SEARCH verb and how you should use it.
My first approach was, well you could use it surely for a search. But asp.net WebApi doesn't support the SEARCH verb.
My question is basically, should I use SEARCH or is it not important?
PS: I found the SEARCH verb in fiddl... |
When designing a RESTful interface, the semantics of the request types are deemed vital to the design.
GET - List collection or retrieve element
PUT - Replace collection or element
POST - Create collection or element
DELETE - Well, erm, delete collection or element
However, this doesn't seem to cover the concept of "... |
I am currently studying design patterns from the book (which, although I didn't try anything else, I find excellent) Head First Design Patterns.
I'm confused about two concepts: The Factory Method, and the Factory Method Design Pattern.
I was trying to understand what each one means, and I came to some conclusion. I'd ... |
I was hired about a year ago as the lead (well, really the only) developer on a new project/product we will call product "B". Product B was designed to pursue a new market for the company.
This company has had great success with a similar product for a different market. We will call this other product "A".
“A” is almo... |
For personal educational purposes I am making a site for a conference. One of the object that exist in a conference is a session, which has different states and in each state it has slightly different attributes:
When submitted it has a speaker (User in the system), Title and abstract.
When under review it has revie... |
this is a kind of data i have to de-serialize
{
"id": "M:11427",
"title": "DAX30",
"nextStartId": "S:727831",
"sections": [
{
"type": "HIGHLIGHTS",
"baseResults": [ values of type highlights ],
"hasMore": true
},
{
"type": "CHART",... |
I am developing a video conference application with the following requirements:
Audio works like call conference, where all participants may talk at the same time.
However, video works like broadcasting, where only one designated client broadcasts one video to the rest.
Clients will be Android devices.
One way of doi... |
I'm attempting to expand my knowledge of how database designs and concepts work. I'm working on a hobby web/mobile app for practice that will challenge me. However, I am running into an issue.
What my novel concept is that there are two buttons 'yes' and 'no'.
The buttons can only be clicked once a day.
If 'yes' is cl... |
I have a number of distinct Java utilities that are shipped together. Currently there are two startup scripts for each utility: a .sh one for Linux and a .bat for Windows.
I'm thinking of rewriting the startup scripts using Python, or perhaps Ruby, Perl, Lua or other scripting language. This way I avoid having differen... |
As a 30-year software developer, mostly in OO languages, but a newbie at python, I'm looking to find what is best practise for isolating unit tests in python.
Let's say I have the following, semi-pseudo-code. I know some_database_client isn't a real database client:
from some_database_client import connection
connecti... |
I have a C# class that represents a content type in a web content management system.
We have a field that allows a web content editor to enter an HTML template for how the object is displayed. It basically uses the handlebars syntax for substituting object property values into the HTML string:
<h1>{{Title}}</h1><p>{{M... |
Let me start by doing a small summary of the changes we did in our code in the last year. We have a software (VERY big) that is used to visualize multiples underground networks, enter data in the entities in the network and create simulation in this network.
In the 20 years of development of this application (in MFC C+... |
I'm working with a Java project that has several interfaces, many of which have only one implementation. (See related question)
For a given revision of the software, one could think this acceptable because the interfaces were some plan for future extensions. However, when I look at the 200+ revisions over several years... |
I am refactoring a huge legacy code class. Refactoring (I presume) advocates this:
write tests for the legacy class
refactor the heck out of the class
Problem: once I refactor the class, my tests in step 1 will need to be changed. For example, what once was in a legacy method, now may be a separate class instead. ... |
I've gotten into the habit of using excessively descriptive names. In addition, I've also gotten into the habit of creating the conditions for ifs like so:
bool user_is_female = user.get_gender() == GENDER_FEMALE;
bool user_is_warrior = user.get_unit_class() == CLASS_WARRIOR;
bool user_can_wear_battle_skirt = user_is... |
I'm wondering about functions used like this:
object1->objectMethod1(arg1, arg2);
if objectMethod1:
- does not change the object state
- does not use the object's state at all
- is used by the class extensively
- logically fits as being used by the class
should it be made into a member function?
example:
class CSV... |
I like using .NET MVC and have used it quite a bit in the past. I have also built SPA's using AngularJS with no page loads other than the initial one. I think I want to use a blend of the two in many cases. Set up the application initially using .NET MVC and set up routing server side. Then set up each page as a mi... |
Is there any specific reason they decided to go with Call by value? Is it for simplicity?
|
I have a team member who refuses to use any form of private source code repository on Github or Bitbucket due to "security concerns". As a result, we have a hard time sharing code with him. He appears to be concerned about source code theft by some party. To me, using cloud based source code repos is fairly standard... |
While it is relatively possible for an experienced developer to estimate how long it will take to implement code when the pattern and problem the code is solving is well understood, how can you make a good estimate when, while the end goal is well understood, the implementation is 95% theoretical/problem solving and ha... |
I'm a bit confused about how the 4+1 architectural view model maps to UML.
Wikipedia gives the following mapping:
Logical view: Class diagram, Communication diagram, Sequence diagram.
Development view: Component diagram, Package diagram
Process view: Activity diagram
Physical view: Deployment diagram
Scenarios: Use-c... |
Here's a common scenario that's always frustrating for me to deal with.
I have an object model with a parent object. The parent contains some child objects. Something like this.
public class Zoo
{
public List<Animal> Animals { get; set; }
public bool IsDirty { get; set; }
}
Each child object has various data a... |
This question regards the usage of the Decorator pattern to add little functionality to objects of large classes.
Following the classic Decorator pattern, please consider the following class structure:
For example, imagine this happens inside a game. Instances of ConcreteCharacterDecorator are meant to add little func... |
On the Nehalem+ architecture Intel CPUs what is the interaction between the L1 cache, L2 cache, L1 DTLB and L2 DTLB? On all the images I have found there isnt a clear explanation whether the CPU looks at the L1 DTLB first, then goes to the L1D cache, or whether it only goes to the L1 DTLB cache if there is a cache miss... |
What I'm wondering is how running programs communicate with each other, and if someone could post some sample code for how to do this, so I can try it out myself, just for educational purposes.
For example, I've worked with databases before, and in my code I always have to "establish a connection to the database." The ... |
I'm looking at developing a simple application in Java for a game which allows a user to keep track of which items they own and how much experience they have obtained while using the item. All of this data is input by the user.
What is the idiomatic/standard way to persist the data that is being manipulated (the model... |
I've been reading in basic concepts of OOP,as i'm trying to make this shift from transactional scripts to more oop manner in php, and i often come across this definition :
An object stores its state in fields (variables) and exposes its
behavior through methods (functions). Methods operate on an object's
internal ... |
So far my best ideas have been as fallows
A) Represent a "card" in one structure and have a "deck" in another
a deck being an array of 52 cards and a card being 2 chars one for and rank one for suit.
B) The second seems like it might be easier to manage but less obvious in code. Creating an array of ints each with a di... |
For example, a bit or a boolean can be either 0 or 1 so the number 2 is associated with it. Similarly, for a byte which is 8 bits, the maximum number of different assignments would be 2^8.
Is there a name for this number?
When we pass everything through our system that has ECMAScript, Java and MySQL, then a boolean doe... |
I am trying to design database for this case:
Assignments have vectors, relation is 1:N
Assignments have submissions, relation is 1:N
Submissions have executions, relation is 1:N
Every execution have one vector.
Business logic
teacher creates assignments and defines test vectors
student upload his solution, so rec... |
What is the current way to authenticate users in a mobile/global fashion? In other words, assume a mobile application. And if there is a database server in the backend, how would these users typically register/login? Is there a current standard for non-domain, non-enterprise authentication?
I was thinking just havin... |
I've been noticing lately, as I've played around with javascript, HTML5, and node.js for the first times that javascript seems to be a language that is used very differently (and with different syntax) depending on where it is used at. My observation with javascript is this:
-Front end javascript finds the JS embedded... |
I have an array of integers of length 20, filled with fourteen 0s, two 1s, two 2s and two 3s. It is like this:
[0,0,0,3,0,2,0,0,3,0,0,0,1,0,2,0,0,1,0,0].
I need a way to list all of its 20!/(14! 2! 2! 2!) permutations, without repetitions. (Note that in the list there are duplicate elements!)
I'm just looking for the ... |
What would be the best way to store data in a database for geographical calculations? Say I have an ItemsForSale table paired to a Users table which holds their geo location. I know I can use latitude and longitude to look up items that are within a certain mile radius by using Lambert's formula for long lines or the H... |
I've found a library (that I'd like to fork, if it makes any difference).
On NuGet, the project file says it's distributed under the MIT license (with a link to the license). However, in the GitHub repository of the project, I don't see any mentions of the MIT license (or any other license) either in the source code fi... |
I'm trying to decide if this might be a good idea to help reduce the size of some of my xaml resource dictionaries on a large project. Except I'm concerned about any potential performance issues going this route so hoping to get some insight from other technically proficient folks.
So as example, say there's dozens of ... |
I am very new to Git and I am planning to contribute to some open-source project on GitHub after discovering a small error in it. Upon forking it and fixing the error, I purposed a pull request and I noticed this showing up:
Failed — The Travis CI build failed
Looking into the details I discovered it was caused by ... |
I'm working on a simple application for a game in Java that allows a user to record whether they have collected a given item and how much experience it contains. This will work for multiple item types (weapons, armor) and each will have its own tab with a list of all items that qualify under it. Making changes as new t... |
So this may be a question that is born of my inability to properly express my intentions to Google.
In a fully connected non-directional graph such that any three points can be properly represented in a triangle in Euclidean geometry it would seem that a greedy first algorithm which chooses the shortest edge would find... |
I have ported libsodium and NaCl to .NET.
NaCl is the original project that is in the public domain while libsodium is a derived work from NACL and is using the ISC license. I looked at both projects to port the code to .NET.
For my project I prefer to use MPL v2, but I'm not sure I'm allowed to change the original li... |
I'm interested in learning how a virtual machine/sandbox actually works. I have developed an 8051 emulator and also wrote a dissassembler for x86, so this part of a virtual machine is not really the problem.
What I'm interested in, is the sandbox functionality of it. To illustrate what I mean consider this example.
Let... |
Memory refresher/My understanding:
A 2-3 tree is a balanced search tree that allows two types of nodes.
2-node: Normal node with two children.
LChild < Parent and RChild > Parent
3-node: Node with two parents and three children.
Parent1 < Parent2
LChild < Parent1, Parent1 < MChild < Parent2, RChild >Parent2
A... |
Does this IConvertible interface satisfy the Interface Segregation Principle (ie. the "I" in SOLID)?
Here is the definition:
public interface IConvertible
{
TypeCode GetTypeCode();
bool ToBoolean(IFormatProvider provider);
byte ToByte(IFormatProvider provider);
char ToChar(IFormatProvider provider);
... |
Sometimes I think it's useful to cite a webpage (e.g. Stack Overflow questions) to justify and explain a piece of code. Is this considered bad practice?
|
I'm trying to sort out whether this is just a personal preference thing or whether it's actually bad practice to do this one way or another. I did try to reference PEP8 first, and I did not see an answer.
What I'm talking about here is the use of more than one return statement. In these examples, it's not such a big de... |
The Composite design pattern allows us to call an operation() on a 'composite' node in a tree structure, and this operation() will be called on all of the children, subchildren and so on.
When an element's operation() is invoked, it is it's responsibility to call operation() on all of it's children, and so on. Each chi... |
I know three terms that have to do with storing objects or data. I'm not sure I understand the exact differences between the terms. Please confirm if what I'm about to write is accurate.
A data structure is a group of data types or objects of the same type, grouped together in some formation.
A collection is the same a... |
My application is currently quite a mess and I'm trying to untangle it all. My current idea is that I should have 3 separate layers:
data layer that knows how to keep stuff in database (and handle data schema changes, so it's not really that trivial)
domain layer (is that correct name?) that does all the magic changin... |
Apparently naming things is one of the hardest things in programming..!
I have a synchronisation implementation which uses timestamps (number of seconds since unix epoch) to sync.
Currently, the timestamps have simply replaced an older revision field. My question is, does it make sense to name it "Revision" or is "Time... |
I get how to do a derivation of a BNF. My text books do a good job of explaining it (much better than the on-line lecture notes of many profs etc). Example below then my questions:
<program> => begin <stmt_list> end
<stmt_list> => <stmt>
| <stmt>; <stmt_list>
<stmt> => <var> = <expression>
<var> => A... |
As an Android developer, the target market I create apps for is very fragmented. While I can specify certain requirements - e.g. my app only supports Android version x.x or above, sometimes errors may occur that are only evident on one specific phone model.
Are there any strategies to handle device-specific errors, wit... |
Recently, I've stumbled across question about predicting the output of code which heavily uses post/pre increment operators on integers. I am experienced C programmer, so I felt like at home, but people made statements that Java just blindly copied that from C (or C++), and that this is an useless feature in Java.
That... |
how would you recommend for me to design an android app where i want it to
1) send location update every 10 minutes
2) to show push notification
I want both actions be available even when the app is closed.
Here i might ask for your explanation what "closed" states an app can be in?
a) removed from recent tasks stack... |
I saw that the Unreal Engine is going open-source on github (see link1 and link2) and that made me wonder: "is open-sourcing a previously commercial engine a smart move?"
What's the benefit to Epic Games in open-sourcing their core code in this manner?
How can they not be concerned about people stealing parts of it ju... |
I've spotted a nice WordPress (GPL) theme for sale.
I know somebody who bought it.
I have 2 questions:
Has the company selling it the obligation to send the source code to whoever (customers or not) ask it?
Can the person who bought it give me a copy for free which I could use in production?
|
this says header files are bad design, but I don't know why. The answers specified there are about the inefficiency of header file when building. Why it is bad design is not really touched upon.
As far as I know:
- headers lets you break the source file up so you can compile smaller things faster
- headers lets you s... |
The Question
What are the origins of the Public/Private function paradigm?
Background
A question came up in chat about Header files in C, and their usage being mainly to help the compiler, not the programmer. It's my understanding though, that this is the first usage of the concept of "Private" functions, or functions ... |
Is it bad software design to have JDBC/raw SQL and also use an ORM? I don't mind using an ORM for boilerplate CRUD, but some queries are better in SQL (for me). I'm not arguing for or against ORMs. I've read about them until I'm blue in the face.
I used JDBC in my question, but it could have been DBI, or some other ... |
Requirements:
My application is latency sensitive. Millisecond level responsiveness matters. Not all the time, but when it acts, it needs to be fast.
My application needs to log information about what it's done in those times.
The actual writing of the logs does not need to be that fast, just the actions.
However, th... |
I'm new to Javascript. I'm learning the concept of hoisting in Javascript.
Based on the Javacsript tutorials in Mozilla website, I came across this word hoisting. According to those tutorials, variables in JavaScript is that you can refer to a variable declared later, without getting an exception. But, my question is o... |
I am preparing to write a database system using PHP and MYSQL which will store every piece of info sent to it as an individual row. Each row will store several piece of meta data (time stamp, who created it, version number, attribute number) and one piece of 'true' data (file name, phone number, username, etc.) Rows ... |
How do I call functions defined outside a source file given you shouldn't use header files?
-- EDIT: generic(?) question below
So, first, a problem should be broken down into simpler subproblems. Then, each subproblem is solved by implementing new code for a subsolution or reusing an existing subsolution. If done cor... |
In c++, is there any other way, besides header files, to use a function defined in file A.cpp, inside file B.cpp that would be considered good programming practice?
|
I have a class named Product, which takes a product model number and number of wheels for that product as part of its creation information, and then it instantiates the product by doing a computation on the number of wheels and on various base parameters
For example, Product(5, 22) creates a model 5 product with 22 whe... |
Consider a service which updates PersonDetail tables in database. I am Using EF which maps the table to this Entity. When a record is updated, it is not actually updated but a new record is created and old one is made history by setting HistoryCode to 0
Class PersonDetail
{
int age;
Date birthDate;
DateTime effec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.