instruction stringlengths 34 19.9k |
|---|
I am currently developing my first serious piece of software in C#. It is a good learning experience so far.
My software is basically a task scheduling tool with some advanced features and capabilities.
I am not near the finishing stages yet, but I was wondering what people's opinions are on trial versions of software... |
I recently wrote some code that I thought very inefficient, but since it included only a few values, I accepted it. However, I'm still interested at a better algorithm for the following:
A list of X objects, each of them are assigned a "weight"
Sum up the weights
Generate a random number from 0 to the sum
Iterate thr... |
We are developing a data model for a marketing database that will import transaction, customer, inventory, etc. files and the directive is ONE process that works for every client. We have been told every client will have different import layouts and different columns that identify a table's primary key.
Our initial id... |
i'm a data scientist and python noob, but I seem to have found a bug with scipy.stats.percentileofscore. it may be "by design" but please bear with me.
if you have an array, you will get an upper bound of 100, but never a lower bound of 0. The lowest percentile you will get is 100/len so if I have an array of 30 it... |
How does the client know to send request to server only when the confirmation box result is ok and stay on page if cancelled? Also, is this mechanism any different in ASP.Net and ASP.Net MVC?
I want to know the internal working of when user clicks OK/cancel what happens internally. How does browser come to know it has ... |
I am a commercial software developer and I want to make use of open-source in my proprietary software.
As I understand the concept of copy-left, it uses the original authors copyright to ensure that their ultimate end users (which would include my customers) are not deprived of benefits of the original work that the or... |
I'm currently working with Wordpress (GPL).
I understood basically when you write a plugin/module/etc. it becomes GPL since it's considered dependent of Wordpress.
But on the contrary images and css from themes, are not due to be GPL (they are considered independent data files that could have meaning even without Word... |
I'm new in unit testing. For last two days I'm thinking how to test non-atomic methods with unit tests.
When i need to write tests for some simple, atomic method situation in pretty easy - i'm taking all scenarios for this method that i can imagine, and reforge each of it in unit test.
But what if i have methods tha... |
So far the most confusing portion of git is rebasing onto another branch. Specifically, it's the command line arguments that are confusing.
Each time I want to rebase a small piece of one branch onto the tip of another, I have to review the git rebase documentation and it takes me about 5-10 minutes to understand what ... |
I hear the term 'bolt-on' used in many contexts, specifically in my organization where PeopleSoft is used extensively. I don't know exactly how it differs from an 'extension' of an existing product, a new module within an application, or an 'add-on' like you would purchase for a product you own. Is there a more forma... |
I am writing a simple webmail where I want (obviously) to display the emails.
I'm wondering if I should take any precaution while displaying HTML emails: is dumping the email content into a <div> a security risk?
I'm guessing that yes since the email could contain anything (could it contain Javascript?). But then how s... |
Should an API be aware of a client version?
The idea of that really goes against the grain for me, but it seems like it is being pushed for in my current project.
Am I wrong? Can I get some reasons for or against this that I can present or understand why it might be good.
The API is a RESTful API.
|
The problem
I write a lot of exploratory code in my research. As I go along, I put functionality that I'd like to reuse in a central location. A project might look like this:
./mylib
./exploration
/experiment_1
/experiment_2
/experiment_3
Where each experiment uses some functionality from mylib.
Now I come... |
I want to draw a class diagram that shows the following for an application:
An external content management system that publishes some news items.
The class that represents the news item in my application.
The question is shall I include the external content management system as a class in my diagram (and maybe give i... |
this is not a question on how to write unit tests
this is not a question on what to test
this is a question on reducing the typing needed overall for a personal testing framework
I know you can send function pointers as arguments to functions in C.
Is there a c++98 version? Or, since c++ can work backwards, should... |
I am only coding in Objective-C and I have no experience with backend coding, only a high-level understanding.
I understand why a lot of programming projects require backend servers but I'm not absolutely clear on a high-level perspective why Mailbox needs their own.
They get their data from the Gmail API,
It is my und... |
Im currently looking for a way to test a lot of requests in the shortest amount of time possible on my web application. My current workaround is to just import the modules I want to test into another python file and shoot requests directly into those functions, but I'd rather have it go through the web server framewor... |
I'm currently developing a responsive website with CSS media queries. It would be much easier if the server returned a different HTML/CSS for each viewport.
I was wondering why couldn't the client include its viewport information when requesting an HTML file. This behavior is already common for returning websites in th... |
I created a general class that accepts a string when it is constructed, and it spits out that string when a user calls what(). This is all it does; on throw, it returns the initializing string.
class Exception_As {
private:
std::string message
public:
Exception_As(const std::string& message) { // const... |
With little or none previous experience of testing, I'm looking into adding automated testing to a continuous integration process of SharePoint applications. I've learned how this can be achieved using coded UI tests that are run before deployment and during the build and I've used Selenium with Java before, where we d... |
I have a Message class which can contain multiple types of payloads (or sometimes no payload), each derived from a common Payload class. However, this becomes problematic because the Message class wants to know about the Payload subclasses for various reasons such as:
Checking for Message equality
if (message parts be... |
As far as I can tell, you can make your interface known to others by providing your .h file. Your .cpp is the implementation. Then they can see the function names, the parameter types, the return type, maybe a description of how to use a function, and maybe what it does in the .h file.
Then I read in posts here abo... |
If Java is a general purpose language, and building a program is something that can be described using the Java language, why isn't this the best way to write build files and instead we use tools like Ant, Maven, and Gradle? Wouldn't that be more straightforward, and also remove the need to learn yet another programmin... |
I'm newish to programming and would like to know what people have found to be the most supportable option or rather what people find more understandable. I'm the only one writing code at my firm, but gradually will hand this off to someone else in the future.
The Project
The project I'm working on is parsing a huge te... |
I work on a fairly large web application. The main solution containing the web application project has over 100 projects. The average build time of that solution is 2 minutes on a 12 GB quad-core machine with an SSD.
We are looking into ways we can improve our deployment process. I am going to work on a proof-of-conce... |
Considering I have a for loop in a method of a class. Should the incremented variable be declared as member of the class, or should it be declared in the method it uses it(or even in the for loop, directly)? While declaring it inside the method seems easier and cleaner, doesn't declaring it at the start of the class ma... |
I'm trying to find the best way of developing a portal that a user can log in to and then be presented with a range of different apps (angular). They should share the same api-backend.
I think that each angular-app could (and should) be developed separately. The only thing I think I need to do is place the dist-folder... |
I'm now writing a program, which will allow processing data expressed in the form of graphs. These graphs will determine workflow of the processing and they are actually an essence of this program (in terms of being the main object being edited by the user).
It is very, very tempting to put all the processing, data co... |
I'm working on scaling an application which is currently polling a mySQL database to send async jobs to a background processing system.
A state machine is being used to keep track of the entities progress throughout a workflow. For example, we might have three states:
Scheduled
Processing
Complete
My plan is to add ... |
Requirement:
We need a tool that simulates a hardware device that communicates via RS232 or TCP/IP to allow us to test our main application which will communicate with the device.
Current flow:
User loads script
Parse script into commands
User runs script
Execute commands
Script / commands (simplified for discussi... |
If I link a program dynamically to a LGPL library (here GTK+/GLib), I'm allowed to distribute the program on my own terms (non-copyleft).
Now, the LGPL library provides loadable modules. Place a shared library (.so, .dll, .dylib) in a certain directory, and it will attempt to load it, using a well-defined interface. Am... |
Mine is a typical website developed with LAMP stack. Due to scalability issues we are planning to incorporate NoSQL for the application.
For the implementation, we are planning to implement hybrid solution: using NoSQL only for few of the high volume tables in database and keep on using MySQL for all the other. So, we... |
I recently started at a new job.
The existing system works OK but is poorly designed and hard to maintain, and they are planning to rebuild it in MVC and I fear it will be much worse. (Not because of MVC)
I want to discourage the lead dev from using an anti-pattern
Existing issues include
Hard coded strings in the bu... |
So i understand the semantics of derivations as far as Backus Naur Form goes. One thing I cannot find in any text book or the various lecturers' notes that are on-line is this.
When would a right most derivation be beneficial over a left most derivation? Would a compiler or generator always use either left, or right, ... |
My team is in a situation where we need to create about 30 different processors. By processors I mean code that takes data from a DB and sends it to a remote service somewhere else in the world. They each do fundamentally the same thing, only with different data.
Only some of these processors will be deployed to server... |
We are developing a desktop application and I am responsible for GUI testing. Currently we have around 500 tests which take 8 hours to complete.
The tests are testing almost every button/menu/field etc. in the application. Some functions are taking 3 - 15 minutes because the application is actually measuring something,... |
I've been searching for the different uses of the keyword mutable. I've found that it is generally used for caching, lazy computing, mutex, ...
But I'm wondering if it is coherent to use it for a cursor on a readonly object.
For example, I have a sound class, and I want each sound to be able to keep track of a play cur... |
In Spanish-speaking countries we use more than one last name, like:
First name ↘ ↙ Last name
Pedro Arturo Rodríguez Loyola
Middle name ↗ ↖ (?)
I'm trying to model data for patient name. In our country it's important, so I can't neglec... |
what is a basic block called if it contains a branch instruction? How about a block that does not contain a branch instruction?
Thanks,
|
A while ago, I asked a question on SO about something written in C++, but instead of getting an answer to the problem at hand, the comments went all crazy on my coding style, even when I indicated that it was a WIP piece of code and that I meant to clean it up later when I had the base case running. (I got so many down... |
I have some methods im trying to test which use a StreamReader dependency that i mock using Rhino mocks. But it is a large xmlFile. In the spirit of unit testing im trying to keep away from using a test file in my test project.
On the other hand copy-pasting 100 lines of xml into my test class seems sort of ugly. What ... |
I'm reading data from a stream in buffered series of bytes (say 1024 bytes at a time) and do some comparison, checking, or processing, before writing it back to the same type of stream.
Currently data comes from file. But in the future it may come from other sources (memorymapped file, TCP etc)
Is there a design patte... |
Analyzed one web-server.
for the http request I got: apache 2.2... what redirects to https, and
for https got apache-coyote 1.1.
and the server runs XWiki java app.
Trying to understand how it is implemented. After googling an hour trying to find any simple page what explaining java technologies for a java dumb perso... |
I maintain a relatively popular github repo.
When a pull request is good to merge I usually ask the author to rebase it to a single commit before I merge it (especially when there have been multiple small edits).
Is this good git practice?
Is this acceptable/standard GitHub etiquette?
So some benefits:
I get a nice cl... |
Specifically asking about the default constructor
Given that the constructor initializes all the data for an object, if I create a class that can't be used without proper initialization, is it not the case that the default constructor is useless? Consider:
// A class for handling lines in a CSV file
class CSV_Entry {
... |
I've been writing a small C application that operates on files, and I've found that I have been copy+pasting this code around my functions:
char fullpath[PATH_MAX];
fullpath[0] = '\0';
strcat(fullpath, BASE_PATH);
strcat(fullpath, subdir);
strcat(fullpath, "/");
strcat(fullpath, filename);
// do something with fullpat... |
How to ignore bracketing styles when doing code comparisons or diffs? We have several formats of bracketing and I would like:
function foo(){
}
to be considered the same as
function foo()
{
}
Right now I use Araxis merge which does a direct line-by-line comparison and we are getting a lot of "false positive" changes.... |
I am playing with dependency injection, but i am not sure I am doing it right.
Especially, I am not sure what should be the correct way to build classes with injected dependencies.
Say I have a class A that creates class B. Class B depends on class C and class C depends on class D. Who should be responsible for creatin... |
We are experimenting with "Github Flow", as defined here.
In short, every change starts off as a well-named branch off of master. When it's done, you open a PR for that branch, it gets reviewed, and then gets merged into master. It's a very simple workflow.
However, we have run into this a couple of times: I develop fe... |
If you are trying to hide implementation, would declaring STL variables be too revealing?
// in Word_Bucket.h
class Word_Bucket {
private:
std::vector<std::string> contents;
...etc
}
... but then if you wrap it up, to hide the implementation, won't you have to reveal it in the wrapper's interface anyway?
//... |
This is a follow up question to the following post: Injecting dependencies (DI) in c++ applications
In a system that uses DI, someone, somewhere should be responsible to create the various objects and "wire" them. I find it difficult to figure out who should do this. I read about one option that it should be the "root ... |
I'm a coop (in college but I work 3 months, then do classes for 3 months, work again for 3 months, etc until I graduate) at a company in their IT department. My job usually has to do with writing software but we are not a software company and much of the software that is is written in India. This work term (3 months) I... |
Dependencies are services required by an object to perform its responsibilities. In OOP context it can be thought as a parameter in a constructor.
In my experience I've never found a case for a valid cyclic A <--> B dependency. Every time I find this it turns out to be one of two cases:
A and B should actually be a si... |
I have a system in place where a Cache is made up of many Cache Nodes. When one is added, a CacheNodeAdded event is raised by the Cache. The Cache has a redundant set of Monitors listening for this event. Monitors are responsible for notifying on Cache events.
Since I have multiple Monitors, but only want to be not... |
There exists a general OOP principle that methods should return local variables rather than set object fields.
For instance, say I have the following piece of code (example in Java):
public class Number {
public int myNum;
}
public class Horrible {
public static void areYouSerious(Number num){
num.myNu... |
Disclaimer: I think the rules are almost the same in most OO languages, but since I'm most familiar with C# I'll be relating to this specific language.
I think that the use of attributes and reflection could be largely reduced if static members would apply the same principles as OO instances.
Static properties and meth... |
I want to illustrated my question by way of a (hopefully) representative example.
Lets say I have a situation where I am developing a class library in C# to be used in some simulations. I want to define the planets (Earth, Mars, Saturn, etc.) and have each of them have some properties and methods that are common in ... |
I'm currently designing a somewhat large program that will involve the simulation of math/physics models and collection of data (I have not implemented any code yet). One of the main problems I'm facing is how to pass data around easily without having to have multiple copies of data (that may potentially be outdated an... |
I am trying to implement an algorithm for finding the zero crossing (check that the signs of all the entries around the entry of interest are not the same) in a two dimensional matrix, as part of implementing the Laplacian of Gaussian edge detection filter for a class,
I understand everything up to step 3 of page 25 of... |
I have an XHTML document that defines several text entities in its internal DTD. I want these entities to be available in other XHTML documents without having to cut and paste the internal DTD everywhere.
The answer that seems to keep coming up for other XML files (not specifically XHTML) -- for example, here: https://... |
If I work for a company and write code for them but I choose to buy a tool for myself and use it to write code for the company, do I need a commercial or personal license?
Specifically, in this case, I am asking about WebStorm IDE
JetBrains have Commercial (For companies and organizations) and Personal (For individual ... |
I'm working on some software at them moment and I'm not sure which route to take with this. I have some data to store somewhere on a mobile device. The data will never change, and has a hierarchical relationship, and will be used to populate the display. There is a reasonably amount of this data.
I have the following o... |
I've been reading Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin. One point he makes:
G34 Functions should descend only one level of abstraction
However, I'm wondering about the functions that actually create the objects for an application. Say we have dependencies
App -> Book -> Database
... |
I can see two ways to fill an empty file with data:
$ run_program arg1 > data_file
or, specifically write code that manages a file and write to it? ie. a file stream?
Which is better to implement?
|
I'am planning my website over here based on MVC.
And I am thinking about a webservice (who knows, maybe one day I'll create an android app or something).
The site and the webservice will behave diferently from each other.
So what should I do? Write different controllers for each... or stuff IFs all over the place?
For ... |
for a list of files, coming from a list like from a file dialog is it better to store the list as a list of strings or should I convert each file to opened Streams stored in a List?
For example
List<string> files = new List<string>();
List<FileStream> fileStreams = new List<FileStream>();
fore... |
A little confused with the notion of stateful/stateless architectures. Forgive me if I'm unclear.
Questions: Can we consider a clients interaction with a web server to be stateful if the web server maintains state via session variables or cookies? What if we assume that any change to this information comes from the cli... |
Lets focus on a domain object that is related to more other (different!) entities. Sometimes we need one relation and sometimes the other. Let's be agile and say: we don't know in a front how many other relations there will be.
In other words: we have object A that is related one-to-one to B and one-to-many to C and ag... |
I am developing an app that will use the Twitter and Facebook login APIs exclusively.
Suppose a new user downloads the apps and is presented with the option to log in through Facebook or Twitter. The user chooses Facebook.
I think the procedure at this point is to
a) create an auto-generated user ID in my Users table
... |
I've got some code I use to take regular screenshots of my screen - it's useful to work out how much of any given day I'm spending on various activities. It looks like this:
/**
* Code modified from code given in
* http://whileonefork.blogspot.co.uk/2011/02/java-multi-monitor-screenshots.html following a SE
* quest... |
class Vector {
public:
Vector(int s) :elem{new double[s]}, sz{s} { }
double& operator[](int i) { return elem[i]; } //function 2
int size() { return sz; }
private:
double∗ elem;
int sz;
};
Code snippet from : the c++... |
I'm trying to design a web app with ability to scale but can't wrap my heads around few concepts. I want to design it right but im not a experienced programmer, i have more of a system engineering background.
Basic architecture look like this:
Web Server -> File processing server -> NoSQL DB -> Search server
So the mai... |
It's very common to see Javascript bound to certain selectors to find elements, store data, and listen for events. It's also common to see these same selectors used for styling.
jQuery (and its selector engine Sizzle) support and promote this by referencing elements with CSS-type syntax. As such, this technique is part... |
(Upfront, I'm not a test or agile expert, just trying to push us to be better. If I'm wrong on anything I'd love your guy's opinions).
So I've been pushing for us to become a real agile shop and less of a "calling ad-hoc agile" shop. So I'm iteratively trying to improve our process. I've found that its been good to slo... |
When I create PHP projects, is it better to put all database (e.g. MySql) queries in a single file (i.e. "queries.php")? Or is it better to place the respective queries in any "model" classes (i.e. User.php) that I may be creating? Is it bad practice to put database queries anywhere in any PHP file?
In the queries.php ... |
First, here are a couple of related, but not-quite-the-same questions:
Should I include dependencies for which I have the source as projects in my solution?
https://softwareengineering.stackexchange.com/questions/35052
Now on to my particular question:
I'm building a small JavaScript library. If run within certain ol... |
So I'm trying to push for more automated testing in my company, which focus a lot on prototype and proof of concept systems.
We currently use Google Test for unit testing. This tests specific test cases for correctness, but a lot of the stuff we do the metrics for how the code is performing follow more of a "does it w... |
In this database I have "accesses" - each access can have any number (usually less than 4, sometimes as many as 15) attributes. I also have "tickets" where N users are requesting M accesses, so I've got a sub-ticket table with the NxM "user access requests". Then for the sub-ticket, there is another table with the A at... |
I’m doing a thought experiment about making a product on top of Linux. I’m wondering: If you make a custom window manager (akin to KDE, for example) on top of X and you release it, do you have to release it under the GPL (Linux) or MIT (X.org)? Or can you keep it closed source?
|
I'm not too experienced in the regard of configuring IIS/ASP.net. A client has asked me to extend the functionality of a custom web application I didn't develop. Unfortunately, they don't have the original Visual Studio project/source code. I'm trying to pull the application off of their production IIS server and confi... |
Can a webservice be written in such a way that it can be called via just a browser url?
For eg. if the webservice is called GetStockQuote, then it should be callable by the following url on the browser
http://myserver.com/WebServices/GetStockQuote?sym=MSFT
Likewise, if there are more params, they can be passed via the... |
How to distribute, one virtual token to each person in this world, and make sure nobody gets more than one?
In other words, how to prevent a user from creating more than one user account in a site?
What's this problem called? Is there any specific name to this problem? What are the solutions? Thanks.
|
In a program I am writing, I have 3 different ways to store user generated data:
(a) XML Files for each object (.Net Serialization)
(b) SQL Database (MSSQL)
(c) Massive terrifying blob of data in 1 file (I'm against this one)
There is absolutely no theoretical difference in performance or file size in this (hypothetic... |
We internally use GitHub Enterprise and Jenkins. If I push on the main repository it is automatically build without and the Commit is marked as correct (just as Travis does this).
However, I want to be able to fork a repository and let the Jenkins build run. Is it possible to say Jenkins that he also runs any fork of t... |
In his talk TDD, where did it all go wrong, Ian Cooper pushes Kent Beck's original intention behind unit testing in TDD (to test behaviours, not methods of classes specifically) and argues for avoiding coupling the tests to the implementation.
In the case of behaviour like save X to some data source in a system with a ... |
In Android source code, we see files like MODULE_LICENSE_APACHE2, MODULE_LICENSE_BSD_LIKE, MODULE_LICENSE_W3C. An outside observer would think that these specify the intended license that applies to the source code tree where this file resides.
Take the JSON module, for instance. It has an empty file MODULE_LICENSE_BSD... |
I am considering the creation of a fork to a small project licensed under GPLv2, and I have some very specific questions I did not manage to answer in my research on various sites and forums.
When I fork the code, I am forced to release the new project under the same license (GPL) as I will do, but could I also decide ... |
I always separate the user interface from other functionality in my programs - its the way I have been taught, and it has obvious advantages since you can change the interface but keep the same functionality.
However, I've come across some programmers who strictly separate data, algorithms and interface. So the data o... |
I'm working on an ASP.NET Webforms project, using the MVP Pattern (which the presenters as you may know use a Page Controller pattern). I'm given a rather complex inheritance chain for my controllers. Below I depict a small example of the structure I'm facing (it is way bigger structure in my app):
A lot of code among... |
In Java, the Swing library implements the Observer/Subscriber-Publisher design pattern to design the way the program responds to events on the GUI (button clicks, etc).
The programmer registers ActionListener objects (the observers) to a GUI element (the subject/observable/publisher), and these objects get notified by ... |
I have the following class with the following members:
public class RegistrationPresenter : EPiPresenter<IRegistrationView, LoginPage>, IDisposable
{
private readonly static string[] DefaultUserRoles = { AppRoles.RegisteredRole, AppRoles.EveryoneRole, AppRoles.ManagerUserRole };
private readonly INavigator nav... |
I am writing a C++ library (but prefer C style interface functions) and one of the function returns array of floats. I am not sure if I should pass pointer or fixed array to get this data?
// in the library header file
#define MAX_ITEMS_SIZE 1000
int getData(float * data, int &size );
or
int getData(float (&data)[M... |
I am making a game and have been following examples which use the MVC architecture pattern. I am now trying to get my head around how this would fit in with a 3-tier architecture. From what I have gathered so far:
MVC and 3-tier are separate ideas and are compatible
MVC has a triangular communication structure, wherea... |
I have 3 classes: a JButton extension, FButton; a JTextField; and a JPanel extension, FPanel, that would contain one instance of both.
The FButton is supposed to open a file, and make the file name and directory for the file available.
The JTextField is meant to display the file name and directory provided by FButton.
... |
Assume a simple SPA (Single-page application), maybe a dashboard and these basic conditions:
The Model contains methods for accessing and displaying data;
The View contains methods to load templates and apply model.data to template;
The Controller manages the user commands;
The Router handles the navigation;
In ou... |
A question similar to this has been asked before, and will be asked again I am sure.
I have spent some time googling and trying to work this out for myself, but I am at an impasse.
What I am trying to achieve is to implement a database search screen for an application I have been tasked with creating.
What I am doing ... |
It seems to me that the Boolean class is an ideal candidate to be implemented as an enum.
Looking at the source code, most of the class is static methods which could be moved unchanged to an enum, the rest become much simpler as an enum. Compare original (comments and static methods removed):
public final class Bo... |
I am building a pair of components that communicates in a one-way fashion:
[ JButton ] --> data...process...process...out --> [ JTextField ]
The JButton allows the user to select a file and the JButton's ActionListener picks up the click and pulls out the file name and directory. I then need that information to be di... |
Consider the following situation:
One hardware device, two applications (1 C# application, 1 Firmware).
The C# application sends frames to the firmware and the firmware executes scripts.
C# -> transmit frame[x]
FW -> receive frame[x]
FW -> execute script relating to frame[x]
FW -> before finished, a FW event is trig... |
I have very little experience working in a big project. But I did work about 3 months in a small outsourcer (a company that do the coding for a bigger foreigner web development company).
This is what I saw. The foreigner company did all the user analysis & all database designs. Then a group of the Project managers in t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.