instruction stringlengths 34 36.1k |
|---|
Joel Spolsky once wrote that 90% of a software project is not its visual parts:
If you show a nonprogrammer a screen which has a user interface which is 100% beautiful, they will think the program is almost done... And then when you spend the next year working "under the covers," so to speak, nobody will really see wh... |
Currently i have requirement saying user from an UI creates there own forms which has types textbox,choicegroup etc..
Does anyone have a any idea on how to architect the database to store all data?
If user want to link form1 to form2 etc.. how will these data links stored in database?
For example, parent1 has child1 ... |
As python memory model is dictionaries of dictionaries, looks like any object in JavaScript has similar representation.
Below code,
>
foo = {}
makes foo as an empty dictionary {}. fine.
If code says,
> foo["bar"] = function(){
this.ack = 3;
};
then foo looks like a dictionary as shown below:
{"bar": function()... |
For example, suppose I had a pageControl UI class and a searcher business logic class with the following :
pageControl.js
function searchButtonClicked() {
// call business logic class method when button clicked
searcher.beginSearch();
}
function showSearchResultsPage(searchResults) {
// when this is called, disp... |
A web service I consume uses XSD to describe its API. Recently, they added a field to a reply message where no xsd:any had been, so when our schema validator tried to validate against the previous xsd, it failed. We considered this a backwards incompatibility and opened a ticket.
Their architect replied that we should ... |
I am developing an application where a user submits a mission and other users accept the mission.
Pretty simple.
I want to keep a track of the mission progress status and store it into a database.
Which would be more appropriately:
1.having the following enums in a database column:
PRICE_NEGOTIATION,
DEPOSIT_NEGOTIATI... |
Suppose I have 2D polygon image and a larger 2D rectangle image and that I have a collection of points for each that I want to align.
For Example the polygon has point collection:
[PA(a, b), PB(c, d), (PC(e, f)]
And the Rectangle has point collection:
[RA(g, h), RB(i, j), RC(k, l)]
Is there an algorithm I can use to pr... |
I am studying some standards and tools for XML, but I confused with some terms and standards and their differences
What is XQL? It seems the same as XQuery and somehow even similar to XPath?
Are XQL and XQuery the same?
Are there other similar [even deprecated] standards?
|
I was just reading http://lasagne.readthedocs.org/en/latest/modules/layers.html and wondering about some documentation style questions. One of them was the use of the word "should".
For example:
This method should be overridden when implementing a new Layer class. By default it raises NotImplementedError.
Is that a ... |
I have seen similar questions about text comparison, but none on such a large scale.
I have a client with two sets of recordings of speeches, 250 and 550 recordings each. Each of the recordings in each set are unique, but about 200 out of the 250 are duplicated in the set of 550, and they need to weed out the doubles. ... |
At the most basic level, a digital media file (document, song, video, etc) is just a rather large pattern of 1's and 0's.
We can say that for any given piece of digital media, there corresponds a binary "fingerprint" unique to said media which defines it.
For example, an MP3 of a song will have a very specific binary p... |
Recently I saw a great video of Scott Wlaschin about patterns in functional programming. He gives an example of dividing a numbers. In f# we'd use int option for the result to handle division by zero in a nice functional way.
As another possibility he mentions creating a type that would not allow 0 as a valid value.
Le... |
Let us say that I have a Book class, a book can have an object of another class like an Author or other complex objects like a list of Genres. My question is, in an MVVM model should I make the complex object a property or should I use a simple object like Integer which contains a reference to the complex object, like ... |
I'm trying to write a cyclic doubly linked list where the nodes or even the link pointers are locked individualy. Or a lock-free or even wait-free (I think that's not possible) implementation.
The list will be used in a simple kernel for the scheduler and message passing subsystems. The kernel is non-interruptible, so ... |
I'm having some discussions with my new colleagues regarding commenting. We both like Clean Code, and I'm perfectly fine with the fact that inline code comments should be avoided and that class and methods names should be used to express what they do.
However, I'm a big fan of adding small class summaries that tries t... |
I have 2 classes, Base and child class.
Base class has a protected int variable. My understanding is that any protected member of a class can only be accessed in a child class, It cannot be accessed from say creating an Instance of a class and accessing the protected member. How is this working then?
class BaseClass
... |
Rounding amounts in Germany we must use Math.round instead of Math.floor.
The rule is called "Kaufmännisches Runden"
Is there any rounding-function for amounts who accepts the Locale in Java?
This is not improbably since toUpperCase respects the Locale too.
|
Since I am mainly an Electrical Engineer, forgive me if I am somewhat off with some terminology.
I am currently programming a display driver/interface module. And like so many times before, I have reached a point where I am unsure on how to separate function prototypes and definitions that are meant for internal use of... |
Here's a simple scenario:
We have a list of tasks and can mark a task as completed by invoking a web service. Doing so will transition the status of the task to completed as well as initialize a completedOn data member.
Is it a good practice for services to return additional data members required for the UI to sync the... |
I found it's very complex to manage transitional animations. For example, when changes to a model get reverted before the animations have completed, the animations for previous changes should stop and the animations for the other direction should start from the middle.
Transitional animation creates a period when the v... |
There are two aspects to this question that I felt were too closely related to ask as separate questions.
Why doesn't SortedMap implement Iterable<Map.Entry<K,V>>?
If you need to perform an action on every key-value pair in a map, iterating over the entrySet() seems like the way to go. So why not provide a direct it... |
My personal approach to a git commit is that every commit should include a unit of change, in its completness.
When I develop, I usually focus on such units. But sometimes, my attention strays someplace else and I work for a while on a different unit. This is probably not optimal, but I have learned to commit carefully... |
During creation of new Github repository I could choose license under which my project will be hosted on Github. I didn't do that because Github suggested only few licenses to choose (and WTFPL wasn't on the list). However, after repository was created I cannot find any option to indicate either WTFPL license or any ot... |
I know there is all this talk about having only one composition root that set all your dependencies and that you should always prefer constructor injection to other types, but sometimes it just doesn't make any sense for me. Here is my pseudo code :
public class FakeModel
{
private FakeDependency Depend... |
I'm doing some refactoring for our application, and trying to reduce the number of issues reported in our ISO Scan (a static code analysis tool based on HP Fortify). Right now, what I'm trying to address is the "Unreleased Resource: Database" issues our application has built up. One of the most prominent reasons for ... |
I am developing an application where a user submits a mission and other users accept the mission.
Pretty simple.
I want to keep a track of the mission progress status and store it into a database.
Which would be more appropriately
having the following enums in a database column:
PRICE_NEGOTIATION,
DEPOSIT_NEGOTIATION,... |
A little over a year ago I was fortunate enough to be able to take a 9 month break from work. I decided that in that time time I would hone my C# skills. I started working on a bunch of projects and forced myself to follow TDD.
It was a fairly enlightening process.
It was tough at first, but over time I learned how t... |
One of the founding principles of the Agile Manifesto is
Agile processes promote sustainable development. The sponsors,
developers, and users should be able to maintain a constant pace
indefinitely.
Scrum teams use the term sprint to refer to a work cycle (also known as an iteration).
However this doesn't make ... |
My question is similar to Leaving intentional bugs in code for testers to find:
We don't do this at our firm, but one of my friends says that his
project manager asked every dev to add intentional bugs just before
the product goes to QA...
...If you ignore the scenario were one of these intentional bugs gets
shi... |
I've gone through a couple of Question on GPL here, but all of them are related to the compiled languages, libraries and distribution.
My web project has a backend that is BSD licensed. The front end is a GPLv3 licensed JavaScript framework which renders a background image that doesn't link to anything from the backend... |
Are events which are intended to tell listeners to carry out explicit actions an anti-pattern?
Imagine a worker service which raises the event WorkStarted at its beginning and the event WorkFinised at its end.
These events convey information about what that worker service did and they are not inherently imperative to a... |
Plain object keys must be strings, whereas a Map can have keys of any type.
But I have little use for this in practice. In nearly all cases, I find myself using strings as keys anyway. And presumably new Map() is slower than {}. So is there any other reason why it might be better to use a Map instead of a plain object?... |
I have simple question, I think its not that big of a deal, but I'd still like to ask it as its boggling my mind for past 2 days a lot.
What if I have a poll where instead of inserting answers to MySQL table one per row, it would just change the amount of votes answer got in row with poll data?
So basically my code wou... |
I've got a package.json that's expecting a SPDX-approved license acronym, but I can't find one that means 'proprietary commercial license, all rights reserved'.
Is there one for non-FOSS, where I want to specify that I want to allow no reuse?
|
I often find complex Linq queries that span over 10-15 lines in our code base.
I find such queries hard to understand and impossible to debug.
I've tried to split the query to smaller parts, but it's hard to do since usually inner parts depend on the outer scope variables. Think of nested loops in imperative code.
Is t... |
There are a few number of tools out there (Excelsior JET, etc.) that claim to transform Java app's into native executables (*.exe). However it is my understanding that these tools are really just creating native wrappers that invoke/execute java from a shell or command-line.
If that understanding is incorrect, I don't ... |
I have a that class does not really specify any real object on its own but is more of a utility class. It has some data whose initialization is expensive. I see two options on how to store the data:
Store it in a static variable(initialized in a static block).
Pro: I can call the utility methods without having to cre... |
I'm confused by how a computer rounds off the last digit in the floating point representation. For example, I'm told that x=1.24327789 is stored in a computer with a 6-digit capacity then it;s floating point representation would be x=0.124328x101, where clearly the last digit has been rounded.
My confusion refers to ho... |
Right now I'm working with some code that combines state and operations.
It looks something like this (note: doesn't actually deal with Cars/Trucks. I'm abstracting the business logic here, and apologize in advance that the analogy doesn't entirely make sense)
TruckImpl {
// Fields/Properties
int Mileage
bo... |
In my (small) company, we are currently thinking about dumping our current versioning system (svn) and release procedures, which are crap TBH, and switching to git. It will mainly be used for one large web project which we will be continously developing for some years, at least. Considering what I found on the web and ... |
Are there terms to distinguish these two different types of inheritance?
The one type of inheritance is
vehicle - car.
(these classes have some similarities).
But then there is for example
event - car
Of course there are also similarities (as in the above example), but here is more a special notion of "to enhance... |
I want to implement like/dislike system, but I don't know how to achieve best performance. I have to tables: blog posts and comments that need rating.
Should I store all data in one rating table? Or should I create separate tables for posts and for comments?
Should I store total result into one record in post table or... |
As I understand the purpose of DI is that I can easily swap a lower level implementation. But it forces the lower level abstraction to be defined inside the higher level.
A lower level becomes dependent on the abstraction defined in the higher level and can't be used without it. But what if I would ever want to reuse m... |
After a couple of useful answers on whether I should use domain object or a unique id as method/function parameter here Identifier vs domain object as a method parameter , I have a similar question re: members (the previous questions discussion didn't manage to cover this).
What are the pros and cons of using unique I... |
A program I have wrote uses multiple threads and I believe my program is thread-safe but how can I really know?
I've read a number of examples online and none of them describe how to test the code is actually thread-safe or not, nor have I found a reliable way to cause a conflict.
Most of what I've tested regarding con... |
After reading many posts explaining closures here I'm still missing a key concept: Why write a closure? What specific task would a programmer be performing that might be best served by a closure?
Examples of closures in Swift are accesses of an NSUrl and using the reverse geocoder. Here is one such example. Unfortunat... |
I have a code where I want to avoid using a for/each loop to count the amount of points options in poll have together. Reason is, every option has different ammount of points and I want to get number of votes by counting options and points they have together and then dividing total points (votes) by those points...
I h... |
I have a very large dataset with two columns of interest: Name and Cousin.
Each row has a unique name and each name has a cousin.
The data is mutually inclusive, so the cousin's name will also appear as another row in the data.
The effect is therefore a big dataset with lots of names of people who are related to each o... |
I am making a basic game with geometric figures.
I am trying to design now how to calculate if the figure collides with another figure in an Array List of figures (called entitiesList).
I have:
Class Entity {
...
public boolean collidesWith(Entity anotherEntityInMap) {}
}
But I can't figure out how I should mak... |
This question appears to be fairly well tread, for example:
Do dynamic typed languages deserve all the criticism?
What is the supposed productivity gain of dynamic typing?
etc.
However, most questions and answers seem to compare statically typed languages like Java and C++ with dynamically typed languages like Python... |
What if the programmer uses Exceptions for debugging? Would it be better in that case to just report the failure and immediately interrupt the script since ideally all bugs should be fixed radically?
Is this a correct way of using exceptions in PHP?
Related reading: exceptions in PHP
Thanks
|
In the following code sample, I have a client that works through a controller. In my specific case the controller establishes a session to an address on a GPIB bus. An instance of this is then injected into the client class, which in my case is a device. The client class knows what to say to the device and uses the con... |
I'm building a web application with multiple forms which all require date fields, and these fields need to be supported across IE, Chrome, and the like.
Our application currently packages the output of the forms as a JSON object which we feed into GsonBuilder to convert them into a java object for persistence.
Our Gson... |
Let's say I am designing business objects around a poorly optimized database that have no ability to change.
I have a Person object with a ShippingAddress property. The ShippingAddress is very expensive to load and located in a separate table, and a minority of pages use it. There are times when thousands of Person ob... |
I've just discovered a huge hole in my Java knowledge. I knew that Java passes parameters by value. I thought I understand that and whenever I needed to edit the field object of a class, I create a field. For example,
private int mNumber;
void main(){
mNumber = 1;
}
void otherMethod(){
mNumber = 3;
}
This woul... |
I've been learning ANTLR, by writing my own (extremely simple!) programming language
It made me curious about how the lexer/parser/AST is implemented for java. Obviously there is a grammar for .java files and this gets parsed down to ByteCode, which is then validated to check that all is syntactically and sementically ... |
I am new to Unit Testing in C++. I am supposed to write a Unit test for my code and I am using Google Mock for the same. I have gone through their turtle example.
But I am still confused as to how to mock a delegated constructor.
I was asked to use a delegate constructor by a senior who advised that I should use a del... |
I'm coding with a state pattern for an embedded device. I have a base/abstract class called State and then each discrete(concrete) state class implements the abstract State Class.
In the State Class I have several Abstract Methods. If I don't implement the abstract methods in the discrete(concrete) class, Visual Studio... |
Can you think of a solution to the following seemingly simple algorithmic problem?
I am given a list of data points with scores and regions they belong to: [(9, A), (8, B), (7, A), (3, C), ...]. Scores are floats and each regions can have multiple data points assigned.
For each number N I'd like to select N data point... |
How can uniformly and deterministically distribute set of GUIDS to N buckets.
N can be as small as 2.
Need to make sure the same GUID is always mapped to the same bucket.
Can't use any additionally memory.
Input GUID set is not known in advance, and will be generated using common library functions available in stan... |
Basic terminology:
Report - single report to generate
ReportGroup - group of Report(s) to generate
Request - contains one or more ReportGroup
I'm working on refactoring of the large function (~350 lines) in an even larger class (~2500 lines)
The function is responsible for a generation of report in various formats (tx... |
My current project is a high-level abstraction package for GPIO programming on those nifty little SoC-Computers (Raspberry Pi, Cubieboard, Beaglebone Black, Pandaboard etc.). One of my goals is to make it possible to run the same code on different Boards using different GPIO modules as backends, like RPi.GPIO on the Ra... |
I recently discovered SOLID principles and i'm trying to learn how to properly apply them. I have an application that had a huge interface:
public interface NotificationService {
public void sendNewProjectRequestNotificationToDesigners(String projectId);
public void sendNewProjectAcceptedNotificationToCustomer(Str... |
I have an N-vertex shape that I cut out from an image, and I want to project it onto another shape with the same amount of vertices, but different. So, the image will get changed inside the projection. Are there any known algorithms to do this?
Also:
I know that the requirement "to project" a shape onto another shape ... |
My question concerns an administrator's console application. The requirements around it are that administrators should be able to log in (other types of user cannot), and they should then be able to do things like look at requests from users, assign requests to themselves, ban users (temporarily or permanently), and gr... |
http://whatsmyuseragent.com/ tells you your screen resolution, javascript enabled,user agent and local time etc?
User agent is a part of HTTP header. How do they know about other information?
I installed Firefox addons "Live HTTP Header" to view this information but I was only able to see user agent.
|
I've just wanted to get to know what these particular settings really do:
Project Properties -> Libraries -> Java Platform
Project Properties -> Sources -> Source/Binary Format
After a little bit of googling I know, that:
[1] By choosing a Java Platform I declare the minimum Java version which can run my jar file. I... |
For REST interfaces or webapps with nice-looking URLs, I constantly ask myself on what numbers to use if we want to refer to specific resources/pages.
A typical approach seems to be to use the unique database ID of a row representing the resource as an index like http://www.mypage.com/questions/4/answers.
Using the dat... |
In cases where there is a desire for objects to be "shared" between multiple containers, I would like to know what is the best practice in C++. For example, when implementing some path algorithms (such as A*), I have implemented a 2-dimensional array of Nodes (user-defined class), and I also want to have a Set, where s... |
I primarily develop for Node.js. I got into a habit of putting a file-level docblock into all of my .js files. It looks something like this:
/**
* project-name
*
* Licensed under the BSD-3-Clause license
* For full copyright and license information, please see the LICENSE file
*
* @author Name <email>
* @cop... |
Recently I saw an inspiring quote:
The secret to building large apps is never build large apps. Break
your applications into small pieces. Then, assemble those testable,
bite-sized pieces into your big application.
Is seems really great so I want to follow it.
But then I found because I'm using Active Record patt... |
Edit: unlike some similar questions such as Moving a multi-GB SVN repo to Git
or
Managing large binary files with Git
My scenario doesn't involve several subprojects that can be easily converted into git submodules, nor a few very large binary files that are well suited for git-annex. It is a single repository where th... |
Say I have created a new (DSP) algorithm. Will I have some advantage if I open source the algorithm under copyleft licence (GPL etc.)? From what I know about licensing this should lock people out from using the exactly same code as closed source, but would they be able to "rewrite" the algorithm as closed source?
Note:... |
I'm looking into creating a single-sign-on portal built in ASP.NET MVC. This single sign on portal should give users the option to sign in with their individual account (which should be verified against AD) or their Facebook/Twitter account. What I'm still in the dark about is if the application/authentication flow I c... |
In my current project i have a CPU intensive 3D chart that needs to be updated in real time.
I have been using background workers for the project and using those, i do all the processing in the background. Receiving of Message, Interpretation of message, finally pass data set to gui.
The updating GUI step takes 20-50ms... |
The Problem
We had a Environment class which would choose whether or not to use a webservice (it was set by a web reference) for our authentication methods by reading the host environment and if it was production or the same as the webservice would invoke it, otherwise would run the code before the migration for the we... |
I wrote a class that basically executes a numerical analysis code in a thread using boost::thread. Now I need to specify the thread priority, since we are running a system with near real-time operations and don't want the OS (ubuntu) to assign a high priority to the thread.
I found that with c++11 you can actually chan... |
Some times I have texts that appears in different places, like comments, messages... For example if I have a custom Exception, probably class doc, messages that passes as parameter to its constructor will have the same phrases (here This exception throws under situation1):
/**
* This exception throws under situation1 ... |
The * symbol is used for three different purposes
multiplication
Pointer declaration
Pointer dereferencing.
Why designers of C kept this notation? In other words, wouldn't it be nice if there was special notation for pointer declaration and dereferencing? I think if there would have been special symbol or notation ... |
I have a virtual method that returns a collection of items that must be unique. I want to make sure that it will be obvious when overriding the method. What is the best way to do this?
Here is an example, where "Two" is being returned twice erroneously.
public abstract class Base
{
public abstract IEnumerable<strin... |
I've written a small toy application using SDL2. I want to distribute it the most user-friendly way, for Linux.
I should make a deb package, but then I should also make packages for other distros, which I'm not familiar. (I am also not familiar with packaging deb. Yet.)
I should compile it to static, and distribute th... |
I'm sure this has been asked before but I can't seem to find anything about this, in theory, is it possible to write an audio driver which takes the incoming audio (from microphone), and compares it to outgoing audio (sound played through speakers/headset).
The reason I ask?
I know for a fact lots of gamers would love ... |
I'm currently developing an application in ASP.NET using SQL as the backend database. In my header, I have a status bar that displays the current status of the user and a timer that shows how long they've been labeled as that status.
Using an update panel with a timer to refresh the data straight from the database (thu... |
When my users are creating an account they need to fill and set several security questions pertaining to their account. I am wondering, how can I make sure that the answer the user enters for each security question is not the same as an answer for a different question? What's the proper attribute for it?
Also, for the... |
I've been working on this little rails app with docker for a while and I'm finally ready to move it into production but I'm not sure what the best practice is for deploying a Docker app.
When developing my app I was using volumes because waiting for the docker to rebuild the image with each change to the app was ridicu... |
It seems to me that it would be pretty useful to be able to indicate an expected crypto hash value in file downloads especially since so many application and data downloads rely on mirrored hosting. This could be done as an attribute to an 'a' tag (I'm not sure if there is a better way). In this scenario the browser wo... |
I hesitated before writing this question, as it sounds like I'm after an opinion without trying anything yet. That's not the case, I just don't want to go down the wrong route with architecture - it needs planning well in advance and I don't want to fall victim to the XY problem.
I have a web-app. It's a 'thin' HTML an... |
I'm developing an app that requires to save data that is not consistent across all rows. These database entries represent different kind of sport activities. Let's take an example: In football the final result is an important field. However, in cycling there's no such field. So it wouldn't be a good idea to create a ta... |
Let's imagine a scenario: When a user posts a message on a blog post, the original author will be notified via a push notification and email.
Should these messages be sent when the user sends the message and let him have a little longer loading time, or should I use a background service to watch the database and do the... |
By Guard Statements I mean something similar to the first part of the function:
def doSomething(String something)
{
// Guard Statement
if(!something)
{
return false
}
// more stuff
}
Say you might have several parameters, maybe you need to log that the method was called with a null paramet... |
TL:DR; Shall I start comitting regularly small pieces of code in new projects? Even if I'm start from scratch and don't have any experience in what I'm using (framework, programming language, w/e)?
Whenever I've learned something new for myself I did not have commited anything in an early stage. For several reason: Bas... |
I'm working with a small-ish team of developers. We're using Subversion for version control. Much of the software is for embedded systems.
We want to set up a reasonably convenient way to share internally-developed software/firmware modules among multiple projects. Desirable features include:
To be able to pull shared... |
I found a certain repository on GitHub that contains a LICENSE.txt file with an MIT license dated 2014, but in one of the source files, the top of the file contains an Apache 2.0 license dated 2013.
This specific instance isn't that important, it's just illustrating my question, but what sort of implications does this ... |
I am new to web programming. Now unfortunately, I was a kid during the advent of the world wide web and didn't have access either. So now when I am just starting out, it feels like there's a myriad of concepts to learn and understand.
For example, I just read about CGI scripts. Now, usually when I see people talk abou... |
I know that pointers hold addresses. I know that pointers' types are "generally" known based on the "type" of data they point to. But, pointers are still variables and the addresses they hold must have a data "type". According to my info, the addresses are in hexadecimal format. But, I still do not know what "type" of ... |
I am thinking about making currying and variadic functions both available in a dynamically-typed functional programming language, but I wonder if it is possible or not.
Here are some pseudocode:
sum = if @args.empty then 0 else @args.head + sum @args.tail
which is supposedly to sum all its arguments. Then, if sum itse... |
I have secured a REST API using OAuth 2.0 security, and I am not sure on how to configure security access using roles or scopes.
There will be three types of clients:
Public mobile app client used by end-users that can access their
profile, data, etc. (using password grant type). By "public" I mean that the app is int... |
I want to POST an array of objects and make an insertion in database concerning each of them.
What is the best practice if one object does not conform and raise an Exception? (cancel all transactions or just one and specify it when I return this list of objects?)
|
I would like to know the low level details of how a network load balancer works with sticky session enabled.
Reason behind the question:
We have a legacy ASP.NET application that is both a front-end application and a REST service.
e.g.
https://somedomain.com/legacyapp/UI.aspx
https://somedomain.com/legacyapp/Service... |
Should microservices be responsible for handling their own authorization or you think it's better to have a separate authorization service that is shared across all or a subset (within the same business domain) of microservices?
To me the latter makes more sense as it makes it easier to apply changes, enforce policies;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.