instruction stringlengths 34 19.9k |
|---|
There are many situations where the validity of the timestamp attached to a certain post (submission of information) might be invaluable for the post owner's legal usage. I'm not looking for a service to achieve this, as requested in this great question, but rather a method for the achievement of such a service.
For th... |
I am currently doing some research for a project. The setup is simple, I have a computer running a service in my home network and any device connected to that same network should be able to discover the service automatically and use it. I have no specific technology requirement whether it is on the server or client sid... |
Please allow me to use this example/metaphor to describe an algorithm I need.
Objects
There are 5 thousand pennies.
There are 50 cups.
There is a tracking history (Passport "stamp" etc) that is associated with each penny as it moves between cups.
Definition
I'll define a "highly diffused" penny as one that passes t... |
I'm trying to write an algorithm (specifically in Ruby) that will rank teams based on their record against each other. If a team A and team B have won the same amount of games against each other, then it goes down to point differentials.
Here's an example:
A beat B two times
B beats C one time
A beats D three times
C b... |
First of all I have asked this question on stackoverflow and got down vote for question being not belonging to the site. I am trying my luck se now(more suitable to se I guess) and I hope I will not get down vote from here too
I want to develop a face recognition app that searches the database for an image. I looked at... |
I need an algorithm which can copy data(files/folder) from one place to another, faster than windows default copy/paste option. I'm working in vc++. Is there any algorithm by which I can do copy/paste faster.
Or Is there is any other suggestion to perform this task?
Thanks
|
To give you a little background: I work for a company with roughly twelve Ruby on Rails developers (+/- interns). Remote work is common. Our product is made out of two parts: a rather fat core, and thin up to big customer projects built upon it. Customer projects usually expand the core. Overwriting of key features doe... |
Is telnet just a simple socket connection?
I usually have a difficult time in the networking area so I use some code from the internet to help me out, but I can't seem to find a library for Telnet in Objective-C.
The closest thing I've found is CocoaAsyncSocket
I was wondering, Is telnet just plain socket connections?
... |
In my early days of programming I often used to get memory related fatal errors in the following format:
Fatal error: Allowed memory size of <some big number> bytes exhausted
(tried to allocate <some small number> bytes) in /path/to/filename.php
on line <some line number>
I'm a little embarrassed to state that even ... |
I have read the documentation and some other questions' threads about this topic and I don't really feel convinced; I don't see clearly the limits of use of this technique.
Fragments are now seen as a Best Practice; every Activity should be basically a support for one or more Fragments and not call a layout directly.
F... |
Overriding a method originally defined in the super class, by definition means this method will do different things when invoked on an object of the base class or an object of the subclass.
So does this mean that overriding methods always means violating LSP? Or are there cases when it doesn't?
|
CAN Driver means application program that interacts with CAN hardware and helps in initializing setup and communication.
CANopen Stack provides various APIs to deal with CAN communication.
Now this is confusing me so please let me know: Is CANopen Stack and CAN driver one and the same?
|
Herb Sutter in a video answers a question about the concepts proposal considered for C++11 and from his remarks it sounds like multiple groups offered prototype implementations but all of them left concerns about slow compile times. The comment surprised me because it suggests that, at least in some cases, the prototyp... |
I'm building an application which fetches large amount of items with ajax requests via other application API. It returns me 6k - 30k js objects which are used multiple times across various application views (sorting, filtering etc.). I would like to avoid querying API every time for such big list so I decided to cache ... |
I am a great believer in the Boy Scout Rule:
Always check a module in cleaner than when you checked it out." No
matter who the original author was, what if we always made some
effort, no matter how small, to improve the module. What would be the
result? I think if we all followed that simple rule, we'd see the ... |
I'm facing the problem of counting the unique visitors of groups of places.
Here is the situation:
I have visitors that can visit places. For example, that can be internet users visiting web pages, or customers going to restaurants. A visitor can visit as much places as he wishes, and a place can be visited by several ... |
I'm programming Genetic Algorithm in C++ and after searching all kind of ways of doing GA'a operators (selection, crossover, mutation) I came up with a doubt.
Let's say I have an initial population of 500. My selection will consist in getting the top 20% of 500(based on best fitness). So I get 100 individuals to mate.... |
I would like if you could explain to me in a simple way how does the disruptor patter work. This concept has been elusive to me as of know.
Perhaps with your help I could comprehend it.
|
Does anyone know how to visually diagram the ways in which the flow of control in code passes between code produced by different groups and how that affects the amount of code that needs to be carefully written/reviewed/tested for system properties to hold?
What I am trying to help people visualize are arguments of t... |
I'm a relative newcomer to OOP, and I'm having a bit of trouble creating good designs when it comes to interfaces.
Consider a class A with N public methods. There are a number of other classes, B, C, ..., each of which interacts with A in a different way, that is, accesses some subset (<= N) of A's methods.
The maximum... |
I have to write a user story for a requirement that involves passing search filters to the same URI and retrieving corresponding results.
I have 5 filters.
I plan to write 5 different stories of type:
As a URI user I can search by #filter1 so that I can retrieve results based on #filter1.
And then a 6th story that invo... |
I kind of ran into this when messing around with FlashPunk, and I'm going to use it as an example.
Essentially the main sprite class is pretty much class Entity. Entity's constructor has four parameters, each with a default value. One of them is graphic, whose default value is null.
Entity is designed to be inherited... |
Currently working on a web based CRM type system that deals with various Modules such as Companies, Contacts, Projects, Sub Projects, etc. A typical CRM type system (asp.net web form, C#, SQL Server backend). We plan to implement role based security so that basically a user can have one or more roles.
Roles would b... |
I have a rather large collection of classes which check and mutate a given data structure. They can be composed via the composition pattern into arbitrarily complex tree-like structures. The final product contains a lot of these composed structures.
My question is now: How can I test those? Albeit it is easy to test ev... |
I'm rather new to JavaScript and programming in general so I am pretty much only used to seeing if statements that have some kind of comparison operator like, if (x < 10) or if(myBool).
I have seen an if statement checking against an event, but I don't understand what or why the event is being checked like that. What... |
I'm implementing an IRC bot that receives a message and I'm checking that message to determine which functions to call. Is there a more clever way of doing this? It seems like it'd quickly get out of hand after I got up to like 20 commands.
Perhaps there's a better way to abstract this?
public void onMessage(Stri... |
A random distribution of points lies on a map.
This data lies behind an API, and I want to grab the complete set of points within a given bounding box.
I can query the API with the bounding box and the API will return the set of points that fall within that box.
The problem is that the API will limit the result set to ... |
In a Web API 2 project, in the project properties, I have enabled the output of an XML documentation file.
By default, Visual Studio 2013 wants to check this into TFS. I'm pretty sure that I'm going to exclude it, but wondered what the general opinion is on this?
|
An example on the asp.net site has an example of using Linq to create a search feature on a Music album site using MVC. The code looks like this -
public ActionResult Index(string movieGenre, string searchString)
{
var GenreLst = new List<string>();
var GenreQry = from d in db.Movies
orderby... |
In a MVP win forms application I'm handling exceptions as follows in DAL.
Since the user messaging is not a responsibility of DAL, I want to move it in to my Presentation class.
Could you show me a standard way to do that?
public bool InsertAccount(IBankAccount ba)
{
string selectStatement = @"IF NOT E... |
I have following development setup for my PHP projects:
Working station running on Windows 7 with PhpStorm IDE.
GIT for version controlling.
CentOS on virtual machine (VirtualBox) with Apache and MySQL (copy of production server).
So far, I've been sharing project's source folders between host and guest systems and i... |
I'm using MVC but I've read that MVVM is sort of about data binding and having pure markup in your views that data bind back to the backend via the data-* attributes. I've looked at knockout but it looks pretty low level and I feel like I can make a library that does this and is much easier to use where basically you o... |
Public inheritance means that all fields from the base class retain their declared visibility, while private means that they are forced to 'private' within the derived class's scope.
What should be done if some of the parent's members (say, methods) need to be publicly exposed?
I can think of two solution. Public inhe... |
I tried to use the 'inspect element' of the firebug addon for Firefox but it doesn't give me any link to the javascript.
For example I got this from the firebug add-on:
<a href="javascript:">
text of the link
</a>
But there is no link to the actual javascript or anything that I can use to directly go to the said ... |
I've heard conflicting information from different sources, and I'm not really sure which one to believe. As such, I'll post what I understand and ask for corrections. Let's say I want to use a 2D matrix. There are three ways that I can do this (at least that I know of).
1:
int i;
char **matrix;
matrix = malloc(50 * siz... |
We have very frequent releases and we use Git for version control. When i am mentioning about frequency, please assume it to include bug-fixes and feature release too. All releases are eventually merged into ‘mainline’. When a release is deployed on production and if a bug is identified, people start fixing the bug on ... |
I want to refactor an OLD legacy application and give it a new feel... so, I want to use Twitter Boostrap for the UI... I've also been playing around a lot with AngularJS... is it common place to use them in conjunction with one another? Is it even the correct question to ask? I've done about an hour's worth of "googli... |
I know that Java uses a controlled mechanism to allow threads to be paused. If I understood correctly, they put a read from a protected page at the end of e.g. loops, and change the protection of that page if they want the thread to be paused.
What I don't understand is why this is necessary and whether this can even w... |
For a hobby project, I'm writing an x86 GC and JIT. For the GC, I need to maintain information about the stack layout (it's a precise GC), for which I need to be able to find out which method the IP currently is in (and the complete call chain of course). How can you do this?
The best solution so far was to keep a b-tr... |
You often see statements like "all non-trivial software has bugs" or "all non-trivial abstractions are leaky". But what makes a program "trivial" instead of non-trivial? Where is the cut-off line at which we can say that a program isn't trivial and "excuse" bugs?
Even something only a few lines long could have bugs. Sa... |
I was reading through the documentation for Bower here and I read this line: "The .bowerrc file should be a sibling of your project's bower.json." What does that mean exactly? Searching Google returned questions of people asking how to find siblings, but not what they actually are.
|
I'm working on a 2D-physics engine, and I need a certain variable to be precise only to the hundredths. Are there any methods for basically shaving off all of that unneeded precision?
I have tried things like
"{0:.2f}".format(a)
but that obviously produces a string, not a number.
I'm moving an object based upon its s... |
I know how the lambda expresion works and I know it is an argument for .filter() that establish the criteria to filter with. But I don't get how .filter() uses the argument, in this case a lambda expression, because .filter() does't have an implementation or at least require one at compile time. I search for this unkn... |
I'm going to start by saying, this may not be the correct place to post this.
So...I'm working in Embedded Development, using C.
Is there any benefit or disadvantages to doing the following:
while (1)
{
i++;
switch (i)
{
case 1:
x_get_inputs();
break;
case 2:
x_react();
... |
I'm writing a library for use in scientific computing and ran into a bit of a quandary. The types at work here are a class M which consists of some data and a reference to a container class C. There are many different implementations of C and I devoted a lot of work to making sure that M objects could use C objects wit... |
I'm building an application, and I'm thinking long-term I would like to be able to allow plugin support. The application I'm creating is a Java based application. How could I allow plugins using a scripting language, or is it better to require plugins to use Java?
Would I need to create some sort of plugin interface to... |
When handling exceptions for example in a method in my presentation logic, is it ok to catch all possible exceptions in a one catch block as follows if the only purpose here is alerting the user.
private void Do()
{
try
{
// Do some stuff here which might throw an exception
}
catch (Exception e... |
What I am trying to do is give the users/visitors the option to alter the whole website based on their taste. So they can move for example the sticky bar from top to bottom, alter background colors, news box from left to right etc.
For users I will probably store all the information in the DB but I am not sure how I sh... |
I have been given an online task in which I am supposed to develop a service which is based on some other class/service which has not been implemented yet but I have a rough API for that and the results return by my class would be used by some other class/service
I am not sure what would be the best way to return this.... |
Following is a code snippet from MVP Win Forms application and this explanation would be helpful when answering the questions.
My DAL doesn't handle exceptions and it will be propagated up to the calling method in the presenter classes where the exception will be handled.
I'm using a single handler called ExecutAction... |
I've been lately thinking over design principles and patterns and a question did strike me.
Let us say, I want to design a racing game. I want to design the classes for a variety of cars.
each car may have different feature
the most common features can be put in the base class - 'Car'
Now, I learned that you should a... |
The video of Scala with style is here: http://parleys.com/play/51c1994ae4b0d38b54f4621b/chapter21/about
It's around 41:10 that he suggested another talk.
I can not hear the name of speaker or the name of the session very clearly.
Could someone help me to figure that out?
|
I want to make a roulette board with a ball spinning and landing on a certain field.
The catch is that the field the ball will land on, is known beforehand.
I want the animation to look somewhat realistic, even though the result is decided beforehand.
So I think I need to calculate the path the ball will follow, starti... |
I have a 2D array filled with a simple class:
class Tile
{
boolean N,E,S,W;
}
I also have a tilesheet representing all possible outcomes except all false (12 + crossroad). Now i need to reference all these possibilities to texture space on my sheet. Apart from having an if statement for each and every outcome is t... |
I'm reading "Rock Breaks Scissors", which describes two "outguessing machines" built at Bell Labs that try to exploit human non-randomness in the game of matching pennies. There was an outguessing machine built by the famous Claude Shannon, and one built by Dave Hagelbarger.
The machines worked like this (quoted from t... |
I have a small mobile quiz game, which consists of 30 questions, and a timer which starts from 0 seconds, and goes all the way up to 1 hour. Below you can see that my timer starts from 0, and it is displayed in the format of MM:SS.
var timestamp = new Date(0, 0, 0, 0, 0, 0);
function pad(n) { return ("0" + n).slice(-2... |
public interface IMyInputProviderPlugin
{
IMyOutput Provide(IMyInput data);
}
This is an interface I need to provide so that I can dynamically load the dlls and not have them bound to my implementation.
However, upon reading this, it seems like this is an anti-pattern?
http://blog.ploeh.dk/2011/04/27/Providerisno... |
I understand the advantages of using markdown in local text files, and then taking those files and generating HTML. This is great for documentation, readme's in git repositories and posts for static site generators. It is very simple to create markdown syntax in any text editor, it's human readable, and you can create ... |
I am looking for a way to solve an assignment problem, but I am having some problems finding the correct algorithm to use.
I have 2 list of nodes A and B, and in my problem may the length of A not be equal to B.
In addition, the node a in A may not be a potential match with all nodes in B. The preference is given by a ... |
I am reading the Core Java (9th edition) by Cay S. Horstmann and Gary Cornell. After making an effort, I cannot still understand the ? super Manager. Here are some materials relating to this question.
public class Pair<T> {
private T first;
private T second;
public Pair(T first, T second) {
this.fi... |
...or, can I license things separately within the project (i.e. images=LGPL, code=GPL). I've been confused about this for a little while now and I can't seem to find a clear answer.
|
Functional/non-functional and interpreted/compiled are two different categorizations, yet it seems that there are a lot of overlaps in the programming languages that fall under those categories. Is this a coincidence?
|
I was reading this blog post and liked the idea of using the DTO class for an entity and using it as a property in the corresponding business object class like so:
public class Person : BALBase
{
public PersonDTO Data { get; set; }
This also can eliminate the need for a mapping tool like AutoMapper (mapping be... |
I am using ownCloud - which is AGPL license - and only create few custom modules, and a theme, the core is not touched at all so:
should I allow download source for the whole app ( owncloud and my modules/theme ) ? ( as it is agpl based )
or should I only provide link to download owncloud code ( the original code ) ?
... |
I have following method in my presenters which validates the user inputs on the UI. Basically to capture the value of the text property of the text box, it uses sender object which was passed in by the event fire on the form.
PRESENTER
_View.ValidateInPut += new EventHandler(_View_ValidateInPut);
private void _View_Va... |
Wasn't sure how to phrase that title, sorry!
I've just come across this in our code base, and was wondering what the consensus was about how to unit test it:
C# (-ish, sorry, this is paraphrased from memory)
class DateCalculator
{
public static DateTime CalculateLeadTime(DateTime deliveryDate)
{
//return th... |
I have been tasked with creating a desktop client application that fetches data from web apis and presents it to the user.
During the last month or so, I've spent most of my time and energy bringing to life the functionality that UX described with two pictures.
Looking at the pictures, it seems like a simple design. Th... |
Are Data Warehouses bespoke projects that are developed to meet the needs of a specific organisation or can you buy off the shelf products that would meet the needs of many organisations?
I am talking about a product that will integrate information from many different systems e.g. finance system, sales system, producti... |
What limitations does inheritance of an interface through an abstract base class present that are addressed by zope.interface?
In the following talk given in 2010 by Jeff Rush about interfaces, at 11:50 Jeff argues that with providedby you are free of the inheritance hierarchy. Why is this important?
If I wanted to ... |
I have been refactoring an existing system to use dependency injection, and that work has been going smoothly.
After a while I noticed that a large number of in-house libraries became dependent upon the DI framework I used. As a result the entire project now depends upon this third-party framework.
I saw an irony in de... |
The currently most upvoted answer to a very recent question states that
DI containers are an "enterprise software" pattern, used when the object graph is very large and complex. I suspect that 95% of applications do not require it.
which is something I strongly disagree with. Maybe I've got the terminology wrong, but... |
This question is regarding MVP triads. Lets say I have two triads and first one has View1, Mode1 and Presenter1. Second triad has View2, Model2 and Presenter2. Now what I trying to do is, I just want to display the View2 when I click a button in View1.
You'd show the View1 calling it's presenter's show method.
View1Pre... |
Tarjan's algorithm for finding bridges in a graph is found here: http://en.wikipedia.org/wiki/Bridge_(graph_theory)#Tarjan.27s_Bridge-finding_algorithm.
However, I don't understand the condition for checking if an edge is a bridge. I get that L(w) = w is a necessary condition, but I think that the condition for H(w) < ... |
Was put on hold at stack overflow: hopefully it has value here.
I want to use a BDD / TDD / ATDD approach in c++. However I really want to emphasize vertical slices of end to end functionality rather than unit tests. There are plenty of unit testing frameworks.
How would you go about in c++ authoring an approach that e... |
I am a hobbyist programmer, bit of a stickler for terminology, currently learning C and recently came across the concept of Memory Leak. Now, I do understand what it means. Dynamic memory allocated to a program is not returned by the program.
But where does the term 'leak' come from? Is it coming from the fact that ot... |
For comparisons / evaluations of objects of the same class(and other purposes), is it better to define a static or a non-static (is this called "dynamic" by chance?) function?
Sample code:
class student
{
internal decimal medianOfMarks()
{
int count = 0;
decimal sum = 0;
foreach(float ... |
Considering favoring composition over inheritance and looking at various design patterns there are multiple approaches to modeling a domain.
Say you have some Entities which are very similar in some respects, yet differ widely when it comes to technical implementations. To try portray the scenario here is the classic ... |
I am new to state machine modeling and while trying to model a system, I have a question.
An example will explain it better:
Considering a system that does calling (probably a customized cell phone device) with possible states:
idle->calling->signal-dropping->handle->call ended
idle->calling->OS problem->handle->call e... |
So from the top-voted answer to this question, it appears that using raw pointers for storage isn't frowned upon so much. However, then what is the point of a std::weak_ptr? I thought that storage was the exact purpose of that class. If so, is there any circumstance in which a raw pointer is considered good, valid code... |
The game development package Unity uses the following version numbering scheme:
{major}.{minor}.{patch}{type}{number}
With the following known types:
a = alpha
b = beta
f = final
Some examples:
1.2.3a27
1.2.3b4
1.2.3f2
Is this a standard formatting for version numbers?
|
In our group we usually don't ponder too much about what kind of design or implementation decisions caused a bug, we just fix it. Of course if some module constantly produces bugs people start to notice it, and sometimes this leads to major refactoring. But we don't have a process where bugs are routinely analyzed for ... |
I have a function that works perfectly for detecting whether or not r1 overlaps with r2:
boolean overlaps( Rectangle r1, Rectangle r2 ) {
return r1.x < r2.x + r2.width && r1.x + r1.width > r2.x &&
r1.y < r2.y + r2.height && r1.y + r1.height > r2.y;
}
But now I would like to add a minimum threshold so that ... |
After I have written some commits, I very often git rebase -i over them, in order to test them, if necessary split them, take parts form one commit and squash them to another, more appropriate one.
But there is a problem. Say, today I am hunting for a bug, that 5 recent commits are causing. I rebase interactively on th... |
In an oft-cited (if dated) reference for C# coding standards (pdf; from Lance Hunt), the statement is made,
33. Avoid invoking methods within a conditional expression.
I've not seen this recommendation elsewhere, including in the .NET guidelines (here or here). Unlike the other very reasonable guidelines in Hunt's do... |
So for example say I had it so that all of my files will be transferred from a windows machine to a unix machine as such: C:\test\myFile.txt to {somewhere}/test/myFile.txt (drive letter is irrelevant at this point).
Currently, our utility library that we wrote ourselves provides a method that does a simple replace of a... |
I previously posted a question [link] on programmers.stackexchange.com asking when it makes sense to adopt an existing enterprise scale agile framework and when it makes sense to allow your own enterprise scale agile framework to emerge (e.g. through trial and error).
This question takes the previous question a step fu... |
We are writing a B2B application that uses OAuth 2.0. Before a token expires we want to refresh it since it is faster to refresh a token, than to request a new one. However, we want to build in some resilience in the system to clock skew, so we want to consider a token expired a few seconds/minutes before it would actu... |
I was designing a kind of a parser when I thought that it would be nice to have an operator overload like this: operator[]=(subscipt_type s, rvalue_type val). For example we have a class:
//collection of Foos
class FooCollection
{
public:
//assume class Foo is defined
Foo& operator[]=(int i, const Foo& val);
... |
Considering the Wavefront obj file format where this syntax fits in the Chomsky hierarchy and why ? I'm also not sure if PEG grammars are being considered in the kind of classification made by Chomsky and if an obj is a real example of a PEG grammar .
to formalize this: what kind of grammar and parser I need in order t... |
I understand the basics of what data races are, and how locks/mutexes/semaphores help prevent them. But what happens if you have a "race condition" on the lock itself? For example, two different threads, perhaps in the same application, but running on different processors, try to acquire a lock at the exact same time.... |
Let's say I have a social media website. On this website, users can upload several pieces of information about themselves, including their phone number. To implement this, I have a class called PhoneNumber that represents the users phone number. But phone numbers are optional. I have this PhoneNumber class which is sup... |
In order to handle several possible errors that shouldn't halt execution, I have an error variable that clients can check and use to throw exceptions. Is this an Anti-Pattern? Is there a better way to handle this? For an example of this in action you can see PHP's mysqli API. Assume that visibility problems (accessors,... |
Say you have arguments A1 >: A2 (contra-variant), and return types B1 <: B2 (covariant).
The corresponding functions are such that:
A1 => B1 <: A2 => B2
Sometimes, this makes sense to me - I will grasp it in a flash of lateral thinking. And then a few days later it is lost to me until I struggle through it for anoth... |
I understand that when naming RESTful URI's it is commonly accepted to use plurals to represent collections of resources. I am curious as to the argument for using singular nouns instead.
|
I'm implementing a sortable listview using bauerca's library here. This works, but now I need to define some things where I need some help. This is the functionality of my app_
I can create up to 5 names. These names are saved in a SQLite database. Then, in other activity, these names are loaded from the database and s... |
I am new to open source licenses and it seems very confusing, therefore need some suggestions. We are developing an application which utilities existing components with following license types:
Apache License v2
LGPL v2.1
MIT License
BSD style license
Mozilla Public License v1.1
Now my concern is:
What kind of distr... |
I work in C# and MSSQL and as you'd expect I store my passwords salted and hashed.
When I look at the hash stored in an nvarchar column (for example the out the box aspnet membership provider). I've always been curious why the generated Salt and Hash values always seem to end in either one or two equals signs.
I've see... |
As part of my job, I regularly get ad-hoc requests from users for snapshots of our very large database. However, there's no fixed format for delivering these and they usually come through in the form of bullet-pointed text, for example:
All customers
All active in last 0-24 months (including non-contactable customer... |
I am converting a project from C to mixed C/C++. It is going quite nice, and the new features are really lightening the work.
The platform is an ARM SAM4, compiler is arm-none-eabi-g++. This is not a safety-related equipment, but still could be left running for months and is not supposed to restart sporadically.
The or... |
In my project, I came across understanding that writing release notes is both helpful and necessary. However, it is not required by my management and I keep these files virtually to myself. You could say, I do it for self-organization. For each version of the internal prototyping software, I create a version number and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.