instruction stringlengths 34 19.9k |
|---|
I have a Bird class.
A bird can learn and a bird can fly (methods).
A bird can only fly after it learns.
Considering both methods are public. How can you make this clear to another fellow developer. Usually they should take a look at the public method names and understand what they do. But how can he understand without... |
My boss asked me to alter our Java Webapp such that users cannot go to places in our Webapp by typing URLs into their browser location bar.
I told her that I can not disable their location bars.
I told her the way this is usually done is to launch a WebApp in a new customized browser window sans a location bar.
That wa... |
After over two years of working in a highly siloed, "lone-wolf" development department structure, we're adopting Agile SCRUM. Great. I like Agile; as a dev it keeps you focused, busy, and productive without having myriad stakeholders shoving project after project down your throat with the expectation they all be done y... |
I am reading this article on a new feature of ECMAscript 6, generators, that are landing in the V8 JavaScript interpreter. Not too far from the top, the author suggests an analogy:
generators are like functions, with their bodies taken to the
first derivative. Calling next integrates between two yield points.
I rea... |
The first answer to an old, recently active question linked to a video which talks about how Google repository is done.
One interesting thing which was mentioned is the fact that everything is build from source, without relying on binaries. This helps avoiding issues with dependencies becoming obsolete but still being ... |
I'm working on a VB.Net WinForms project and found myself writing code like this:
this.Fizz.Enabled = this.Buzz.Enabled = someCondition;
I couldn't decide whether that was bad code or not. Are there any .NET guidelines for when/when-not to do assignment chaining?
|
We have a research project with idea->prototype->statistics development cycle.
Anyway, our final product is a prototype, so the statistics collection suite is
not used persistently. Supposing I have following class:
class Transform {
private:
someData;
public:
transformForward (inp_block, outp_... |
UPDATE 1 as requested by Brendan.
We are developing a Unix batch application for storing millions of customer records into a relational database. In order to allow multiple batch jobs to run in parallel, and to achieve a certain amount of concurrency while processing an input record, we've distributed the work across ... |
So from what I've read about combinators I can't quite tell how they're different from simply chaining function calls. I know I must be missing something but I'm not figuring out what I'm missing. I mean would g(f(x)) (where f and g are functions) effectively be a combinator if I gave it a different name?
|
Is it ok to call a webservice from a Domain object?.
As I write the question I am thinking that you should never do that, as it is poor design, but the situation is the following:
I have a domain object called Postman that works very closely with a Message object. This Message is provided by a web service. Without the ... |
I am working on project that deals in customer support. This website actually sells products ( so it is commerical ), and provides customer support. So in this project/website I was about to use select2 .
Select2 License:
This software is licensed under the Apache License, Version 2.0 (the
"Apache License") or the... |
Normally I start a project working on a site, I'd do the basic html skeleton and then start tweaking the styles using CSS. Slowly I'd just add one CSS rule after another with no "organized structure" or groupings in the CSS rules.
And at the end of the project I look at the CSS document and the abomination I have creat... |
I have a class, called PolicyProvider, at present with the following (abridged) interface:
public interface IPolicyProvider
{
List<Policy> GetRenewalPolicies(Client client, int financialYear);
}
The purpose is quite obvious - every year, the insurance renews for the client, and they will get a number of new polici... |
Is RESTful API appropriate for the following scenario?
A time-limited token is obtained, which will last for one minute only
Image is uploaded to a server
Server performs some CPU-heavy image processing upon request, within the time limit
The result is available for download, within the time limit
When the token expir... |
If I download a module for Python (such as alglib) and installing is simply a matter of running
python setup.py install
Where should I be keeping the files I download, or the files that get created after I run setup.py? Is there some neat folder in the python directory that people put these modules before running setu... |
What work path do there exist to identify reasonable vertical slices of a classic n-tier platform code base and infrastructure (enterprise size)? Regardles of refactor or a new solution I think there will be the same approach (more or less?) So i'm primary interested in steps and definitioning of modules, functions, th... |
In FP languages, calling a function with the same parameters over and over again returns the same result over and over again (i.e. referential transparency).
But a function like this (pseudo-code):
function f(a, b) {
return a + b + currentDateTime.seconds;
}
is not going to return the same result for the same para... |
My friend and I decided to create a large programming project together. Before that, I have never worked in a pair (I had quite many projects on my own and at work the boss defined the task for me). But now we have an idea of what kind of app we are going to do, how to plan it...but how can we divide the responsibility... |
I'm thinking of building a language for PIC microcontrollers. I want to be able to use non-fixed size arrays, like this:
Declare the variable as int[]
Wait for input from serial connection
Make the variable input long
I think such a feature would be useful, but don't know how I should go about implementing this in a ... |
I'm in the middle of moving away from PyroCMS to a custom solution built on Laravel. Wont go into the details as to why here, but it is a necessity.
I'm toying with the idea of caching things like pages and posts into flatfile once they are created, and then loading them (if they exist) and falling back to the mysql d... |
I am in the process of writing a library that is used to be able to access data from a database. The library requires the initial definition of all the tables that the application will be using in the form of classes that extend an abstract class within the library.
These classes contain the database connection the tab... |
Scenario:
One data input feed (call this Source)
Multiple objects (call these Layer1) read this Source, and analyze the feed. This analysis is stateful.
Layer1 objects have configuration parameters. For example, new FooLayer1(10, 20) will do different analysis than new FooLayer1(20, 20) will do different analysis than... |
Exception handling in C++ is limited to try/throw/catch. Unlike Object Pascal, Java, C# and Python, even in C++ 11, the finally construct has not been implemented.
I have seen an awful lot of C++ literature discussing "exception safe code". Lippman writes that exception safe code is an important but advanced, difficult... |
I am reading Clean Code by Uncle Bob. Because I am not a native-English speaker, I couldn't understand following statement:
Classes and objects should have noun or noun phrase names like
Customer, WikiPage, Account, and AddressParser. Avoid words like
Manager, Processor, Data, or Info in the name of a class. A cla... |
I am trying to write a system log parser. It will receive messages from the FreeBsd syslog daemon through stdin.
It will use those messages to determine if an ip should be banned or not.
The problem I have is that after x seconds the ban should be removed, but if I won't get any input from stdin, my program will just b... |
I'm trying to make a case for not putting the structure in the parent BaseModule class I've shown below. I'm more for a Strategy Pattern, and minimizing inheritance in favor of has-a relationships, but I am not really sure of what principle of OOAD this pattern is breaking.
What principle of OOAD is this pattern bre... |
With no time to refactor, when you are working on legacy code, with the most awful conventions, what is the best practice?
Will trying to follow better coding style would improve readability or actually hurt it?
For example, in java method names are usually camel cased:
myGoodNamedMethod
But in the repository there ... |
So I'm finishing up refactoring some code to remove a number of previously-mutable objects and add a better generic processing for all the classes in the domain. Just as I thought I was finishing I eralized that there is one sub-class that has some additional state.
The additional state is a link to other classes that... |
This question could be titled "Place password hash and salt in query string?" as well to be less subjective, but the point remains the same:
I want to create kind of a launcher application for my web application, which should allow the user to specify his credentials to auto login into my web application.
Now since pla... |
I am interested to know what other peoples' experiences are with managing development infrastructure are. I am talking about things like the build server, the central git repo etc etc. Any infrastructure which end users would probably not even know existed, but which are essential for the development team.
Do your d... |
From the basic Angular tutorial, it seems like all it does is fetch some JSON from an API and display it. Also, there's its double binding magic.
But why would I use it instead of a backend solution (like Rails) that builds the view in the backend and serves it to the user, with everything in place already? What are th... |
So in the javascript app, we have a lot of repeated chunk of menu items with the specific settings: URL, Name, Title, etc etc (these settings sometimes can be optional). Here is the gist of the menuItem and we have tons of them.
The client pushes new changes every month or twice per month on these items, either the men... |
I have created a utility library and open sourced it on Github, and I'd like to document the HTTP utilities. I created this around some apps I've developed, but none of the APIs I use are for public consumption. I want to use a well known public API in my documentation so that code samples will work and be really eas... |
I think it is just my thinking that is off here. Suppose I have two entities: question and choice. A question can be a parent or child, or both (in relation to other questions). It seems that this model is too simple and is an unresolved many-to-many, but I think my thinking is the problem here so this is more of a con... |
I am trying to find a way of classifying different types of PHP functions. For example that fopen, fwrite, fclose and so on are all part of IO, and the MySQL functions and MySQLi class is all for mysql related things but something more automatic was wondering if there is some sort of function class mapping in PHP
|
Haskell core language is really simple. Coming from an OO background, the main difficulty is to adapt to the pure functional paradigm.
While learning "basic" Haskell, I have always considered language extensions as toys for CS people or as experiments for future versions of the language (like from future import ??? in ... |
I read in the Dennis Ritchie's The C Programming Language book that int must be used for a variable to hold EOF – to make it sufficiently large so that it can hold EOF value – not char. But following code works fine:
#include<stdio.h>
main() {
char c;
c=getchar();
while(c!=EOF) {
putchar(c);
c=g... |
I am writing some agile user stories and acceptance stories for the first time, and was hoping for some feedback from an experienced product manager or developer.
I only need to capture the main points in the acceptance criteria.
User Story
AS A registered jobseeker, I WANT TO create and edit my CV on the user interfa... |
First, I believe I've seen this question discussed here before, but I cannot find it. My apologies if you do find it.
I'm starting a new project, and trying to figure out why IsResolved and/or ResolvedOn make more sense to me than Resolved. Obviously, when something is named "CompanyName" (for example), I'm fairly conf... |
I am a developer in a 5-member team and I believe our project is headed for disaster. I'll describe why in a moment, but my question is: how should I behave?
The deadline is in 1.5 months, and I feel no matter what we do, this project will fail. I'm of the opinion that we should just terminate the project and stop was... |
I have a list of integers.
Also, I have a function which returns True when the element is non-zero, and returns False when the element is zero (let's call it FUNCTION1).
So, how to define another function (using FUNCTION1), which will give us a new list and only include the non-empty elements?
For example, we have [1,2... |
I'm writing a handy library (we'll call it Thinger) that goes off and fetches an XML document, does some X-Path query on it and does something helpful with the result of that. (What I'm actually doing is far too boring to bother you all with, this is just a simplified example.)
Because I'm a wise and lazy programmer I'... |
I have sets of probing data from an internal monitoring tool which represent the availability of different services (databases, webservices and so on).
Now my task is to visualize this data and I reached a point where I should make a decision concerning the data interpretation for the most recent data set.
Quick overal... |
I've just been told by my boss that I will receive a negative performance review on Monday. He wants to talk to me about why I am so slow and why my bug fix rate is so low.
I love programming and solving problems but I actually do find my job really really hard.
I've actually been a programmer for about 10 years. But t... |
I would like to know how transparency is defined, and what is the measurement for this in the context of a broker architecture.
For example :
from a developer point of view, [in the broker architecture] distribution is transparent. you talk to a broker one way or the other and it introduces an object model in which dis... |
I have seen and used both of the methods to hide the on screen keyboard while coding Android:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
and:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditTex... |
We build products which often integrate with third party systems. Sometimes these systems error, which in turn causes our system to error. For example, we call a web service when a user updates their data after we've saved to our own database. While testing, the service on the other end is not functioning correctly.... |
In my PHP web page (index.php), I have a simple script that calls a "page" class, and then builds the page from it.
Index.php executes methods within an instance of the 'page' class, such as "add_to_body("bla bla bla")". It can then call a "build()" method, where the page class will return a string with the user input ... |
Based on this page, I can see that only Apache License 2.0 is compatible with GPL v3.
Now my question is, in layman's term, how do I make those two work together?
My current situation is that I am developing an application that is made from a GPL v3 licensed programming language. I want to put some form of security on ... |
I'm working on a legacy system that has a helper class that is symbolically linked into many different .Net projects within a solution. The logic is riddled with compiler directives that change it's internal behavior based on which .Net project it happens to be compiled in. For instance, there's a compiler directive t... |
I'm a team leader of a team of 8 programmers in a company of about 20 technical people. They're working on a range of projects, these projects also involve people from other teams that are outside of my control. My organisation is not doing proper agile development, and they're somewhat resistant to change, but I've be... |
What notation do you use for the average time complexity of an algorithm? It occurs to me that the proper way would be to use big-theta to refer to a set of results (even when a specific try may differ). For example, average array search would be Θ(n+1)/2.
Is this right?
Explanation of average search time being Θ(n+1)... |
This is a question driven by curiosity. I am learning Oracle database and Oracle database handles Blob data in a separate tablespace, which I believe reduces overhead while trying to read large Blob data. I am wondering how MySQL handles Blob? I am actually planning to start a project and I wish to give a try on saving... |
I do not see how the MoSCoW Method's "Must, Should, Could, Would" prioritisation is better that simply 1,2,3,4? If I receive the requirements from the customer, they already are prioritised, usually using this range.
Also what is so interesting on this MoSCoW thing, why it is so 'famous'?
|
I'm thinking of making a Python-JavaScript converter/compile. I've been wondering about the pros and cons of the following methods to parse the Pythonic code, into JavaScript equivalent.
Working with the output of ast.dump(ast.parse(code))
Working with tokens.
I've been trying weigh the pros and cons of these method... |
I have a situation where I would like your input and think over / solve algorithm.
The specs
There are inventories with a specified amount of capacity. 'X
(width) and Y (time)' creates together a total space. '60 * 100 =
6000'. In reality "width" are a business value unit, but we can talk width here.
Now there a... |
I am writing an interactive program in which it takes speech input from the user for a specific list of commands.
The list of commands will be stored locally in a graph and based on the usage their weight will be modified.
The speech input is taken and processed into text and then it's executed by bash scripts.
I am th... |
I have a commercial application that uses a Qt Solutions component. Until recently, this component was licensed under the LGPL license, so I was forced to use the component in the form of a shared library.
According to this post http://qt.digia.com/Product/Qt-Add-Ons/Qt-Solutions-Archive/, the Qt solutions have been r... |
There is a good example on Wikipedia regarding the violation of SOLID principles.
The ISP was first used and formulated by Robert C. Martin while
consulting for Xerox. Xerox had created a new printer system that
could perform a variety of tasks like stapling a set of printed papers
and faxing. The software for ... |
tl;dr
How would I represent GUI as agents in a multi agent system.
I am learning more about Multi Agent Systems.
I like the concepts of such systems, it makes a lot of sense and it sounds very useful when I want to create a large system devised of smaller parts for the Web.
So, I created a basic Agent class, taught my... |
I hope this is the right place for this type of problem.
An Object of my class Movie can have several keywords ( like 'fight club', 'brad', 'fincher'), and be part of different categories (like 'Drama', 'Best Movies Ever') I implemented them as ManyToMany:
@OneToMany(targetEntity = Keyword.class,fetch=FetchType.EAGER)... |
I am attempting to create an list which should be sorted by a particular field in a colon separated string. I have an array of strings with the following values:
name1:535
name2:697
After sorting this list, I would have it sorted by the number in the second field:
name2:697
name1:535
How should I go about doing this... |
I have an exam coming up and I'm looking at past papers to get some ideas of what to expect.
I'm a bit stuck on the following one and would really appreciate if someone could give some example answers.
Write preconditions and postconditions in OCL for each of the following operations (included in the Stack class in th... |
RSpec allows users to share context across tests / examples, which would reduce the number of code lines in my app by a significant amount.
On the other hand, somehow related to the question of sharing codebase between tests, one of the reasons why I'm using Factories and not Fixtures is because I don't want tests to b... |
I'm trying to learn node.js and create a web application, and although I'm doing my best to just use only node.js to create it, I'm having a very difficult time finding resources and examples that describe the process without using other frameworks or libraries.
Specifically, how can I serve HTML and CSS content withou... |
Since a few days I am fighting my way through implementing arithmetic coding. I found a really great source of information which made me understand how it should work. Long story short, it implements arithmetic coding on integers using two registers: HIGH and LOW. Those register store a fraction, ex.
HIGH = 98765 //me... |
I have a Season class. This Season has a few properties: among them, a list of Games. This should be populated from the same source that populated the rest of the Season properties.
I have a test to ensure all items in that list are of type Game.
There is no hard requirement that a Season must contain any Games, so t... |
In C# if i declare a constant variable is any memory allocated to it as it acts as a compile time replacement? How long is the variable's life?
|
The advantage of using tabs for indentation is that people can configure their editor to use the tab width they are comfortable with. The only argument against this seems to be that people don't want their code to look differently based on editor settings. However, since code is ultimately being written to be easy to r... |
I've been working on this project for my company. Currently I am embedding my SQL statements inside the program itself as and when they are needed. I do have two seperate classes -
QueryBuilder Class (Contains all the queries)
DbConnection Class (Executes the queries against the database, takes care of connectivity a... |
I have a main template like website I have made that will allow me to quickly roll out and make new websites on demand when I need them, for my personal use.
I'm wondering what is the best practice when using a Git repo is for this practice. My goal is that if for example down the road I'd like to make a change to all... |
I'm preparing a presentation about Agile methodology for managers (not programmers) and I'm looking that, from a side, the Agile talks about functional perspective*^ (in Scrum we have planning game) but, from other side, it lacks any (standard) definition of **functional measure.
In my opinion it's strange: how I can g... |
I have recently been moving through a couple of books in order to teach myself Java and have, fortunately, mostly due to luck, encountered very few difficulties. That has just changed.
I read a section on the following under inheritance and the whole superclass subclass setup
When a new superclass object is created, i... |
As mush as FP has done, in the end, all our programs are structured.
That is, it doesn't matter how pure or functional we make a them - they are always translated to assembly,
so what actually runs behind the hoods are instructions, states and loops.
We are kind of emulating FP.
As a hardware noob, my question is: why ... |
It's time Haskell had a modern REPL like Mathematica's (or better).
Make each calculation run in a separate thread, so user has control over each computation box's resources (ability to pause, play, cancel, replay, set memory/stack/time limits, etc). Allow for graphics output as well (how?).
Then detach these boxes fr... |
What exactly does "Security through obscurity" means in the context of stroing unencrypted passwords?
I'm using a small program (I won't name it, to not enlarge enough large shame on its author) that uses my Google account for some tasks. I've noticed, that it stores my password in plain-text unencrypted file. Just a s... |
I would like to know what options are available for documenting a project which has already been developed, as the developers who worked on didn't write even a single page of documentation.
The project has no other details other than many pages of scripts with functions written and modified by developers who worked on ... |
Is there a way to show and save all "final" definitions entered into a Scheme REPL into a text file?
Say, if I have defined in the REPL:
(define (increase x) (+ 1 x))
(define (multbytwo x) (* 3 x)) ; let us say this was an error
(define (multbytwo x) (* 2 x))
I want to save this into an .scm-file with the ... |
I want to see all user-made definitions in a Scheme REPL, both loaded from files and entered at the REPL. Is there any way to "dump all definitions"?
E.g. if there is:
(define (plusone x) (+ 1 x))
(define (plustwo x) (+ 2 x))
(define (plusthree x) (+ 3 x))
then I want to see all of these definitions, but o... |
I am confused as to what the problems could be if a constructor was inherited from a base class. Cpp Primer Plus says,
Constructors are different from other class methods in that they
create new objects, whereas other methods are invoked by existing
objects. This is one reason constructors aren’t inherited. Inher... |
While trying out the below applet, I saw that this path finding algorithm called Jump Point Search yields significantly faster result than A* and Dijkstra.
http://qiao.github.io/PathFinding.js/visual/
A*: 46 seconds
Dijkstra: 1 minute 39 seconds
Jump Point Search: Less than 3 seconds
Needless to say, I'm quite astou... |
Let's assume that we have a simple GIS-like application, which presents (using Google Maps or anything similar) recorded tracks. Each track consists of points (data portions) with geo-data and additional information, like speed, altitude and similar attributes.
Basing on these additional params, I want to calculate som... |
My company has so far been developing a medical device, which is connected via USB to a desktop system (running x64 Windows 7) to run the image analysis and do everything GUI related.
I am familiar with both Windows and Linux programming, C, C++, C++11 and C#, but now our new project coming from management would be a h... |
When Enum is used as below, say if we have
enum Designation
{
Manager = 0,
TeamLead = 1,
Associate = 2
}
then write the below code
if (designation == Designation.TeamLead) //somecode
Now if we decide to change the enum element from "TeamLead" to "Lead" then we have to modify the above line of code as well... |
An asm.js application is very fast (near native C++ speed):
http://kripken.github.io/mloc_emscripten_talk/micro4b.png
But how is it possible to write one in C++, convert it to LLVM code, then do some trick with emscripten/asm.js ? I haven't found any tutorial about it.
And if I write the code in C++, then how to use ... |
I'm trying to build a general understanding for what's common in this situation so that I can decide if it makes sense to pursue it further.
Are installers welcome in a typical corporate environment with the following?
Change control process
Dev/QA/Production environments
Designated deploy teams for various areas (fi... |
I am fairly new to Angular.js, and one that confuses me is how to best use modules in an application. It seems to me that modules can contain any of the other common constructs in AngularJS (controllers, directives, filters, services, etc.), but from here I am unsure which module(s) should contain which things.
Shou... |
Recently I've been browsing source code of large applications written in C++ to learn a bit but I couldn't help but notice that most if not all use a lot of IFDEFs and class-less functions (where they could have been class members/methods).
An example is Qt Creator IDE source code:
http://qt.gitorious.org/qt-creator/qt... |
I have some questions about VPS and web hosting.
As far as I understand, VPS is a virtual machine on which we can do anything as we can do with our local machine. Install software, change settings etc.
Web hosting is where we have only a folder in which we place our web site in.
However, most of the provider currently... |
In electrical engineering class we learned that signal lines are not ideal, so it takes time for the signal to reach the other end of the cable, and if we doesn't take this into account, it can lead to crazy phenomenons like:
Imagine we have a tank game, where tank1 (played from Europe) shots tank2 (controlled from th... |
Single responsibility ( reason to change ) of an entity should be to uniquely identify itself, in other words, its responsibility is to be findable.
Eric Evan's DDD book, pg. 93:
most basic responsibility of Entities is to establish continuity so
that behavior can be clear and predictable. They do this best if they... |
Through most of my dev experience, I've never had to deal with much variety of access control architectures.
They've all been pretty straight forward:
Group [Create, Update, Delete]
- User 1
- User 2
Group [Update, Delete]
- User 2
Which, for all intents and purposes, works well. The problem I have is the... |
i'm using Ruby 1.9.3
I figured out that you can use an array, or a hash as hash key in ruby:
h = Hash.new
h[Array.new] = "Why?"
h[Array.new] # Output: "Why?"
h[Hash.new] = "It doesn't make sense"
h[Hash.new] # Output: "It doesn't make sense"
But an object works differently...
h[Object.new] = "LOL"
h[Object.new] # Ou... |
We have a team of roughly ~8 devs who regularly work on the same feature over the course of a 3 week sprint. It isn't quite pair programming, but in our current workflow devs regularly push up incomplete code for a colleague to complete. This worked fine before we introduced Gerrit, but now our commits need to represen... |
I've been using Python for a little while now and I am enjoying it, but a few of my friends are telling me to start using a language like C# or Java instead and give these reasons:
Python is a scripting language
Python apps don't port well to people who don't have Python
It's hard to make good GUIs in Python since it'... |
I recently took over the maintenance of 10-15 SQL Server databases and to my surprise found out that the team does not store the code scripts anywhere. They currently deploy changes to each environment without any paper/code trail.
The code for applications that use these databases are all stored in TFS and I need t... |
There are a few claimed benefits to Node.js that I typically hear. Some (many?) I agree with. There is one that I completely do not understand, which is the one language argument: "You can now use one language on both the client side and the server side."
This does not make sense to me on many levels:
most people alre... |
In most MVC frameworks, Controller class contains multiple methods, each representing one action. Then annotations and reflection is used to call those methods appropriately. But from OOP point of view, the whole class has many responsibilities, eg. one for each action. Then each action should be represented by it's ow... |
Why not use a RTOS with microkernel architecture for web servers? The scheduler is deterministic and all requests will be handled quickly leading to faster response time? It's easy to extend an OS based on microkernel architecture, since everything is like a client-server communication via message passing. Also, the se... |
I am interested in building a custom Websocket server for college project. I have a good familiarity about HTTP 1.1 and knows quite well of how it works. I am asking this question assuming that Websocket clients (browsers) have their protocol specification since Websocket clients connects to Websocket server through UR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.