instruction stringlengths 34 19.9k |
|---|
Is CSV considered a good option against XML and JSON for programming languages?
I generally use XML and JSON (or sometimes a plain text file) as flat file storage. However, recently I came across an CSV implementation in PHP. I generally have seen CSV used for inputs in Excel files though, but I have never used it wit... |
Are design patterns (e.g. factory pattern, observer, etc...) required to be known to write good code?
I often have no idea of what people mean when they talk about inserting pattern name here pattern and sometimes I realize I‘ve implemented that pattern without knowing it even had a name.
I‘m a self-taught programmer ... |
This question might seem strange, but it's something I've faced sometimes. I've been trying to adopt DDD, however I'm always facing the problem of anemic domain models. The problem is that when I start to think about what should be the behaviors of the domain objects, nothing comes to mind. I've started then to seek on... |
Recently I learnt about a new methodology based on waterfall and scrum: Water-Scrum-Fall.
Some say that is the new "reality" and is what scrum pragmatist use nowadays....
But, from the definition of "Avalanche":
The Avalanche model is a Software Engineering project management
anti-pattern, it is a combination of a ... |
I found this statement from the gang of four's "Design Patterns" particularly odd; for some context, the authors are comparing inheritance versus composition as reuse mechanisms [p. 19]:
"...you can't change the implementations inherited from parent classes
at run-time, because inheritance is defined at compile-time... |
The problem
C# project consisting of WCF services used by a Flex application.
A customer may request a functionality change that requires me to alter code to work just for them. It could be a single line of code in a method or maybe a method acts in a totally different way for customer x.
My Ideas
Use branches for cus... |
I am using signals (specifically Boost signals2) to create an event driven protocol API and model.
Most elements have their own signals, and there are usually multiple of each element.
Consider a basic entity, a user; amongst others, the user may leave the system, so I need to have a leave signal.
The question is, shou... |
I am not sure what is the best way for the tasks below: threads, AsyncTasks, Loopers, services? Why? Are there other candidates?
I need threads/Tasks/Services/other for:
Plotting data, (refreshing should be done let's after after specific amount of data has been read)
Generating data, (must being done during whole app... |
I know log rotation is a feature seen in application servers like Oracle's Weblogic. I would like to understand:
What is actually meant by log rotation?
What is it useful?
Who performs the task?
Is this duty performed by the logging frameworks that the developers use or is it handled by the servers themselves? Would ... |
I want to know what should I write in copyright part? I mean the copyright part when you right click on the executable, click properties, and click the details tab.
I was developing a little tool that parses some information from output files. It's been a year now and somehow it became something more than a simple, per... |
I'm working on a modest sized web application that receives circa 30k unique users per day, this is an MVC C# application hosted on 3 web servers and backed by a single SQL server, everything is hosted in one data center.
The issue is we are seeing dom complete times upto 3 times slower in some parts of the world. We ... |
I have been reading (and watching presentations) about subjects like: DDD, TDD, BDD, SOLID (principles), design patterns, clean code, clean architecture, agile project methodologies.
All in all I have quite a clear view on how to approach agile software development. Especially the DDD part really helps in communicating... |
I'm refactoring some custom JavaScript modules written to support our mapping functionality. I'm looking to make them much more unit-testable and be able to plug pieces in and out more easily.
My question is related to having UI manipulation and business logic be in the same module. I know that having the UI part makes... |
I am very new to HTML5 (and web coding in general), and I am trying to create an interactive calculator. I will try to explain this as clearly as I can.
The basic idea is that the user will use pre-set equations to add numbers with the calculator. All of the buttons on the calculator will have an animated 'push down' e... |
I'm wondering how I seamlessly include a JavaScript unit testing framework into my workflow.
The context is, we have an existing data processing algorithm + webapp to display it, with no automated testing or continuous integration.
We use Eclipse as our IDE.
For the webapp JavaScript modification, it would be nice to... |
I want to pass a parameter to a function as below for clarity. It doesn't give any error. But is this a bad practice. Do I have to avoid this.
test('','','',$d='text','');
function test($a, $b, $c, $d, $e){
}
|
With relation to what's considered good OOP engineering principles, SOLID, DRY, KISS etc
I am wondering whether to complete multiple tasks within one loop when easily done.
The problem is that this conflicts with some principles (SRP), but could also partially lean in favor of others (DRY, KISS).
A simple example would... |
I have read that we should only catch exceptions that can be handled, which makes catching the base exception class (C# in this case) a bad idea (on top of other reasons). I am currently part of a project in which I so far have yet to see anything but the base exception being caught. I mentioned that it is considered b... |
I have an app that have multiple users. In my app an user can
- create contacts (people)
- edit contacts
- view contacts
- create an entry to agenda
- view entry from agenda
Also I need that User A is allowed to view User's B contacts but is not allowed to edit that contact.
User B can view and edit User's A entries in... |
In the following image for the State Pattern from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET
I'm trying to persist the SalesOrder entity into the database. Normally I would have a salesOrder table in my database with a field currentState pointing to the current state of the entity.
This i... |
I'm wondering how should testing take place in small teams (or start-up teams).
I'm talking 5-10 developers that are assigned to multiple development tasks.
From my experience there is little to none testing in the development process, but I also hear small teams can get through the initial level of software process ma... |
It is considered better to have a separate factory class than having static methods in same class. See this question.
But the standard API uses both approaches.
Separate factory:
DatatypeFactory.newInstance().newXMLGregorianCalendar(...)
Static methods in same class:
Calendar.getInstance(...)
Why is this? In what cas... |
I am a experimental physicist. In our research, we have our experimental data in a 400*400*400 matrix(x, y, z axis of a 3d space), each entry is associated with a value("brightness"). We expect the brightest entries will form a closed path in the 3d space. But some portion of the path is always too dark to identify, al... |
Historically a HLL is something like C, Fortran or Pascal and a VHLL is something like Ruby or Python. I am familiar with the terms 4GL, 5GL, DSL and LOP, and those who aren't should read Wikipedia for the definitions. I'm looking for UHLLs.
My question is: are there any computer languages out there which are another o... |
Let's say we have a website requirement to allow User functionality. Simple!
We create the UserModel, UserController and UserView. Works perfectly.
However, let's assume that User has a many-to-one relational table connected to it titled Child which also has its own MVC components: ChildModel, ChildController, ChildVie... |
I have observed a strange trend in the company I work at.
There are people who insist that there should be a list of tasks. They estimate those tasks, implement them, and try to meet their commitments. However, while they are coding, the requirements are likely to change. The priorities shift, the tasks increase or dec... |
I have several types of XML document.
The format of (i.e. the elements in) each document type is defined in an XSD.
Is there a convenient way to create HTML elements (or ASP.NET controls) on an ASP.NET form, to display/edit the elements in (contents of) an XML document, given the XML document and/or the document's XSD ... |
I am developing a jQuery mobile app. In this app, i often use Mustache.js templates in separate html files. Actually, every template is needed by the user, but my app loads a template (via GET method) only when it is needed.
For now, all the templates are small and they're all used by the client at runtime. But obvious... |
I have made a simple application which searches for files and folders on users computer. Since, I am a student currently in my 1st year and don't have any formal training and have made my application while I was still learning C# and .Net framework, I didn't have knowledge about unit tests and other good testing method... |
We are putting together an API to provide our vendors some simplistic direct access. I've built APIs before, and have always routed them as such:
{controller}/{action}/{id}
My boss, however doesn't think that's intuitive. He thinks we should route our API like this:
{controller}/{id}/{action}
His reasoning is this: "... |
I'm attempting to try out using unit test in for the first time in new iOS activity for work. I love the idea of unit testing, but always find the specifics to be... messy.
I get the general principals -- I have read a lot about it so I wanted to ask a specific question.
My situation:
I have a UITableView that can ha... |
I'm building a report for an end user.
They would like to see a list of all widgets... but then also like to see widgets with missing attributes, like missing names, or missing size.
So i was thinking of creating one method that returns json data containing all widgets... and then using javascript to let them filter ... |
I have a Entity Framework Database First Model.
I want to write a MSTest/nUnit test to verify that all the stored procs, tables and views that are defined in my edmx model are still valid on the database.
|
So I've lead the charge with my fellow engineers to, at the very least, start "thinking" Lean. We hit on a few major areas of waste, and 2/3 lead to the exact same point..."Extra Features". We dogfood our own software on two fronts, sales and project management. It works great for sales, because that's what a CRM is gr... |
First some backgrounds, I'm interning at a company that makes parallel processing hardware.
We're currently working out the design for a component of our driver that is supposed to evolve over a few generations of our products. The next gen is still in simulation phase and the specification we have now may change when ... |
A few sprints ago I was assigned a task that was primarily research. I had to figure out how to get our product to interoperate with a very complex black box that we did not develop.
I couldn't think of a way to estimate this work. Even if I got the ball rolling and knew the immediate problem I faced, I could not g... |
Here's a basic example of what my unit test needs to be, using qunit:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link rel="stylesheet" hre... |
I can certainly see the need for CLAs with a terser license like MIT or BSD, but the more verbose Apache seems to already have that type of verbiage in it. I would prefer to not add this level of complication an open source project if it is not necessary with the Apache 2.0 license.
CLAs seem to primarily grant a copyr... |
I am working on a project where I'd like these licensing terms:
Allow unmodified redistribution, with attribution to the author
Disallow modified redistribution
Non-commercial use
Now the CC BY-NC-ND 4.0 license is perfect for this... however, it does not cover any software topics, and CC themselves say that you shou... |
I appreciate the need for a Contributor License Agreement (CLA) in open source software projects and even understand that some tools are starting to make this process easier (like the low-friction CLAHub for GitHub and Project Harmony). However, rather than requiring a third-party form submission for an electronic sign... |
First, I want to say this seems to be a neglected question/area, so if this question needs improvement, help me make this a great question that can benefit others!
In my experience, there are two sides of an application - the "task" side (where the users interact with the application and it's objects where the domain m... |
I am working with Forgot password, where I have single EditTextBox and a single submit button.
So whenever I am opening this Forgot password page, my keyboard is opened at the start of this page.
In my mind there is a question that it is not a smart choice to open a keyboard at the start of the Forgot password Activity... |
First, I want to say this seems to be a neglected question/area, so if this question needs improvement, help me make this a great question that can benefit others! I'm looking for advice and help from people who have implemented solutions that solve this problem, not just ideas to try.
In my experience, there are two s... |
For the last 3 years I have used git on an almost daily basis for all my pet projects and at work for small projects that were not in the global SVN repository. My workflow is quite similar to the famous git branching model from http://nvie.com/posts/a-successful-git-branching-model to sum it up:
I work in branches, o... |
There are various refactoring options in Visual Studio to use at the time of coding. When we extract and create a new method. Then Visual Studio decide whether the new method will be static or instence depending on the usage inside the new method. If that method use some intence member of the class then it creates as i... |
We have 6 people in my group. My boss and the others are all SQL developers with little understanding of programming, design patterns, good object oriented design, etc. But, they have all taken a Java course in college.
When new projects come up, I am usually asked to give a time estimate for how long my part will ta... |
I got probably "micro optimization" problem.
I got "History number", "Next Number", "Reset" buttons, as well "label" for text.
Every time I click At "Next number" button I would like to show random number in the label, and add this number to history array where I keep track of the past number.
Every time I click at "Hi... |
I have some javascript that creates a canvas image that I want users to be able to share. I simply need to save the image somehow. Nothing else.
I've been contemplating using bits and pieces of ruby and activerecord, or perhaps sinatra but I feel like both would be over kill for this simple task.
Ideally I'd like to d... |
Many Builder Pattern examples make the Builder an inner class of the object it builds.
This makes some sense since it indicates what the Builder builds. However, in a statically typed language we know what the Builder builds.
On the other hand if the Builder is an inner class, you should know what class the Builder bui... |
I work for a company that is moving heavily into mobile. We find the majority of our customers use our mobile app pretty regularly.
We have tons of things we want to add to it -- as well as to deliver all these new features on Andriod- and iOS-native apps.
But I wonder how big we could possible make a mobile developme... |
I work for a company of <60 people. I understand that larger companies typically are ISO9000/9001 certified, as a matter of quality assurance. I also understand that for a company my size, such certification is not cost-effective. However, one could still make a case that as a matter of QA best-practice, I think it mak... |
Using third party libraries for productivity gains in software development is common. Unfortunately, along with the library's functionality we also import its bugs. Some of them get fixed in subsequent releases. So, to upgrade or not to upgrade, this is the question.
I am interested in learning from experiences when... |
It seems commonsense nowadays that polling is a bad practice and pushing is the way to go when developing mobile applications that require to constantly receive data from a remote server.
All major mobile shops provide their version of a push notification service:
Apple Push Notification Service
Google Cloud Messaging... |
in my current project have:
module Stats
class Site
...
end
class Product
def initialize(product_id)
@product_id = product_id
end
end
class Profile
...
end
end
now in my Product class have methods to get/set product views(day, week, month) and methods to get/set product sales(day... |
This is less a question about the nature of duck typing and more about staying pythonic, I suppose.
First of all - when dealing with dicts, in particular when the structure of the dict is fairly predictable and a given key is not typically present but sometimes is, I first think of two approaches:
if myKey in dict:
... |
When working with user interface based Java programs, one way of attaching behaviour to a certain actions (e.g. to a button click) is through the use of anonymous classes. In the example below, the GUI framework is SWT, however I have the same issues with Swing or Android UI components. Namely the structuring of my pro... |
Let's say we have a function like this:
public void myStart()
{
for (int i = 0; i<10; i++) myFunction(i);
}
private int myFunction(int a)
{
a = foo(a);
a = bar(a);
return a;
}
private int foo(int a)
{
//do something here
//something gnarly here
//etc
return aValue;
}
private int... |
Lets look on a simple example: assume that I have three classes implemeting IPersonRepository: SQLPersonRepository, WebPersonRepository, InMemoryPersonRepository. I also have PersonRepositoryFactory class which is simple Factory method pattern implementation - contains GetPersonRepository methods which have enum/string... |
There are currently multiple approaches for building web applications:
1. Server-side only
This is a classical approach where you render pages on the server by a web framework like Ruby on Rails, Django, Express, Play! Framework and etc.
Typical workflow: Build all your business logic, models and view templates on the ... |
About a year ago I had an idea in mind which was using my friends computers to help me process my data, so I programmed a socket server application with boost::asio, and gave the client part of it to my friends.
When they connect they send the server (my machine) a message containing their computer specs (available cor... |
Is it any indications of poor programming if the support staff for a given product requires you to clear the cookies in order to troubleshoot issues with their web-site?
As a point of example, if you're trying to activate a new SIM on a tablet, and the carrier's activation web-site is giving you an error message that t... |
Where can I find Turbo Pascal dialect description/reference? Is it still availiable in some place? I'm looking for the famous Turbo Pascal dialect description/reference(yes, the one from 80s/90s time) but I'm not having luck with google.
|
The way i am doing it now is using boost::asio TCP sockets handling everything manually with a main server that orchestrates the processes between the available machines, but the number of machines is increasing and when i need communication between specific machines i have to do it through the server and the number o... |
What kind of problems have you encountered when building plugin interfaces for your application? And how did you resolve them?
Background
I want to refactor an application so that various features can be moved into plugins, allowing them to be easily added and removed in future.
I hope this will be a neater system tha... |
This is a very naive question about input validation in general.
I'm a MATLAB user (1.5 years old) and I learned about input validation techniques such as "parse" and "validatestring". In fact, MATLAB built-in functions are full of those validations and parsers. So, I naturally thought this is the professional way of c... |
I have a test database with few user accounts. I don't want to break any tests.
If I am writing a function that updates password for user in db and one that reads the password.
Should I ideally reset the password to the previous one, once I am done testing update function ?
I have never written unit tests before, so I ... |
I've recently started a new job and I've been tasked with completing a feature that another developer didn't finish before he left the company.
The existing tests are out of date (i.e useless)... technical debt everywhere. I think it would be a very bad idea to implement features without tests, I've put this across to ... |
I program and I am dyslexic. My vision is excellent. I do poorly processing symbols and am a visual thinker.
When I code, I'm slower than normal people because I am unpredictably unaware of the errors I make. I am learning python and the text only development environments cause me a lot of visual stress; I am using Win... |
I'm writing a brief for a new starter at the company.
I've pointed out the aims of what I want to achieve and now I'm writing some suggested (but not concrete) solutions.
For each of the aims, I'd like to suggest a fast, dirty method, and a slower, but more robust solution. I don't mean 'dirty' as in uncommented and un... |
I am trying to implement a graph data structure in C#. I have the following interfaces:
public interface IVertex<TValue>
{
TValue Value { get;}
VertexList<IVertex<TValue>> Neighbours { get;}
int InDegree { get;}
int OutDegree { get;}
}
public interface IWeightedEdge<TValue, TWeight>
{
IV... |
Given that all else is equal, and there are no coding standards defining the best approach, what would be the recommended way in C++ to check that a value exists and return it if it does?
For example, something like one of these declarations:
bool getMethod(double& ret);
double getMethod(bool& ok);
void getMethod(bo... |
Suppose there is a function get-data which returns a map of information about the id of the user passed in. Now this function uses 3 functions source-a, source-b and source-c to get three different kinds of maps. Now we combine all these maps into one map and return from get-data.
When I test get-data, should I test fo... |
I'm the main author of a multiplatform free software/open source GUI program. Although the program gets thousands of direct downloads per month, I have no idea of the number of people regularly using it. It is also included in some Unix distributions and download sites making the counting harder. It would be interestin... |
I'm trying to use Shake and I stumbled upon the following problem: there's no easy and convenient way to interpolate a string. I know about Text.Printf — it's not what I'm looking for. The interpolation syntax I'm talking about is like this:
(Make)
HEADERS_DIR := /some/path/to/dir
CFLAGS := "-g -I$(HEADERS_DIR) -O2"
... |
Java 8 has a whole new library for dates and times in the package java.time which is very welcome thing to anyone who has had to use JodaTime before or hassle with making it's own date processing helper methods. Many classes in this package represent timestamps and have helper methods like getHour() to get hours from t... |
I'm not sure how to proceed in the following situation.
say we have a function as so:
def runsATask(codes):
myDicts = [helperFunc(code) for code in codes]
for item in myDicts:
# some logic.
Here's the problem, codes is some iterable and should be either a list or a tuple, ie it should be used as so: ru... |
Trying to build a case against this as we have a developer that likes to use class properties in place of methods. I think it's a bad idea. In some cases he is accessing the data layer inside the setter and getter.
here is a snippet of code, what are your thoughts on this?
private Dictionary<string, List<string>> _acti... |
I have a proprietary project, with parts of it written in javascript. We would like a software license to include in the header file for this code which ensures the work remains:
proprietary
cannot be reverse engineered (as it will be obfuscated / minimized)
cannot be reused elsewhere
cannot be linked to
does the D... |
When I see the term pattern in a description of syntax I infer a regular expression is being specified. Is there a separate term that specifies a wildcard expression?
^foo.*(bar|baz){3} <-- 'regular expression' or 'pattern'
foo*bar.txt <--- 'wildcard expression' or ...?
Or is a wildcard expression just another... |
I understand that a process a unit of resource ownership and executable instructions. Threads allow a process to share its resources with multiple executions, and it's easier for an OS to schedule threads because of all the overhead associated with whole processes.
But why the name thread? Does it have some reference t... |
I don't know how a 4-bit instruction could be enough to do something so I read about the Intel 4004 and it says that it used 8-bit instructions and then I can understand how opcode and numbers has enough digits.
Is it true that there never were any 4-bit instructions and that 4-bit systems use 8-bit instructions?
And ... |
I am building a small application and I am trying to understand the best way to approach the design. I am looking for some guidance/advice how best to approach the following issue.
What I have is that I receive a set of data, real time. I then analyze the data for patterns. The patterns are classes that derive from an... |
After so much research, I thought I should ask the experts.
I am working on a project for my corporate employer, we have android and iPhone mobile apps that make request to a web service, the request is logged in pending state for processing.
A windows service retrieves the pending requests and spins a new thread for e... |
I am building a small application and I am trying to understand the best way to approach the design. I am looking for some guidance/advice how best to approach the following issue. Please bear with me. Thank you.
What I have is that I receive a set of data, real time. I then analyze the data for patterns. The patterns ... |
I am seeing the benefits of Portable Class Libraries for centralizing Models and ViewModels to a single code-base. Where should dependency injection management (IoC container) take place, though? My Models have dependencies that I believe would benefit from being supplied through injection. I'm not sure how to go about... |
I have a style question about overloading methods/constructors. I have a constructor which
does something very simple, and then calls a method with some side effects. Sometimes however I don't want the side effects so I made a separate overloaded constructor. I show two versions here. Version 1 is simple: if I pass an... |
What are the main benefits of Facebook's React over the upcoming Web Components spec and vice versa (or perhaps a more apples-to-apples comparison would be to Google's Polymer library)?
According to this JSConf EU talk and the React homepage, the main benefits of React are:
Decoupling and increased cohesion using a co... |
I am looking for a good analogy to help the concept of a method in ruby stick in my head. When I truly understand a concept, an image flashes in my mind that relates something physical to the abstract concepts I am trying to learn.
For example, someone explained the concept of a variable to me in the following way:
A ... |
NOTE: This is in reference to the question I asked on Stack Overflow but was told to post this here
I'm building a trading application that matches buyers/sellers that own subscription. Subscriptions have a certain quantity amount for a certain duration of time. There are 8 order types which are:
Buy/sell subscription... |
I am about to start a new project and I cannot decide if I should pick OCaml or Lisp for the project. My main concern is about the difference of productivity — if any.
I program OCaml since 1998 and, while I neither tried to measure this precisely nor to even define precisely what the productivity I would like to mea... |
I'm searching an algorithm to store my data (which are moving objects' coordinates) and allow me to query objects within a specific radius of a specific point.
I came up with R* Tree which is said as good solution for geographical data, but as I studied further, R* Tree stored data in secondary memory and its data most... |
I see many examples of libraries that use a 'chunker' and also people asking how to write chunkers, but what is this for and why do we need it? Isn't it enough to split a text by whitespace or other characters that delimit boundaries between words?
|
By non-MVVM code, I mean things like highly generalized components, like one with common extension methods for CLR types, and other 'homeless' helper classes etc? I have a Core project that most others reference, but to resolve circular dependencies I had to refactor the extensions to another project. This seems a comm... |
How would I express the speed of the following sort algorithm? I know bubblesort is n^n (er, I mean n^2...as someone pointed out below). In the following the array decreases each time you call it recursively.
thanks.
$myarray = array("21","4","8","8","1","2","19","21");
mysort($myarray);
function mysort($myarray,$so... |
I am trying to make an UPDATE STATEMENT generator using C# Winforms. I would like to build a statement generator which will print statements like this:
UPDATE Customers
SET ContactName='Alfred Schmidt', City='Hamburg'
WHERE CustomerName='Alfreds Futterkiste';
But my problem is, how can I let the user paste in multiple... |
input: C matrix 2xN (2D points)
output: C matrix 2xM (2D points) with equal or less points.
Lets say we have C matrix 2xN that contains several 2D points, and it looks something like that:
What we want is to group "close" points to one point, measured by the average of the other points. For example, in the second im... |
This was a question proposed by a friend of mine. Define an algorithm that, given 40 unique integers in the range 1-1000, returns 41 unique integers in this range. Given these 41 integers, we must then be able to map them back to our original 40.
Does anyone have any insights? I have an idea, but it definitely isn't e... |
In RFC 2617 HTTP Authentication: Basic and Digest Access Authentication they speak always of username and password for the authentication.
Why should I choose to take a username as identifier for a website? Usernames are often hard to choose a not existing one or one which is unique. But everyone getting an account som... |
SELECT
* #Case 1
cp.* #Case 2
FROM crawl_page AS cp
LEFT JOIN artist AS a
ON cp.cpURL LIKE CONCAT('%',a.artistPageID,'/',a.artistPageURL,'%')
WHERE cpPageType = 'SONGS'
AND cpPageAdded < (
SELECT cpCrawlDate
... |
So I need to code a simple program, and I need to define 2D coordinates?
Is there any coordinate system I can use in Fortran?
I was told it might have to be all in arrays? And if so, can anybody push me in the right direction as to how to set up 2d arrays?
Many thanks.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.