instruction stringlengths 34 19.9k |
|---|
The C# community has so ubiquitously used the "I" prefix to denote an interface that even the most inexperienced programmers know to use it.
Why is it then that we do not prefix enums, abstract classes or structs (possibly with "E", "A" and "S" respectively)?
For example, if we did mark all abstract classes with an "A"... |
I'm planning to write an e-commerce app using PHP & MySQL with lots & lots of custom rules. Say for example, I want to have a rule like "Give Customer X, a 10% a discount for Product Y if he bundles it with Product Z"
I've heard about Business rules engine(in Java and others). I intend to implement a flexible business... |
PHP supports the list() language construct which, in short, allows you to return multiple values from a function and then attach them to different variable, eg:
function myBigReturn(){
return array("foo", "bar");
}
list($fooer, $barer) = myBigReturn();
echo $fooer; // echoes "foo"
echo $barer; // echoes "bar"
I ha... |
Function A() calls B() calls C(), which encounters an error. Which function writes to the log and which function reports to the user?
My first inclination is that all functions should write to the log, and that the inner-most UI-facing function should be responsible for outputting the error to the user. However, the fi... |
I recently was assigned to a task, but it says only a couple of words, like, do it as it made there, with no actual spec attached. What is the best thing to do in that circumstances?
|
Teams in our company deal with Product Owners who are in such a position that they cannot spend as much time with us, as we would like, to do proper Backlog Grooming.
Thus in order to alleviate some of the time constraints we have begun implementing the art of getting stories "Ready for Sprint" or in other words gettin... |
While practicing TDD, I came across this specification:
A user should be created with its password hashed, be persisted and an activation token should be returned.
Should my first unit test, (aiming to begin to test this scenario) should encompass the whole needs? :
shouldPersistTheNewlyCreatedUserWithAHasedPasswordAnd... |
I recently read this question that features, the arrow anti-pattern.
I have something similar in code I'm trying to refactor except that it branches. It looks a little something like this:
if(fooSuccess==true&&barSuccess!=true){
if(mooSuccess==true){
.....
}else if (mooSuccess!=true){
....... |
I'm involved in a project for a redesign of an existing site. The Designer Team delivered us -the Engineering Team- four separate HTML/CSS prototypes of how the site should look:
On a Desktop Browser.
On a Table Device, a similar but simplified design of the Desktop View
A High-Tech Smartphone, the design is mobile-ap... |
I'm currently working on a code base that has many classes that implement a Start method.
This seems like two-phase construction to me, which I had always considered a bad practice. I can't tell the difference between this and a constructor.
When is it appropriate to use a start method instead of normal object constr... |
The company I'm working on has a RUP-like software development process, with very heavy documentation. Right now we're doing a Multi-Channel web site -it's intended to be seen in Desktop, Tablets and Smartphones- and every version of the site has a particular flow of events and content.
I don't see in RUP an artifact w... |
Specifically, I am working on a tool that integrates a DVCS and build system, but I image the challenge I am facing would arise for anyone developing a "meta" tool (compiler, VCS, build system, test runner, etc.) that they wish to develop through "dogfooding".
My question is: in a scrum-style release process using the ... |
Despite being very stakeholders friendly, ATDD aimed to provide a "stop" line when a feature has just been done. This avoids wasting time to add non-focused (and sometimes useless) code.
That's why some teams start by establishing a walking skeleton of the application, and directly specifying with an acceptance test th... |
I'm trying to decide on what format I should save data in, and hopefully this question will help me come to a decision. The program I'm writing uses 'databases' in which word=meaning (not a dictionary, that was just an example). I don't really want people to be able to manually edit these 'databases' without my program... |
It's current to see the terms callback, trigger and handler in some API documentations. It is just synonymous or each term correspond to a specific concept?
I used to think that this terms are just synonymous, but I must be wrong ...
Thanks !
|
I'm not coming from web-development at all, but am looking to build a web application.
So far, I've looked into all the server-side stuff (for example, I think my stack will be Linux + node.js + ExpressJS + MongoDB), and have learnt a lot! At this point, I'm comfortable setting up an HTTP server, routing requests, usi... |
I understand that in the earlier days of computing, shorter method names like printf made sense, because storage was limited. But why do modern languages like Python and Go still use the less readable names from the C APIs? Why don't they switch to a more readable form like print_format, the same goes for other names. ... |
It always happen to me that if I leave the stuff for 1-2 months I forget the stuff.
5 months back I had symfony project and I did that. At that time I was very much confident that I can do any project in symfony2.
Then we got one Python project in django and I worked full time on that for few months.
But now when I had... |
I have a customer who has a client app and when they log in to their client app, they will see a link to my website. When they click on the link, it should log in them in automatically to the website without asking for the credentials. Is this only possible if the username/password are the same between the client app... |
I'm new to Android and while going through a tutorial on saving Activity state to a Bundle, I noticed that instead of accepting the more generic List interface, Bundle's put methods are expecting ArrayLists.
Example:
Bundle.putCharSequenceArrayList(key, value)
Bundle.putIntegerArrayList(key, value)
Bundle.putParcelable... |
I'm aware that most modern languages use reserved words to prevent things like keywords from being used as identifiers.
Reserved words aside, let's assume a language that allows keywords to be used as identifiers. (For example, in Ruby a keyword can be used as a method name). During compilation, how would you deal with... |
could you please help me understand this ternary operator
public static <E> void replace(List<E> list, E val, E newVal) {
for (ListIterator<E> it = list.listIterator(); it.hasNext(); )
if (val == null ? it.next() == null : val.equals(it.next()))
it.set(newVal);
}
i thought the part after ? is j... |
Consider the following code:
a.py
import os
def print_rand():
print os.urandom()
And another module:
b.py
from a import *
In this code, I end up with an os variable getting imported from a. I could prevent this with a small change:
a.py
import os as _os
def print_rand():
print _os.urandom()
Since from a im... |
There are some design guidelines about testable code in “The Art of Unit Testing”. The first one is “Make methods virtual by default”. I’m curious to know your idea about non-virtual-by-default behavior in C#. I’ve read about Hejlsberg opinions but I think one the most important reasons could be that it may lead us to ... |
I just started a new job, I have to create a web app for them and host it on their intranet on an Windows 2003 R2 server with SQL server 2008.
As said in the question, I'll work on a MCV3 with Razor syntax application.
I know that it won't work easily or even not work at all.
On a recent server you have to install some... |
I'm trying to adhere to PEP 8, with a 78 character limit on the length of my lines.
I have the following statement:
startTime = time.strptime(request.GET.get('st', (dt.datetime.now() - dt.timedelta(days=1)).strftime("%d/%b/%Y:%H:%M:%S")), "%d/%b/%Y:%H:%M:%S")
How should I format it so that it adheres to PEP8 (where sh... |
I'm investigating the legal issues of using LGPL native libraries in a closed source Android software.
As for now, my research on the subject shows that using LGPL libraries in closed source software is doable, and that the requirements are not specially high.
On a regular application (for example a C closed source app... |
Normally TCP/IP Sequence and Acknowledge numbers are 32 bit. However, I need a way to shorten them to be 24 bit (it's an experiment in deep inspection firewalls).
Question: Is it possible to shorten the bit resolution of the Seq/Ack numbers in windows without the knowledge of the application? (which in this case is IIS... |
I'm learning about REST and had the chance to build a basic REST API. After doing so, most of the material I read was internalized and I now have a better understanding of it.
However, I do not see any real difference yet as to the tangible benefits of using REST over the old way I was doing things, which was simple... |
if I had a boolean (property) shouldAutoLogin is it better to name the getter getShouldAutoLogin or just shouldAutoLogin so that it reads more like English?
ex :
if(shouldAutoLogin){
...
}
or
if(getShouldAutoLogin){
...
}
|
I work in a fairly large and old solution that has many entry points for different kinds of clients, with web sites for public access, web sites for internal access, some web sites and web services for partner companies access, etc.
All those applications use different (Microsoft-based) technologies, such as Classic AS... |
I think this question should apply to most programs that load settings from a file. My question is from a programming point of view, and it is really how to deal with the loading of settings from a file in terms of different classes and accessibility. For instance:
If a program had a simple settings.ini file, should i... |
Recently I have started using a new(to me) paradigm for web services. I use the controller to accept JSON strings sent over POST, process it and return JSON strings. GET, PUT, DELETE and other methods throw HTTP 405.
This pattern is proving to be very efficient from the point of view of asynchronous web frameworks (ver... |
Say I have a class like this:
public class MyObject
{
public List<string> MyCollection { get; set; }
}
And a method like this:
public void DoSomething(MyObject object)
{
if(object.MyCollection == null)
{
// MyCollection must not be null
// Should I...
// a)
object.MyCollect... |
We are basically using Waterfall life cycle methodology.
Requirement Analysis: I get a use case created by some one else.
Design (talking only about Low level design): I get some little feeling about how would I design it, may be either instantly/ or after some time.
Coding+Unit Testing: In case of unit Testing I am no... |
I'm currently setting up a MongoDB database for a web-app. I'm running node.js and using Mongoose to help manage mapping, validation ect.
I'm wondering if it's a good idea to really decouple MongoDB from my code, just on the off-chance we want to switch to something like CouchDB a little later. Specifically, I'd make ... |
For my job we have a nice RESTful webservice we've built out that we use to drive a couple websites we have. Basically the webservice lets you create and work with support tickets, and the website is responsible for the front end. Any webservice requests use an auth header which we use to validate the user and their ... |
What does "(say)" mean in this Java method?
Since Mapper and Reducer are separate classes, the type parameters have different scopes, and the actual type argument of KEYIN (say) in the Mapper may be different from the type of the type parameter of the same name (KEYIN) in the Reducer. For instance, in the maximum tem... |
I have the following field in Flex:
[Bindable] public var zIndex:uint;
And I was trying to create the methods to process the calls in Java and I ran into a problem.
1. public int getZIndex(); // Does not work.
2. public int getzIndex(); // Works.
I thought that the letter following the get/set was supposed to be capi... |
I'm trying to test this wrapper to request that I made:
// lib/http-client.js
var app = require('app'),
request = require('request');
exports.search = function(searchTerm, next) {
var options = {
url: 'https://api.datamarket.azure.com/Bing/Search/Web',
qs: {
'Query': '\'' + searchTerm + '\'',
... |
On my web page, if I wish to display dynamic dropdowns (e.g city names based on country selected), I can do it using AJAX. But I can also do it using a REST call. So which should I use?
My problem is I really don't get the difference between REST and any other HTTP browser request.(a.k.a a form submit). I have looked a... |
I'm making a facebook app and I'm trying to follow MVC properly. But I was wondering if I had a class that was a bunch of fql queries (getting data from facebook) should I have keep these in a controller or a model?
According to Codeigniter's user guide "Models are PHP classes that are designed to work with information... |
In my org, we use SVN for version control So for each build (done periodically), we merge the code to trunk from the development branch (all the developers checks in to this branch). So when we want a new branch say for a new release, we create from the trunk doing a svn copy.
Now in the new branch we have the histor... |
I'm having a set of data's, say
Question,
Question's Main Category,Main Category followers,
Question's Related Categories,Each Related Categories followers,
Whether it got answer in 24hrs [Yes/No]
Now, I need to analyse a database with thousands of sets of data's like given above and predict whether the new given qu... |
I wonder if there are benign use-cases for simulating mouse clicks using event.initMouseEvent. I found that it is used for creating pop-under ads in the following way:
var e = document.createEvent('MouseEvents');
e.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, true, false, false, true, 0, n... |
I have just moved to a new company and they are using TFS 2010 (2012 in a couple of months) as their version control system and recently started to use it as a work tracking system for the developers.
However, there doesn't seem to be a bug tracking system for use by people outside development & test. Production suppo... |
I work in a company where there are Excel spreadsheets everywhere. As my colleagues are non-programmers, I'm sure they haven't contemplated that there might be a better/easier/more productive way of managing their data. Naturally, I advocate an application of sorts that can leverage the features you find in relational ... |
I know there is a difference between INNER JOIN and FULL OUTER JOIN, I can see it, but, what is the difference between the two following: JOIN ... ON... and INNER JOIN...ON... and still yet JOIN...ON... vs FULL OUTER JOIN...ON...
Reason being is I think maybe just using JOIN is messing up a query I am working on that i... |
This is my first project related to SMS verification.
How to implement SMS verification in online ordering web application? For example:- when we try to reset the password in amazon's website, it sends an sms verification code and after entering the code it proceeds with changing the password. I want to implement the s... |
I can't decide what to name my class. So far I've labelled it up as a Factory, but I am not sure.
Here is the class. As you can see, it exists to return a concrete type of an Interface (ResolveRegistrationIssue) based on the argument supplied to the getter method (ResolutionFamilyEnum):
@SuppressWarnings("serial")
@Man... |
I want to write a function that return random unique pair numbers every time call it from a range until resetting it.
Something like this:
function randomUniquePairs($ranges, $reset = false){
if ($reset === false){
// some code for reseting
}
/*
some code for creating random unique pair numbers
*... |
I'm in process of making an open source application for Windows. In the end I would require an icons for my app and its gui. I'm huge fan of Tango styled icons, but its pack doesn't provide all icons I need. Gnome project seems to provide ones for more mature projects that run on linux.
What is the general way, procedu... |
A team has decided that every morning someone should bring croissants for everybody. It shouldn't be the same person every time, so there should be a system to determine whose turn it is next. The purpose of this question is to determine an algorithm for deciding whose turn it will be to bring croissants tomorrow.
Cons... |
I'm confused by this post by Mark Seeman.
And his comment on IInitializable below:
The problem with an Initialize method is the same as with Property
Injection (A.K.A. Setter Injection): it creates a temporal coupling
between the Initialize method and all other members of the class.
Unless you truly can invoke a... |
The titled basically states it. If I have a bigint column with primary key and autonumber, and a record is deleted, will SQL Server ever reuse that now available value?
The underlying issue is that I have a multi-user environment, and if I retrieve a record from the database into memory, then another user makes changes... |
Recently I've started to work with object oriented analysis and design and it seemed very interesting to me as a way to get work done better. But I'm still in doubt with one kind of situation. If this is not the correct site to ask about it, sorry for that.
Well, if I have to design a system that allows one user to reg... |
I have recently inherited a large, legacy system with a complex codebase that has a lack of documentation. I'm the sole internal developer embedded with the core users, taking some responsibility from an external contractor. While modules and functions are documented well enough, there is no documentation around the sy... |
Imagine I have a rich data model that is represented by a hierarchy of objects.
I also have a view hierarchy with views that can extract required data from model objects and display the data (and allow the user to manipulate the data).
Actually, there could be multiple view hierarchies that can represent and manipulat... |
In a language like Python or JavaScript (NodeJS), is there anything wrong with defining "the configuration file" as a file which essentially hard-codes the configuration settings? For example:
options.py:
OUTPUT_DIRECTORY = 'out'
LOGLEVEL = 'debug'
options.js:
outputDirectory = 'out';
logLevel = 'debug';
Does this co... |
I can write PHP application in linux platform.
However, I getting a request to explore the idea to run PHP application into .NET.
I have zero .NET knowledge.
So wondering, is it possible?
Is it advisable? Implication ? Or maybe I should just install a .NET to playaround first?
In short, zero code changes, except setu... |
I'm designing an append-only ("journaled") file format, and I'd like it to be friendly towards being stored in VCS (git/Mercurial/...).
On one hand, I'd like if after each change, only delta (difference) from previous file state was added into the repository (i.e. some trailing bytes), not the whole contents of the fi... |
I was going through the answers to this question:
What information must never appear in logs?
And noticed that nobody mentioned this particular attribute. It's something I find useful- whenever any logging is added to the system as a result of tracing a particular issue raised in the bug tracker, or adding a feature, I... |
I have come to python from C++ (I also know a little Java). I am writing code to exercise a server so I basically use http methods to send a load of requests to the server. As part of my code I created a class and called it testdata. This contains basically test input data (to send in requests) and output data to ch... |
Internationalized applications usually display links in header for translating in different languages, e.g.: Spanish | English | Italian.
These links usually translate current page in the selected language, and usually the url includes the language: http://www.mysite.com/myapp/es/somePage.
Questions:
Does this only a... |
We have Development department and the department of System Engineers that works on a big project (development of J2EE application).
We are using Build management system, Bug tracking system and a Wiki engine in our work.
Sometimes we have a situation when some developer initiate a server restart or an application buil... |
If I have a method taking input and giving output, it's a no-brainer that tests should be written. But what about things like validation rules?
For example, I add a validation rule that a certain property must be at least 5 characters long. Should I then write a UI test to check for an error message when the form field... |
We are moving our software project from the practically auto-creating Visual Studio Installer in Visual Studio 2010 to a WiX installer. I'd like to use this change to make sure things are right.
The application is a subsidiary to our company's main app that will already be installed in its own folder. The main app ha... |
I recently looked a Flow-Graph question.
Consider 8 boxes with following values
Box 1 = 2
Box 2 = 7
Box 3 = 2
Box 4 = 1
Box 5 = 5
Box 6 = 7
Box 7 = 1
Box 8 = 4
Now follow the instructions:
Put the number from Box 7 into Box 1
Add the numbers from Box 1 and Box 2 , and put the result in Box 1
Change Instruction 2, Inc... |
I am seeing a lot of programmers turning away from management and administration roles. They want to build stuff. And as a result, a lot of these positions are filled by non-technical people. I fail to see how they add value. Is scheduling meetings, booking offsites and other administrative work enough to justify their... |
I have been doing a lot of code review lately, and I am unsure of the positive and negative effects and professionalism of putting positive and/or funny comments in code reviews.
We use Github as our code review platform on my team, so the comments are viewable by anyone. I generally try to use this platform so the en... |
I have a client-side Javascript framework that is publicly available and BSD licensed. Each file says it is copyright me, the date, all rights reserved, and the BSD license text.
I am making a project which uses - and adapts and makes code changes to - my BSD licensed framework. Although obviously browsers will downl... |
I have a set of classes from a 3rd party library. These classes use an inheritance structure to share logic. I would like to add a layer of abstraction in the middle of their inheritance tree to add functionality to all of the children (concrete) implementations.
Here is a simplified example of the classes in the 3rd p... |
The title pretty much says it all. I'm just having a little computer science exercise and am building a Tree. I want a node to be able to add a sibling which requires one to first get a reference to the parent, obviously. I was wondering what is the "correct" way, by definition of what a Tree is, to do such a thing?
|
I have a monitoring web application which has a .Net Backend and a Silverlight frontend. The application crunchs big chunks of data, process them and presentates to user. Then user can interact with the data to see different graphs of log. He/She can unselect dimensions, group some values, choose metrics like transacti... |
I wondered what functional languages are mainly used for? I've been reading about them and read about Haskell and others. Some seem to be just "academic" languages which makes little sense to me, so hoping to get a better idea of their uses in real world applications.
|
gtkmm provides lifetime management of widgets using
Gtk::Widget* aWidget = Gtk::manage(new Widget());
Gtk::Widget.add(*aWidget);
This delegates lifetime management of aWidget to its container widget.
We also have several types of smart pointers, particular the C++ 11 smart pointers templates, which I use everywher... |
Up until now it seems that when you register on a random web site you do so with blind trust.
You assume that the site isn't harvesting information and passwords. You assume the site is reasonably secure. And you also assume that the information you've submitted isn't used in an undesireable way.
More recently, it's b... |
Forgive the title -- it needs work. I am struggling to find better English to express my issue. Edits encouraged.
Example to describe my issue:
Checker Method
I have an argument checking method called public static void StringArgs.checkIndexAndCount(String, int, int). Given a string, an index, and a count, confirm t... |
I am not experienced in javascript. I try to use some popular javascript libraries such as jQuery, Angular.js and Meteor.js.
I wonder if understanding the logic of functional programming (in javascript of course) will help in understanding and using these libraries better?
|
I've been writing JavaScript for a bit and have now seen code using the idiom
var that = this;
and
var self = this;
Used to gain access to this through closure scope. At this point var self = this seems somewhat more common.
My question is which of these two idioms is truly the convention?
Since they do exactly the... |
I have recently taken a project with another developer, and he has a certain way of initializing his references.
class Player
{
private:
Console &console;
Armor &armor1, &armor2;
Debugger &debugger;
sf::RenderWindow &window;
sf::Event &event;
public:
Player(Console... |
On a high level, this is my understanding of the difference between a client and server:
a server listens on a host and a port, receives requests (e.g. through a socket connection), and then sends a response to the client who initiated the socket connection.
The client is what sends a request to that server socket, an... |
Is there some recommended practice regarding methods as verbs in OOP? Should the object work syntactically as subject or as object/complement?
Should object.doSomething() be normally understood as "the object iself does something" (subject) or "the caller does something with the object"?
I suspect that the first alte... |
I got mainly abstract classes in my project and there are a few other class which are using/inheriting them. When I'm writing the documentation I would like to specify that a part of it is just about the behavior of these non-abstract classes, but I found using this word silly.
I could just say it's a class, however an... |
For example, Say I make a business software product. I sell it for $100. The competitors charge thousands for their version. Does that kind of model work? Do company's ever buy software turnkey like that? No support. No nothing. They just spend $100. Sure there are continuing efforts to improve the product but ... |
All functional programming languages that I know of (e.g. Haskell, Scala, Scheme, Clojure, SML, OCaml, ...) support a notion of closures.
Also, I often read that a language X can be considered functional because it supports closures.
On the other hand there are programming languages that do have closures but are not co... |
Is there a reason, historical or otherwise, why the modulus operator is part of a small set of standard operators in what seems like many languages? (+, -, *, / and %, for Java and C, with ** in Ruby and Python).
It seems strange to include mod as a "fundamental" (not to knock it, I use it plenty, but I also use expone... |
Well, the title is not very appropriate, please read on (I couldn't get a better one).
Note: Using Python 2.7, but an algorithm will help too.
I'm making a side scroller game, in which I am generating the obstacles on the fly. The trouble I am having is figuring out how to generate the obstacles. o_O
I have a some kind... |
These days password hashing algorithms are designed to be slow. While it prevents black hats from guessing the password (at least partially), it also gives additional work for the server.
I can imagine that, if someone wanted to make server run extremely slowly, they could simply send many log-in requests which would l... |
I'm looking into building my first mobile app. One of the core features of the application is that multiple devices/users will have access to the same data -- and all of them will have CRUD rights.
I believe the architecture should involve a central server where all the data is stored. The devices will use an API to in... |
I have certain preconditions on input data and I need to design an algorithm for that data. Should I also handle invalid preconditions? Also is it normal that my algorithm will work only for a certain number of inputs, for example 4, and for any smaller number of inputs I'll have "if input.size" clause?
To clarify my ... |
When should I use one versus the other? For instance, let's say I have 20 comma delimited, denormalized text files and I want to transform the data and load it into normalized SQL Server tables.
|
I have an open source script for a specific site (I'm trying not to call anything by name here) that I and a few other developers recently moved to GitHub. We've gotten several new developers since we moved to the new system, including one very active one in particular. However, this active one has started changing a l... |
We have a Javascript codebase that we want to open-source in an incremental fashion. That is, we want to release the full code to some of our core modules first, keeping the rest of the "application" code in minified format. Eventually, we will also release the whole application code in full (although that may take a f... |
I'm designing a system which needs to report basic distance between zip codes. It will use the Google Distance Matrix API but I want to cache the results in the database so that multiple requests for the same data points don't result in duplicate API calls.
A basic Distance class might look like this:
A basic data str... |
Most "Canvas" widgets in common GUI toolkits offer low level operations like drawing basic shapes of different colors/line-width/etc, or displaying sprites and images. Some seem to have slightly more advanced features like the ability to treat primitives drawn on the canvas as "actors" so they can be moved and manipul... |
As far as I remember myself programming I was taught not to compare floating point numbers for equality. Now, while reading Programming in Lua about Lua number type, I found following:
The number type represents real (double-precision floating-point)
numbers. Lua has no integer type, as it does not need it. There is... |
I would like to know what the overall impact of resource planning on a software project is, where the requirements and design of the project are driven by automated acceptance tests and unit tests, in contrast to a more "traditional" approach to software development.
What, in your experience, is the overall effect on ... |
In each application there are concepts like users, customers, etc. and some part of the application tries to manage them. For example:
1. keeping the information of people, organizations, firms, etc.
2. managing users (people who work with the system)
3. managing customers (people who purchase goods/services)
4. distin... |
I'm working on an ordering system where we receive tab delimited files that look like this (I removed most of the columns for clarity):
OrderId OrderLineId BuyerName BuyerAdress RecipientName RecipientAdress
1 1 John 123, Street Doe 25, street
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.