instruction stringlengths 34 19.9k |
|---|
I am creating a penny auction site using PHP yii framework. The main consideration of the system is to update the database records of all active auctions (max 15 auctions) with the current ticker timer.
I am seeking for advice on how I should design the system where every auction item will have its own countdown timer... |
Lets say I have library "A2" as a dependency in a project. Library "A2" is derived from library "A1"(A2 is a fork of A1 with some modifications to the original source code) where someone has done few changes to the library "A1" 's source code.
Lets say there is a new version of "A1" I want to use the new version but no... |
I am designing a new system which is more of a help system for core applications in banks or healthcare sector. Given the nature of the system this is not a heavy transaction oriented system but more of read intensive.
Now within this application I have multiple entities which are related to each other.
For e.g. Assu... |
I have a requirement for a workflow which I am trying to model as a state machine, I see that there is more than one outcome of a given transition(or activity).
Is it valid for a state machine to have more than one possible states, but only one state will be true at a given time?
Note: This is my first attempt to mode... |
I have an application and my desing approach look like this:
class Manager
{
public int State;
static Manager _instance = null;
public static Manager Instance
{
get { return _instance; }
set
{
if (_instance == value)
return;
_instance = va... |
I have a free open-source project with around 800K downloads to date.
I've been contacted by some monetization companies from time to time and turned them down, since I didn't want toolbar malware associated with my software.
I was wondering however, is there a non-evil way to monetize software ?
Here are the options ... |
Problem. I have a symmetric distance matrix with entries between zero and one, like this one:
D = ( 0.0 0.4 0.0 0.5 )
( 0.4 0.0 0.2 1.0 )
( 0.0 0.2 0.0 0.7 )
( 0.5 1.0 0.7 0.0 )
I would like to find points in the plane that have (approximately) the pairwise distances given in D. I understand that this will... |
I'm using svn without branches (trunk-only) for a very long time at my workplace. I had discovered most or all of the issues related to projects which do not have any branching strategy. Unlikely this is not going to change at my workplace but for my private projects.
For my private projects which most includes coworke... |
Actually I came across a question in Dynamic Programming where we need to find the number of ways to tile a 2 X N area with tiles of given dimensions..
Here is the problem statement
Now after a bit of recurrence solving I came out with these.
F(n) = F(n-1) + F(n-2) + 2G(n-1), and
G(n) = G(n-1) + F(n-1)
I know how to so... |
I once read (I think it was in "Programming Pearls") that one should use templates instead of building the string through the use of concatenation.
For example, consider the template below (using C# razor library)
<in a properties file>
Browser Capabilities
Type = @Model.Type
Name = @Model.Browser
Version = @Model.Vers... |
Does Liskov substitution principle apply to inheritance hierarchies where the parent is an abstract class the same way if the parent is a concrete class?
The Wikipedia page list several conditions that have to be met before a hierarchy is deemed to be correct. However, I have read in a blog post that one way to make th... |
Among computer scientists and programmers, there's the common habit of naming people in the context of security protocols e.g. Alice, Bob or Eve. Descriptions of more elaborate attack vector sometimes refer to Charlie (as does this XKCD strip), but is there a convention for additional participants?
|
Back in the day, it was common to manage database transactions in Java by writing code that did it. Something like this:
Transaction tx = session.startTransaction();
...
try {
tx.commit();
} catch (SomeException e){
tx.rollback();
}
at the beginning and end of every method. This had some obvious problems - it's ... |
I need (for unit testing purposes) to create adapters for external library classes.ExchangeService and ContactsFolder are Microsoft's implementations in its' EWS library.
So I created my adapters that implement my interfaces, but it seems that contactsFolder has a dependency for ExchangeService in its' constructor.
The... |
First some background. Let's say we have a system where a customer is placing an order in a web interface. The items that customer is ordering can priced in various ways. Sometimes including the cost of delivery and sometimes not at all. That pricing effectively depends on a variety of factors including the vendor's ow... |
I am developing a simple text editor and would like the application to save the text automatically. In other words, the user would never have to press a save button.
I have seen other applications that do this, and was wondering how often is it safe to write files to disk? From a user experience standpoint, it seems th... |
I write numerical routines for students of science and engineering (although they are freely available for use by anybody else as well) and am wondering how to properly use machine constants in a JavaScript program, or if they are even applicable.
For example, say I am writing a program in C++ that numerically computes... |
Directly post graduation from University, I decided to build my own web app (Ease My Day) while waiting to get a job as a software Engineer.
The reasons to build this app:
Gain solid hands on software experience before hitting the job scene
Providing a solution to a common problem
Not sitting doing nothing while searc... |
I have been asked to clone some existing software for a company. Basically its an old 16 bit DOS console app, which was supplied free of charge in I believe the late 80's. Having replaced the machine that needs to run it with a box running Win7 x64 they can't get it to work. It crashes every couple of minutes under DOS... |
As I understand, the cause of the speed difference between compiled languages and python is, that the first compiles code all way to the native machine's code, whereas python compiles to python bytecode, to be interpreted by the PVM. I see that this way python codes can be used on multiple operation system (at least in... |
I'm working in an Android project with multithreading. Basically I have to wait to the server to respond before sending more data.
The data sending task is delimited by the flag boolean hasServerResponded so the Thread will loop infinitely without doing anything until the flag becomes true.
Since this boolean isn't dec... |
Some applications (for example Minecraft) have the 'free-to-deobfuscate'-model. It means that you are free to make and distribute changes to the applications code, but you must decompile and deobsuscate the application first.
This makes less than zero sense to me. Isn't the whole point of obfuscation the prevention of ... |
I work on a Symfony 2 codebase.
We use a number of third-party packages (most are in the Symfony Standard Edition).
We use composer for dependencies.
We current have all of our third-party code committed in our repository (after changing .gitignore files) to ensure stability.
According to Proper Programming Practices™,... |
My assignment is to use local search heuristics to solve the Multidimensional multiple-choice knapsack problem, but to do so I first need to find a feasible solution to start with.
Here is an example problem with what I tried so far.
Problem
L1 L2 L3
RESOUCES : 8 8 8
GROUPS:
G1:
11.... |
My experience is that Java requires about twice as much RAM compared to C (comparing char arrays or other comparisons). I also read in a hardware book that Java takes about twice RAM than C. Is is based solely on empirical evidence or also has a theoretical explanation? Is there a theoretical limit that limits Java fro... |
PHP 5.5
I'm doing a bunch of passing around of objects with the assumption that they will all maintain their identities - that any changes made to their states from inside other objects' methods will continue to hold true afterwards. Am I assuming correctly?
I will give my basic structure here.
class builder {
protec... |
Right now, I'm working on refactoring a program that calls its parts
by polling to a more event-driven structure.
I've created sched and task classes with the sced to become a base
class of the current main loop. The tasks will be created for each
meter so they can be called off of that instead of polling.
Each of t... |
I am trying to develop a computing application which needs a lot of memory (>500gb). Buying a single machine for that is overly expensive. I can, though, buy ~100 small instances on Digital Ocean or similar, divide the memory in blocks and use TCP to emulate shared memory between the instances.
Now, my question is: how... |
When I worked in Microsoft on MSE antivirus, we had several stages of pre-release: Alpha, Beta, RC. The biggest difference between these stages were bug fixes. Each time we fixed more bugs, and usually updated some minor features.
Apple works in the same way. Look here:
http://www.techrepublic.com/article/pro-tip-how-... |
I have spent quite a few days reading up on Oauth and token based security measures for REST API's and I am currently looking at implementing an Oauth based authentication approach almost exactly like the one described in this post (OAuth alternative for a 2 party system).
From what I understand, the token is to be ver... |
Can someone explain to me how are effected the performances of an Access 2003 DB when it's used by a lot (30) of users on the same LAN?
I'm working on a vb6 project with this access 2003 DB wich performs ok on my local PC, but it's terrible when used across 20-30 users.
It's there something I can do to improve perform... |
I have one exception handler class. I want to show this class in the uml -- class diagram. But, I do not know how to represent relationship between class <X> and exception handler class. How can I represent relationship between class in class diagram?
|
In a windows forms payroll application employing MVP pattern (for a small scale client) I'm planing user permission handling as follows (permission based) as basically its implementation should be less complicated and straight forward.
NOTE : System could be simultaneously used by few users (maximum 3) and the database... |
Disclaimer: I'm sure someone is going to moan about easy-of-use, for the purpose of this question consider readability to be the only factor that matters
So I found this site that converts to easting northing, it's not really important what that even means but here's how the piece of javascript looks.
/**
* Convert Or... |
I my c# program I have to perform 5 steps(tasks) sequentially. basically these five should execute one after the other only the previous task performed is success. Currently I have done it in following style. But this is not very good code style to follow.
var isSuccess=false;
isSuccess=a.method1();
if(isSuccess)
... |
Let's say that we have a regex and an index i. If we suppose that the set of strings that match our regex are sorted in a lexicographical order, how could we get the i element of this list?
Edit : I added this simple example for more explanation:
input :
regex="[a-c]{1,2}";
index=4;
In this case the ordered list of ... |
I ported this from http://www.effectgames.com/effect/article.psp.html/joe/Old_School_Color_Cycling_with_HTML5 some time ago.
However i'm now wanting to modify it for the purpose of changing it from floating point to fixed point maths for enhanced efficiency (for those who are going to talk about premature optimization ... |
I was creating and discussing a class diagram with a partner of mine. To simplify things, I've modify the real domain we're working on and made up the following diagram:
Basically, a company works on constructions that are quite different one from each other but are still constructions. Note I've added one field for e... |
(This is an extremely newbie-ish question).
I've been studying a little about Virtual Machines.
Turns out a lot of them are designed very similarly to physical or theoretical computers.
I read that the JVM for example, is a 'stack machine'. What that means (and correct me if I'm wrong) is that it stores all of it's 'te... |
I'm trying to parse equations like the ones below, which only have two values or the square root of a certain value, from a text file:
100+100
-100-100
-(100)+(-100)
sqrt(100)
by the minus signs, parentheses and the operator symbol in the middle and the square root, and I have no idea how to start off... I've got t... |
I'm finding R confusing because it has such a different notion of reference than I am used to in languages like C, Java, Javascript... Ruby, Python, C++, well, pretty much any language I have ever programmed in ever.
So one thing I've noticed is variable names are not irrelevant when passing them to something else. The... |
A recent paper by Wilson et al (2014) pointed out 24 Best Practices for scientific programming. It's worth to have a look. I would like to hear opinions about these points from experienced programmers in scientific data analysis. The authors' advices sound good, but do you think these advices are helpful and practical?... |
I've learned how to program primarily from an OOP standpoint (like most of us, I'm sure), but I've spent a lot of time trying to learn how to solve problems the functional way. I have a good grasp on how to solve calculational problems with FP, but when it comes to more complicated problems I always find myself reverti... |
Is it necessary to start variable from zero (var i = 0) of any looping ? When should I use var i = 1; and when var i =0;?
|
I'm wondering if there are any general guidelines or best practices regarding when to split data into a metadata format, as oppose to directly embedding it within the data. (Specific example below).
My understanding of metadata is that it describes data (without the need to actually look at the data), allowing for data... |
In the case where a couple of classes implements an interface, and those classes have a couple of constants in common (but no functions), were should I put this constant ?
I've had this problem a couple of times.
I have this interface : DataFromSensors that I use to hide the implementations of several sub classes like ... |
What are the differences between a while loop and a for loop? It seems to me that they are the same.
|
Is this a bad practice?
const int sId(int const id);
// true/false it doesn't matter
template<bool i>
const int sId(int const id) {
return this->id = id;
}
const int MCard::sId(int const id){
MCard card = *this;
this->id = id;
this->onChange.fire(EventArgs<MCard&, MCard&>(*this, card));
return... |
I'm building a Date/Time class with a "configurable quarter" system as follows.
User specifies which month the quarter starts at (config)
Set of functions to deal with quarters (next quarter, prev quarter, etc)
All quarter functions respect the config
Now this class is primarily to be used for fiscal quarter calculat... |
I am currently designing a functionality in my Web Application where the verified user of the application can execute queries which he wishes to from the predefined set of queries with where clause varying as per user's choice.
For example,Table ABC contains the following Template query called SecretReport
"Select def... |
Can the fact that the business logic is mapped to interfaces instead of implementations actually hinder the maintenance of the application in certain situations?
A naive example with the Java's Hibernate framework would be, that for example (provided I don't have the whole code-base in my head, the project structure is... |
How should I structure, in the DB especially, but also in the application, a trinary state?
For instance, I have user feedback records which need to be reviewed before they are presented to the general public. This means a feedback reviewer must see the unreviewed feedback, then approve or reject them. I can think of ... |
This isn't a serious problem or anything someone has asked me to do, just a seemingly simple thing that I came up with as a mental exercise but has stumped me and which I feel that I should know the answer to already. There may be a duplicate but I didn't manage to find one.
Suppose that someone asked you to write a pi... |
This is a code organization question.
I got my basic code working but when I expand it, it will be terrible. I have a DLL which I don't have a .lib for. Therefore I have to use the whole LoadLibrary()/GetProcAddress() combo. It works great. But this DLL that I'm referencing has 100+ functions. My current process is:
1)... |
I've been looking for some implementations of Service Layer and Controller interaction in blogs and in some open source projects. All of them seem to refer DbContext object in repository classes but avoided to use in service classes. Service classes essentially using a IQueryable<T> references of DbSet<T>. I want to kn... |
Everyone talks about legacy code in software development and I have heard the term over the last ten years used to paint any codebase as being bad.
Where did this term, which has such powerful connotations to programmers alike originate?
I am sure there must be some book on software development that pioneered this term... |
We are given an array of integers where all elements are between 0-9. have to start from the 1st position and reach end in minimum no of moves such that we can from an index i move 1 position back and forward i.e i-1 and i+1 and jump to any index having the same value as index i.
Time Limit : 1 second
Max input size ... |
Microsoft provides some VMs for testing purposes (advertised on Stack Overflow) and I'm trying to understand the license terms. The one I don't really understand is
1.b. You may use the software for testing purposes only. You may not use the software for commercial purposes.
My thoughts:
Testing a website in severa... |
I recently noticed decoupling as a topic in a question, and want to know what it is and where it can apply.
By "where can it apply", I mean:
Is it only relevant where compiled languages like C and Java are involved?
Should I know about / study it as a web developer?
|
I'm wondering if such a thing can exist. Can there be an object that is mutable but not flagged as garbage collected ( specifically, tp_flags & Py_TPFLAGS_HAVE_GC )
I have a C++ struct-like object that I'm writing and I'd like to know if all of its members are immutable. I'm thinking of checking for the Py_TPFLAGS_H... |
I am working on the design stages of an application that will a) collect data from various sources (in my case that's scientific data from serial ports), keeping track of the age of the data, b) generate real-time statistics (e.g. running averages) c) display, record, and otherwise handle the data (and statistics).
I a... |
I'm trying to add data from a webhook (from a web cart) to a local Microsoft SQL Server. It seems like the best route for me is to use a PHP script to listen for new data (POST as json), parse it, then query to add to MSSQL.
I'm not familiar with security concerning the connection between the PHP script (which would si... |
I was thinking that maybe I should forget AJAX (HTTP) requests when I've got a web-socket open between client and server, but I decided I should ask here to check if this could be a bad practice for some reason that I'm not thinking of.
Once the socket is open, there's less syntax (often meaning simpler error handling)... |
I'll admit I'm a spring newbie, but you can correct me if I'm wrong, this one liner looks kinda fishy in a best practices sort of way:
@RepositoryRestResource(collectionResourceRel="people"...)
public interface PersonRepository
extends PagingAndSortingRepository<Person, Long>
For those who are unaware, the following d... |
One of the main advantages of Docker is the isolated environment it brings, and I want to leverage that advantage in my continuous integration workflow.
A "normal" CI workflow goes something like this:
Poll repository for changes
Pull from repository
Install dependencies
Run tests
In a Dockerized workflow, it would b... |
I'm trying to determine OSS compliance for a body of source code, part of which includes sections from OpenEmbedded, and contains a lot of patch files, as they (seem to) try to adapt various tools.
In these patch files I find a range of copyright possibilities
the patch file removes a hunk of code from an original, h... |
The C function for seeking in a file is called lseek(). Why ins't it called just seek()?
|
I've tried to learn Haskell a few times over the last few years, and, maybe because I know mainly scripting languages, the functional-ness of it has always bothered me (monads seem like a huge mess for doing lots of I/O). However, I think it's type system is perfect.
Reading through a guide to Haskell's types and typec... |
I'm proficient with HTML and CSS but I'm still pretty shaky when it comes to Javascript. That said, I've been able to build a site using the Internet Archive Book Reader, which relies on reader.js
Here's a copy of one of my versions of reader.js https://gist.github.com/dylan-k/ed4efed2384e221d46cc
It's a good site, bu... |
I've been using session middleware to build web apps for years: from PHP's built-in session handling layer to node's connect session middleware. However, I've never tried (or needed) to roll my own session handling layer. How would one go about it? What sort of checks are necessary to provide at least some modicum of s... |
I've googled 2 days straight and I can't find how to do this. I have an open stream between client and server, and client will send a JSON string (encrypted to bytes) to the server each 3 to 5 seconds.
How can I write to the Socket OutputStream so that I can read each JSON string in the server. I'm guessing I need to s... |
Currently the software development lifecycle followed in the IT company I work at is:
The "Business" works with a solution manager to build a Business Requirement document
The solution manager works with the Program manager to build a Functional Spec
The PM works with the engineering lead to develop a release plan and... |
Our current code base is contained in a versioning system that is old and outdated (Visual Sourcesafe 5.0, mid 1990's), and contains a mix of packages that are no longer used, ones that are being used but no longer updated, and newer code. It is also a mix of 4 languages, and includes libraries for some of our systems ... |
Consider such code (let's say it is C++)
Foo::Bar.get().X
How one should keep the AST for this -- as "tree" with root at left Foo(Bar(get(X)), or with root at right (((Foo)Bar)get)X? Or maybe as a flat structure (list)?
The first one seems more convenient when resolving names, the second when working with it as expres... |
I am trying to understand what is the purpose of making files using commands such as cmake .. and make, I have tried looking online but there is no concise explanation on its purpose that i could find.
Also, is it necessary to use make on a project folder that is not built in order to use the source (C++) in other pro... |
There are a ton of questions like this, but they are mostly very generalized, so I'd like to get some views on my specific usage.
General:
I'm building a new project on my own in Django. It's focus will be on small businesses. I'd like to make it somewhat customizble for my clients so they can add to their customer/i... |
I'm using Fossil-SCM to maintain my projects. Since I don't work in a team I usually have just a very linear branch of development: 1.0 -> 1.1 -> 1.2
I'm wondering what the procedure is when you have one project who's task is about to be given to a related project. And thereby rendering the first project obsolete. Alth... |
I'm trying to train and perform classifiers from TMVA. My data set contains event weights besides event data.
In the TMVA::Factory there's a method setWeightExpression to specify event weights. What are the event weights good for? Why it doesn't exist similar possibility to set event weights in TMVA::Reader?
Regards,
V... |
I am looking for a job and have applied to a number of positions. One employer responded. I had a pretty lengthy phone interview (perhaps an hour +) and they then set me up with a developer test. I was told that the test was estimated to take between 6 and 8 hours and that, provided the results met with their approval,... |
Assuming that I am dealing with dedicated physical servers or VPSs, is it conceivable and does it make sense to have distinct servers setup with the following roles to host a web application?
Reverse Proxy
Web server
Application server
Database server
Specific points of interest:
I am confused how to even separate ... |
Let's say that I am writing two different versions of the same software/program/app/script and storing them under version control. The first version is a free "Basic" version, while the second is a paid "Premium" version that takes the codebase of the free version and expands upon it with a few extra value-added featur... |
There are quite a few enterprise agile software development frameworks available:
Scott Ambler: Disciplined Agile Delivery
Dean Leffingwell: Scaled Agile Framework
Alan Shalloway: Enterprise Agile Book
Craig Larman: Scaling Lean and Agile
Barry Boehm: Balancing Agility and Discipline
Brian Wernham: Agile Project Mana... |
If there is a method
bool DoStuff() {
try {
// doing stuff...
return true;
}
catch (SomeSpecificException ex) {
return false;
}
}
should it rather be called IsStuffDone()?
Both names could be misinterpreted by the user:
If the name is DoStuff() why does it return a boolean?
If ... |
I am working in sprint. At the end of sprint I need to send a defect report per sprint. Considering the below scenario please let me know your views.
Two teams(A & B) are working at different locations in Sprint-2 and I am a tester from Team-A and report the defects for the items developed by Team-A in each sprint
... |
Really sorry about the title that probably doesn't make much sense. Hopefully I can explain myself better here as it's something that's kinda bugged me for ages, and is now becoming a pressing concern as I write a bit of software with configuration.
Most software comes with default configuration options stored in the a... |
I hope I'm in the right place to ask that.
I have a question regarding the practice of open-sourcing a proprietary library that we built and use at work. The licence will probably be MIT. I like the idea, but here comes the unusual part : I have been tasked to remove some of the most advanced features. Those will remai... |
Suppose we have the following setup under Linux, .so library named "libcnt.so" and 3 user space apps: "app1", "app2", "app3". This library does 1 simple thing, it says to the app (app dynamically links the library at runtime) by how many apps it is already linked. Apps should have access to link counter. My knowledge i... |
I'm attempting to write a cancel operation for a software download application. This application will first transfer the software to the device and then install the software on it. (These are givens I'm not allowed to change).
What should the cancel operation do? When a user presses 'cancel', the application should sto... |
I am not understanding the output of this ,
#include <iostream>
using namespace std;
// pointers and arrays
char ch1 = 'a' , ch2= 'b';
char ch3[6] = {'c', 'd', 'e', 'f', 'g' , 'h'};
char *ptr[3];
int main ()
{
ptr[0] = &ch1 ;
ptr[2] = ch3;
cout << &ch1 << endl;
}
The out put is abcdefgh .
isn... |
I have a bit of a challenge at work at the moment. Presently (and in fact, for some time now), we have been experiencing the following problems with some in-house maintained applications:
Defects (sometimes quite serious) being released into production;
The Customer (that is, the relevant business unit) perpetually c... |
I have a domain where an Organization has People.
Organization Entity
public class Organization {
private readonly List<Person> _people = new List<Person>();
public Person CreatePerson(string name) {
var person = new Person(organization, name);
_people.Add(person);
return person;
}
... |
This is the problem i am dealing with. I have to make a simple game of NIM. I am learning java using a book so far i have only coded programs that deal with 2 classes. This program would have about 4 classes i guess including the main class. My problem is i am having a difficult time designing classes how they will in... |
One of the methods that I commonly use in our codebase is misspelled (and it predated me).
This really irritates me not simply because it is mispelled but more importantly it makes me ALWAYS get the name wrong the first time I type it (and then I have to remember "Oh, right, it should be mispelled to this...")
I'm maki... |
In the process of learning test-driven development, I've been introduced to dependency injection and the use of interfaces, and have started using these concepts in my own PHP code in order to make it more testable.
There have been times when I've needed to test code that was doing things like calling the PHP time() fu... |
During code reviews a couple devs have recommended I break up my methods into smaller methods.
Their justification was (1) increased readability and (2) the back trace that comes back from production showing the method name is more specific to the line of code that failed. There may have also been some colorful words a... |
In Unix whenever we want to create a new process, we fork the current process i.e. we create a new child process which is exactly the same as the parent process and then we do exec system call to replace the child process with a new process i.e. we replace all the data for the parent process eith that for the new proce... |
We're trying to plan how to mash together a build server for our shiny new Java backend. We use a lot of JAXB XSD code generation and I was getting into a heated argument with whoever cared that the build server should:
Delete JAXB created structures that were checked in.
Generate the code from XSD's.
Use code genera... |
In REST, do we always use link relation values to convey semantics/role of a linked resource?
I assume link relation value is always specified using rel attribute?
Should rel attribute only be specified within a hypermedia control?
I assume for an element to be considered a hypermedia control it must provide a linkin... |
I try to learn C++ and programming in general. Currently I am studying
open source with help of UML. Learning is my hobby and great one too.
My understanding of memory allocation in C++ is that it should be
symmetrical. A class is responsible for its resources. If memory is
allocated using new it should be returned... |
I've been watching a few of the Is TDD Dead? talks on youtube, and one of the things that surprised me is Kent Beck seems to acknowledge that there are just some kinds of programs that aren't worth unit testing. For example, right here DHH says that Kent Beck is
... very happy to say "Well, TDD doesn't fit in this ca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.