instruction stringlengths 34 19.9k |
|---|
I'm working on an ASP.NET MVC site (using Team Foundation Service for source control) that I've divided into a few separate projects under one solution:
Project.WebAPI (Main entrypoint, contains "Views","Scripts" folders
Project.Data (abstract interfaces for backend data access)
Project.Data.SqlServer (concrete impleme... |
I'm on my first bigger C++ project and find that I have some really long lines. My goal is to break them to 79 columns, but I do not really know how to do this in a neat way. Are there some guidelines to break lines like these:
VectorHistogram::VectorHistogram(size_t bins, size_t cache) : bins(std::vector<double>(bins)... |
I am working on a C# net micro framework project, in particular an I2C bus management/class.
I have several different I2C devices each defined in separate classes which contain all of the devices' unique methods. In my case, I can only have ONE I2CDevice object "active" to communicate with and to switch to another I2C ... |
I have a fairly simple data structure like this:
create table project (id int auto increment primary key, name text);
create table item (id int auto increment primary key, name text,
project_id int not null,
project_sort_index int not null,
sort_index int not null,
foreign key fk_project(project_id) r... |
Does it violate the GPL v3 if I were to use a gpl licensed firmware with my closed-source hardware that I am selling? Or do both have to be open-source, or do I just have to make the firmware source freely available?
Thanks!
|
I created and maintain an open source Android app. Recently someone offered to translate my app into several other languages. At the same time, development continues on the app which can sometimes add string resources which need to be translated.
How can I ensure that the additional string resources are translated with... |
I have a long experience in programming Java EE projects, but as I noticed most of the job I have done was with Transaction Script (anti)pattern.
So I want to learn using a rich domain model, but then there is a question, shall Domain Object be depended on container/system services (such a persistence, mail, ...)?
I ha... |
Historically, I probably would have written a script (php or something) to loop through all spreadsheet rows and perform some calculations.
I'm looking for a pure SQL solution on the presumption that SQL has better options than loops.
How should I approach this problem while using a pure SQL approach?
DATA OVERVIEW... |
I'm confused about some of the notations of UML class diagrams.
Pretty sure I know what Association means. Any relationship between instances of two classes, where an instance of one class needs to know about an instance of the second class in order to perform it's work - is an Association relationship. An Association... |
I have a question how to design a stack without using list or array?
This is one question that I want to think about as I want to better understand stack.
|
I wrote code, but I myself many times don't even understand the code i wrote. I heard people using "refactoring method" to help them to understand others' code.
I just knew a very little about refactoring. That is using the combined key Alt Shift R in eClipse, but it will automatically change all the related code & thu... |
A short summary of how we do branch managing: From the MASTER branch one or many feature branches can be made (for mid to long term development), when deploy-able changes have been merged to MASTER then release branches are made. Release branches are kept for maintaining deployed version until the next release occurs a... |
We are having rich text editor in which we can insert html. if any input contains <style> tag then the css is applied to entire window.
is it possible to restrict that CSS to be applied within <div> not entire window?
|
I just dropped production database. It happened because I used dbCreate = "create" instead of "update" in DataSource.groovy.
I was changing some domain models and wanted to update the database. dbCreate value was empty string (""), and I accidentally changed it to "create" instead of "update".
How could I prevent this ... |
Has anyone started a project to do IOC at compile time (possibly using Roslyn or Linq MethodInfo emit)?
My experience with IOC containers has thus far been great, baring a few small issues
Many IOC containers are slow to start up, as much of the resolution logic occurs here
It is often hard to ensure that resolution i... |
I am coding and found it's pretty hard to come up with an elegant design for my app at the first attempt.
First time I'm only about 40% happy, then I refactor it to code the same app a second time (almost start from scratch).
Second time coding, I'm only happy about 60% happy, so I refactor it once more to code the ... |
Recently I create a fork from an "open source project GPLv2" with different name. I make a major changes in source code and I gave a new name to the modified open source. I kept in the header of each source file the origin author copyright. And then I publish my new open source in github.
is this behavior is legal acco... |
I am working on a C# net micro framework project, in particular an I2C bus class.
I have several different I2C devices each defined in separate classes which contain all of the devices' unique methods. In my case, I can only have ONE I2CDevice object defined and to switch to another I2C device, I have to change the I2C... |
Currently my architecture is a monolithic block that handles a really specific duty. Now it needs to be generalized.
Right now it handles a request and all processes (1 or many) associated to it. There's a class Request and a class Process and since it serves one specific duty this model was OK.
Right now I need to s... |
I'm pretty new to Haskell although I did some ML many moons ago.
I'm trying to set up a deck of playing cards, shuffle them and then deal them. I have the deck and shuffle sorted (of a fashion) but I'm not sure what I'm doing after that.
This is what I have so far:
import System.Random
import Data.Array.IO
import Contr... |
In the source code I'm evaluating (jarjar), there exists java code that can be used like this:
JarJarTask fixture = new JarJarTask();
fixture.addConfiguredRule(new Rule());
fixture.execute();
Which will throw an exception like:
java.lang.IllegalArgumentException:
The <rule> element requires both "pattern" and "result"... |
I had a discussion with a co-worker yesterday about design philosophy. The other coder is more experienced then me, and I fully admit that he is likely much better at properly automating his testing, which I'm just now trying to break sloppy habits. However, it seems that some of our dispute is a philosophical issues... |
I am working on a project with several older programmer and we were doing up the documentation of the program when I had a heated debate with one of the older programmers regarding the term : Kilobyte.
He wanted to stick to the old way of using Kilobytes to represent 1024 bytes as he said most programmers understood t... |
Where I work we have our own system library, which pretty much is only wrappers around the STL, such as:
template <typename T>
class HVector {
protected:
std::vector<T> data;
public:
int size () const; //Only returns data.size()
int custom(); //Some generic custom function that uses the data vector
}
Most ... |
I have something of an annoyance in my Git workflow. I do the usual thing where I branch off master, into a branch called feature. I work on this feature branch for a while, meanwhile possibly master has commits of its own, which I might merge into feature. As I do this, I have a remote branch for feature (origin/featu... |
I am trying to improve performance of my ASP.net Web Api by adding a data cache but I am not sure how exactly to go about it as it seems to be more complex than most caching scenarios. An example is I have a table of Locations and an api to retrieve locations via search, for an autocomplete.
/api/location/Londo
and th... |
I ask in terms of high cost classes, with a particle engine as an example.
I read somewhere that an instance of a class with a high cost to initialize, like a particle manager, should have its state variables altered at run time rather than reinitialize the particle manager with new data every time it is used in a diff... |
I saw this in code and was wondering if there is any performance benefit to checking the item count prior to looping:
if (SqlParams.Count > 0)
foreach (var prm in SqlParams)
cmd.Parameters.Add(prm);
I always prefer to do a null check instead and let the foreach loop just hop out if there are 0 items.
if (S... |
It's a rather simple concept, and each vendor seems to have their own "Website" for their config. I am curious to find out a few things. In my linksys router, if I go to 192.168.1.1, it asks for a simple log in, followed by the status page.
Here ports/passwords and all that can be completely changed. What's interesting... |
I'm currently learning how to develop web apps with C#, ASP, .NET and MVC. I am enjoying the MVC paradigm a lot, but then thought about using this to develop desktop software with. I googled around, but found nothing using the MVC pattern to create desktop apps that connect to databases. So what software pattern do .ne... |
To provide some context, I've seen some comments lately that equate inheriting behavior from a supertype, with inheriting a pure interface with no behavior. But there are pretty significant, and different, consequences to each.
e.g. Here's a sample base class, and a "pure" interface (pseudocode):
class FlyingBird {
... |
I really enjoy working with C# however one of its biggest drawbacks is that it is kind of split-brained between MSFT .NET and Mono. In practice its not a big deal most of the time but it is one of those things that makes the language 'stink' a little. It would get a lot more uptake, I suspect, if one could answer "If I... |
I tend to find that after I build an application, the logs emitted by it become near useless and completely unparseable, and has the problem of being really verbose, while not outputting important stuff. Example:
Apr 9 21:49:58.648 [ DEBUG] - Read configuration successfully
Apr 9 21:49:58.649 [ INFO] -... |
I'm writing an enterprisey utility that collects exception information and writes to the Windows Event Log, sends an email, etc. This utility class will be used by all applications in the corporation: web, BizTalk, Windows Services, etc.
Currently this class:
holds state given to it via public properties
calls out to ... |
I have noticed that all the columns in a SQL Select Query should be in a aggregate function, because otherwise the output value for group would be arbitrary.
This makes sense. But when the other columns are same in value, it doesn't matter which is returned. Is there a way to specify this or just use MAX() or MIN() on ... |
I'm having trouble coming up with an approach that isn't n^2 for this problem. Here's a contrived, simplified version I've come up with:
Let's say you're a company that needs 4 employees to launch in a new city, a manager, two salespeople, and a customer support rep, and you magically know how much impact every candida... |
As title says it, i'm looking for a way to store many dictionaries (one per user) of type Dictionary<DateTime,enum> in a database (sql server 2012).
Each dictionary has 366 items inside and it represents a calendar where each day has a certain "status", and preferably i don't want to store each item as a separate recor... |
I've read quite a lot of posts lately about different branching strategies (e.g a lot of links from To branch or not to branch?), and while almost every article explains on how to do this or that strategy they rarely explain the why.
Currently our team is investigating whether or not to switch to "feature branches". We... |
Can customer take one of tasks during the planning meeting, which was already assigned to this team, and put it to another team? For example because a customer think that the other team will be faster in implementing it?
Is it normal for some agile methodologies? If yes, could you, please, provide me with the source o... |
Basically, what I would like to obtain is a way to iterate through ONE list, and call methods specific to the interface the objects in the collection implement.
In my Java project, it would result in something like this:
//GameComponent would be my empty abstract class
HashSet<GameComponent> components = new HashSet<... |
I just started to draw class diagram, I think it is based on 3-tie architecture. I have mobile application, servers, database, and web interface.
But I do not know if it should put the server in? I just want to write a high-level one.
|
Given the following scenario
A canned enterprise application that maintains its own connection pool
A homegrown client application to the enterprise app. This app is built using Spring framework, with the DAO pattern
While I may have a simplistic view of this, I think the following line of thinking is sound:
Having ... |
I've searched about this here and on StackOverflow and found some differences between the two.
But I'm still not sure in what cases one would prefer a Singleton, and in what cases one would choose to use a static class.
(In languages which don't support 'static classes', like Java, I'm obviously referring to classes co... |
I am working on an ASP.NET application. One requirement by the users is they are capable of exporting to Excel of some UIs. I have worked on them using the Infragistics library, and I have supplied them with the exports they want.
However, some of the UIs they see are so complex that it takes a great amount of time to ... |
Update: I was wrong about the PyQt license. It isn't merely a GPL license. The PyQt authors include a special set of exceptions that allow users to release their own code under a different license, as long as it is one of the Open-Source licenses specifically listed in the PyQt GPL_EXCEPTION.TXT file.
For the purpos... |
What is the recommended approach for helper functions? I would like to choose one technique, and run with it to create my new "class".
Here are the design options I have pondered:
Option 1: Helper function in outer scope, invoke with context of instance
function createPane (pane) {
// logic to create pane
var p... |
This is a newbie question, but I couldn't find a newbie-proof enough answer on Google.
What do people mean when they say 'state' - in programming in general, and in OO programming specifically?
Also, what is mutable and immutable state - again, generally in programming and also specifically in OOP?
|
I have used WPF for an Enterprise solution (hundreds views heavily used Data inputs and validation) in MVP pattern (it was a clean solution usually small amount of code behind forms and main code was in pretension layer which we called it user interface process or UIP layer )
For the next small projects I used WPF wit... |
Unicode seems that its becoming more and more ubiquitous these days if it's not already, but I have to wonder if there are any domains were Unicode isn't the best implementation choice. Are there any languages or scripts that Unicode will not work well or won't work at all? Are there any technical reasons to use a diff... |
Unit tests should be isolated, automated ( ie we don't need to do any prior-configuration for all tests to run at the click of a button ) and consistent in their results. For these reasons we should stub any external dependencies ( ie databases, webservices etc ) used by unit under test UUT ( with integration tests UUT... |
I'm not sure if I'm being clever or making things more difficult. I'm working within a custom MVC framework, and within some of my "views" which contain forms I'm preserving input and styling errors as follows:
<form action="submit" method="POST">
<label for="name" class="italic">Name:</label>
<input <?php if (in_array... |
You task is to design a search algorithm that will find my secret number, which is between 0 and 2^64. If your test value is too low you can test again in 1 second. If your test value is too high you are not allowed to test again the next 300 seconds.
Every second I will add 1 to or subtract 1 from the number. I will n... |
I'm new to DDD and IOC/DI and I'm having some trouble figuring out how to design an entity that needs to use a state pattern to manage its status. As the transitions are somewhat complicated, I'm using a finite state machine (FSM) to handle the states (I'm using Stateless).
To further complicate the situation, the FSM... |
I understand that Singelton helps to instantiate only one class AT A TIME. I try to learn how to Design for Singleton function in java. I want to know it better to understand Kernel. So I try to do this following, but I like to know if it's the only way to come up with private constructor.
public class Singleton {
... |
In the 1970s, a man called Bill Gates developed an interpreter for BASIC: the Altair BASIC. Per my understanding, he was able to persuade the guy in charge of a microcomputer company to include the interpreter program on every microcomputer he sold, which I assume brought Gates and his crew some royalties. Apparently t... |
I am in charge with updating a software product that is made up of two components the Controller process and the UI process. The Controller and the UI communicate via XML messages. Furthermore, the Controller is built on top of a shared library that implements a number of business flows.
For builing the messages for Co... |
I have a database table with 3 columns; id, question and answer. On the front-end, I have a PHP application that shows questions to the user. The application would then compare the user input with the answer on the database.
Using only PHP, how do I loosely compare user's input with the record on the database and pass ... |
There are situations where the deployed environment (development, test, or production, for example) might dictate the outcome of certain actions.
For example, perhaps a successful "user registration" process will send a notification email to the new user. Environment-specific actions:
Development: Do not actually se... |
I have a problem that is more serious than it might seem.
I've been programming for about three years , and I have learned and improved a lot , I read the code easily to others, understand the problems and transform them into code, I easily adapt to new technology and I love to learn how it all works . That's all fine ... |
I was just working with a method of about 70 lines of code developed by others. It uses a very nice pattern structure, stuff like IOC container, but I wonder.. The method is too long?
Is it a so long method still easily readable?
The question could be finished, but now starts the premise from which my question has orig... |
What's the difference between model for test and model for development?
Is it that the model for test contains only what we should test? Do we use the same diagrams in model for test and model for development?
For example, if we use sequence diagrams for generating test cases, these diagrams will not be used for coding... |
I have joined writing middle-size multi-purpose database application as co-lead. It currently has about 150 tables (and growing) and overall functionality you can imagine as very small ERP.
At many places in code, functionalities which would normally belong into procedures (I mean functions without return value) like D... |
Most people here and on StackOverflow agree that Singletons are evil.
The main explanation I've come across against the use of Singletons, is they fact that they provide a global point of access to an object.
I admit to not understand why this is a bad thing. It's very convenient to be able to access an important and u... |
When I'm coding something I know that there are many ways to see if my code is good or not. First is testing: I can do unit tests or even test the software by myself and see that it works or not. After getting it working, I can analyze the coupling of the code and so on to refactor and make it better. In that sense, I'... |
Note: the following is C++03 code, but we expect a move to C++11 in the next two years, so we must keep that in mind.
I'm writing a guideline (for newbies, among others) about how to write an abstract interface in C++. I've read both articles of Sutter on the subject, searched the internet for examples and answers, and... |
One of my projects just changed the version number of a supporting third-party library. Specifically, we changed a J2EE app from JPA 1.x to JPA 2.0. Our CI system has had this change for a week and the tests are passing.
In general, how can I do an effective code review and QA check when another developer changes the v... |
I'm getting into the Repository pattern (which I love), and as I read up on it I see this UnitOfWork pattern in many articles. Before I knew anything about UnitOfWork I was just using my Repository pattern inside my service layer (business logic). This seems to work great so I'm wondering why having another layer (ie. ... |
What kind of process or static analysis would catch the heart bleed bug other than human code reviews which we already know failed. The Fix Commit is here.
|
I have read a few asserts vs exception questions already; I ask specifically about package visible classes though.
When you write a package, the classes marked with "public" are exposed to the outside world, thus exceptions are used to let users of the package's interface know they're using the package wrong.
The class... |
I understand that C++ compilers are not compatible with each other. However, I was unable to find anything on this topic for C in particular. I know that the C standard leaves a lot of room for compilers to implement things however they see fit: for example, the size and alignment of most (all?) data types is implement... |
I am working on a project where I am trying to decide between using a standard SQL relational database or JSON objects to store data about an event or activity.
The project will store data on multiple event types so I have decided to just describe one event type for this question.
The live music event (described in fu... |
I've always wondered what other programmers think about the idea of creating pure aesthetic functions.
Say I have a function that processes a chunk of data: Function ProcessBigData. Say I need several process steps, only valid for that data: Step1, Step2, Step3.
The normal aproach I see the most in source code is to w... |
I have been coding for a good bit, and I found a project I want to work on -- a python web app using django + mongodb.
I know what I want my web app to do. When you are in this circumstance (just starting a brand new project) where do you start? What do you code first? Do you code the views first?
Hope this hasn't bee... |
For an API I'm building what it does is load an XML file that is passed to it as a string, drill to the correct element, modify values, and return the modified XML.
I'm doing something like this in my code
if (valid)
{
XDocument docRoot = XDocument.Parse(XMLstring);
var node1 = docRoot.Descendants(namespace + ... |
There is a <fieldset> tag for a set of fields.
Why isn't there a hierarchical child for fieldsets?
<form>
<fieldset>
<legend>Thin Sandwich Options</legend>
<field>
<label>Meat</label>
<div class='inputs'>
<label>
<input type="radio" name="m... |
I have a client who is requesting that we develop their fairly small web application directly in their environment by RDP to the server that will host the app. They have had a contractor do this for a while and it has worked "fine" for them, so they are comfortable with that approach. The client's biggest concern at th... |
I might not have had a counterexample when I got the reply "A pointer is just an address, what's the difficulty?" but I didn't really buy such a simple explanation and at assembly code it's not obvious what's a pointer for 2 different C programs that generate the same assembly.
cat pelle.s valle.s
.file "pelle... |
I am implementing a Canny Edge detector for a class which I have based off the code found here. For the first derivative mask that I will convolve with the image, I am using the Sobel mask, although the website uses the Prewitt. As you can see in the samples on the website, the code is perfectly functional. However, I ... |
Firstly, I'll try to describe the real world model of what we are trying to express in C# code.
We have a device called M100. It's purpose is to read\write data from\into cards (plastic or ULTRALIGHT cards such as MIFARE). It can be with one up to 3 antennas (the device read\write data through antenna). One of antennas... |
Let's consider the next situation:
We have a module A which has a class Crt570 intended to interact with a device.
We have a module B which uses Crt570 in the class called M100Communicator.
We have two applications C and D and both of them wants to use module B.
Application D wants to use B, but doesn't want to use Cr... |
I've been looking on Google for a clear diffrentiation with examples but couldn't find any.
I'm trying to understand the differences between Dynamic Dispatch and Dynamic Binding in Object Oriented languages.
As far as I understand, Dynamic Dispatch is what happens when the concrete method invoked is decided at runtime,... |
So I've noticed a trend lately of .net web developers using angular.js on the client side of applications and I've become more curious as I play around with angular and compare it to how I would do things in asp.net mvc.
I'll give a quick example of what really got me thinking.
I recently came across a situation at wor... |
I have studied some persistence frameworks mainly Hibernate, DORM, TMS Aurelius and I'm wondering. In a model of type:
TOrderFiscal < > ----- > Items < > -------- > TOrderItem ------- > TProduct
TOrderFiscal --------- > TSuplier --------- > TCidade -------- > State
Each class of this with countless attributes, all ma... |
Is it a common or normal practice to encounter schema changes, especially renamed or removed columns, in a production database, without having been notified of the change? If unexpected schema changes are anticipated in the production database, how are they guarded against, other than basic exception handling?
I've ... |
My question will be about how do you think it would be fit to name some methods in a fluent interface. Let me try to demonstrate the problem.
Consider this relation tree:
A person can have dogs and cats, and a dog can have bones. Pretty simple.
What i'm trying to do is create a domain specific fluent interface for det... |
The Decorator pattern is usually used to extend the functionality of an object by extending one of it's current methods.
To illustrate, please consider an object object and a decorator decorator. object has one method called methodA(). decorator, because we're in the Decorator pattern, also has this method by inheritan... |
In my earlier days of programming, I was using Visual Basic for learning. It taught me many concepts, and I was able to make some cool programs (in my opinion, anyways...). I have expanded my horizon to basic C/C++, PHP, and MySQL.
One of my most favourite projects, I want to turn into a multi-platfrom (for x86/x64) wi... |
I'm involved in a project which involves implementing a binary protocol that will be transmitted over TCP. During our early discussions we have hit a brief snag on deciding whether byte stuffing is required if we decide to include the packet length in the field header.
For example. If our packet structure was like so... |
At some point I had to create some class "Class1" and that class needs a method "method". So I have the following:
Class1MethodTest: A total of N tests that check the behavior of Class1.method
Class1 method: A full implementation of the method
But a bit later I need a different class "Class2" to have a completely simi... |
For example with:
Total population = 400000
Number of villages = 800
The average population is 500
How can I randomize the amount of people in each village using a specified deviation (eg +-50) so that it equals the total population?
I came up with a solution using this normal distribution class
Basically I created a n... |
Let's imagine I have an abstract class named ProtocolA that represents the basic operations to work with the protocol A. Such protocol is in version 1, but new revisions are expected in the future. Version 2 is coming. How should I name the classes that implements that abstract class for each version? ProtocolA1 and Pr... |
From what I understand, SVM's take a discrete number of x and y values from which to learn from, then when given new x values map it to one y value (category). Is it possible to use SVM's or something similar to instead map x values to probabilities of y values?
Let me give you an example, say your x values are arrays... |
I'm currently learning Clojure (my first functional programming language), and I'm curious as to its order of evaluation.
Here is an example:
(take 10 (cycle [1 2 3]))
If the cycle expression was not wrapped in a take expression, this would cause a memory error, as it would iterate infinitely through the vector. So, ho... |
I've been told that when I have a hash table of size m and m=2^k, I can use the & operator as num & (size-1) instead of num % size, to fit the hashCode to my table size.
I've also been told that the the command Num&sizeMinusOne is more than twice faster than num & (size-1).
My question is, why?
And isn't the operati... |
In my current company we're using Scrum with 2 week iterations and a regular planning session.
How planning normally works in our company is that we take a predefined , prioritized (by PO before the planning) product backlog of user stories / PBIs, take PBIs from the top one by one and break it down to tasks to then e... |
I'm using Rails engines to break up a big app into smaller pieces. The parent app mostly handles users and authentication.
In one of my engine tests I want to log in a user before each test. How should I access this user log in functionality, which exists in the parent app, from the engine?
It seems there are two optio... |
I have used Factory pattern where I have multiple classes which does similar sort of work, but I don't want client to worry about class instantiating and return types. So Instantiate the necessary class dynamically depending on input and pass the values. These classes have similar methods but does slightly different wo... |
Lately I've been reading about Hypermedia as the Engine of Application State (HATEOAS), the constraint that is claimed to make a web API "truly RESTful". It boils down to basically including links with every response to the possible transitions you can make from the current state.
Let me illustrate what HATEOAS is base... |
I'm currently refactoring an existing design, which was created without TDD. There is a class hierarchy with one abstract base class and two subclasses. In the original design, these classes were mostly just data holders without much behavior. I have identified some functionality which should be implemented in the base... |
I'm looking for the kind of a certain datatypes.
The main idea of this datatype is to describe a productionline containing several steps. Each step should be represented as a "vertex" containing an object of any type. Then for every "vertex" there are possible "subproductionlines" joining the line.
So it could look som... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.