instruction stringlengths 34 19.9k |
|---|
Short version:
In a tree (non-binary) with many levels of children, where each node can have multiple leaves, what is the best way to tally leaves that meet a certain condition given a node?
Long, convoluted version:
Say you have Folders, which can contain more Folders. In production, my system has about 15 layers of... |
This might sound like another of those questions with "best way" or "best practice" but I couldn't find anything related that could give me some light.
The scenario... I have some ajax calls. Everything works alright. I make the calls, get the results back, change fields, values, colours. Nothing interesting here.
But ... |
In our current setup, most of our database calls are updates where we increment a key by 1.
If all one is doing is incrementing certain keys on a document (a lot) in mongodb, and there are several application servers doing so at once, does it ever make sense to somehow aggregate these increments at the application laye... |
I have a behaviour that I'd like to use in different classes. Those classes are unrelated to each other (no inheritance). I'm using AS3, where multiple inheritance is not possible.
I could use an interface but then I'd have to rewrite the same implementation every time, which is basically what I'm doing now (but withou... |
I was reading an article/interview (Language War: PHP vs. Ruby (by Jeffrey Way; Mar 2011)) by a developer for Envato using Ruby. He says, "PHP is a web framework disguised as a language."
He didn't expound on that statement, so it got me wondering if that is true, and if so how. I did a bit of research but couldn't tur... |
I'm currently doing my OCPJEA assignment.
I have to draw several sequence diagrams for the use cases presented in the documentation. One of the use cases (A) state that after some interaction, the system executes another use case (B).
I've already drawn the diagram for B, is there any way in UML2 to show inclusion, or ... |
I want to implement an in-memory datastore for a web service in Haskell. I want to run transactions in the STM monad.
When I google hash table steam Haskell I only get this: Data. BTree. HashTable. STM. The module name and complexities suggest that this is implemented as a tree. I would think that an array should be mo... |
I'm writing a library which links with modified LGPL library,so two questions:
Do I have to make my code LGPL in case of static linking with LGPL library?
in case of dynamic linking?
|
I deploy an interactive software using Java Web Start. This is a quiet useful deployment technology and I don't want to change. Besides I am about to publish my software under a GNU GPL license.
Usually, when a user installs a new software he is asked to read the license terms and accept it. Is there any equivalent pr... |
I want to make a simple game similar to the choose-your-own-adventure books. The player is presented with a narrative text and gets to choose his action from a list of possibilities. This, in turn, leads to a new narrative text, ad infinitum. The only catch is that depending on some previous decisions, the list of poss... |
I have some experience in building PHP based websites with MySQL access, storing encrypted user details, but all other fields being plain text. My most recent project will require sensitive data to be stored in the database. All of which I'm hosting myself.
I want to set up a system where a user can access his own entr... |
I'm using a BSD-2 Licence code in my project and with author permission, I modify the code. Now, I am using this code in my project. I know, I should mention Author's name and copyright information. Should, I mention What I modify in this code??
|
My software composed of an EXE and dependent class library dlls, built on Windows using visual studio C# Compiler.
I've been able to run it directly on Mac OS X using mono myApp.exe without rebuilding.
Now, for the deployment, I've successfully made mono bundle using mkbundle with --deps option for all dependent class ... |
We "use" JIRA as our ticketing system, but "use" is a real stretch. We have no standards, no templates, no "best practices" documentation for writing a proper JIRA ticket. So I'm spearheading the movement to create such a doc.
It's bad. Real bad. Sometimes, the reporter just copies-n-pastes a stacktrace and submits the... |
This is how I roll with git:
I clone/fork something locally
I create a new branch devel. This is supposed to be a quickfix branch. It is also supposed to be parent to all branches.
I create a topic branch (say make a new theme lex)
I actually create a few more child-topic-branches (say lex.th2) to test/see different ... |
I am writing a RESTful service in Java, of course it's typical HTTP based interface.
I am wondering should the service provide Java interface which has same semantic to the RESTful interface? I think Java interface will ease other Java code to call the service. (Client Java code doesn't need to use HTTP client to trigg... |
I'm trying to document a piece of software I wrote in detail. An SAS is too high level and doesn't cover the API. I found several examples of an SDS online, but I don't see a trend in their format.
I'm wondering if there are some general guidelines to writing a Software Design Specification or what the best approach is... |
From what I've seen of Prolog, it seems as if it would be ideal for crafting a rule engine for an app. Yet, I don't believe I've ever seen a rule engine written in Prolog. Is there some inherent limitation in Prolog (e. g. poor garbage collection algorithm) that would prevent it from being used to build a rule engine... |
Is there any advantage / is it a bad practice in Java to do the below
x = x = 5
I saw it in one of my peers code and I was surprised why he would do double assignment?
Is this something that is same as x = 5 or if x = x= 5 makes a difference?
|
Sample situation: A team of Java developers starts an iOS project. Only one developer has Objective-C/iOS knowledge, and in the beginning he will work on this project alone.
How we can perform code reviews in this situation? What are processes, approaches, tools that this developer will use?
|
I have been programming for a while, and the edge that I am missing over other programming is algorithms. I know what is linked-list and binary tree, but I dont know many more of them.
I failed on 2 interviews, because of exercises that demanded me to know some data structures algorithms. I am also starting to build a ... |
I want to draw a UML diagram of my program. Class Barney has a method Yabadaba(Doo d) which takes a parameter of type Doo.
How do I represent that class Doo is used in class Barney in my UML diagram?
|
The third party login is excellent function that has come in recent years that relieves the load on a programmers mind so that I have to remember less useless passwords.
I don't use the same password for many sites, I use an algorithm: for instance if I make a password for StackOverflow its name starts with S so I'll ... |
Given a project architecture as follows, where each box represents an assembly (all are class libraries), and each arrow stands for a dependency:
Might be worth nothing that this project is massive (well, it will become!), the complexity incurred by such decoupling is absolutely warranted.
Business Logic Layer
The BLL... |
One of the fundamental ways of handling user login authentication & session management is by storing variables in Session space plus setting some data in cookies on client computer while sometimes in database as well.
I have been using this simpler technique in many of my academic as well as a few online projects. But ... |
I am trying to develop a selenium application (using c# win forms). So, while the application starts, the users will enter an app name in the text box. I have many fields such as cost, validity etc corresponding to each app.
Example webpage:
description appname cost validity xyzattribute
---------------------------... |
We have some problems figuring out how to mock complex data and operations on it.
First the problems with generating complex data:
In one of our components we have really complex data structures where the logic of our classes is executed. Unfortunate there are some bugs, where it is necessary to use a big data model to... |
I checked all the relevant question's of my query and their answer's but my questions aren't exactly listed anywhere.
Basically i have just one year of web development experience using joomla , HTML , PHP etc.I have had .NET Training during my academics and now i have a requirement for a professional type .NET web appl... |
Compared to other serialization languages, one of the main criticisms directed at XML is its verbosity; JSON's more terse and readable for most cases, but not all.
But it seems to me that we could cut a lot of the excess from XML simply by stripping away the names from the closing tags. With proper indentation readabil... |
We maintain an API that as part of its purpose makes a call to an external API. This external API takes a few seconds to fulfil the request we make to it. With our current architecture the request is made synchronously, meaning that the http response we return to the user request is blocked until our service get the re... |
I've got a little problem in choosing the best design.
I have some (5 at the moment) image processing operations in my coe (Java). Every processing step independent from the other ones and consoists of a small amount of code, 5-15 lines in general. These are mostly wrappers to JAI, AWT and so on.
My current design is a... |
I have an android app idea, I want to make the app along with a few batch-mates in my collage.
(1) How do I make sure that these guys will not compromise the intellectual properties involved? In the sense that they will not leak out confidential information, new theories, new ideas, new features descriptions either fr... |
When writing boolean expressions out, you often have to use something of the type:
A == any of B1, ..., Bn
C < all of D1, ..., Dm
But in code you have to use expanded forms:
A == B1 or ... or A == Bn
C < D1 and ... and C < Dm
That looks, to me, like any of and all of are simply the distributed form of or and and. Tha... |
When a software project wants to use Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License that denies making derivatives, does it conflict GitHub terms of service clause F.1 that says:
By setting your repositories to be viewed publicly, you agree to allow others to view and fork your repositories.
... |
I've worked with Cinder previously under Windows, but have recently switched to Ubuntu. Since Cinder doesn't work on Linux (::sadface::) I've began looking for alternatives. With that in mind, could you please tell me what the differences between Processing, openFrameworks and Polycode are, and compare them to Cinder?
... |
I wrote a number of NodeJS modules (some of which are actually good, in my modest opinion). I basically forgot to set a license for them.
I would like to pick the AGPL (Affero GPL).
How do I do that? Can I just get away with a LICENSE file in the project? Or do I need a license disclaimer in every single file in the pr... |
I'm considering taking an old PHP4 web application and re-writing it using ASP.Net MVC4 in C#.
The old application was licensed under GPL2.
I'm unsure how this affects my new application, if at all. I obviously can't directly copy any of the code from the old PHP application to my .Net application as the two languages... |
I am confused about using licensed open source control in my comercial iOS application. Do I have to include any license in my code or i can just add open source control and push app to app store?
For example have look on following
https://www.cocoacontrols.com/controls/klnoteviewcontroller
It has two lincenses. I can... |
I have a legacy Java webapp ( Spring 3.1 MVC, legacy servlest and JSPs ) I have modified to log the user out after s/he clicks an external link to leave the web site.
The last screen(s) s/he was on are getting cached in the browser, enabling them to see some data by hitting their back button.
I could put no-cache heade... |
I would like to know if this is a good practice to store variables and classes names in database to use let users accessing them.
For instance users may create entries in database's table in which they can insert a program's function name that would executed when the program will read it.
I find it is a dangerous pract... |
I'm currently an intern at a government contractor and am getting the (obnoxiously unavoidable) feeling that Word is the de-facto standard in the software development process.
Its binary format makes it very difficult to collaborate on documents in the way I am used to collaborating on a code base. The use of plain te... |
I am trying to implement basic cons, car and cdr of SCHEME in C. I have made a simple program that allows me to cons two integers as shown in the main program. However, I want my program to be able to cons a 'consed object' with a digit as well as cons a 'consed object' with another 'consed object' as shows below:
(co... |
How do I go about designing this particular application example below?
For example:
I have client, who would like to embed my data feed into this GUI interface. The data is made of names and and descriptions fields. If a user comes along and searches a particular name of a products using the client's interface, then t... |
Another question over on SO introduced me to Oxygene, formerly Chrome before the browser of the same name came to prominence. It's in the Pascal syntax family, but brings in a lot of object-oriented grammar and elements from the C family, notably Java/C#. One of its big advertised strengths is that the language is impl... |
I'm slowly learning node.js and have a small project I want to start. The project will have a lot of background processes (downloading data from external sites, parsing CSV files, etc.).
A big "win" for me and node is the fact it uses JavaScript for both client and server. I code in Java and JavaScript in my day job ... |
Are modern testers like 'stupid' users which try to find a bug clicking and filling fields or they have solid knowledge about product cores?
What modern testers must be able to do?
Must they be coders creating independant/embed tests?
Must they understand source code of products and even can fix easy bugs?
Other thing... |
What is the best way to keep third-party source code up to date?
For instance in my app, I'm using third-party source code from an open GitHub repository. What I've done is that I have downloaded the zip of the source code, unpacked it and imported it in my iOS app and then started modifying this source code to my hear... |
Bitcoin relies on Proof of Work (hashing) to control the writing to a central repository (the blockchain). It also relies on a set of rules for these updates, and defines what happens if a conflict is found (longest chain wins)
Using that as an example for my question:
What are some architectural examples of differen... |
I have just learned HTML/CSS and I practice everything I read to make it more understandable to me and I really enjoy it. My goal is to be a Modern Web Developer both front and back-end, so I won't stop learning. I'm planing to jump on JavaScript now but what I would like to know is how important is math to being a Web... |
Are there any languages where something like the following might be possible?
people = [ ... a list of people ...]
Person jake = Person("Jake", 165, ...)
jake is Tall
people.add(jake)
for Person person in people where Tall:
// ... do something terrible to them
jake is not Tall // ... Jake no longer wishes to be tal... |
I'm trying to refactor (actually, rewrite) an application which currently uses only stored procedures to access the database (hundreds of SPs). My goal is to use Nhibernate and follow a good design as much as possible.
But since the database (and the SPs) are used by dozens of other apps, I can't really change the db d... |
Alright. I have this pattern to model that comes in two variations that are very much the same. I have a class which can be considered an "entry point" which will call a few manager classes depending on the user interaction. We can probably liken it to a controller class.
This class should allow the user to manage eith... |
I've been asked to develop a program with four interchangeable GUI's so that users can switch from basic to intermediate to advanced to expert mode seamlessly and at will.
I have a good understanding on how to separate the GUI from the business logic. That's taken care of.
My question is exclusively about how to organi... |
we are modelling an application using the "Service-Provider" pattern, where the service will offer a generic functionality implemented by different providers registered on the service.
The responsibility of the service will be to choose the right provider based on certain conditions.
The layers we currently have are th... |
At my job, in our core project, we have a Validation class that has been evolving with the years. And ee have an old project with an User class that uses an old version of the Valdiation class.
And we have to update some functionality that requires new validation methods. All those methods are implemented in our latest... |
Say that you work on a feature described by a single JIRA ticket and during the work, you:
Create feature-specific code like the GUI or specific use-case behavior.
Some of the code was generic so you placed this infrastructure code in a shared library.
As an example (deliberately simple), say that the ticket is about... |
I'm working in a company and in my job contract there are confidential clauses concerning code, documents, etc...
In the company we are working on an open source project (GPL V3). The project is not shared yet to the public.
Do I have the right to share the code of the project with people (out from the company)?
|
We have a class that has been properly identified for optimization. We've done the profiling and testing, and it's a problem.
Now we have two possible approaches for optimizing this class:
There is some very low-hanging fruit. We can rewrite this in a few days in such a way that the interface and results aren't change... |
I am having trouble with python. I am making a text-based adventure game, and I am trying to make a restart function when you die. I am trying to count deaths by doing deaths = deaths + 1 whenever you die, but the only way to restart is to re-run the entire script, which resets the death counter. Does anyone know how t... |
I've just started working on an existing application that uses an LDAP directory service as its object store instead of a database. Many of my coworkers have been commenting how an application should never use a directory service instead of a database as its object store. I've got to work on it regardless, and won't be... |
I am aware of the floating point errors as I had gained some knowledge with my question asked here in SE Floating Point Errors.
What I am finding it difficult to understand is, the output of the following program.
double d1 = 0 + 1.123 + 2.456;
double d2 = 3.579;
float f1 = 0f + 1.123f + 2.456f... |
We are working on a new project, we are two lead developers and got on a crossroad on how to use a token to secure the communication between the server and the client.
First Suggestion: (The one time token AKA Static Token)
the client requests a primary token, by sending the username and password and the current_time ... |
Idea. To make my shareware program free in less-developed countries. Or release a free edition for these countries.
Purpose. More users, bug reports, extensions, active forum, etc. Anyway, 90% sales are in ~30 richest countries. Why not make it free in China, India, Russia...
Question. What are possible problems? I can... |
Is the new Scheme standard, R6RS which was published in 2007, backwards compatible with the older standard R5RS? If not, is there a compatibility mode in R6RS?
|
If I include an open source library in my project that is licensed under the MIT license, but contains BSD-licensed code that requires attribution (correctly attributed inside the project), is it my responsibility to attribute it again if I decide to use that library? Normally this is not a problem (I would just credi... |
I have something bother me in the understanding of polymorphism (vs role):
Note: I am using rails (but it's a general question)
I have 4 models:
User
Pro
Customer
Company
There is a polymorphic association (profileable) between Pro/Customer and User [because Pro has many more fields for the registration process than... |
Usually whenever I want to fetch an aggregate root by ID I just use some type of Repository::findByID(...) function
Whenever I started with DDD I thought factories where just a pattern to build new objects, but after meeting some aggregates needing one or two extra queries to load, I realized that Factory::objectWithID... |
Often in coding, I find it very slow and difficult to detect the root cause of a bug and sometimes I end up going to wrong point in my code. It's painful. I know that to detect the root cause of a bug is a very important skill for programmers. Does anybody have a trick or technique to suggest a good way of finding the ... |
Please note that I do not want to argue about the moral aspect of this question. I know that there are probably many different concerns.
I have been researching for a special license that could be used in a following scenario, but with no success:
Let's assume I have a software and want to release its source code, so t... |
F1 F2 F3 C1 C2 C3
------------------------------------------------
A B C 1
D E F 2
A B C 3
D E F 4
A B C 5
D E F 6
i have a table like this.
i need my table to be free from Data redundancy
like this
F1 F2 F3 C1 C2 C3
------------... |
I always wondered why git prefers hashes over revision numbers. Revision numbers are much clearer and easier to refer to (in my opinion): There is a difference between telling someone to take a look at revision 1200 or commit 92ba93e! (Just to give one example).
So, is there any reason for this design?
|
How to represent the days and hours of different tasks(design, development, testing) of a software project in a graphical way.
I tried using a Gantt chart for it, but it does not represent the hours but just days, of a particular task, in a project.
Is there any way to do this in software management, I need this to ... |
The title tells everything about my question but still let me elaborate to clarify : I know very well about the ZEND Framework but what about the Zend server?
Does it work like Apache server or anything else? What is the main difference between these two? I also know that Zend Server is a product of the Zend Company b... |
I'm designing a REST API of service and got stuck on proper way to nest resources.
Resources: partners, tickets, settings
Connections between resources:
partner has many tickets,
partner has set of settings,
Bussines logic:
you can list all partners as anonymous user,
you can add new ticket to specified partner as a... |
I have a bunch of calls to a method that may or may not need to be made depending on whether certain features are enabled or not. As such, I've wrapped these calls in if blocks checking the enabled statuses.
The arguments to the method in each of these calls use some long variable names, so I've broken them out into di... |
I need to write a map of string data to an XML document. The XML document has a specific format. An entry key determines where in the XML document the value will be written to. See below for an example (pseudo-code where appropriate);
map = {"document_id": "123"; "document_type": "type_A"}
Produces an XML file like th... |
There has been a story in the news about a man whose Paypal account was accidentally credited with $92,233,720,368,547,800.
Where does this number come from? What sort of programming bug is likely to give rise to this number?
|
Very often, when using the command line or just programming, you want to express some kind of combination that you end up using a for - which is often verbose.
for (int i = 0; i<10; ++i)
std::cout << "img_" << i << std::endl;
for f in *; do echo "$f"; done
I always wondered if there is some kind of language made ... |
Suppose you have the following:
+--------+ +------+
| Animal | | Food |
+-+------+ +----+-+
^ ^
| |
| |
+------+ +-------+
| Deer | | Grass |
+------+ +-------+
Deer inherits fro... |
Fowler talks about a number of design patterns available for the data access layer e.g. Table Data Gateway, Row Data Gateway, Active Record and Data Mapper.
In the book it suggests using Data Mapper with Transaction Script and Active Record with Domain Model. This doesn't seem to be logical to me as Transaction Script... |
I was trying to find examples for using DDD factories and I came across the shipping application from Eric Evans' book.
However when I checked the BookingService the code to create a Cargo had this comment at line 37:
34 public TrackingId bookNewCargo(final UnLocode originUnLocode,
35 ... |
I'm currently a beginning developer (3 years). I have been mainly doing Web Development for as long as I have been developing. This is my comfort zone when it comes to programming.
I like both JavaScript and PHP because they are easy to use; however, I would really like to further my knowledge when it comes to programm... |
In a general sense, for medium/big projects, what's the best way to handle javascript/ajax code?
Is it better, to have a script file where to put each script or, to add the script directly into the html file between tags?
I know it doesn't make any difference in terms of result, but i would like to understand what's ... |
There are a lot of variants of the CSV "standard" (or lack thereof). I've never personally see any that use an escape character (like \) instead of surrounding each field with double quotes. Instead of foo,bar,"foo,bar" it would be foo,bar,foo\,bar.
This would be handy for situations where a file needs to manually ins... |
I would like to extend an application using LuaJit FFI. Having seen http://luajit.org/ext_ffi_tutorial.html this is surprisingly easy when comparing this to the Lua C API. So far so good. However I do not plainly want to wrap C functions but provide a higher level API to users writing scripts for the application. Espec... |
Background
We have several webapps running on Tomcat 7.0.x (on Linux). For historical reasons, we have populated the "Common" lib (i.e. $CATALINA_HOME/lib) with many application jars. These jars include Spring, Jackson, and our own persistence-layer jars.
As we deploy new persistence-layer jars, we are embroiled in a c... |
There are some very experienced folks on Stack Overflow who always talk about the C standard. People seem to not like non-portable solutions, even if they work for me. Ok, I understand that the standard needs to be followed, but doesn't it put shackles on programmer's creativity?
What are the concrete benefits that co... |
We are having a disconnect between development and business needs.
Business is asking me to produce an accurate list of deliverables for a fixed date and development being difficult to predict is pushing back saying that can only produce a list 80 or 90% accurate.
So my question is, how do we solve this problem? How t... |
I'm thinking about a design issue which affects my project's data base. Supposing there are three diferent tables:
CLIENT
ORDER
PACKING_SLIP
Each order has its client and different packing slips. So there are some foreign keys which are compulsory, there would be clientId for the ORDER and orderId for the PACKING... |
When developing web apps you often build your app on top of some frameworks like Twitter's bootstrap. These frameworks come with less/sass/stylus, javascript, images and sometimes webfonts.
I'm wondering how to embed these frameworks in my app. Most of my apps are build using some grunt tasks that compile my coffeescr... |
I am a Java developer who is starting to pick up more and more C++/C (yes I know they're different, bear with me). One thing that struck me as odd was the different naming conventions used by these languages. In Java, is is very common to see something like this:
int someVariable = someFunction(someParameterToPass);
... |
I have been reviewing C# code that has a lot of generics (and generics with generics...) and its taking me longer to grok the code.
I know the gang of four patterns, and I know some of the fowler enterprise patterns (learning them as I go).
Are there any techniques you could suggest when tackling understanding systems... |
When I'm coding small projects, I often use System.out.println to print valuable info. It's simple, easy and gets me info. The only drawback I found is that there is no simple way to disable parts of this output for finished application, except for commenting them out, which dirties my code. So, I d like to know, is th... |
I know I should not expect a lawyer's notice here, but programmers advices would suit me well enough.
I want to publish a program which is derivated from a GPL-licensed program. I understand from the GPL legal notice that the whole work is to be licensed under GPL as well.
Now, I'd rather publish my work under a more ... |
After working Scrum(ish) in a previous workplace, I am trying to implement it in my new place of work for a brand new project (I am no scrum expert). We have some pre-requisites to code before we can begin working on the stories (which are being groomed in the mean time). Things like database design, api design, etc. W... |
As a freelancer, I come across many projects. Its almost impossible to store a backup of all of the projects on my laptop. What are some better options to store them?
|
Here is a simple code for a randomized skip-list:
Coin_Side flip()
{
if ( random() % 2 == 0 )
return HEADS;
else
return TAILS;
}
Note: random() returns an integer that uses a modulus of the form M = 2^B. Then, what is the expected performance of the skip list algorithm?
So we have: (ax mod M) m... |
I started to create a php application I'd like to make open source in the near future. However I do not know, if it's needed to follow any kind of code/documentation convention, to make it more usable and acceptable when released.
Is there any model, to follow, to develop a good open source application?
Do you think it... |
I am specifically interested in SQL Server, but the same question applies in general. When creating a new application, the way I see it, there are two options:
Create a table called "Users" and store the user name, password, etc. Set up one database user called "application" (and possibly more users for various comp... |
For the GUI of a program, I want it to list several items, all of which are, from a programming side, just subclasses. They can add one of these items to a list. I don't want to hard-code which subclasses there are. What would be the best way to allow the GUI to know about the subclasses, only having the base class to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.