instruction stringlengths 34 19.9k |
|---|
When I learned relational databases, the prof said that one would "almost always" want an artificial int as the primary key in a table, but did not specify what the exceptions are. At some time I stopped using them for junction tables, and never had a problem.
Now I am making a database with a lot of lookup tables, an... |
I've been working in a very small team for PHP development and we've been using an ad-hoc, "Invented Here" style guide. Now that our team and codebase is growing, we would like to use a more broadly-used style guide that would be, if not an official standard, a de facto standards used in many PHP communities. Does such... |
I have a fair number of items in a session, and I am wondering if there are any advantages to copying the session variable to a normal php variable (in order to close the session file as quickly as possible) and then do any calls from there. Something like:
session_start();
$copiedSession = $_SESSION;
session_write_clo... |
I'm learning programming in Objective-C and I can't understand what a static method is. I know what class/instance/private/public methods are. Can someone explain what it is using an example and comparing it to the others I mentioned? And in what situation would someone use it?
From what I read on Wikipedia, it soun... |
First, some context (stuff that most of you know anyway):
Every popular programming language has a clear evolution, most of the time marked by its version: you have Java 5, 6, 7 etc., PHP 5.1, 5.2, 5.3 etc. Releasing a new version makes new APIs available, fixes bugs, adds new features, new frameworks etc. So all in al... |
I have just released an iOS app for beta-testing with TestFlight.
I'm wondering what is good practice during beta-testing?
Should I halt development of the app during beta-testing?
Should I continue developing but make a snapshot image of what the
code looked like when it was released for beta-testing?
Issues that cou... |
A colleague and I have been taking turns debating/discussing the issues/merits of integrating a version derived from the current git repository into our code whenever it builds.
We think the merits include:
No need to worry about human error in updating a version number
Traceability between what we find in a device an... |
I know exception handling is a topic often discussed in the world of Java. I've read a few threads on here and SO as well.
https://stackoverflow.com/questions/2169339/exception-handling-in-a-java-web-application
I find myself identifying with principles such as Do not suppress or ignore exceptions, Do not catch top-... |
My organization does web projects and employs a handful of disciplines like backend dev, frontend, BA, UX, graphic design, QA. We've been pushing to have tasks for every discipline in our sprints with explicit dependencies (Can't build a page without comps, can't do comps without wires, etc). I've heard some other orga... |
Hi I had today my first interview for a position of android developer.In my portfolio I had a php e-commerce application that has a catalog , ajax powered shopping cart , and administrator functionality.
Because my Android knowledge is prety limited , I only started learning about 3 weeks ago , I was asked to migrate ... |
I am developing an Android application for my final year project which allows the holder of a mobile device to receive a text notification containing potentially sensitive information from a server.
My question is this, if a User downloads the application, what is a suitable way for them to create an account / log in o... |
https://stackoverflow.com/questions/98734/what-is-separation-of-concerns
In computer science, separation of concerns (SoC) is the process of
breaking a computer program into distinct features that overlap in
functionality as little as possible. A concern is any piece of
interest or focus in a program. Typically,... |
I was recently talking with a recruiter who wants to put me at a company for a position of Developer in Test. He essentially made it sound like a position where you get to fiddle with new programming techniques and test bugs and improvements in software but where you don't need to worry about standard deadlines. You ge... |
I have created web services before that are used by a small number of users but have a new project that would have lots of users.
For each user that uses the services, this is what they would do:
1) Call a method on the web service that calculates a "price" based on parameters passed by the user.
2) The actual method a... |
I have an event(s) controller:
class Event extends CI_Controller{
public function index(){
}
public function foo(){
}
//Shouldn't be able to use this method unless logged in
public function bar(){
}
}
And I'm trying to organise my code so it's fairly tidy and straightforward. Just now I have ... |
I am currently building a website, which until quite recently was purely PHP. However I am now making trying to have the site use more AJAX, to lessen the page reloads. In PHP I had a lovely object orientated user class with methods for updating data, logging out, and so on. When a user logs on this would be stored as ... |
To me, it seems as though "mainframe" is a somewhat dated term; is it simply an older synonym of "server," or does it server a purpose more similar to a cluster/supercomputer?
|
I pulled the term smurf naming from here (number 21). To save anyone not familiar the trouble, Smurf naming is the act of prefixing a bunch of related classes, variables, etc with a common prefix so you end up with "a SmurfAccountView passes a SmurfAccountDTO to the SmurfAccountController", etc.
The solution I've gener... |
I'm in the process of implementing a programming language on top of LLVM. For my polymorphic system, I'm looking for suggestions for a ultra-fast dictionary. I am not concerned with insert time, as these maps are only written to a dozen times or so. But I'm looking for super fast lookup.
I did some research on the ope... |
Have you ever had this feeling that your code is bad, the whole project is a mess, and you just want to step off? On your daily job you can explain this feeling away with your coworkers, asshole boss, or something like this. But with side/pet projects there is really no excuse.
For example I'm currently maintaining my ... |
What are the common terminology used to schedule software update and support. For example, I really have no clue how releases and updates differ, how often are updates released (not everyday I hope)?
Most importantly communicating stuff like milestone (what is this mean?), roadmaps, basically I want to know how I can o... |
I know there are different ways to combine programming languages (Haskell's FFI, Boost with C++ and Python, etc...). I have an odd interest in combining programming languages; however, I have only found it "necessary" once (I didn't want to rewrite some older code). Also, I notice that this interest is shared (there ar... |
My university lists the rotation of courses each semester/year. Therefore, it is possible to predict when every class will be taught.
I am trying to create a JavaScript (language is irrelevant, really) program that will have the user select all the courses they would like to take, for how many semesters, and the max (o... |
I am developing a small application which I want to make open source.
Currently only my work is on the application, and so in all the files I have put up a copyright notice in my name.
Now when I make the project open source and say a developer Sam does some enhancements to some existing files. Then should he be allowe... |
Bug tracker for any decent sized project seem like a bit of a no-brainer to me - it makes it really easy to organise hundreds or thousands issues, without issues colliding or getting mixed up.
So when I see some really big projects, like Git, using a mailing list as the main method of coordinating maintenance and devel... |
The scope: it is part of a big ERP system which provides specific calculations. One can think of it as a salary calculation module in a CRM. Yet this is way beyond that in both complexity and integration points. Thus, there are a lot of technological debt, but not unmaintanable one. There some some unit/integration tes... |
I have a generic design question that relates to enterprise applications but I think that software developers from other types of projects may have experience with this as well.
The scenario is following - you have a database and you are about to write an application that provides access to its data. The database also ... |
A question has been bothering me for a while: when developing international projects, it is common sense to use English as the reference language since it is the language that the most people understand.
However, how can one choose to name a function when it could have different valid English spellings. For example, wo... |
I am new to unit testing, I've one REST web method that just calls DB and populates a DTO. Pseudo code is
public object GetCustomer(int id)
{
CustomerDTO objCust = //get from DB
return objCust;
}
My doubt is how to write tests for these methods and type of tests (Integration/Unit) to be included. And for unit test... |
I am just a graduate from India and I have knowledge of Java, JSP and Servlets, Android application development and some iOS development.
I do not have a background in C or C++ and a little weak background in Data Structures and Algorithms. I want to know whether I can make a successful career in the IT industry withou... |
I am working on one of my first projects in C (microcontroller code) which is split up into multiple C files. I noticed some inconsistency in my coding where I had some variables declared as extern global variables and would just access them directly (ISR and some other places), and others declared static global variab... |
A typical MVP application might have a View method such as:
void setDisplayItems(List<DisplayItem> items);
Should the Presenter sort the list of items or is that a task for the view?
I feel this might be a task for the View, for two reasons:
If it were a task for the Presenter, then methods such as:
void addDisplayIt... |
I have a question regarding ASP sections and partial views.
What ser the benefit of using one over another?
Because if I have a menu, i guest that it could be both as a section, but also as a partial view.
So what is the difference?
|
I would like some input on how to handle clients and third party vendors that ask me about the deficiencies in my design.
For example. It turns out I need a data field in a webservices response. This response has been signed off on weeks ago and I get questions like "Why haven't you identified this field X weeks ago?".... |
New to C++! So I was reading this: http://www.learncpp.com/cpp-tutorial/110-a-first-look-at-the-preprocessor/
Header guards
Because header files can include other header files, it is possible to
end up in the situation where a header file gets included multiple
times.
So we make preprocessor directives to avoid t... |
I am creating the model part of an MVC architecture. My one class will provide all the accesses to allow one to fetch system state. I want most of this state to be immutable as it shouldn't be changed and I don't want anyone accessing my model to be able to break the state by making a foolish change.
However, The obj... |
It is said, by Mike P. Wittie, in the course curriculum of computer architecture that,
Students need to understand computer architecture in order to
structure a program so that it runs more efficiently on a real machine
I'm asking to more experienced programmers or professionals that have a background in this topi... |
In a single directory with a Git root folder, I have a bunch of files. I am working on one of those files, X.py, with my friend Alice. The other files I am working on with other people. I want Alice (and everyone else) to have access to X.py. I want Alice to only have access to X.py though.
How can I achieve this with ... |
I have been seeing a lot of projects that have repositories that return instances of IQueryable. This allows additional filters and sorting can be performed on the IQueryable by other code, which translates to different SQL being generated. I am curious where this pattern came from and whether it is a good idea.
My big... |
The few LAMP web applications I have installed require me to create the necessary database tables myself, with a schema file, instead of doing it automatically with a script or setup page. Is this a normal and accepted practice? In my own hobby projects I find it much easier and hassle free to just create the tables in... |
I have developed a Java program for academic purposes (non-profit, non-open-source).
In the process, I made extensive use of many apache common libraries.
The program is now to be set free on the net, so I was wondering what my precautions should be. My program will (preferably) consist of a single .jar file, having a... |
So my CS professor gave the whole class a simple assignment. "Write a recursive function that will swap the order of a section in an array of chars." I thought to myself, "Easy. I'll finish this up in about 5 minutes and I'll get to work on my Trig homework before I leave."
This is not what happened.
An hour later, the... |
Ok, so I'm at a point where I think I have my basics down. I'd like to think I'm just starting to become an intermediate dev. So, how do I level up here?
It feels like I have reached my threshold, but I really want to break it, and move ahead, do more crazy stuff (for context, I'm talking about programming).
So, what w... |
I know a lot of programming languages that can be used to web development like PHP, ASP, etc. but why many web developers use java programming language for web development?
|
I am trying to find a efficient algorithm in Java to find the repeating decimal part of two integers a and b where a/b.
eg. 5/7 = 0.714258 714258....
I currently only know of the long division method.
|
I was recently asked this from my friend after explaining how µTorrent worked, he then went to ask me, "Could this be used for browsing the web?", (not a direct quote) but I found my self thinking about this for a while there after.
Could someone be credited with making the first Peer-2-Peer browser?
How could it sen... |
I have a question, to explain that, what better than an entirely fictional example?
Let's say you are a young developer just being employed in a firm.
All data is stored in a huge database (let's say 500+ tables with billion rows).
Your boss ask you to make some consolidation queries stuff.
So, you start making your qu... |
I have data available in the form of Structs and Arrays.
I need some design pattern advice, which I can use to model this situation
into corresponding Coldfusion Components.
Here is the data definition
I have objects like
Hotel
Apartment
Bus
Each object has it's attributes and images. Images have also different types... |
A WebApp writes a stream of data coming over a network to disk as key/value pair and then reads & send it over network again after few milliseconds in 99% of case. In 1% of cases write/read can be few hours to days apart (really don't know).
Latency is strict "no" in the app and we have to serve 100% of customers there... |
I want to build a command line interface with menus and sub-menus and eventually the leafs of the tree should be operations like..
bank management -> account management -> add acount (insert account info)
And I'm looking for a good way which works with the OO principles...
Thanks for any piece of advice!
|
What are the general strategies to employ when attempting to ensure that a module of code will function correctly on the live system? A common problem we have at our software house is that we typically deploy solutions to a remote client's server, which hasn't got any software-development-related software installed on ... |
I'm developing a .Net application that uses google protocol buffers. Historically the application used the approach, advocated by the protobuf-net team, of decorating the classes with attributes instead of using .proto files.
I am now in the process of migrating part of the application's client to another technology an... |
This isn't career advice, this is more of a question of logistics.
When looking at job market and such there is a lower than what I think would be out there of database admins but I'm curious if database admins actually include strictly database developers, or of database developers are more under a blanket term "Prog... |
I've been reading various techniques for splitting large user stories in helpful ways, such as by user workflow through the system etc. What I'm struggling with is how to word these smaller stories if all they achieve is facilitating the next step in the process and not delivering the application's main benefit to the ... |
Recently we have had some turnaround in the shop I work in, because of this comments in our source code were made hastily and explained very little. We have started working on the departments first draft of coding standards and one of the bigger questions is: Should we implement this standard across the existing sourc... |
I work for a large financial company that manages money for thousands of clients. This company has very complex business processes and they operate in a very dynamic environment.
This is a fairly old company and over the years they have implemented many heterogeneous systems to automate processes within the company. ... |
I am trying to build a project which uses an unmodified copy of libconfig (http://www.hyperrealm.com/libconfig/). libconfig is LGPL, but I don't want to open source any of my code. By my understanding, LGPL means I need to provide the source for the library (easy), and a means for them to use their own modified version... |
I am developing a PHP Application that needs to display and accept content written in tamil.
For example "login" should be written in tamil on the form.
How can I achieve this ?
|
Reusing large amount of helpful codes made by other programmers is very tempting for me. I specifically refer to codes that can perform generic tasks, such as Data Access Layer (DAL) codes.
I am just beginning a project using a newly familiar language, and I don't think programming from scratch is feasible. I can unde... |
I'm starting to hear rumblings about this project called ASM.js. Currently their web site is terrible and confusing. Here's what I know from my research on the web.
It is a subset of JavaScript that can be highly optimized. I'm guessing because it avoids the more dynamic parts of the language.
Performance of code comp... |
When and why would you generally sacrifice typesafety for a nicer programming interface?
Let me give you an example: if you had the choice between two event aggregators, which one would you prefer and why?
Reflective Version:
SomeEvent.subscribe(instance, "nameOfAMethod"); //method called via reflection
SomeEvent.fire(... |
How can I handle timeouts in a network application.
I'm implementing a provisioning system on a Linux server, the code is huge so I'm going to put the algorithm, it works as like this
Read provisioning commands from file
Send it to another server using TCP
Save the request in hash.
Receive the response then
if suc... |
I have built a JavaScript library that I'd like to release for free within my user community. However I want to keep it under control, and not allow my users to pass it on to others without my permission.
As far as I can tell, a MIT or GPL license won't work for that scenario. What licensing options do I have?
Backgrou... |
I'm the lead programmer at a small software firm (currently 4 developers including myself), we develop bespoke ASP.NET WebForms applications for businesses. I joined there in 2010 just after graduation, so it was my first real job. After more senior programmers left, I was promoted to lead and we hired a bunch of junio... |
During a recent project I've been working on, I've had to use a lot of functions that kind of look like this:
static bool getGPS(double plane_latitude, double plane_longitude, double plane_altitude,
double plane_roll, double plane_pitch, double plane_heading,
double gimbal_... |
According to Gregory Baker & Erik Arvidsson (Google), creating a named function and then passing that to setTimeout is actually faster than creating an anonymous function (reference: Optimizing JavaScript code -> Avoiding pitfalls with closures):
Creating a closure is significantly slower then creating an inner functi... |
I have a database table that stores uploaded files (excel files) in a blob field. Each record contains the uploader, upload-time, the upload ID (primary key) and of-course, the blob itself.
At some point, I need to get that data from the database do something with it. Currently, I have a POJO which just mirrors the tab... |
I am implementing a C preprocessor in C...
I have the three functions:
trigraph replacing function
Line splicing function
comment removing function
However these functions work separately on files i.e.
First function will take a file and replace the trigraphs producing a temp-file1 as output
Second function will take... |
I was wondering what is the best way to organize my source code. I was researching on SO and found https://stackoverflow.com/a/1398594/137261 but this source code layout is library specific and doesn't cover my situation.
My situation:
10 own modules (100k lines of code)
15 external libraries (e.g. boost, sqlite, zlib... |
I am looking for a recommendation of a best practice for XML comments in C#. When you create a property, it seems like that the expected XML documentation has the following form:
/// <summary>
/// Gets or sets the ID the uniquely identifies this <see cref="User" /> instance.
/// </summary>
public int ID {
get;
... |
I have a web app I would like to gradually refactor by adding structure to it.
I have narrowed down the options to Backbone (with some plugins), Ember.js and AngularJS
My goal is to refactor that app, which has the usual jQuery spaghetti and gradually add some structure to it.
Requirements
not a "all or nothing" fram... |
I happened to create a mutable class like this:
class Mutable<T> {
private T value;
public Mutable() { this.value = null; }
public Mutable(T value) { this.value = value; }
T get() { return this.value; }
void set(T value) { this.value = value; }
}
And then it's often used in a method like this:
bool... |
For commercial and licensing purposes, what is the correct wording for differentiating JavaScript source code (written by the programmer and including comments) from the minified version used in production?
|
I have a class which represents an entity object in our system (for sake of argument, a Customer object)
public class Customer()
{
private int id;
private String name;
... // 30+ fields
public Customer()
{
// empty constructor!
}
// getters and setters
}
I'm trying to refactor this so that the fiel... |
My team is trying to find out the best way to test one of our components; the main scope is to check if the user/actor has the right to complete the operation requested. The component is formed by many functions that usually have the following structure (simplified):
Example language: PHP
public function addGroup($idEn... |
Say some 20 people go to a shop and everyone buys something. When it comes to paying, 5 of them pay the complete amount of 10,000$ split unequally between them.
Since everyone bought different things they all owe different amounts to the payers. Now there are multiple ways the payers can clear the balances with the pa... |
I'm in the middle of designing an API for a very basic flashcard application for learning purposes and I'm wondering if you all think there can be any improvements.
In the app, a Folder contains Folders and Sets. A Set contains Cards. The Homepage lists any top-level Sets and Folders that the I've created (but neve... |
The upper management at our company has laid out a goal for our software team to be “15% more productive” over the next year. Measuring productivity in a software development environment is very subjective, but we are still required to come up with a set of metrics.
What sorts of data can we capture that would measure ... |
Say I have a class that implements multiple interfaces. I pass the same instance around using a different interface, depending on what the consumer is interested in.
I am trying to remember what this is called. I know there is a fancy name for it - I thought it was "interface partitioning", but I'm not finding any hits... |
Is there a way to make sure that modifications to free software are released even when no binaries of modified code are conveyed? Though it may sound odd and from what I understand, e.g., GPL requires to distribute source only if binary is conveyed to other parties thus making it possible for unlimited private use as i... |
I'm writing a middle layer between vendor code and company business logic. Part of the exercise is to insulate our business logic from vendor's types to make swapping out vendor code easier.
As such, I'm writing a lot of extension methods that do translation to and from. I'm placing these extensions in public static p... |
Within the world of developers/firms specializing in building/deploying solutions built around software built/sold by Oracle (aka "Oracle houses"), what ORM middleware is considered as the "industry standard" (if any), based on your experience?
We have limited experience on Oracle's stack, so would appreciate insights... |
I've used git for my personal projects for years, but that's always working alone, not needing to branch much, etc.
Our development team at work has decided we are definitely switching to git, and as one of the most experienced git user on the team I have the task of figuring out our project structure.
Our current st... |
Background
I hate the way .Net/IEEE-754 handles equality of floating-point numbers (FPNs) (i.e. double, float). It requires the programmer to be prescient with respect to the yet-to-be-determined history of the number, as the programmer must choose a 'reasonable' value of epsilon where frequently no such value can be d... |
Is it okay to have a strategy implemented as a non-static inner class or is it considered a bad practice?
public class SomeClass{
private final Strategy strategy;
public void someMethod(){
this.strategy = new Strategy();
//call some strategy method to run an algorithm
strategy.doSomeWork();
}
priva... |
Say I have a method called 'functionA' that is called by a service and carries out a single piece of functionality, it is easy to unit test as it is does one thing only.
If a few months later an new requirement comes in that requires another method 'functionB' to be called directly after 'functionA' has executed. What... |
Some programming languages like e.g. Scala have the concept of Option types (also called Maybe), which can either contain a value or not.
From what I've read about them they are considered widely to be a superior way of dealing with this issue than null, because they explicitly force the programmer to consider the cas... |
For the sake of an exercise, say you have an input file with a series of lines of text with the objective of reversing their respective character sequences.
Now introduce 5 threads that will each do the reversing, thread 1 taking care of line 1, thread 2 taking care of line 2 and so on.
If the aim is to save these reve... |
I noticed some duplicate code in a codebase I am working on that appended a filename to a directory path, so I decided to refactor it into its own method. The application I am working on is not well tested, however; I just set up the first unit tests on it two days ago, so I am very concerned to get as much code under ... |
I work for an organization that does a lot of work with government data. We have a couple of different projects where we've abstracted out common text search/manipulation operations into reusable libraries, for things like standardizing the way politicians' names are displayed (e.g., transforming "MCDONALD, BOB (R-VA)... |
Distributed issue tracking seems like a belting idea to me, but it has never really taken off in a big way. Is there a good reason for that?
I am aware of:
bugz everywhere
too complex to set up
too many requirements
reasonably successful, used by some large projects
fossil
tries to integrate too many things, and en... |
I was watching one of Uncle Bob's videos and he brought up the Database Interface Layer. He had this diagram showing it:
These arrows show that the DB Interface Layer is aware of and calls the Application and Database layer, but not vice versa.
The DB Interface Layer has "data records" in it. These are "classes" t... |
How are effort estimations and duration estimations distinct?
At present my understanding is that effort is related to the amount of work required for one person to complete a task, and duration is the total amount of time required to complete the task, irrespective of resources. Is this the commonly accepted definitio... |
In a lecture, the lecturer described the following model :
E - entry (the preconditions to a task).
T - task - doing the task
V - verifying the tasks quality
D - Delivering the tasks
X - Exit.
or ETVDX
If anyone is familiar with this 'generic compliance model', how does it fit into software development exactly? I... |
I've got a simple authentication solution, where a user can log in with either email or username.
Since I want to show the little feature in the acceptance tests but don't want to pollute them, I thought I'll introduce some randomness. Do you think this is bad or good?
step "Fill in my credentials" do
fill_in :user... |
I am looking to write a Bayes filter that will act as an indicator of topic for a number of topics with a variable number of sources. Given a really big number of RSS feeds and here really big might only be a few hundred only few percent (let's say 2%) are interesting to a given group.
What I want to write (in PHP) is ... |
From time to time I find there is a need to build a service class. Something I can't really attach inside a model in order to respected GRASP and SOLID.
So I created a class called AccountTransferService.
Are service classes good design practice ?
Do they represent a Model ?
If a Service is not a Model what are they... |
From time to time I implement functionality which requires asking user questions sequentially.
Questions are conditional, that is the answer defines the set of the following questtiongs.
Sure it is Wizzard UI design pattern, but for now I have no clear understanding how it is implemented from the point of view of softw... |
I always try to follow the DRY principle strictly at work; every time I've repeated code out of laziness it bites back later when I need to maintain that code in two places.
But often I write small methods (maybe 10 - 15 lines of code) that need to be reused across two projects that can't reference each other. The meth... |
I think i've understood more or less what a parsed Scheme program looks like (a binary tree with atomic values on the leaves, if i have understood correctly). Can anybody please define to me, or give a reference, what a state (or a computation) of a Scheme program is? Is it just the current binding plus a position, o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.