instruction stringlengths 34 19.9k |
|---|
Going through Modulo operation (the avenue I entered while exploring the difference between rem and mod) I came across:
In mathematics the result of the modulo operation is the remainder of the Euclidean division. However, other conventions are possible. Computers and calculators have various ways of storing and repre... |
I can't remember but recently in one of the APIs I saw something like this class A (member:A){}. Scala does support it and there is no problem creating such a class but how do we initiate it and what purpose would such a class serve?
|
I'm moving over to work on a library that a fellow developer has been writing. It's full of == true and == false, which I find crazy frustrating to read.
I've tried asking him to quit doing it, but he just says that it makes it more straightforward to understand what is going on. Is there a good reason why this isn't a... |
I am writing a simple piece of code. Its a function that allowed the user to withdraw some money. There are some restrictions to this though.
The user can't withdraw more than the given withdraw limit.
The user cannot withdraw more money they that have.
The script will terminate if this happens, and let the users kn... |
How important are to-many relationships in iOS programming? Do you often hold a list of pointers to objects in an array in your codes?
I don't think I fully understand the concept of to-many relationships, let alone how to implement them into code. From my current understanding, to-many relationships holds a list of po... |
I'd like to create an app similar to Barbell Pro for Android, for practice / interest / educational purposes really. Or even as another example for database purposes, Fitocracy
The problem is, I have no idea how the database could be designed... For example:
We have a 1000 Persons using the app
Each Person could ha... |
I can't understand why connection pooling improves application performance.
I suppose connection establishment would cause latency. But reusing an established connection requires more complex error handling. Application server need track state of every connection to set connection to initial state before reusing (such ... |
Let's say you have a list of values that are:
a
b
c
d
e
The order on the list might be changed.
a
c
d
b
e
How would you detect this change? We needed something like this when we were building a revision history page for our online form building tool. We found a quick and dirty solution, but I am looking for a more ... |
I need to fill a form using data from a CSV file. I was planning to use CURL+PHP to do it, but then I realized the form has several steps (one on each page), plus it uses javascript to fill hidden inputs. It is an ASP.NET form, so it has a lot of variables a postback, etc.
I am thinking now, to make a browser extension... |
If my code contains a known defect which should be fixed, but isn't yet, and won't be fixed for the current release, and might not be fixed in the forseeable future, should there be a failing unit test for that bug in the test suite? If I add the unit test, it will (obviously) fail, and getting used to having failing t... |
Well this question is actually asked multiple times here already.
but the answers are contradictory
So that's why I ask it again (maybe time changed things). Can LGPL licensed libraries be used in closed source applications on androids? Specifically, when they are linked together dynamically through .so. but inside a ... |
I am reading Algorithms 4th Edition by Robert Sedgewick and in chapter 1.2 it discusses API design. It says:
"The key to success in modular programming is to maintain independence between modules. We do so by insisting on the API being the only point of dependence among modules."
Now the book is based on Java. I am ... |
If you borrow code from some source, it is probably best to cite it (like "adapted from [source]"). However, if you take let's say you borrowed this function (example in C++):
void doWork()
{
cout << "Doing work!\n" << endl;
}
and now you editted it to be like this:
void doWork()
{
string name = "";
co... |
Scrum master is a facilitator for the delivery team and acts as a bridge between Project Management and the team. In course of time if he realizes that his team is not delivering the deliverables perfectly possible w.r.t competency of his team, can he question his team members why it is not happening?
It is more like a... |
I've provided only simplified code as it's more of an abstract design question.
So I have many, many nested business/domain event objects, e.g.
public class Event
{
//bunch of properties and standard accessors
}
public class ExplosionEvent extends Event
{
//properties and standard accessors
}
And many mor... |
The main benefit of having a potentially shippable product at the end of each Sprint is the ability to release the product quickly in case market conditions change.
However, usually in the first half year or more the product doesn't have enough value to be actually shipped. So why spend all this energy to make a potent... |
I basically have one big gigantic table (about 1.000.000.000.000 records) in a database with these fields:
id, block_id, record
id is unique, block_id is not unique, it contains about 10k (max) records with the same block_id but with different records
To simplify my job that deals with the DB I have an API similar to t... |
I am absolutely miserable when I get in a situation where I have to merge other developers' changes into mine. When using git and working on a really extensive change, that happens a lot.
When I start working on a change, I make a new local branch and start working in it. The intent is to push my changes to the remot... |
Clearly Apple has the ability to create dynamically loaded libraries (known as frameworks) for iOS, as they ship several with XCode (such as UIKit). App developers only have the ability to create static libraries, or at best, trick Xcode into thinking it's loading a framework when it's actually loading a static library... |
Problem
I find myself nailing the class structure down by having too many unit tests which makes making changes hard.
Example
Assume we have a class A which uses classes B1 and B2.
Class B1 uses classes C1 and C2.
I start off by writing tests first for class A. During that process, classes B1 and B2 are created. To ma... |
Since DTMF seems impossible on Android devices, I really wonder how it is possible to setup a direct dail service like Jinggling (http://www.jinggling.com/how_it_works.html). I realize one registers his phone number, but to what end?
Say a customer now dails an international number, the App intercepts the call, rerout... |
I have a class 'Task' which represents any Task that is done by an individual employee. For this class I wrote properties like EmpID, Priority, etc. and methods like AddNewTask(), ArchiveTask(), MoveTaskToUser(int userid), etc.
Then I wrote a method
public List<Task> GetAllTasks()
This seemed incorrect to me with rega... |
I'm learning ruby (and OOP in the process) and I find keep having to write the same patterns when logging progress so I want to wrap this up in a logging library that my other code can then just pass data to - say a string, a file name and a log level. This of course couples the logging library with other code - other ... |
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int n = strcmp("hello","help");
printf("%d\n", n ) ;
return 0;
}
Result:
-1
Does the value for this program have to be the same on all machines or different compilers?
In other words can this return value take on different v... |
My list of the most important criteria is below. What do you think?
The value to the user - naturally features that are more important to the user must come first
Implementation time - the faster it is to implement a feature, the higher it should be on the list
Dependency between features - obviously you can't make a ... |
Working on an E commerce application where we need to send so many email to customer like
Registration email
Forget Password
Order placed
There are many other emails that can be sent, I already have emailService in place which is responsible for sending email and It needs an Email object, Everything is working find, ... |
The current Websocket RFC requires that websocket clients mask all data within frames when sending (but server is not required to). The reason the protocol was designed this way is to prevent frame data from being altered by malicious services between the client and server (proxies, etc). However, the masking key is st... |
I heard many people around still saying Perl is great language for CGI. But i think it is not as much as popular as now growing languages such as Python, Ruby.
Is there any solid reason for Perl still being the appropriate language for CGI.
|
As the title suggests my question is whether or not
unit-tests should be entirely self-contained or can
one rely on the results yielded by previous tests?
What I mean, in case that it isn't entirely clear,
is that if ones initial test sufficiently asserts
that a certain module A works in a certain way can,
or more appr... |
Two questions:
I assume that when Scrum coaches say "the team should decide" they mean there has to be a consensus decision process usually facilitated by the Scrum Master?
What if there is a disagreement between members of the Scrum team on the way to develop/design some feature and a consensus cannot be reached, wh... |
I have a website in which I'm loading all of the users' comments by the number of likes they have. This has caused me some troubles.
Let's say comment #1 has 5 likes, comment #2 has 2 likes, and the rest have 0 likes. We have the following comment id's:
1 2 3 4 5 6 7 8 9 10
Now let's assume someone e... |
I am the single programmer working on a website handling both frontend and backend. Recently in my task list I have to provide a social news feed (activities among friends) which should summarize activities from different modules (at least 7 modules). It has taken at least 20-25 days for me to develop that. Remember in... |
This question applies to both parameters and arguments, since I've seen this style used in both.
I usually write parameters like this
someFunction(arg0, arg1, arg2)
but I've recently noticed that many people write theirs like this
someFunction(
arg0,
arg1,
arg2
) // the bracket doesn't have to be on its own line
I ha... |
I have some windows c++ code (pure winapi c++, no MFC etc) that I would like to build a GUI for. My code does not know about windows GUI, it is completely decoupled from any type of UI.
The question: How could I build a UI around the existing code. Ideally, I am imagining something like this:
GUI <--> Mediator <--> MyE... |
I'm coming from a Java background and trying to learn Scala. At the moment I'm feeling pretty overwhelmed, there seems to be so much more to learn with Scala, so many different ways of doing the same thing.
I was wondering if anyone has any advice on where to start, and how long it took them to feel reasonably competen... |
How is the end() function implemented in deque-STL of C++ with array?
As per my knowledge it returns past-the-end element. But when a loop is run like, for(i=deq.begin();i!=deq.end();i++) and the whole array is full (suppose size=4), then I think end() will point to the position where begin() is pointing, in this way i... |
Why
for(k=1;k<=n;k*=2) grows logarathmically = O(logn)
but I feel it grows exponentially, as the seq look like 1,2,4,8....
and for fibonacci series people say it grows exponentially.
which for me doesnt look like 0,1,1,2,3,5...
but for tis they tell O(2^n).
PLease explain
|
I am a QA/Test manager in my organization and until today I verified the quality of the software (tests written and executed and bugs fixed). Who will verify this in Scrum? How do I know that the team wrote and executed all the right tests? On the other hand I'm afraid that if I continue to do the verification the team... |
I know many people have asked the same question but I think it really depends on the type of the website. So that's why I am asking the question about my website.
I am developing a PHP web application for an insurance company. the application contains all information about the customers but this app is only used by the... |
Given a string variable variable, for example, the convention to expose it is:
public class SomeClass {
public String variable = "";
public String getVariable() {return variable;}
public void setVariable(String variable) {this.variable = variable;}
}
Which looks like:
class.getVariable(); // Gets "variable"
class.s... |
There are several times where you're coding a method which has two parameters with the same type, lets say, integers, NumberOfUnitA and NumberOfUnitB. Given that we're coding in a language that doesn't support named parameters, why is that we don't see people creating types closer to the domain logic, in this case, Uni... |
Recently, I came across a number of open source Ruby (or majority of it was Ruby) projects on GitHub that when checked with a code analyzing tool like Rubocop, create a lot of offenses.
Now, most of these offenses include using double quotation marks instead of single quotes (when not interpolation), not following the... |
Now I'm thinking about the architecture of my program. I plan to provide access not only for Desktop usage, but for mobile platforms as well.
I want to create a bpl package as separate file. That is I want to have in Windows version next files: program.exe + logic.bpl. It can be usefull because logic.bpl may be often ... |
Scrum advocates assume that a team without a designated team leader (as it is in Scrum) is more effective than a team with a designated leader (as in traditional hierarchy). Although I can understand this point of view, I am not entirely certain that's the case.
In Scrum teams leaders always emerge. Power vacuums get f... |
I'm new to C# coming from a Java background. I'm working on a take home assignment for a coding interview. I normally write my code as following(Java):
public class Test {
//fields
private string fieldA;
private int fieldB;
public Test () {
//.....
}
public String getFieldA() {
return ... |
We all know that it is good to use descriptive identifier names. However, the convention in java is to use a single letter for a type parameter identifier. The default most people go to is T, but if you are dealing with elements in a collection, you often see E. Now I can see how it makes sense to use single letter ide... |
I'm working on a social network website and I'm not quite sure when I should store the date/datetime. The service includes some of the following events:
Register/Login
Follow
"Like" (images & comments)
Post a comment
Post an image
In my eyes, I would use DateTime for all of them... Although I'm not sure if that's pro... |
I've been thinking of creating an online database creator (think DabbleDB, Zoho Creator, Intuit Quickbase, etc.).
I've been thinking of a couple solutions:
Have 4 database tables: Tables, Rows, Columns, Items. To create a database as a user, you'd go to the "Add New Table" page, give a name and type to as many columns... |
Earlier, I was messaged about a potential security risk in one of my projects.
I checked it and found that it allows for "arbitrary code execution". (Quotes because it is running in a VM, but the damage that can be done is huge nonetheless)
Since it is an open source project, I imagine other people have found it and ex... |
I've recently realised that my workplace doesn't comment their ASP.NET MVC applications. By 'doesn't document', I mean there is probably 1 line of comment per model/view/controller. No file purpose, date created etc. The excuse is that the MVC should be self documenting, with skinny controllers, self-documenting view c... |
I'm new and I am trying to figure something out. I have a simple program which executes a method either when an event happens or when my timer ticks. Lets just say the method takes 5 seconds to complete. During that 5 seconds an event could happen. What would I use/do to make sure my method isn't called while its alrea... |
I am trying to understand how and where to implement domain model factories. I have included my Company aggregate as a demo of how I have done it.
I have included my design decisions at the end - I would appreciate any comments, suggestions, critique on those points.
The Company domain model:
public class Company : Do... |
I am starting to learn Lisp, using the SICP book. The authors mention that a procedure (i.e. function) can be recursive or iterative. Additionally, the process those procedures will generate will also be recursive or iterative, and that, surprisingly, a recursive procedure can sometimes generate an iterative process.
T... |
In my organization when we move a task to the "Done" column we write the number of hours it took to complete the task. It can be useful when during retrospective the team tries to understand why certain stories took longer to implement than anticipated. However it is also burdensome and developers feel somewhat microma... |
I'm currently working on a php frontend. Specifically, the authentication process.
I'll spare everyone the exact details of the decision tree, but it includes a lot of checks and about half of them branch to a call to do_logon() which generates the login page and then calls exit to stop processing further.
Currently, I... |
Most Java applications don't look the same as C/C++ applications. Swing might have been designed on purpose to have a distincitve look, but based on what I've read, SWT for example tried to 'look native', and doesn't completley succeed.
My question is:
Why is it hard for the developers of the Java language to design a ... |
Assume we have an abstract class having several concrete classes which
interfaces publish an information under several equivalent forms, with
the difference that each class has a preferred form which can be
consulted at no cost while consulting the others might require a
time-consuming computation. How to implement a ... |
In iOS, the coordinate (0, 0) means the top left corner. In macOS it is the bottom left corner.
What is the Apple's rationale or technical advantage of this coordinate system?
|
My manager wants me to refactor a gigantic amount of terribly-coupled, macroed, full of private namespace methods, hierarchy-perverted (even 10+ levels of inheritance) code which hasn't been (indeed) designed with a "whole-vision" concept.
I tried to explain to him that this code needs to be rewritten, not just refacto... |
I want to write a refactoring tool for the Java programming language.
For this reason I need to do structural queries against the abstract syntax tree. Given this AST how do I get answers to the following statements:
Get superclasses of an object.
Give me the expression where I call a method x() on type XClass
Is meth... |
I am interested in finding an approach that will detect what language a string of text is. As Google translate does.
|
In my Android application, I am using a couple of open source libraries. The only requirement these libraries have is that I must show their respective copyright notices in my application. I am trying to understand where would one typically display third-party copyrights. I could probably create a menu item "About" and... |
I have a large (≈ 20 million nodes) directed Graph with in-edges & out-edges. I want to figure out which parts of of the graph deserve the most attention. Often most of the graph is boring, or at least it is already well understood. The way I am defining "attention" is by the concept of "connectedness" i.e. How can i f... |
Tried to search the web and couldn't find an answer. It might have something to do with "load", but that doesn't make much sense to me.
Obviously, "ln" was already taken, but where does that "d" come from?
|
There are a lot of algorithms which will tell you whether or not a given point is found inside a polygon.
I'm looking to write an algorithm which, given a non-convex polygon, will return a point which is inside the polygon.
I don't need the point to be in any specific location inside the polygon, but I prefer to rece... |
I have a codes table that stores name value pairs and a group name.
So for this example let me demonstrate with two rows, each row would represent one value in the same drop down.
Group Name = 'Drop_Down_1'
Name = 'Value 1'
Value = 'This is my value'
Group Name = 'Drop_Down_1'
Name = 'Value 2'
Value = 'This is my value... |
I have encountered the following pattern while programming in Haskell (but the pattern could occur in any language supporting lists, option types, and mapping of a function over a list). I have types a and b and a function
f :: a -> Maybe b
Now I want to define a function that maps f on a list of type [a], but I am no... |
What's the name for a class that has only methods? There are no fields/properties. Just two methods with the ability to parse some file in two ways. I have named the class Parser, but it just doesn't seem right to have a class do only that. Or?
Should it be in a class ?
EDIT:
Dummy Example
class Parser
{
public in... |
I can understand this:
List("one word", "another word") unzip (_ span (_ != ' '))
But don't get what's happening here below in the span. span takes a predicate and I think the braces can be omitted as span is used inline and has only one parameter but why isn't there any _ and what is ' '.!=
List("one word", "another ... |
So I've taken on a project at work that I'm having a hard time attacking, and I'd love some feedback and suggestions.
I work for an online retail store where we have an old, +7k-line script that we use to create various product feeds (mostly for CSEs like Google Products, Pricegrabber, etc). It's become a complete mes... |
Some quick background - we don't have PMs or upper management breathing down our necks about status of features, etc, as we almost always deliver ahead of time and have built up a high level of trust with them. In other words, we have a huge amount of flexibility as far as process goes. We do very well with our current... |
I have recently come across a requirement related to our release/SDLC process that seems a little out of the ordinary to me so I am writing this to inquire whether this practice is common and, if not, whether our deployment process should be changed to eliminate a burdensome constraint.
I work for a small software shop... |
We are considering using BitBucket rather than hosting our Git repositories internally. Does anyone know if this breaks any rules of PCI compliance? I haven't been able to find much information on this.
|
I don't work too often with Java/C# iterators directly but when I do I always wonder what was the reason to design iterators in "next" fashion.
In order to start you have to move iterator, in order to check if there is some data you have to check if there is next element.
More appealing concept for me is this-iterator ... |
I'm creating a fictional architecture and other fictional components for this computer/emulator. I'm facing an issue, this being the virtual display.
I need to be able to create a Window in which my program has access to all pixels contained inside, this is to emulate video memory/access.
For the best speed I was thin... |
I have two plug-ins. One has the GNU LGPL 3 license and the other has the Apache Software License, Version 2.0. Can I use them in my commercial app?
And if yes, what precautions should I take?
|
What algorithm would pair parcels with a high proportion of property x to a parcel with a low proportion of property x so that the weighted average of the two parcels falls within an upper and lower bound? The algorithm needs to pair a set of parcels to maximise the quantity that fall into the given range. The parcels... |
My organization was flat two years ago, and people felt that the general manager had disproportionate almost dictatorial powers. Also the general manager didn't have time to coach employees, so some employees were dysfunctional and nothing was done about them. However on the plus side everyone was involved in the decis... |
Before forming a class in Java or other programming languages that support OOP, should I use underscore (_) in each (local or private) field declaration.
More precisely:
private String _customername;
Is this a correct declaration?
|
When you are reading about web application development, "front controller" and "single point of entry" are frequent words you are confronted with. To my understanding, the point is to provide a single location where you decide what to do in your program. That's all nice and well in theory, but I am confused as to how t... |
We are a small team of programmers, and we are now facing a situation where we have to outsource some of the work in order to complete it in time.
Project is about website that was previously build with asp.net webforms, EF and SQL server. We have previously build a data layer and optimized SQL, but we need to complete... |
I have inherited an API implemented using ASP.NET WebApi 2. The actions on the controllers are all like this:
public object Get(long id) {
LoginContext loginDetails = GetLoginDetails();
if (loginDetails.IsAuthorised) {
return _dependency.DoSomething(loginDetails, id);
}
return new HttpResponseM... |
I came across the idea of using function points as a metric for the velocity of a Scrum team. I saw it in a team and I found two articles mentioning a link between estimates and function points (http://www.ifpug.org/ISMA5-2010/Amol%20Keote-FunctionPointsAndAgile-Hand-in-Hand.pdf and http://www.cosmicon.com/portal/publi... |
has there ever been a proposal for establishing a formatting style file for programmers? In web programming, we have CSS files that help separate style from 'code', so two people can see the same code while each can see it in his/her preferred way.
I was thinking something like this could theoretically be achieved for ... |
I recently put up a project, called Hebel, that I've been working on to GitHub. It's a framework for GPU accelerated deep learning written in Python and Nvidia CUDA. I posted about it on Google+ and soon afterwards it was picked up on Hacker News and went slightly viral for a few days. I later posted about it again in ... |
Few days ago, I started to work in new company. Before me, all front-end and backend code was written by one man.
As you know, Django app contains two main directories for front-end: /static - for static(public) files and /templates - for django templates
Now, we have large application with more than 10 different mod... |
Background
I'm been contracted to help a company maintain their server. I work on some minor PHP projects but also look over performance issues and recently, scan logs for hackers.
These guys have been running their server for some time and have what I would call a legacy application on its last legs. It uses magic quo... |
So I have the following code, which connects and then binds to an LDAP server.
The question is in the first method.
public function getUsers() // This is the method in question
{
if( $this->connect()->bind() ) {
ldap_query(self::$connection) // Here, should it be aware that class succesfully loaded
... |
I currently have a .NET app that I want to convert to being cross platform, as a growing number of my users want a Mac version. Since this forum doesn't seem to like questions that are "what languages are suitable for these requirements", I'll focus this question on Python as the language of choice. Will Python be a ... |
I'm refactoring code and have reached a horribly gigantic switch statement. Every single API method available to end users is represented as an enum and we have a switch statement iterating over the enum and responding to each possible API call.
Each individual enum option has only a few lines of code. Any sufficient... |
I need this algorithm for one of my projects. I will paraphrase the problem.
There are 'n' ropes that have different colored rings on them. (The colors might repeat on the same rope or across different ropes).
My job is to pick a few of these ropes and join them such that all the colors in the n ropes are included in t... |
I'm having trouble understanding a past quiz question I got:
Bobby works at Starbucks in San Mateo (V). He is doing quality assurance testing and needs to visit stores in Palo Alto (B), Tenderloin (C), and San Jose (S) - and then return to San Mateo for a meeting.
The distances between the stores are:
V→B = 2
V→C = 3
V... |
I'm working on an algorithm which routes tasks through a chain of distributed resources based on a hash (or random number).
For example, say you have 10 gateways into a service which distribute tasks to 1000 handlers through 100 queues. 10,000 connected clients are expected to be connected to gateways at any given time... |
I have started using Pivotal tracker for a project I'm working on. Conceptually, this seems really cool and I'm interested in using the agile model. However, I have one problem with everything talked about in the video.
At 4:19 in the linked video they talk about story acceptance and how it should be done by the proje... |
My team is considering a department goal of doing Test Driven Development next (fiscal) year.
TDD sounds good and my manager is on board. The only problem is measurement.
Our company rules require that department goals be measurable.
Is there any (sane) way to measure if a team is doing TDD?
Note: We had a goal for ... |
I need some ideas on how to protect a private API key in an application, specifically in a c# .NET application.
Firstly, I understand that it is theoretically impossible to hide anything in the source code, so I came up with another idea, but I'm not sure how plausible it is. Anyway, would it be possible to somehow com... |
I'm working on designing a new programming language and trying to decide how I will do variable comparisons. Along with many different types of languages, I've used PHP for years and personally had zero bugs related to its comparison operations other than situations where 0 = false. Despite this, I've heard a lot of n... |
I am currently a software developer on coop that was in an interesting situation today. I cannot say too much, as the things I do are under NDA, but I make Grasshopper 3D (which is a Rhino plugin) components.
Our firm has under three software developers including me. We all specialize in different languages. This proje... |
Is there any decent work around to PHP's lack of Generics that allow static code inspection to detect type consistency?
I have an abstract class, that I want to sub-class and also enforce that one of the methods changes from taking a parameter of one type, to taking a parameter which is a sub-class of that parameter.
a... |
I've been reading up a lot on Domain-Driven Development, and I came to the question of how to preserve lack of distinct identity with value objects (VOs). While in the DDD world, this is a requirement (yet I'm not sure I understand the full power of this) it poses problems for the lower ORM layers in terms of persisten... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.