instruction stringlengths 34 19.9k |
|---|
Whilst I have good experience with OOP, I'm fairly new to the concept of (H)MVC. I understand the basic concept of modular design that comes with HMVC, it's the great attraction of it. But one thing that has been bugging me, and will hopefully help me understand HMVC better is how do you handle the database connection?... |
I have multiple regexes matching an input in greedy-first mode. All regexes are already compiled and I don't see what I can do more to speed-up things. I mean using tools coming with .Net framework.
Since I don't do any replace, or capturing, I wonder if it makes sense to built my own regex matching -- in result I woul... |
Some friends and me wish to develop a 2D game just for the experience of learning this paradigm. We are all software engineers with experience in business apps, but we are unsure if the typical design patterns and architectures (MVC, 3-layer, etc) apply as well, and we are totally unknown about the techniques that are ... |
I am creating an application with lots of photos. They will take > 100 mb on memory. So far I have 3 ideas:
Place it in @drawable - app will be heavy
Download by JSON and place in java array - caching - How long it can be there?
Download by JSON, place it on phone memory/SD card and read in the application from memo... |
I'm planning the creation of a webapp with a dedicated mobile web interface and a dedicated desktop/tablet interface.
I am considering ASP.NET MVC, but it is clear to me that MVC is for separation of concerns as explained here, anyway in my case i'd like to minimize the code and to support elegantly phones and desktop ... |
At a previous job (circa 2010), my manager mentioned that he's doing some research into quality metrics. The bottom line is to answer the question how many bugs should I expect? The goal is to try and predict how many bugs are incoming, and more importantly, how many bugs we probably haven't yet found.
There are some p... |
I am working on some C++ code that uses several libraries, including some C libraries, that all have different coding styles. It will be open sourced once it reaches a usable stage. Which would cause the least confusion for a short-term contributor who checks out the code to fix one bug or add one feature?
Have one ... |
I am developing a CRUD type web application. It is a project management system having projects, milestones, tasks, employees etc. Each employee has his/her own account to login and view the system. The problems come here:
If one user deletes a task while the second has it opened at the same time, the second user will ... |
I recently came across an internal project where they were using DTOs throughout the solution, and when I sat down to implement a new MVC controller with a JSON REST endpoint I decided to use an anonymous object convention instead of declaring a discrete DTO class solely for the purpose of this API endpoint.
public Jso... |
General, high-level question for people who work with code regularly.
I was repurposing some old, outdated Javascript code into a Chrome extension, and to help me understand it, I wrote some quick code to help (see below). I regularly put messages in my code such as dbmsg('Begin function loadDefaults()'); or dbmsg('Se... |
On my form I have an icon which represents whether my entity is locked (shown by a locked padlock) or unlocked (an open padlock). At the model level, this is represented by a boolean property (isLocked). The user can toggle the entity between locked and unlocked by clicking the icon. This also updates the icon tool-tip... |
TLDR: Should TIMEOUT be a public property on my static class, or a parameter to every function?
Background:
I am releasing a c# client-api library that facilitates communicating with our REST api.
The client-api consists of an object model and one large static class with a bunch of request extension methods for variou... |
I am trying to put together a way to figure out if incidents occurred based on log content. Typically, on log (or DB table) would contain a list of transactions composed as follow:
{Timestamp} {TransactionID} {Message}
As an example problem I have run into, I used this to detect if "incidents" occured by running some v... |
By loop constructs I mean for… and while… constructs with nested statements.
Currently I am coding a tool in Python and decided out of curiosity not to use the regular loops - and rely on filter/map/reduce instead. E.g. now I have code like:
fields = filter(None, map(parse_field, struct_decl.get_children()))
So far it... |
I will have international users use my database, but I don't know how the mailing system operates outside of the US.
Are the concepts "City", "State, Country and possibly "Zip" sufficient to capture any hierarchy (even if it was only 2 levels deep: (city/country)
|
How do certain services, just like google plus and facebook, check for new content without reloading the page? Whenever you are on any of those websites a new notification of a post related content just pops up without the need to refresh the page. Can someone give me some tips on how this works? :)
|
Should user permission checks take place in the model or the controller? And who should handle the permission checks, the User object or some UserManagement helper?
Where should it happen?
Checking in the Controller:
class MyController {
void performSomeAction() {
if (user.hasRightPermissions()) {
model.som... |
I'm curious about how to test reports that seem rather straightforward. I'm supposed to create test cases for an Oracle report(XML Publisher/BI Publisher). So for example, a report is supposed to just return columns(say , 10 columns).
Here is what I thought of so far:
Validate that the report returns accurate output... |
I know so little about this that I'm having trouble formulating the question.
Apparently due to technical limitations, nastaleeq style of writing Urdu is very difficult, perhaps impossible, given current standards used on the web. I'd like to do a deep dive into why this is so (the technical aspects, at least).
My, ver... |
We are using PHP (a dynamically-typed language) in our project. However, I have found my colleagues asking questions such as https://stackoverflow.com/questions/20438322/modeling-a-binary-relationship-between-two-types.
I’m feeling like we have a paranoia that we are going to get unexpected errors (E.G. if you look at ... |
I started working on a new project lately related to Big Data for my internship.
My managers recommended to start learning functional programming (They highly recommended Scala).
I had a humbled experience using F#, but I couldn't see the the important of using this paradigm of programming as it's expensive in some c... |
I'm hunting a metric to measure the cost of cut-and-paste programming. We already use tools to detect duplicated code - but if we don't clean up our duplicated code, how much will it cost us?
We know that the DRY principle, Don't Repeat Yourself, is a core principle of Extreme Programming. How can we actually measure ... |
I understand the concept and can use both the Factory Pattern and Dependency Injection, however they seem a little at odds with each other conceptually. Is it a case of using one over the other? Or can they be used in conjunction with each other?
If using DI would you hard code the creation of classes within a Factory?... |
This is one of my assignment for this semester. And just to be clear, this question is not about the answer to my assignment as I have already finished it, it is more about the sanity of the question
I am confused because as I know from the textbook, ATAM is a software architecture evaluation process which has multiple... |
I started learning functional programming, I am trying to compare between different algorithms that are written in an imperative, functional , parallel programming and using Collections and Lambda expressions.
In order to make my question clear and avoid sharing long algorithms that I am working on. I will take as an e... |
I normally construct my search tree by following the common convention:
Place Queries or Goals in need of unification inside node boxes.
Write down decision points on the edges, where Prolog has assigned an element to a variable.
Leaf nodes which are fully satisifed will be an empty box, they represent a solution.
Lea... |
What's the OO principle that states (in sum):
A base object should have no knowledge of its subtypes.
I thought it was Liskov Substitution but after reading that wikipedia article I don't believe I'm correct. Thanks in advance!
|
I have a small responsibility separation issue that I hope someone can clarify. I have a small model composed by 2 classes: GameBoard and GamePiece, and the obvious relationship is that a GameBoard can have several GamePieces.
In the application I'm implementing, GameBoard and GamePiece contain data related to renderin... |
I recently purchased a product (a website template, licensed by GNU GPL 2.0). My product, which is a web software, coded in PHP, uses that web template as its appearance.
The question is: How can I sell a software which includes some parts of a GNU GPL 2.0 commercial website template? Do I have to pay a license for the... |
Why does Mono for Android cost money if the mono project is opensource and therefore everything based on it must be opensource?
|
I was reading Cohen–Sutherland algorithm on Wikipedia and I am confused in these two parts,
int ComputeOutCode(double x, double y) {
...
if (x < xmin) code |= LEFT;
else if (x > xmax) code |= RIGHT;
if (y < ymin) code |= BOTTOM;
else if (y > ymax) code |= TOP;
...
}
and
if (outco... |
I have just realized something disturbing. Every time I have written a method that accepts a std::string as a paramater, I have opened up myself to undefined behaviour.
For example, this...
void myMethod(const std::string& s) {
/* Do something with s. */
}
...can be called like this...
char* s = 0;
myMethod(s);
... |
I am doing a Windows C# application.
I asked this question and I was told that the viewer/presenter should never know anything about the model. Does this mean that I should not add a reference of my model to the GUI I am making and instead of, lets say List<Car> I should transport the information using only strings and... |
I am working on a project in which we have a desktop application that should be able to receive commands from a web application. To solve this issue, using sockets seems like a good approach (instead of long polling and various other techniques).
The desktop application also uses a web API, and this is secured with mut... |
After adopting Agile for a while now, we started to think that we can improve how we do Agile. But for starter, we need to know how well are we doing now and to identify the problems in our current processes before we can improve it.
One thing we notice is that every team do Agile a little different from another. A rit... |
Since user threads are mapped to kernel threads, why don't we create all threads as kernel threads that is a process with zero user thread. Doesn't mapping of user thread to kernel thread create overhead?
|
I am a somewhat defensive programmer and a big fan of Microsofts Code Contracts.
Now I cannot always use C# and in most languages the only tool I have is assertions. So I usually end up with code like this:
class
{
function()
{
checkInvariants();
assert(/* requirement */);
... |
Haskell has a notion of “generic functions” that has some apparent similarity with common lisp—having neither experience with Haskell nor with common lisp, I might be very approximative here. This means that one can define a generic to_string facility to define a string representation for all types. Of course, the fac... |
A Scrum team has been forced together and is feeling very uncomfortable. They are constantly saying that it is not working for them and that they are fed up with hearing the words Agile and Scrum. They are feeling that the business if simply forcing a new buzz word on them.
They don't have any Agile experiance before... |
I am thinking about using a GPL Bison grammar for my own compiler.
Will the grammar "infect" my parser such that it needs to be open source?
The grammar - in terms of - the input of bison is GPL.
|
I already searched the site, but I could only find answers relating to using GPL libraries in software that people were going to sell/distribute. In this case the answer is that they must also make the source code available.
What about SaaS? That is, I'll be building an app that clients will pay a monthly fee to use o... |
(note I'm putting the question here because it's about the conceptual mechanics of it, rather than a coding problem)
I was working on a small program, that was using a sequence of fibonacci numbers in its equasion, but I noticed that if I got over a certain number it got painfully slow, googling around a bit I stumbled... |
Is there a name for including a limitation in a loop structure to prevent it from running if its primary condition becomes unwieldy.
For example
for (var i = 0; i < len; i++){
some_function();
}
but if len is somewhere set to ten million, I don't want to run it, so I would do something like:
for (var i = 0; i < l... |
I'm trying to think of fine way to store historical data for my web application. The application has users that add photos, comment and grade them. All this is stored in relational database.
The users also have ability to delete own photos (and thus comments/grades) and own account.
I want to store those deleted entiti... |
What behaviour should be preferred for widget initialization:
1) Required HTML is generated by widget itself:
Layout:
<div id="my-widget"/>
Initialization:
$('#my-widget').myWidget(); // Creates HTML
2) Required HTML is placed to the page by user:
<div id="my-widget">
<div class="foo"/>
<div class="bar"/>
</div>
... |
I was trying to understand the difference between Open Closed Principle (OCP) and Dependency Inversion Princible (DIP).
Based on research I've made on the internet so far, I came to the conclusion that 'DIP is one option through which we can achieve OCP'.
I'm I right on this?
Can you give me an example which doesn't ... |
In other words, is DRY (don't repeat yourself) applied at a class level a subset of SRP (single responsibilty principle)?
What I mean is that while SRP states that each class should have only a single responsibility ( ie. class should only have one reason to change ), is it the application of DRY at class level that p... |
We are trying out mandatory code review on each commit -- nothing gets into master that hasn't been validated by at least 1 person not the author -- for a couple of sprints. We have buy in from both developers and management (which is an amazing situation to be in) and we want to get some of the benefits that it is kno... |
Every click event on the web works on mouse click and release. Is there a way to do a action on a click event before mouse release??
|
I'm in a situation with my company where this may be an important distinction.
Is there any distinction between "source code" and "source files" in a technical context?
Is there any distinction between "source code" and "source files" in a legal context?
Thanks.
Edit: I saw some close votes on this. I want to note that... |
I hope you bear with me here. It's difficult to explain this problem, especially so without direct reference to the specific domain.
I work on a component of a larger system which performs computationally expensive pre-processing in order that the "real-time" component can perform it's functions quickly. My product eff... |
I've noticed that even when a websites front end is coded in HTML 5 as evidenced by the <!DOCTYPE html>, people rarely seem to use the new HTML 5 <section>, <header> and <footer> tags.
Is it because people don't understand that you're supposed to use reusable classes for styling things within a <section> instead of t... |
Are there any software licenses that automate the reassignment of ownership?
For instance, in a usual circumstance, you have a license, and then you make all contributors sign off that by contributing they reassign ownership to the project owner.
In the sort of license I'm looking for, by just editing and redistributin... |
Context: I am developing a web application using webapp2 web-framework with python to be hosted on GAE.
The web application (web-app from now on), is a chess variant. Being a first timer, I have definitely made a lot of design blunders. One of them, is what this question is regarding to, I will come to it in a short w... |
Long story short, I have a social networking site I wrote a while back as a "proof of concept" to myself that I had the skills to do it. I decided to revisit it, and "improve" a lot of the bad coding practices I had when I first wrote the thing (3 years ago).
My current situation
Users can create posts. When posting... |
I have heard that my C++ programs "need to link with the C++ library/runtime". However, the C++ runtime is just the compiler inserting stack operation code in to the image, or "boilerplate" code if you will. The C++ runtime is basically intrinsic to the program itself, so "linking the runtime" is a bit illogical. Linki... |
I've written a program for another group within my company that uses scripts. These scripts are user selected by the use of two drop down lists: category and name. Currently the application uses an XML file that is on a network share to populate the drop down lists with the scripts and their associated categories and... |
A lot of languages like Java and C# have garbage collectors that free memory when that memory no longer has any reference. Yet they don't immediately free it after the reference counter hits zero but instead every once in a while they check on all the memory to see if that memory has any reference and delete it if it d... |
I do a lot of flat-file processing to extract data. The file "formats" are very unique and each file format requires a lot of format-specific code. Sometimes, the parsing code needs to maintain a lot of state while the file is being read. I've used something like this "pattern" at times:
parser = New FileTypeAParser(fi... |
I read on a similar forum https://stackoverflow.com/questions/8117530/examples-for-acceptance-criteria-for-a-user-story about putting in the acceptance criteria for product backlog item.
I am working on a Scrum based project and I need more info as my backlog item is as follows -
UserProfiles ( I am using this in the ... |
I have one idea that I want to make an app for iPhone, I have recently bought a mac for the same purpose. I want to make small app and build on it in later versions. I work in in a small company and have 1 year of experience on working of iOS platform . I am a developer and don't have any design background so I want to... |
Driving instructors (at leas in Germany) often mention 100.000 km driven as a reference point where a driver is considered experienced.
Is there a similar number for programmers?
For example, how many lines of code does the average junior/senior developer have written when starting their job?
Also: after how many lines... |
I'm an apprentice and I've been on a couple of training courses in C#, I understood the concept of c# programming and covered inheritance etc, but when I've came to code for my coursework "I've got to make a shopping basket and save the contents into a .txt" I just seems to not know what to do, as if I've got no idea h... |
I am designing an application where users message one another privately, and may send messages to any Entity in the database (an Entity may not have a user account yet, it is a professional database). I am not sure how to best design the database and the API to allow messaging unregistered users. The application should... |
var Id = from value in Enumerable.Range(0, 100)
select value;
IEnumerable<int> ids = from value in Enumerable.Range(0, 100)
select value;
foreach (var v in Id)
{
Console.WriteLine(v.ToString());
}
... |
I was going though this blog and it says
You can represent a list of distinct integers no larger than N using exactly N bits: if the integer i appears in your list, you set the i th bit to true. Bits for which there is no corresponding integers are set to false. For example, the integers 3, 4, 7 can be represented as ... |
if(condition1)
{
Statement1A;
Statement1B;
}
else if(condition2)
{
Statement2;
}
else if(condition3)
{
Statement3;
}
else
{
Statement1A;
Statement1B;
}
return;
I would like to refactor that code so that I do not duplicate Statements. I always need to check condition1 before any other condition. (S... |
The use of source control management tools is nowadays a standard
practice in the software industry. Furthermore, it seems that there
is quite a strong consensus (for deliverables) to have an instable
branch where new features arrive and one or several stable branches
where only bugfixes are added. I am interested in... |
I have made a search on a Hong Kong job seeking website. There numerous of jobs titled "Computer Analyst". These are the requirements of the job:
Over 3 year experience relevant working experience in IBM Mainframe environment.
University degree in Computer Subject.
Proficient in system analysis, design and coding for t... |
I'm currently making some improvements for a client on a backbone.js app. The app is a web store and inventory management system. One thing that bothers me about this app (and other backbone.js apps I've encountered) is that it loads the entire collection of inventory items into memory from the server on every initial ... |
I have been working with SpringMVC, Hibernate, and some databases in a java web application example.
There are a few different ones that do this, but this Spring 3 and hibernate integration tutorial with example has a model class, view (in jsp), and a service and dao classes for the controller.
My question is, don't b... |
I'm writing code that I would like to release under the MIT License. It uses the public API of a library licensed under the BSD 3-clause license. I am not redistributing the library with the source code, and I am not providing binaries, users must install the library themselves and compile from source. Do I need to inc... |
In our app we are currently saving binary data to the database (terrible, I know; but this is legacy stuff and it wasn't my decision). We're trying to migrate this data out to an external device and I'm trying to come up with a scheme to save these files.
We have multiple tenants, I'd like to have a directory per tenan... |
is there a good pattern for how to send multiple calls to a web service but without taxing it and ensuring the data is sent back? I don't know enough to correctly describe the problem to even start googling it properly - current google results compare streaming vs. non-streaming wcf answers?
Scenario: I am working on a... |
I'm still trying to understand design patterns here, after learning the Abstract factory pattern , I realised that this pattern will not scale well. Take a look at the uml diagram of the abstract factory pattern
If I have to create a new 'AbstractProductC', I will have to add an abstract method 'CreateProductC' in 'Ab... |
So, essentially the project I wish to undertake is an SVG editor. I would prefer to use WPF because then I can leverage XAML for my application layout (that designer is so nifty). Unfortunately, I have only been using the .NET framework for just a few months, and am still unfamiliar with most of the class names.
The g... |
Say I want some parts of my software to be encrypted. For example, the credentials for a database, etc. I need to store those values somewhere, but doing so in cleartext would make it easy for an attacker to gain unauthorised access.
However, if I encrypt some cleartext, then where do I store the key? Anything that sof... |
I'm using some codes that I modified, from Paradigms of Artificial Intelligence Programming to create another project, the project is released under GPL V2.
The License agreement is written here, it says: Copyright © 1998-2002 by Peter Norvig.
My question is: Were's almost in 2014, do I still have to include that licen... |
I'm having some problem developing a web application with various developers, each one has an specific configuration to work.
and i would like to use the less resource cosuming approach to avoid that any personal configuration goes to the repository.
the basic idea is: to have a config file with all the pairs of key/va... |
Up until now the styles were handled by a single CSS file (for each site).
I'm customizing it like this:
opened the site in Firefox
opened inspector/style editor
changed CSS values around until I was happy with how the site looks
copied the generated CSS code and pasted it in the .css file from the server
The design ... |
I have been working on a project and running into a very difficult problem.
The problem can be stated simply as how to unit-test numerical algorithms.
However if you just took this simple statement you would get the standard set of answer isolation of input, random processes, mocking, tolerancing, etc.
The answer (if ... |
One of my company product need to implement a license mechanism. I'm planing to generate a key base on users PC MAC address. But I'm bit scared is this method confuse with some advance hardware. configurations such as.
Multiple network cards.
Virtualization.
Mac address change possibilities(?)
Working with VPNs.
Is ... |
If the boolean operators &&, || are implemented as infix methods, then isn't short-circuit evaluation just a consequence of being implemented using call-by-name semantics, since, for example, the && method wouldn't then evaluate the second arg in any case if the first is false.
I'm just wondering because they are gener... |
I'm working on my own application and I'm stuck. I have to implement a feature but I can't find a good approach to implement this feature. I was thinking about it for a couple of days, and no good thoughts came. Searching the Internet didn't give me any inspiration.
I need to move on, but I want to know, what's the b... |
I have an abstract class abstract class MathFunc that is used to implement the mathematical functions Rastrigin, Griewangk and Rosenbrock in their specific classes final class Rastrigin extends MathFunc, final class Griewangk extends MathFunc and final class Rosenbrock extends MatjFunc.
This hierarchy of classes and h... |
In numerics, it is very important to be able to identify unstable
schemes and to improve their stability. How to identify unstable
floating point computations?
I am working on a very complex simulation where many numerical schemes work together and I am looking for a methodic to identify its weak parts. I am working ... |
I am developing an Hybrid android app using HTML5 which will work completely offline.
Today morning when I opened the app, I saw that all the data stored in localStorage was cleared.
Under what scenarios can the localStorage get cleared?
Given these scenarios, is it a good idea to use localStorage?
|
I am currently a high school student, I've been assigned to manage a group in my school to develop a mobile app and the problem is that all of us have no experience in making a project in a team and the greater problem is that we have only till the end of the month to submit the app.
Can I have some tips to overcome th... |
After googling for a couple hours, I came to a conclusion that all sorting algorithms are inherently sequential which can be data distributed but not task distributable.
Is there any algorithm which is not inherently sequential and is task distributable?
|
I was hoping for some advice:
I need to design a software solution for a medium-sized java / Swing application.
The application will have about 200 use cases requiring complex data validation and business logic.
Typically, this is my usual design:
Create a simple POJO for each use case, with a custom constructor and c... |
I seek your advice on SPA (Single-page application) architecture.
I'm building an SPA which edits a model. The models consists of objects which have a relation to one another. The objects (and relations) are stored in a single a collection on the server's database. The user must authenticate on server and sessions are ... |
I have inherited an application that stores data in multiple tables in Microsoft Access; the Access DB is only used for storage, all data processing is handled by the app (VB.net).
Is this good practice? I need to build a similar app from scratch and am unsure of what is 'normal' practice.
I have tried Googling the que... |
I am trying to apply DDD to the design of a Release Management system.
Domain Entities
Project: The project/product/system.
ProjectEnvironment: The environments (Test, Staging, Prod) that exist for this project. Each project has its own defined environments.
ProjectVersion: A specific version of the project. This w... |
When they ask you to choose the programming language you are comfortable with before an interview, is it to ask questions about the programming language or to check how well you code in it?
Like for example, if I don't know what iterators are in Python but I'm comfortable with Python because of its in-built facilities,... |
I installed xampp in my machine. I wonder what is the difference between apache and tomcat in the xampp control panel.
p/s: I started apache only and test with "localhost/index.html", it works.
I started tomcat only, but it doesn't work.
|
This is somewhat controversial topic, and I guess there is as many opinions as there are programmers. But for the sake of it, I want to know what are the common practices in business (or in your work places).
In my work place we have a strict coding guidelines. One section of that is dedicated to magic strings/number... |
The title says it all. Some employees in our company believe that automated tests are "easy" and that it "should take a day" to write suites of COM and UI tests. What can be done to counter this?
Note: I'm not asking about how to promote automation. That isn't the problem. Automated testing and processes are being pro... |
This is from the Hartl Rails tutorial. We are automatically logging in a user in the process of creating that user with a callback to #create_remember_token. It works great but there are some things, I am not clear on. Please bear with me as I'm thoroughly confused to the point that I don't even know how to ask my ques... |
I am a new software developer and I wish to sell my software. I recently realized that from C++ code we can not stop the user seeing parts of the code that are related to scripts or system commands.
Would you make some comments on how software written in C++/JAVA (distributed via CD-ROMs or available via download) is p... |
We have an application with Oracle backend. The DAO layer is written in C# and uses nHibernet to perform the data operations.
To unit test our DAO code, we use SQL Lite which creates the database based on our existing mapping in the project.
Some of our nHibernate queries that go to oracle use (+) for outer joins. Now... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.