instruction stringlengths 34 19.9k |
|---|
Often what's displayed to a user (e.g. on a web page) will be based partly on security checks. I usually consider user-level / ACL security to be part of the business logic of a system. If a view explicitly checks security to conditionally display UI elements, is it violating MVC by containing business logic?
|
I have a function containing other functions. These function are called based on value of variable action.
These sub functions are logically grouped - i.e., they all deal with file manipulation.
Each function has 2 to 5 lines.
I would like to improve the style.
Is there a more concise way of achieving this end than wh... |
Objective-C lacks private methods or java-esque final methods. This means that it is possible for a subclass to (accidentally) override some of the internals of a superclass.
How does one prevent overriding methods in Objective-C?
|
I've got some code that I want to run when certain HTML elements are added to the page.
To do this, I have a "runOnRender" function:
runOnRender: function (func, args, interval) {
var that = this;
var guid = hb.getGuid().substr(0,7);
var checkFunc = function () {
i... |
Most low latency/high frequency programming jobs (based on job specs) appear to be implemented on unix platforms. In a lot of the specs they make particular request for people with "low latency linux" type of experience.
Assuming this does not mean a real-time linux OS, could people give me help with what this could be... |
I have been stuck for some time on which is the fastest string search algorithm, heard many opinions, but in the end I'm not sure.
I have heard some people saying that the fastest algorithm is Boyer-Moore and some saying that Knuth-Morris-Pratt is actually faster.
I have looked up for the complexity on both of them b... |
This question could go here or on S.O. perhaps...
Suppose that your training dataset contains both categorical and continuous data such as this setup:
Animal, breed, sex, age, weight, blood_pressure, annual_cost
cat, calico, M, 10, 15 , 100 , 100
cat, tabby, F, 5, 10 , 80 ... |
I have the following sample question for a compilers exam and wanted to check my solution.
Convert the following grammar into an LL(1) grammar which recognises the same
language:
E -> E + T
E -> T
T -> id
T -> id()
T -> id(L)
L -> E;L
L -> E
For my answer I have
E -> T E'
E' -> + T | ε
T -> id
T -> i... |
We recently had a consultant tell us that if a feature can only be tested via automated UI tests (e.g. Selenium, Coded UI), then there is an underlying architectural issue. While this statement might be a bit extreme, it is along the same lines of the testing pyramid in that UI tests should make up a small portion of ... |
In my company, we successfully working with agile practices - but without using iterations. The main reason is that we can't find a clean way to fit in QA in an iteration cycle.
We understand QA as an extra bit of verification to a certain build (release candidate) before this build gets deployed to the customer. The p... |
I'm making mandelbrot fractals in C using Xcode and I want to use parallel computing but everything I've tried so far doesn't work. Such as This Question and other how to guides. Whats the easiest way to use frameworks such as mpi.h to run my program in parallel?
|
I've been reading Martin Fowler's Refactoring. It is generally excellent but one of Fowler's recommendations seems to be causing a little trouble.
Fowler recommends that you replace temporary variables with a query, so instead of this:
double getPrice() {
final int basePrice = _quantity * _itemPrice;
final doub... |
Disclaimer: Not as exaggerated as the title suggests, but it still makes me uncomfortable. I'm just going to express honestly, so take it with a grain of salt. Just pretend that I'm talking about that coding standard that you don't like working with.
Edit: The fact that I don't like it, doesn't mean I don't use it or e... |
I have been developing an Immutable queue in java, but the version I have developed is supposedly slow and I have been suggested to create a faster version of the same and I have no idea as to how to accomplish that.
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
public clas... |
In ASP.Net MVC, in the razor view, you can type this kind of code:
@Html.EditorFor(model => model.Name)
(in this case, it creates a textbox for the field Name of the object which is defined as the type of the model)
Now when i see the definition of the EditorFor method, it is this:
EditorFor<TModel, TValue>(this HtmlH... |
I'm looking at implementing a PHP based application, where by you have a certain route for example London to Edinburgh. Along this route, I want to calculate say a 10mi Radius or Polygon around the whole route/driving directions, check whether certain defined points/lat-lon's are within this radius. If so - Add them to... |
I realise this might be offtopic here - but I couldn't find a better place in the stackexchange family. And this question has simply been bugging me for years..
What I wonder is: can an eula define WHAT you use an application for? IE: if I write a text editor, can I say "You can't write fantasy novels with it".
I'm wo... |
The company I used to work for before we had automated unit tests to test our work. However the coding standards and architecture was not very important for tests. Of course you had to indent code correctly and put your braces where you are supposed to put your braces, but no one would go nit picking through your tests... |
Or more generally: to trigger compiler errors in test projects if something that can be checked at compile time is wrong?
|
I've written a recursive search algorithm to find the boundaries of a voxel data structure in order to render it more efficiently. I've looked around, and either it's such a simple and obvious technique that nobody's bothered to patent it, or it's novel and nobody's done it this way before.
It's openly "published" on G... |
I have a bit of experience with loop invariants but I'm not really clear on them. I'm trying to learn them through an example in Python. Can someone point one out or help me understand?
I've searched both on programmers.SX and on the web but the only things I could find were invariants and design by contract -- nothin... |
Possible Duplicate:
To branch or not to branch?
A co-worker is against branching. I use branching all the time. I put the team onto a basic 3 branch system. I create my own feature branches. Said co-worker tends to have good ideas, follow best practices and I tend to agree with him on many such things. Except ... |
Given a mutable property, it generally makes sense to only hold/store that property in a single place. When the data needs to change you only need to update a single field, and you can completely avoid bugs where the different fields get out of sync.
An extremely simple example could be:
The 'right' approach:
class Own... |
Although it is a commonly held opinion that planning poker improves the accuracy of project estimations (a small sample of which demonstrated on this question), has any defined research been done on the subject?
More specifically, I am looking for non-circumstantial information showing that planning poker would be an i... |
I have built a QlikView script generator (QVS), that can be used to generate large script files for data imports from SQL Server to QlikView.
QlikView does not like 'fully' normalised database structures (loops between several tables): for example, three tables A, B, C in SQL Server could have three PK/FK links; in Qli... |
Possible Duplicate:
When should the VCS history of a project be deleted?
I am experienced using svn and recently started learning git. I was quite shocked to learn that git has features that allow you to "rewrite history".
Coming from svn, I had accepted as sacrosanct the source control principle that once a change ... |
I'm working a small-to-medium legacy codebase and when working on a ticket I will come across code that should be cleaned-up or that I need to clean-up just to be able to understand the follow of the application.
A real example is:
if( !a && b ){
doSomething1();
doSomething2();
doSomething3();
doSom... |
I was reading a thread titled "strlen vs sizeof" on CodeGuru, and one of the replies states that "it's anyways [sic] bad practice to initialie [sic] a char array with a string literal."
Is this true, or is that just his (albeit an "elite member") opinion?
Here is the original question:
#include <stdio.h>
#include<str... |
I want to write a multithreaded server application which is able to process requests in a multithreaded fashion while keeping up execution order of incoming requests of the same client.
For example if client A sends a message M1 and then a message M2 the muiltithreaded server must process these requests in exactly the ... |
I did a look around and couldn't find a question that addresses my case, so I figured I would post.
I have a situation where as a new team, we ran into 2 unforseen spikes (is there a better term?) during a sprint. We 'thought' we knew, but then we had to research mid way, so this introduced a spike.
My questions are:
... |
I'm trying to come up with a name for a class that can represent both files and folders. Anyone know a word for this?
|
Here is a C++ class that gets constructed with three values.
class Foo{
//Constructor
Foo(std::string, int, char);
private:
std::string foo;
char bar;
int baz;
};
All of the parameter types are different.
I could overload the constructor so that order doesn't matter.
class Foo{
//Constr... |
I've read a bit on denotational semantics (DS) and I'm very intrigued about the process of designing computer programs where types and functions have strong and clear mappings to mathematics.
Are there any resources that discuss designing programs based on DS in detail? I've seen a few superficial treatments of the su... |
I'm trying to educate myself on potential web attacks. I just found a site (which will rename anonymous) where it shows me what looks to be like the php session id inside the cookies section of the request header.
My immediate reaction was "wow, that's bad"... but then i couldn't really come up with a scenario as to ... |
Every time I look for an IDE (currently i'm tinkering with Go), I find a thread full of people recommending Vi, Emacs, Notepad++ etc.
I've never done any development outside of an IDE; I guess I've been spoiled. How do you debug without an IDE? Are you limited to just logging?
|
I will explain the context of the problem first. For a University project I'm going to implement an Android application. The Android application (and others) will be able to send data to a remote source, that remote source will also be able to send messages to the Android applications. For example the messages may be "... |
I am designing an API which mostly involves refactoring the original code.
So Right now I have a method which has two big chunks which are seperated by an If-else condition, which in my opinion is not exactly the best idea.
The code looks like
do_something():
if (isTrue):
#Large block of statements.
... |
We have a branching structure of:
multiple dev branches for each major new feature
Main branch, merged into from a dev branch once a feature is ready for testing
Release branch, merged into from Main once a feature is ready for production
We often have new features completed at around the same time that end up in Mai... |
I don't want to know which IDE is best, because that's subjective. I'd like to know how to evaluate an IDE. I'm primarily a vim user, and realistically happy there, but occasionally look at languages that have powerful IDE's and I consider using them.
The problem I run into is that they mostly seem the same to me. Cert... |
I'm working with an embedded device with a unique protocol that sends messages to other devices and I'm making an application that parses the sent packets. Each packet carries 8 bytes. The protocol is defined as where first byte is header and remaining 7 bytes is the data.
They are trying to pass a particular ID string... |
I'm designing and prototyping a server that has the following characteristics:
during the daemon's initialization it spawns nine "manager" servers, each of which solves one part of the overall problem.
after initialization, the daemon accepts connections from clients, forking a "slave" server for each which connects t... |
Is there a rigorous way to classify programming languages ?
If so, can the various "dimensions" be quantified ? (degree of purity)
For instance, I just went on the Shade language website (I am not affiliated with it in any way) and saw :
"semi-functional" -> But how much is that language semi-functional ? -> quantific... |
I am writing an enterprise web-forms-frontend application for in-house use. It has Direct access control (DAC) masquerading as Role-based access control (RBAC).
For anonymization purposes, let's call the main unit of information stored in my application a Document, and the roles in the company a Boss, a Grunt and a C-... |
If I wanted to make a suggestion to a change to how the UPDATE statement works in SQL, how would I go about it?
Is there a website for the next standard?
I googled, but just kept getting the Wikipedia page.
|
Although there are many similar questions here regarding using GIT for maintaining different versions, none seem to answer my specific case.
I'm OK with how to use GIT to do my development, using different branches to do hot fixes, versioning etc.
However, I am making a commercial application that needs to track variou... |
I am studying Visual Studio 2010's architectural tools for application lifecycle management.
After we have sketched some modeling diagrams, we wonder now how should be the natural workflow to convert that to architecture-compliant code.
We noticed that UML Explorer tab keeps track of entities created in class diagrams,... |
I have read an article with following example:
void func()
{
if (condition1)
a = a + 1;
if (condition2)
a = a - 1;
}
It says the CC is 3 as there are three possible paths. How come? Why not 4? I Would expect TRUE,TRUE; FALSE,FALSE; TRUE, FALSE and FALSE, TRUE.
Does not matter what the statements are. CC=Ifs-EndPoints+... |
I'm working on a simple UI system for a game. The building blocks are Widget objects, which can contain each other. There are several sub classes of Widget, e.g. LabelWidget, ImageWidgetand ButtonWidget.
Since nesting is possible, a ButtonWidgetis really nothing but a container for a LabelWidget and an ImageWidget. I'm... |
Some people run the bleeding edge of technologies - updating the day that something is updated. In production, this isn't as appropriate.
Researching about if the current (Java 7) version is ready for production produces a significant amount of old material that might not be correct anymore (at the time of this writin... |
I'm currently writing a library of helper functions to produce some repetitive markup. I have a reference to the markup the functions should produce, but I'm curious about how I should go about unit testing this?
There are a lot of unit tests needed to get full coverage of the number of different variations of output f... |
I'm looking at doing my first mobile development using Mono Touch and Mono for Android. I'd like them to communicate with an ASP.NET MVC 4 site I'm designing. I've worked with WCF and WebAPI in the past but I'm wondering if there are any quantifiable advantages to using one over the other in this context?
|
There is a decent Wikipedia article on the "Feature Creep", but it doesn't state an origin. A Google search only leads to some vague article claiming "Earl Rich" coined the term, but there isn't much backup for that claim. There is a Dilbert comic from 2001 on the subject, but the tone seems to imply that the term pre-... |
Googling around I found a particular page:
PCB Via Calculator
Looking the page code I found in the JavaScript code:
//copyright circuitcalculator.com
//please do not copy without permission
Taking in account the simplicity of this code, can I write my own JavaScript function for this? I think some related links can b... |
I am looking to quantify the cost or problems of bad software development practices. Specifically can software that has been developed resulting in an anemic domain model be quantifiable in terms of business cost or risk?
My initial thoughts (which are all nearly impossible to generically quantify) are: -
Reduced flex... |
I have recently began studying Makefiles in Linux. I have ample experience developing applications with advanced IDEs, such as Visual Studio.
My first impression and query after reading a few tutorials: is there any need to study Makefiles? Perhaps the IDEs are using it internally, but is this something everyone should... |
I frequently hear these two valuable programming practices: (1) lines of code should be 80 characters or less and (2) use descriptive names for variables, methods, classes, etc. I understand the reasoning for both of these words of advice, however, they seem to often be tradeoffs of each other. If I keep my code below ... |
This is a question I originally asked on Stack Overflow, but as a conceptual design question as opposed to a technical issue, I believe it may be more appropriate, or possibly have alternate parallel value, on this board.
The structure of a FiM++ program requires that it end with the closing of a letter and the code au... |
I am learning how to write a System Requirements Specifications, and most of templates I have seen talk of a Context Diagram.
What exactly is a Context Diagram?
|
There's a project I'm working on that is looking to produce a web application that will manage a task list between multiple users. This is a master task list whose task items get distributed by an authorized user. Each user has his/her own account to login and view the tasks they are assigned; it is possible for mult... |
Does the choice of using a DVCS over a CVCS actually make for shorter release cycles? If so, what makes software release cycles shorter and what are the arguments for this?
Related to pull request? Does easier submission of patches play a role here?
Related to people factor? Are project teams that use CVCS act more c... |
I'm writing a log parser that continuously looks for specific patterns and then fires off events to another system when it finds these matches. The firing of the event is time critical to catch errors or ensuing problems. This part is non-negotiable in terms of design.
The log files belong to Applications and the Opera... |
Is there a word for the problem of a framework becoming married to the software modules it supports, for example adding methods to a base class that may apply only to certain subclasses or use cases? It's a particular kind of violation of separation of concerns.
The words that come to mind are "upward devolution" or "f... |
It might be a strange question, but why there is no implication as a logical operator in many languages (Java, C, C++, Python Haskell - although as last one have user defined operators its trivial to add it)? I find logical implication much clearer to write (particularly in asserts or assert-like expressions) then nega... |
My department specializes in converting customer data into our database schema so that they can use our software.
Right now, we have C# applications that take an IDataReader (99% of the time it is a SqlDataReader), perform some cleaning and mapping, insert it into a DataRow object, and then use a SqlBulkCopy to insert ... |
So I'm fairly new to programming in the real world (outside of academic projects) and have come across lots of posts saying that using instanceof is a bad thing to use to determine what class a specific object is.
My situation is that I have three classes, a base product class, one that extends off that and another tha... |
I've been struggling with a design so I figured I'd ask here and see if anyone's able to help :)
High level overview
I'm designing an app to gamify exercise by creating mini competitions (ex. Who can lose the most weight in 3 months or bike the most miles in a month).
Users can create competitions (calling them races... |
Like many corporations the company I work for is transitioning to a performance review system based on SMART objectives. My team is a high functioning agile development team employing practices from Extreme Programming. To our great benefit our employment of agile practices has the full support of immediate and upper m... |
When it comes to JSF, I've had trouble distinguishing where certain objects I create fit into the overall MVC pattern. The View is simple enough since that's handled by the .xhtml template but when it comes to objects like:
Action/Change Listeners
PhaseListeners
Validators
Navigation Beans
Converters
Filters
At firs... |
I have been trying for years to master Swing layout managers with no success. Every time I need to do something with Swing, it is like pulling nails to get the visual components to line up the way I want them to. I am familiar with frameworks like Matisse but that's not the point.
My question is: Why does Swing even... |
I am reading the C# specification. I could use clarification on a segment:
C# has a unified type system. All C# types, including primitive types
such as int and double, inherit from a single root object type. Thus,
all types share a set of common operations, and values of any type can
be stored, transported, an... |
I recently got hired on as a new ASP.NET developer (C# code behind). When I arrived, I was told that they were moving to MVC 4, and so I bought two books on that. However, the other day I learned that they are NOT using Razor, but using WebForms. Most of the results via Google returned articles from before the WebFo... |
From Section 5.3 of Google's paper describing MapReduce.
"A Map function extracts a 10-byte sorting key from a text line and
emits the key and the original text line as the intermediate key/value
pair. We used a built-in Identity function as the Reduce operator.
This function passes the intermediate key/value ... |
I have always wondered why Java does not do type inference given that the language is what it is, and its VM is very mature. Google's Go is an example of a language with excellent type inference and it reduces the amount of typing one has to do. Is there any special reason behind this feature not being a part of Java?
|
There seems to be an immediate problem with starting to develop in Common Lisp: choosing an implementation. What should one take into account, and how much weight should it bear when considering a CL implementation?
Should it conform to the ANSI standard? Should it be supported by SLIME? Do certain implementations lack... |
Firstly I am sorry I do not fully understand about licensing. Thus I want to ask here for my curiosity about licensing things.
Here is the case. I build a WordPress theme that using underscores.me as its starter theme. It has GPL v2 license. And then I build the theme using Twitter Bootstrap. It has Apache v2 license.
... |
$clean = array();
$email_pattern = '/^[^@\s<&>]+@([-a-z0-9]+\.)+[a-z]{2,}$/i';
if (preg_match($email_pattern, $_POST['email']))
{
$clean['email'] = $_POST['email'];
}
The example code above (Source) uses an array called $clean to store the filtered value from $_POST. It's considered a security good practice. What... |
my question is rather short:
How do I document typescript code properly?
I found out that for projects becoming bigger and bigger, it is important to look at a function and immediately know parameters, what it returns and side-effects etc. It is tiring to have just a bunch of comments before a function, most of the tim... |
Possible Duplicate:
Does “Inversion of Control” promote “Anemic Domain Model”?
My impression is that projects using a DI framework like Spring or Guice tend to lose their object orientation and degenerate to a purely procedural design:
DI not only centralizes the question of which implementation of an object to use... |
I was reading up on scalable bloom filters and could not understand how each time a constituent bloom filters fills up, a new bloom filter with larger size is added.
The elements that contributed to the set bits in the initially created filters cannot be looked up for presence. Perhaps I am wrong in my understanding of... |
I am working with a legacy system that is not too bad, but I thought of making some improvements to it, and I wanted to solicit your feedback to help me make good decisions. The platform is Linix (different flavors of it).
The system revolves around running [sometimes long] "jobs" - command line programs. The jobs usua... |
I have a resource loader object that loads objects from the disk or from a ZIP archive, depending on the platform.
It has state (e.g. the path to the directory or the ZIP archive, and possibly some caching in the future), so it needs to be a single instance.
So normally, a Singleton would do. But my problem is that thi... |
Recently I found about two new programming languages(Vala and google's GO) which don't support method or function overloading and intend on not supporting them in the future ever! The creators of these languages say that overloading is evil and should not be used!(in system programming?)
I was told that the creators of... |
I recently started working on a PHP application that was built many years ago before the advent of objects and namespaces in PHP. The code is procedural, does not separate presentation logic from business logic, lacks a front end point (front controller), and has files everywhere with a seemingly random folder heirarch... |
In the error monad, the first failure halts any execution further just carrying the fault through any following binds.
What monad halts on success only carrying forward successes, and basically swallowing any faults and trying the next bind disregarding the failure of the previous one?
The error monad could maybe be us... |
Background: Here is the scenario, imagine I have a little Robot. I give this robot a Map, and I want him to traverse the map, after doing so, I want the Robot to tell me the shortest possible path on the map. So here is an example of a Map:
Difficulties: The Robot is given the Map in the form of a HashMap. For the abo... |
When I started working a programmer, I learned lots at first, on the job. Although Ive been given more responsibility, which is good in a way, it is mostly in the form of increased workload. I havent had much time or energy left to learn anything much new day to day. Sometimes I have 1 hr of time and energy left at th... |
I'm learning Common Lisp, mostly as a "mind gym" hobby thing, but I want to end up with a set of skills that would also be usable "in real life", because when you learn a language you also accumulate knowledge about module and package management, deployment and stuff, whether you like it or not, so I want to learn with... |
I came across this about CLISP: *"it all-but-forces your code to be released as GPL" here, when looking for a good Common Lisp implementation.
How can a language force a license on your code? Is this just FUD?
I'm asking because I really don't speak "legalese" so maybe there's something I don't understand here...
I get... |
Consider this function intended to kill all running instances of a subprocess:
killAllFoobars()
{
pids = getRunningFoobars();
foreach ( pids as p ) {
killOneFoobar(p);
}
return TRUE;
}
Where should I check that in fact all Foobars were killed? Should killOneFoobar() check that its Foobar is n... |
I am currently working on an MVC 3 Web app project where I need to display a lot of information on the front page. I am relatively new at web page layout and design so I have hit a wall in terms of how to structure the code behind for this page.
My first thoughts were to split the page up into as many partials as possi... |
I want to start a little project, where I want to connect several of my devices. Some are Android mobile devices, others are desktop devices like a PC or laptop. Furthermore I want keep the project as generic as possible. Means I want to share it, so other people can use it.
By connecting I mean send messages between t... |
I developed an app in Java (which is working perfectly; with this app you can scan TCP/UDP ports -for testing purposes only-), but meanwhile when I was writing the code I read several documentation (wiki) about sockets. I thought open port is mean, a protocol where the client/server can establish/bind a connection even... |
I just jumped into a new project with a new company using Entity Framework and ASP.NET MVC 4. I am no expert on Entity Framework, but I think I have a decent grasp of how to use it.
From what I can tell, my models should reflect a table in the database omitting the columns I don't need. Also, we can use stored procedur... |
My understandment is that hash maps allow us to link, say, a string, to certain memory location. But if every string were to be linked to a unique place in memory it would need a huge block of empty memory. I don't get it.
|
I need to sync my local core data stack against a server running a persistent data storage underneath the covers. (I've gone through other posts here and on SO on similar topics)
My requirements:
One way syncing. Meaning my server is always updated and my clients just merely need to be fed incremental deltas which the... |
Im reading a log file in Java on a Linux box on a continual schedule of 2 minutes looking for certain messages. I store the last offset (RandomAccessFile getFilePointer) and read from it onwards when I detect LastModified has changed; is this best practice or even right?
|
I was just writing an if statement with fairly long property names and came occross this problem.
Let say we have an if statement like this:
if(_someViewModelNameThatIsLong.AnotherPropertyINeedToCheck == someValue &&
!_someViewModelNameThatIsLong.ThisIsABooleanPropertyThatIsImportant)
{
//Do something
}
The sec... |
In many native types, a common suffix (and sometimes prefix) of t or _t is used to denote platform-independent types (such as wchar_t, int32_t, etc.)
What was the logic behind the letter t as opposed to other letters (or none at all, especially in the case of wchar_t)? Does it stand for something?
|
So maybe the quick answer is 'Yes' absolutely (or no I suppose), but let me explain my question angle to get a better derived answer.
We all commonly use SOLID design principals when making up the pieces and parts of our applications. Don't make a class do too many things, don't make an Interface too large, use abstrac... |
If I want to create an infinite list of integers in Java like so:
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i = 0;;i++){
list.add(i);
}
I run out of memory. My understanding is that we allocate some memory for i, list, and every time we add i to the list, we allocate more memory for it.
But, by u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.