instruction stringlengths 34 19.9k |
|---|
I am looking at trying to rewrite an application that is mostly procedural to an MVC/OO approach in order to teach myself a deeper understanding of both.
BUT, I am having some conceptual issues with the current group/access control that is used.
We have Groups (Businesses) that have role based users (Manager, salespers... |
I am currently working on an open source PHP script and trying to adopt an attribution license. The ones that I found are
CC 3.0: http://creativecommons.org/licenses/by/3.0/
and
CPAL 1.0: http://opensource.org/licenses/CPAL-1.0
They seems very similar to me. What's the difference, pros and cons?
What I want is:
Allow ... |
One of the things that Valve's Steam distribution platform is known for is its Custom Executable Generation system, which creates a unique copy of a program for each person that buys it.
I'm sure that Valve isn't the only company or person to have implemented or thought of implementing such a system, however. If I want... |
Example:
You have a game with different schools of magic (fire, ice, etc). Each school has a set of properties that pertain to independent features of the game, such as:
strings to be displayed on the GUI (generic data stored in memory)
graphics, sounds, and other files to be loaded as necessary
different behaviours (... |
I'm developing a small system for internal automation. I use asp.net webforms and faced with a choice:
develop a system architecture in an object-oriented style (development becomes more difficult and time-consuming)
or
just put controls on forms and write sql queries in control handlers (high speed development, the ... |
I want to become a better developer, and so have been dedicating most of my free time outside of work to learning design patterns, and when to implement them (since I feel learning general patterns is a better starting point than learning specific libraries or tools). One issue is, that the majority of highly regarded ... |
I am a beginner in Software Engineering principles. This question have only academic significance.
I read about Function Point analysis.We will be getting an integer value as output for Function Point analysis.
What all things can be inferred from that output?
I know that it is an estimation technique. But couldn't und... |
My team at work is starting a new project, using Subversion as our VCS (you may consider this set in stone for the purpose of this question). We're still in the early stages of the project and are trying to agree on a branching model. Our previous project was based on a non-standard version model that led to issues w... |
Why didn't Java designers create static versions of string manipulation methods in the java.lang.String class? The following methods are what I refer to, but the question can be extended to other non-static methods in the class as well.
concat(String) substring(int, int)
replace(char, char) ... |
I need to do the code review of fellow members.
One of the member always defined the helper functions at the bottom and use them at top e,g
class Sample {
public function SendFile(){
file = $this-convertFile($file);
}
public function convertFile(){
//bla bla
}
}
I sometimes dont know if he has custom defined this f... |
In open source projects there is typically a set of devs that have permissions to commit code - the committers -, and others that "pull request" or send patches, the "general public".
I find a annoying when
the committer signs the commit with its own name, and writes in the commit message a "Thanks to ...".
the commit... |
I'm writing a Java program that works as a presentation of a written document, which needs to be stored in a database (I'm using MySQL, but am open to suggestions of other DB types).
The Essay class is a collection of objects of the Paragraph class (more specifically Essay extends LinkedList<Paragraph>, which consists ... |
I have recently been moving away from ASP.NET Websites in favor of Web Applications. More specifically I have recently been picking up MVC as an alternative to developing ASP.NET Forms websites.
Something that I find highly frustrating is the constant build->change->re-build process when testing small changes to compil... |
I've just started freelancing and have two projects where I am splitting my week with both companies, one I'm charging hourly and everything is fine, the other one however they have said they will pay me based on a points basis using Pivotal Tracker.
For example, there's a fixed rate per point and they work on an estim... |
A new project has an amount. It is always related to a client.
One client can have many projects. And he may pay in steps for a particular project.
In order to keep track of client payments, I've created a table namely client_ledger which contains information about date, time, amount, mode of payment & related project.... |
This was posted originally at StackOverflow though suggested to post here instead.
I am looking to create an Excel VBA solution that will create a rota/schedule allocating staff to service users using an algorithm. I believe there are already existing names for this kind of problem/algorithms but not entirely sure what... |
We are dealing with a lot of CRUD operations in our application. Each database table has one or more corresponding SQLContainer instances to perform various types of operations. All of these SQLContainers are stored in one helper class, so that you could perform any type of CRUD operation anywhere from the program (onc... |
We are currently using Entity Framework as an ORM across a few web applications, and until now, it has suited us well as all our data is stored in a single database. We are using the repository pattern, and have services (the domain layer) which use these, and return the EF entities directly to the ASP.NET MVC controll... |
I'm starting to write C++ code to run a robot, and I don't know how to incorporate unit testing, if indeed I can. I have been provided with a library which allows the creation of "commands" for the robot, which are automatically scheduled and executed. The mechanism to create these commands is to subclass a command bas... |
With our public SDK, we tend to want to give very informative messages about why an exception occurs. For example:
if (interfaceInstance == null)
{
string errMsg = string.Format(
"Construction of Action Argument: {0}, via the empty constructor worked, but type: {1} could not be cast to type {2}.",
... |
I got asked to do a code review of a very simple one-route web service that when hit would simply restart an application on the system. The developer had coded this up as a POST which strikes me as odd.
Now I realize that this is not really the type of thing that HTTP is all about - you can't even query state - but is ... |
I'm working on a payment processing website that will function like PayPal does on many e-commerce websites. The idea is for the customer to fill their shopping cart and click checkout, then be directed to the payment page on a secure site. After the payment page processes the payment, it directs the customer back to t... |
How would you go about parsing a sentence like
"Bought two kilos of steak from Acme supermarket" into a data structure like the following JSON representation:
{
item: {name: "steak", tags: "meat,beef" },
quantity: { value: 2, unit: "kg"},
source: "ACME Supermarket"
}
?
I'm looking for a high-level conceptual ove... |
I'm unit testing some code that processes data from an external API. That external API serves up a large pile of JSON data.
The right thing to do here, of course, is to use fixtures in the unit tests, so that I don't do a real API call every time the test runs.
Those fixtures can be quite large though - many thousands ... |
Context
In a Cocoa application I am developing, I need to load a data model that is defined in plist files. So, I have something like:
root (Array)
---- item (Dictionary)
-------- name : "objects" (string)
-------- prefab : "object" (string)
-------- children : (Array)
...
---- item (Dictionary)
-------- name : "action... |
Disregard your usual paradigms for a mere moment here....
I've seen a few sites who have used the following logic:
a=[];
b=a["sort"];
c=(b)();
c["alert"](1); // intended output: Alert displaying "1"...
supposedly to access (I'm guessing here) the primitive of the sort function to gain access to the window object, and ... |
I created a Chrome browser extension, and I want to post the code on Github so developers can contribute to the project.
My goal is to keep this as one single project though, and I fear that a lot of nearly identical extensions would start showing up in the Chrome Web Store if I released the code without restriction.
I... |
This is a basic question. But, I think understanding this would be helpful to play with buffers in 'C'. Thanks.
Scenario
Just a sample snippet
char *test_buff = (char *) malloc(512); //allocate 512 bytes in heap memory.
bzero(test_buff, 512); //Reset buffer instead of Junk/garbage.
/* random code here to fill-in the bu... |
I've been thinking lately about how I handle config changes between multiple developers on a project.
Specifically here about a Laravel project in PHP, but I guess this applies largely to all frameworks/languages.
In general would you say it's a best practice to not commit your configuration? If so what's your practice... |
I'm developing a new application and I'm trying to come up with a convention for defining routes. Ideally, I would like it to be simple, flexible, and reversible.
Here are some from popular frameworks:
Backbone
route matches
-----------------------------------------------------
help ... |
While reading the difference between Compiler and interpreter , I found the following differences fromt he internet.
Advantages of using compiler:
Since compiler converts the program to native code of the target machine (object code), faster performance can be expected.
There is a scope for code optimisation.
Advan... |
Are all scripting languages dynamically typed?
I am using TCL. It is a scripting language and it does not enforce or allow type delaration of variables. It is instead a dynamically-typed language with ducktyping. The type of a variable is assumed by the interpreter according to the value assigned to it.
I would really ... |
int *itPins = pins;
for(int i = 0; i < count; i++)
{
ConfigureGpifPinAsGpioOutput(itPins);
itPins++;
}
I have the impression that doing two things in one line is bad practice. This is why I am advancing the iterator outside of the only statement, using it. However, I feel blindly following a rule.
Is this cod... |
I was looking at some of my past codes, and I viewed one of my admin boards I've made. I had it setup so that the admin has to define/enter 2 passwords for his account.
Is this really double-safe or was I deluded?
It seems that it's reaaally hard to force-match username and 2 passwords from the client side. I've got it... |
I have a sorted list of blocks L that I want to put in 4 containers C, the containers have a size limit S. I want to have similar containers height, by similar I mean the size variance should be as small as possible.
eg:
S = 4
L = [1, 1, 3, 1, 2, 1, 2]
should result in:
C = [[1, 1], [3], [1, 2], [1, 2]]
note: it is a... |
The Problem
I came up with this select-box variant in answer to a question on UX.SE:
https://ux.stackexchange.com/a/48951/16187
However, working out how to implement it has been driving me mad ever since I wrote that post.
What I've tried
Initially I figured it would be easy enough to do.
The strategy I would have tak... |
Kanban does assume a more-or-less linear flow. Most of the time this models software development quiet well: we crate a user story, we code it, we test it, and we deploy it. However, some internal stages are iterative in nature and thus not so obvious. Take this (simplistic) board:
|| Planning || Development ||... |
If I have a photo album where each Photo can be commented on, Should the Comments be Entities or Value Object in these cases:
Comments can be added only anonymously (i.e. Comments have no relation to anything except the photo).
Comments can be added by registered users (i.e. there will be a relation between the Commen... |
In the higher order function fold/reduce what is the name, if any, of the functional argument?
I am working on a monadic tabular processing library where rows are folded to produce simple analyses (like finding the minimum, maximum, average of a column). I am therefore looking for a sound name for the argument of the ... |
Which of the following options take less processing time/is less expensive in a graph traversal algorithm for a (indoor)navigation system?
a) To produce all possible paths between start and destination points (nodes on the graph) then applying a filtering mechanism to match the navigation user's capabilities and prefer... |
I am litle curious about what sorting algorithm is using OrderBy (linq to objects). quicksort? heapsort? introspective sort ?
As i see in MSDN documentation List.Sort is using introspective sort:
see: http://msdn.microsoft.com/en-us/library/b0zbh7b6.aspx
Maybe OrderBy use the same?
If we go to order by documetation i ... |
I was reading the Bootstrap Getting Started docs, and I came across "Pre-Compiled Source" as a feature. Upon downloading the package, I just found .js, .css, and some image files. What is there to be "pre-compiled"? Doesn't it all compile in the browser upon page load? I'm guessing this means that it was compiled and t... |
When we look at the the overlap between the Ruby Community - we see the following overlaps:
Think Relevance (now Cognitect) has switched from Ruby to Clojure
Jay Fields has switched from Ruby to Clojure
David Chelimsky - author of RSpec - has left the Ruby RSpec project to join Cognitect
Is there some linguistic simi... |
What if, instead of looking at the C++ specification, you analyze the behavior (by inspecting the source code and testing with sample inputs) of existing C++ compilers and use your knowledge of C++ to create a new compiler? Is it a good way to implement programming languages? What are the possible disadvantages of this... |
Programming languages are not just language. Each one tends to have:
Its own IDEs,
Its own package managers,
Its own set of libraries,
Its own build tools,
Its own data formats.
If you are writing Java syntax, you will be using Maven packages; if you are writing Haskell syntax, you will be using Cabal packages. What'... |
I use a pattern that I call "ensure" extensively in my repository layer. In short, it does the following when I call an Ensure(...) method:
It uses the arguments in the method to attempt to populate an entity of a specified type (ultimately from the database),
If it finds one then it returns it; f it does not, it sav... |
In the past, I've had alot of success just using a .NET Dictionary, with a TKey consisting of the X,Y coordinates merged together. However its read performance, despite being amortized constant time, is a bottleneck in a design of mine.
My application needs to perform alot of reads, and would benefit greatly if the per... |
I've been reading some into it, but I am time pressed, so I would require a simple solution now and I promise to read up on it later. I come from a winforms c# background, and have lately been working with WPF. As the user interface I'm implementing is not that input intensive, I've gotten by with using INotifyProperty... |
I need to process all log messages from Postfix (/var/log/mail/mail.log), and print a summary/statistics (how many emails were sent/received and from/to which email addresses)
The situation is made more complicated by the fact, that Postfix has multi-line log entries (in contrast, Apache for example, has single line en... |
I would like to release a software library written in a class-based, object-oriented programming language (Java) on a web-based source code hosting service, that allows forks of the project to be merged into the main project (GitHub via pull requests). I have researched on the web and given a lot of thought on how to ... |
I've been using Javascript for quite a while, but I've always ignored the common naming conventions that I see online (camelCase). I know it all depends on the developer's preference, but why camel case for Javascript?
I'm originally a PHP programmer and I kind of have my own naming convention and I use it everywhere I... |
I'm currently working on a project that requires a complicated model structure and I'm struggling with picking the right architecture.
First of all, there are several interdependent models. Change in one model can trigger changes in several other models. For example, user inputs a query, first model checks the database... |
I have read in several places this following rule concerning Aggregates:
Entities in one aggregate can hold references to any other Aggregate Root, but never to an
Entity or Value Object inside the other Aggregate.
What can go wrong if an Entity was holding a direct reference to an entity in another Aggregate root?... |
Should I use
<?php
if(!$user->is_logged_in()){
echo '<p id="login">Click <a href="login">here</a> to log in</p>';
}
?>
or
<?php
if(!$user->is_logged_in()){
?>
<p id="login">Click <a href="login">here</a> to login.</p>
<?php
}
?>
? Why?
The first one will not have the HTML tags coloured so ... |
I'm trying to create a queue processing script that's purpose is to find particular files and apply actions based on specific parameters,
with the result being to call a PHP script that serves to process a list of message files that we generated and passed to it.
One of the things I need to specify in a config file th... |
In code quarterly interview with Rich Hickey, Michael Fogus hints that Clojure borrows a lot from Haskell:
Fogus:
As someone who only knows Haskell enough to read the papers, Clojure appears to be influenced by it substantially. From the names and operation of core functions—take, drop, iterate, repeat, etc.—to its pr... |
Last week, a few colleauges and I were participating in career fairs at three major universities (two here in the US and one in England), where we were trying (without much success) to recruit for several compiler positions, ranging from internship, to entry-level, to more senior, for our team.
To our surprise, 80% of ... |
Currently I am working on C++ project, which can be classified as "legacy" project. A lot of poor written code was committed because of lack of experience and under the pressure of deadlines. When I try to fix bugs I eventually make the new one.
Recently I got some more free time and I want to make this project better... |
Given the following relational model:
I need to implement a typed search for hotels, which should be able to query on name, city, country, category, hoteltype, roomprice, customtype, room custom type and roomtype or any combination of these criteria.
At the moment I'm doing this though Entity Framework, dynamically co... |
First of all, I'd like to say this is a hardware-level question, which is very closely related to the "in" and "out" command in x86 assembly.
I have searched for quite some time, but I still haven't found how they send the addresses and the data. Does the 8086 first send the address, then the data? If so, how does the ... |
I have been reading about the (un)convenience of having null instead of (for example) Maybe. After reading this article, I am convinced that it would be much better to use Maybe (or something similar). However, I am surprised to see that all the "well-known" imperative or object oriented programming languages still use... |
I'm having a hard time with this concept. What is Stroustrup getting at here? What is special about a class whose "representation is part of its definition"? What does a "concrete type" contrast with? (I assume it contrasts with "abstract type", but since, AFAIK, you can't even bring an instance of an abstract type i... |
Over the last few months, I stumbled a few times over the following technique / pattern. However, I can't seem to find a specific name, nor am I a 100% sure about all its advantages and disadvantages.
The pattern goes as follows:
Within a Java interface, a set of common methods is defined as usual. However, using an in... |
I am writing a paper on the tension between OOP and Generic programming created by Stepanov. He widely criticizes OOP and says it is "technically flawed" when compared to Generic Programming.
Now I know we have plenty of programming languages that support OOP exclusivley and have no Generic support including Google GO... |
Certain datastructures, like Python's Dictionary, are unordered/random read/written.
As programming in python is iterative (and programming in general is?), how do these unordered datastructures work?
I understand that Python's Dictionary is in essence a hashtable. But I figured that the datastructure gets stored in t... |
We are required to make a package diagram for our senior project. Since our project uses MVC patter design, we created an MVC class diagram, now, our problem is in creating the package diagrams from our class diagram.
Is it possible to have packages with MVC at the same time? so it would be something like this:
Package... |
If my domain has several Bounded Contexts, but only ONE team will work on all contexts, should I develop an Ubiquitous language for each context? or should I have only one and force to into all contexts?
The bounded context definition from Evan's book states:
A BOUNDED
CONTEXT delimits the applicability of a particu... |
I should log some events in a program but as far as I know it would be better to keep the logging code outside the program because it is not about the real functionality of the program. So may you tell me if I should keep it completely out of code and only use Observers and Listeners to log the events? Or I can add a l... |
We currently have a SOAP based web service which is being used by various teams as the primary data source. We eventually want to transition to REST based services. We are reluctant to do this now as the clients would have to do changes.
What can we do to make this transition smooth?
|
I have built a restful json api for an online store using Laravel.
I now wish to create an AngularJS app to run the front-end web application. Product prices for my store need to update every second, so Angular needs to get the product json from the server once per second to update the html.
I wish to somehow do someth... |
I'm working on a Meteor app which lets users create events and assign them crew members. I've played around with MongoDB before and made some experiences along the way, where for instance my first attempt went overboard with embedded objects and quickly became sluggish and hard to maintain. Several people therefore sug... |
I found, that some very famous app (I'm not disclosing name intentionally) has a "problem", when writing meta-data of a file and the file turns out to be read-only. Program doesn't handle that too gracefully.
It does not check, whether a file is read only upon opening meta data dialog box. Thus, it allows the user to f... |
I write CLI-executable Python 3 scripts regularly to do data compilation and some maintenance tasks, and try to adhere to PEP 8 and the Google Python Style Guide when doing so. Google's guide says to avoid using global variables, while PEP 8 offers naming conventions but doesn't really encourage or discourage use of th... |
I recently started using namespaces in PHP. When I first saw them, I thought that their syntax was ugly and I'd never use them. However, I created an autoloader (spl_autoload_register) that makes it so that I never have to write an include/require statement again.
I like namespaces, but is there any objective benefit o... |
Stroustrup says that you should use structs unless you can specify an invariant for the data structure. I have to represent a physical object which holds things such as position, velocity, mass and inertia (and so on). I also want to render the object, for which I will need setup in the constructor and unloading stuff ... |
The problem is the following.
There's a set of simple entities E, each one having a set of tags T attached.
Each entity might have an arbitrary number of tags.
Total number of entities is near 100 million, and the total number of tags is about 5000.
So the initial data is something like this:
E1 - T1, T2, T3, ... Tn... |
I haven't been able to find the appropriate terminology to search for content on the web related to what I'm asking, so I'm hoping someone on here can at least point me in the right direction.
I'm a fairly senior JavaScript developer, but I have a secret -- I don't like event-driven programming (aside from user-trigger... |
I'm trying to re-write a backend interface doohickey for a calendar, a todo list and another sort of calendar and found that they all were programmed to have subtly different formats for patterns of dates that could be used to configure certain properties in them.
I have three screens that have different ways of essent... |
I have a clustering problem which I can't seem to solve, although if I treat it as a labeled classification problem, I can solve it with satisfactory precision. Is there an elegant way to make the leap from being able to solve the classification problem, to being able to solve the clustering one?
The details:
I have a ... |
I know nothing about gui programming. I try to learn. I have simple question...
For example, I have small program. I have class that extends JFrame with main Window (MyWindowClass) and my "logic" class (MyClass) that do something (for example calculate something and I want to display it in window).
Should I implement t... |
I want to really opensource a project that did start as a personal hobby, but I'm an ignorant of licensing details.
This project, provides some libraries for a given $language, and some wrapper command line utilities for those libraries.
Those libraries, across many things, do generate more code in the same language, c... |
Sometimes I read in observer-pattern descriptions, to make the constructor of a observer base class protected so the class will be abstract. but by making the constructor public (if even one is neccessary), I could use the observer as an instance and not only as base-class.
Is there any disadvantage of doing so i'm not... |
To make this question answerable, let's assume that the cost of ambiguity in the mind of a programmer is much more expensive then a few extra keystrokes.
Given that, why would I allow my teammates to get away with not annotating their function parameters? Take the following code as an example of what could be a far mor... |
I'm trying to create a website where the user enters a few numbers, these numbers are fed into some equations, and the output of these equations is emailed to the user. I'm using Python 2.7 for everything. I'm using a cheap Amazon instance (m1.small, Ubuntu 12.04) to host the frontend, but I only want to launch a backe... |
ASP.NET WebForms seemed really great until that moment of realization the abstraction you'd welcomed was producing HTML that was worlds away from what you needed. Wrestling with that framework to generate HTML that matched a designers or used external libraries became a big nightmare for me and one I'd rather not have ... |
I'm writing a Java class, part of an opensource game development framework under the Apache 2.0 license.
There is another framework, under the same license, that happens to also have a Java class that addresses the same subject as mine. I recently checked it out, and my implementation is extremely similar to that. Heck... |
I have a function that linearly "remaps" a value from a given interval to an other interval?
The function remaps a value from a given interval [oldMin, oldMax] to another interval [newMin, newMax] using this formula:
newVal = newMin + (newMax - newMin) * (oldVal - oldMin) / (oldMax - oldMin)
If it helps identify what ... |
My friend and I are building a mobile game and ran into the following design problem:
We will have many different types of units all with different stats and abilities. However, all unit types should have a few commonalities (for example, they would all have a totalhealth attribute).
We were trying to decide what the ... |
The main issue I have here is are the 720P, 480P, 240P... classes for defining video quality or do they unambiguously define the resolution of the video?
For example, the wikipedia article about 240P refers to a family of resolutions.
|
I was taking this course - CMU 18-447, Computer Architecture at Carnegie Mellon to brush my knowledge and concepts.
They say that most of the machine level details and implementations are taken care of at the Instruction Set Architecture(ISA) level and is abstracted at that level.
Some Intel processors even have hardwa... |
Large codebases are more difficult to maintain when they are written in dynamic languages. At least that's what Yevgeniy Brikman, lead developer bringing the Play Framework to LinkedIn says in a video presentation recorded at JaxConf 2013 (minute 44).
Why does he say this? What are the reasons?
|
When writing an API in Java, returning an immutable collection of some sort, I've got the option of returning Collection (or List, Map, etc) from the method, or guava's ImmutableCollection (or ImmutableList, ImmutableMap, etc):
private final ImmutableMap<> _immutableMap = ...
public Collection<T> getValues() {
ret... |
I currently have 4 projects under development. All of them related to the same product (hardware) but different after all (desktop, android and web environments).
That product, the hardware, is constantly changing, improving and thus all related software so there is no real "ending".
How should I manage time? Should ... |
I'm relatively new to TDD and have been thinking a lot about how to manage the perpetually growing pool of tests that comes with it.
One of my biggest concerns is about false positives.
In my experience, it's not uncommon at all for a feature to undergo fairly massive changes over time. To implement a change we would ... |
Is it better to have either a
Deterministic test suite, that results in the same tests succeeding
Non-deterministic test suite, which potentially possibly covers more cases
?
Example:
You write a test suite to test controller functionality in an MVC application. The controller requires application data from a databas... |
We have a database with tables that use an inheritance hierarchy. An entity in the derived table will have an ID that matches an entity in the base table and so on through the hierarchy.
We have repository classes for the derived types/tables so that you can get specific instances by ID. The problem we have at the mom... |
A class loads properties from a file and uses those as it performs its duties. For testing purposes I want to be able to modify said properties directly without having to use a test properties file. I did the implementation, but it seems filled with smells -- I'm wrestling with keeping this thing small (avoiding fram... |
I'm interested in build a prototype that needs this sort of thing:
Point A (xa, ya) with a radius of 500 meters.
Point B (xb, yb) with a radius of 700 meters.
Point C (xc, yc) with a radius of 1200 meters.
Point D (xd, yd) with a radius of 200 meters.
Person 123 is in some certain point.
Question: which points 123 is... |
Are there any examples of inheritance in languages where classes call their subclasses' methods rather than their super classes' methods?
It should not behave like traditional inheritance like the following.
Parent.method = function () {
// Do things
}
Child.method = function () {
// Do things
super.method(... |
I am working on an application which have multiple layers. Data access layer to retrieve and save data from data source, business logic to manipulate data, user interface to show the data on screen.
I also doing unit testing of the business logic layer. The only requirement is to test the flow of business layer logic. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.