instruction stringlengths 34 19.9k |
|---|
I am rather new to writing applications that interact with databases, and I'm curious about a project I'm working on. I have to write a very simple web app which is going to be displaying metric data based off a handful of various queries (probably not over 15) to various database tables. Based on my own research, Spri... |
Does it violate REST principles for a REST API to support a batch of operations (perhaps with transactional guarantees) that can be added to a queue via a POST?
This design seems outside the scope of REST architecture but not necessarily in violation of it, but I'm looking for authoritative sources here, and/or support... |
My game reads a number of JSON files, deserializes them, and hands the resulting objects off to the classes that need them. These deserialized objects, which can be thought of as the domain model, are normally very simple:
public class Settings
{
public bool FullScreen = false;
public int WindowWidth = 800;
... |
I have two libraries that implement a protocol: one provides tools for establishing a channel between two parts, and the other provides classes and tools for building and parsing the binary protocol messages.
These two libraries can be used independently, they don't depend on each other, and each has its own build setu... |
I have a C source file and another (non-code) file in a project which contain the same hard-coded value. Ideally, the value would be specified in only one location and be copied to the other location automatically during the build process. It's not hard to think of hackish ways to accomplish this task, but I want to kn... |
I'm responsible for designing a dashboard and data manipulation front-end for a sale transaction database and am not quite sure what type of architecture to use. The database is populated by an external ETL system.
The required functionality for my app is very simple; it must display a few alerts of exception condition... |
In my application, I'm currently creating a single instance of a UserPrefs object at startup, then passing a reference to that object to multiple other objects through their constructors.
I am doing this because it's important that multiple classes have immediate access to any real-time changes the user makes to their ... |
If two Scrum teams use the same software component, who is responsible for providing a clear architectural vision of that component and maintain/develop this vision as the code base evolves? In Scrum you are supposed to have a collective code ownership, so how to make sure that development done by Team A doesn't interf... |
I need to build a new web application and I am looking for advice on how to manage communication to my API layer. My goal is to have complete separation between the front-end and back-end code. Like most, I plan on having a front-end server to serve the views, while the back-end server will expose my API layer.
I am ... |
In real-time games, there is always a game loop that runs every few milliseconds, updates the game with new data and repaints the entire screen.
Is this something that is seen in other types of applications, other than games? A 'constant-update-loop'?
For example, imagine an application like MSPaint. The user can draw ... |
In building a software from scratch, there is necessity to conduct detailed needs assessment and find out what the clients/stakeholders really need.
When interviewing the end-users, organizing workshops or directly participating in business process for which the software product is written, there are many requirements ... |
I couldn't find any links or books claiming that Lisp is the first programming language to adopt structured programming (actually, most of them don't even mention Lisp at all), but if conditionals were invented by McCarthy and got into Algol later, is it fair to say that Lisp is the first?
|
So I'm creating a very simple project/task management application in Laravel 4 and I'm not sure how these relationships would work. I have a Project, Task and User model. A User can own a Project or be a member of a Project. A Task belongs to a User and a Project.
What is the best way to define the User/Project relatio... |
I have a system which needs to do cross-origin requests and having trouble understanding the relevance of CORS. At first glance it doesn't appear to provide me with any type of security I'd actually want for my service.
Since CORS is honoured only on the client side my server must still make zero assumptions about the... |
Say I'm making a snapchat clone app for Android and iOS. Let's say that I get a snapchat from Baz. I want to pre-download the audio for this snapchat. However, as the developer, I want to secure this audio from being viewable outside of the app.
I've been thinking of encrypting it using AES with an IV and key that are ... |
My first try was on stackoverflow. I'm picking up on the answer there to improve my monad: StackOverflow - Is this a monad in Java?
My goal is to write an example of a monad. I'm not trying to solve the general case, just come up with one to see how it works. If I'm right, then I really like this pattern. I've already ... |
I'm interested in creating a Database as a Service.
I want users of the service to be able to do a few seemingly not very simple things.
Sign up and be given access to a JSON datastore that they can easily query from a RESTful API.
Now I've implemented RESTful account management with Eve in python, so a user can sign u... |
I'm trying to automate the process of sending many domain name lookup requests.
I tried to do this by sending for example http request to domain registry site like Whois.net, but I notice they block you after several attempts.
others like networksolutions adds token to the page to avoid automated requests.
Is there any... |
So we estimate the story and put tasks on the board. Then during the Sprint the UX guy comes up with a user experience for the story that is more complicated than what we originally thought. So on one hand we want to implement the right feature for the user, on the other hand if we had known about the complexity of the... |
I am writing a cross-platform (OS X and Windows) desktop application in C++11. I intend to use the same C++11 core on both platforms, utilizing native frameworks for the UI (Cocoa and Objective-C on OS X and WPF and C# on Windows) as I believe the best UX experience is a native one.
Currently the application runs as a ... |
As the title states it, I would like to get some suggestions about putting knowledge into action.
We have many additional requirements that concern: coding practices feature development (all of them or only a subset), process, etc. The problem is that we have problems with introducing those practices into new projects ... |
I am a C++ programmer. I would like to use DSP algorithms in C++.
Is understanding the science behind Digital Signal Processing a prerequisite to implementing DSP algorithms?
|
Set the WABAC machine, Sherman. This question is about BASIC in general, and Microsoft's BASIC-80 in particular. Old school basic. With line numbers.
How do (or, rather, did) old-school BASIC interpreters handle FOR...NEXT loops when the loop body was not executed, and the NEXT statement appeared out of order?
An ou... |
I need to build a site for a mobile app that allows users to sign in with facebook/twitter or sign up as a new user (traditional username/password).
No matter which method the user chooses, they should remain login until they choose to logout.
While signing up as a new user is straight forward, using username/password ... |
I have an old plotter that can't handle printing true spirals. I need help with developing an algorithm to approximate a spiral.
Here's a LISP sub-script that I have written which uses semicircles of varying radii to draw a spiral:
(setq inner_radius 1e3) ; The spiral grows from inner radius to outer radius
(setq coi... |
Like a data stream in general, this can be an I/O stream or memory stream or a file stream or what not.
I understand that it's some sort of stream of bytes, that you can read to parse very large amounts of data if needed, what I don't understand however, is how it works.
Is it possible to 'miss' data from a stream if y... |
Some or all of the tests I write and run are checks for consistency e.g. assert that if I create a new user account, that the account that was created actually has the same name as the name that was submitted in the registration. And now for checking that I implemented a pagination correctly, I suppose I can check that... |
What is difference between protected static method and protected method? For example demo and demo2 in Data2 respectively
Data.java:
package pack1;
import pack2.*;
public class Data extends Data2 {
public static void main(String args[]){
System.out.println("From main class");
Data d=new Data();
... |
When Murray Gell-Mann was asked how Richard Feynman managed to solve so many hard problems Gell-Mann responded that Feynman had an algorithm:
Write down the problem.
Think real hard.
Write down the solution.
Gell-Mann was trying to explain that Feynman was a different kind of problem solver and there were no insights... |
I am looking into finding an efficient way which can scale up to thousands of restaurants, for doing a reservation search. Ideally, it would be efficient to answer queries like find a restaurant which has availability for 6 people at 19:00. Time slots are based on 15-minute interval, e.g 19:00, 19:15, 19:30, ...
I am... |
Why isn't this allowed in VB.NET:
New SqlCommand("some string", someSqlConnection).ExecuteNonQuery()
Why would the language have been designed to require that this be used instead:
Dim com As New SqlCommand("some string", someSqlConnection)
com.ExecuteNonQuery()
It doesn't seem to me like it would have taken much tim... |
In a situation where there are multiple teams making changes to some Maven projects with dependencies between them (otherwise unrelated projects i.e. no super POM or anything like that), with each team working in a separate working branch on all of these projects and merging them back to trunk only after a story is com... |
I have a git repository, and I'd like to make a "debug" branch.
In the "debug" branch, I'd like to add a line:
debug = true;
But I want to make sure that any merges back to master ignore that change. Is there any way to set that up in way that doesn't require me to manually handle all future merges?
|
In my organization we almost never finish all the stories in the Sprint, and most of the stories are finished about 80%.
One reason for this, is that many times testers don't have enough time to test all the stories, and developers don't want to test. Another reason is that the teams are usually too optimistic so they ... |
JavaMail sends e-mails using an e-mail server, typically through the SMTP interface of an e-mail provider. Is it necessary to use an e-mail server to send e-mails?
I have a web site that will send e-mails and if possible I'd like to send the e-mails directly from the web site code without using an e-mail server. The ... |
I've recently convinced the team that we could upgrade from php5.4 to 5.5 -- but, unfortunately, it seems I overlooked that php-apc is no longer supported in php 5.5 -- which is fine and dandy, but we could use a replacement for apc_define_constants()
Thus, I've heard about the wonders of hidef -- but, I cannot seem to... |
I'm somewhat new to programming (I'm a mechanical engineer by trade), and I'm developing a small program during my downtime that generates a (solidworks) part based on input from various people from around the plant.
Based on only a few inputs (6 to be exact), I need to make hundreds of API calls that can take up to a... |
When reading about the various options for working with things like ARC / GC, I often come across explicit wording about which weak references are zeroing (ie, your reference becomes nil/null/0 when the object is collected) and which non-zeroing (you get a dangling pointer). This leads me to ask: What possible use coul... |
My company uses an application called TotalHRWorks for time keeping and what not. They have an Android and iOS application; however, there is no Windows Phone application. Since there is an Android and iOS app, I figure that I should be able to create a Windows Phone app; but I don't know where to start with trying to ... |
On a side project I'm working on I came up with a way of handling exceptions that's adjustable by configuration. So a try/catch block might look like this:
try
{
fileHelper.MoveFile(file, destFolder);
}
catch (IOException ex)
{
if (exceptionHandler.HandleException(ex))
{
return ResultCode.Fail;
... |
I have a class that will have a number of external methods that will all call the same smaller set of internal methods. So something like:
obj.method_one(a, c) and
obj.method_two(a, c)
where obj.method_one calls obj._internal_method(a, c, y) and obj.method_two calls obj._internal_method(a, c, z).
They're nearly ident... |
We have a project with a few release branches and a trunk. Lately we've been adding bugfixes and new features to the release branch, while doing simultaneous infrastructure development on the trunk. This has caused us some problems.
Today I was told to merge changes from branch to trunk, using HEAD as starting/end revi... |
I'm writing a piece of software in python that will communicate with a bunch of devices via an I2C bus. Each of these devices are going to need some sort of a module or class to handle the communication and data conversion in some sensible way. The operations that each of the device modules perform are drastically diff... |
I am developing a single-page web application using AngularJS. Data for this application is consumed over a REST API which is well tested in its own right.
The Angular application has a bunch of unit tests that test e.g. individual controllers and their methods. It also has a bunch of integration tests that currently v... |
If I have 2 tables in my database, let's say for instance 'buyers' and 'sellers' but I collect a common set of data for both for instance telephone number, email address, address etc. Is it better practice to have one common table for 'contact_details' with a reference to the table and row that the contact details are... |
So, I am a noob in assembly language and machine instructions.
When the discussion came up as to how funtion calls are implemented at the processor level, someone said that the CALL instruction pushes the address of the next instruction to be executed on the stack before updating the EIP and then someone asked how do w... |
How does assembly relate to machine/binary code.
For example here is how to print to the screen in mikeOS(a small pure assembly OS), mikeOS it uses NASM to assemble.
BITS 16
ORG 32768
%INCLUDE 'mikedev.inc'
start:
mov si, mystring
call os_print_string
call os_wait_for_key
ret
mystring db... |
I don't find the docstring to be very clear:
def compileUiDir(dir, recurse=False, map=None, **compileUi_args):
"""compileUiDir(dir, recurse=False, map=None, **compileUi_args)
Creates Python modules from Qt Designer .ui files in a directory or
directory tree.
dir is the name of the directory to scan fo... |
With reference to this answer:
At the end of the day, we are delivering a product to a paying customer. This customer has needs and expectations, realistic or not. Often the sales team gets us into trouble just to get a commission.
I realise there are processes (mainly with communication and project managment) that c... |
Before you answer, yes I know that other languages have no native javascript object support, but neither do they have native support for json.
So wouldn't it make much more sense to modify the json spec to allow identifiers without "" and allow comments? Very sensible things because you don't have to serialize/deserial... |
I'm not liking how my JQuery is after making some dynamic buttons, or other dynamic things. For example, when I have checkboxes marked, I add a button that is called "Download Selected" and "Remove Selected". Of course, there are many more JQuery + HTML things in my site.
I'd like to know how I can make my code better,... |
In a multi server system, e.g. a load balancer, multiple web servers and a database server, where do you store the files / images users upload when each web server will need access?
Before now I've just used a single web server, or maybe one web server and a MySQL database server.
But if you have multiple web servers I... |
I use java language to develop android application, after static analysis, the tool warns about high efferent coupling.
What is the reason of this warning? Is it about AComModel which is extended by other class?
There are 4 classes below which the tool warns us about them. I hope I asked logical question, but I really... |
One of our developers has an opinion that all client data should be validated before using it. Even non-input data.
Say, our web service has an internal protection against database injections.
Examples: machine generated codes, various integers, indexes, calculated values.
We use ORM (Django). As I know there is a next... |
As a programmer, I have always wondered whether it is preferable to write (a) short modular functions that are each stored in their own script (i.e., file) or (b) long comprehensive scripts that contain all of their relevant functions.
For example, if I code a data analysis stream that includes a variety of operations ... |
We have had a situation with a scrum sprint where a team member went on vacation for a few days at the beginning of the sprint. This led to us being behind the ideal trend on the burndown chart at the beginning of the sprint, although we caught up later since we knew we had slightly less resource and as a result had co... |
We have a number of tasks that need to be completed, but are probably not real user stories, or if they are, they are very developer-centric user stories which will never be visible to the end-users. The problem is that because they do not get estimated as a part of a sprint and very little gets done on them. Eventuall... |
A terminology question appeared when I was comparing EJB 3 and Spring.
Wikipedia says that
Enterprise JavaBeans (EJB) is a managed, server-side component
architecture for modular construction of enterprise applications.
and also
The Spring Framework is an open source application framework and
inversion of contro... |
I was told that atomic operations are a dynamic language feature. I was too afraid to ask in that context what this actually means because I didn't want my coworkers to think I'm stupid. But I actually don't really understand this statement.
My understanding of the term "atomic operations" is any operation that is eith... |
Why does
cursor = connection.cursor()
cursor.execute("...
return cursor.fetchall()
return the expected non-empty result whereas
connection.cursor().execute("...
return connection.cursor().fetchall()
returns an empty list the SQLite3-command being identical in both cases?
EDIT 2014-02-19: Added the last "...fetchall()... |
Is it possible to develop private apps for iOS (iPhone/iPad) and Android?
With "private apps" I mean apps that do not appear on the public app store, but can be downloaded and used only by selected clients.
|
Device targeting for product XML catalog
We currently have a webservice that outputs an XML of products based on get parameters in the request. The webservice is consumed from a windows mobile application.
In front of the webservice we have an HTTP accelerator/cache that caches the results for identical URLs.
The busin... |
Well I'm no expert, but as a student, I'm curious about languages and their design patterns / goals.
I'd like to know, whether there are any points I miss in the following examples, and why techniques like this are not widely used in popular languages. Why is it a better idea in a real-life program to explicitly define... |
I want to learn OOP. I know Python and I know very little things about OOP.
But when I search for "learn OOP" in forums I saw a guy saying that "Python is so new that's why you can't learn OOP on Python. you should learn Java then understand OOP on Java"
Is it true? Is there any difference understanding OOP on differen... |
I'm trying to find a clean, intuitive way to implement this problem. Basically, I have three numbers, and based on relationship (less than, greater than, and equal to) among these numbers would change how I execute the next set of code.
For example, if there are numbers A, B, and C. Here are some examples of relationsh... |
I am currently designing a graphics library in Java and now it's come to making the frontend I am curious why I have never seen libraries using global variables for their settings/properties - in-fact some go out of their way to protect them such as JavaScript libraries, and of course choose to use getters and setters ... |
It's not clear to me what benefits there are of declaring your stack variables as constant in C++, I was hoping somebody might explain the benefits and purpose for this technique.
For example:
void func(const std::string& arg)
{
if(someCondition)
{
const std::string foo ("some string plus " + arg);
st... |
Please read the question carefully: it asks how, not why.
I recently came across this answer, which suggests using a database to store immutable data:
It sounds like many of the magic numbers you describe - particularly if they are part dependent - are really data, not code. [...] It may mean an SQL type database, or... |
I have a slightly complex SELECT query which uses a number of JOINs and variables inside it and the query is run frequently throughout the application.
The result varies when one column is updated. Eg: When the product quantity is updated only, the result set changes.
So my question is, is it a good idea to run a trigg... |
imagine
given a project business object and such (simplified) rules:
it's lifecycle is divided into several stages of evaluation;
stages flow lineary and represent an evaluation chain;
each stage provides its own reward value/algorithm;
promotion of the project is controlled by other user's decision;
the resulting rew... |
I often use the following syntax:
std::vector<foo> vec;
vec.push_back( someClass.getFoo(...).modifyAndReturn() );
Considered about exception safety, I quote the standard on vector's push back behavior (23.3.7.5):
If an exception is thrown other than by the copy constructor, move
constructor, assignment operator, or... |
With the current project I'm working on there's an architecture question being asked which feels like it might just be asking too much.
System Basics:
HTML/JS MVVM
Asp.net MVC
Web Services
EF
SQL 2012
The Web Services deal with DTOs passed back and forth either to the presentation layer (MVC or mobile app) or to va... |
I developed a Windows software about an year ago. Part of it was to monitor few configuration files for manual changes by user and if any of these change restart a particular service.
So, I used the simplest approach. I load them as a string in memory and after few seconds, I read the latest file and compare it with th... |
I am making a Game in HTML5. In one part of it, I want the users to be able to customize the avatar they get by default.
For sample, let me share a screenshot from Zombie Lane on Facebook (now this game may not be in HTML5 but that's not the point):
My question is as to how do I include the images in the HTML5 page an... |
In our company, we are going to deliver a new product which will be used for mass notification, so it is an embedded software project and we are going to use the SCRUM as a framework for the product.
We have started to write down the product backlog. Based on what I understood the product backlog should reflect a busin... |
I stumbled upon a discussion between senior engineers and people from non-technical backgrounds and this seems to be a strongly held belief in some places.
I'm of the opinion that such a situation is purely down to incompetence on the side of the developers and project managers, those involved in creating the original ... |
We have a User class which handles all things related to users within a Content Management System. As you'd expect, the class contains a function login(). This function accepts three arguments: $username, $password and $remember (the latter defaulting to true).
My question is: what is the best way to handle login erro... |
What data structures can you use so you can get O(1) removal and replacement? Or how can you avoid situations when you need said structures?
|
It's very common in .NET for an exception to be wrapped in several layers of "outer exceptions" which give marginally more contextual data. For example, in EF if your update fails, you get exceptions wrapped similar to this:
EntityException
DbUpdateException
SqlException
The data I need to understand what failed is ... |
With jquery very slowly being phased out you get into more and more situations where library X will run with either jquery or zepto.js (but at least one is required).
No package managers that I can think of however allow you to express dependencies like this. If I was to propose this feature to - say - bower, is there ... |
I work for a small company that hasn't done much work in bespoke development. It's something we're growing into. With all our projects, whether a bespoke development piece of work, or a simple brochure website, we plan out how long we expect the job to take us and then multiply that by our daily fee to give us a quote ... |
Thinking about Access Control Lists bound to a web MVC architecture, I have a doubt on where the verification should be done.
Within Models? Controllers? FrontController?
Imagine a multiple module web application (like a website). I have a public site and a restricted admin zone.
All public site pages are acessible b... |
I'm currently working on a web mail client. When a user logs in, I'm fetching all the mails from the INBOX from the beginning of time. As expected this is pretty darn slow. I'm planning to implement some sort of a filtering/caching technique and was looking for some ideas.
If I fetch all the message numbers, trim them ... |
I read in this question that functional programmers tend to use mathematical proofs to ensure that their program is working correctly. This sounds alot easier and faster than unit testing, but coming from an OOP / Unit Testing background I've never seen it done.
Can you explain it to me and give me an example?
|
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4) # directly give literal values
x = 5
y = 7
printMax(x, y) # give variables as arguments
I'm learning python via the byte of python book, and the author uses this e... |
I am trying to better my understanding of polymorphism.
Say I have a base class called baseClass with one method called foo() and I have three derived classes called derived1 , derived2 and derived3 which all override the and implement their own versions of the foo() method.
If I have an array of baseClass objects can... |
(I see there are a lot of similar questions, but answers are not really what I am interested at.)
The thing that is bugging me is indirection. If I'm writing something, I do tend to inline as much stuff as possible. I might be less strict about it in compiled language hoping that compiler will do all the inlining for m... |
Effective Java provides 2 ways to implement swap:
// Two possible declarations for the swap method
public static <E> void swap(List<E> list, int i, int j);
public static void swap(List<?> list, int i, int j);
Then, Mr. Bloch says:
Which of these two declarations is preferable, and why? In a public
API, the second... |
I have been experimenting with creating a website that leverages MVC with JSON for my presentation layer and Entity framework for data model/database. My Issue comes into play with serializing my Model objects into JSON.
I am using the code first method to create my database. When doing the code first method a one to... |
I'm creating a website which will publish one or more articles a week.
I'd like to be able to rank the articles based on popularity. In order to do this, I need a formula to calculate a score for each article. This formula should reward popular articles (those that receive many views), while also bringing new articles ... |
In my application users have lists. They can either add a new item to their list or add an item from a previous list. The set of all items I'll call G (global) (each user's global list is their own).
G = { a1, a2, a3,...,an}
After (or during) a user has created a list they can sort it. This has been no problem. The pro... |
I'm developing a set of simple widgets for a small (128x128) display.
For example I'd like to have a main screen with an overlay menu which I can use to toggle visibilty of main screen elements. Each option would be an icon with a box around it while it is selected. Button (left, up, right, down, enter) events should b... |
When working on a requirements document, how do I capture system roles and responsibilities?
E.g. "I'm a manager and I will only use the system to generate reports on xyz".
I was looking for an example online but couldn't find one.
|
I tried to understand how objects can be passed as parameters but it was difficult for me. How can we pass an object as a parameter to a method of another object? I need to understand the idea behind this.
updated:
public class Student {}
public class Admin {
private ArrayList<Student> students;
public voi... |
I'm looking for information on common patterns for initializing and executing Javascript page by page in a "traditional" server-side MVC website architecture.
A few months ago, my development team began, but abandoned, a major re-architecture of our company's primary web app, including a full front-end redesign. In the... |
Quoting from Selenium Architecture
A natural implementation would have been to provide a database
connection to the underlying data store, using something like JDBC.
Eventually, we settled on an API that closely models the underlying
Javascript implementation because something that modeled typical
database acc... |
I'm developing a mini framework and I want to perform changes to existing methods. I know in order to deprecate a method I can use the @deprecated annotation. However, what annotation should I use to let the users know that I'm going to change the amount of parameters a method will receive or maybe the returned result?... |
Usually I use std::unique_ptr to convey ownership and pass in raw pointers as parameters when no ownership is implied. However, I almost never consider a nullptr to be acceptable as an argument, so it would be nice to use references to avoid this, but I'm not sure most people would expect that the object the parameter ... |
Recently, I've spent a lot of time trying to dive into, and understand, Javascript Promises, especially those adhering to the Promises/A+ spec. What I'm trying to understand is whether or not Promises actually give developers additional tools specifically when compared to CPS based async, or whether it is mostly syntac... |
For example, take the case of Fibonacci number to calculate nth number you require n-1 and n-2 term.
If I do it with bottom up approach, is it recursion as f(n) depends on f(n-1)?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.