instruction stringlengths 34 19.9k |
|---|
Can anybody point me to some resources about "cutting algorithm"?
The problem:
have rods with length of L meters, e.g. 6 m
need cut smaller pieces of different lengths, e.g. need:
4 x 1.2m
8 x 0,9m
etc... (many other lengths and counts)
How to determine the optimal cutting, what will produce the minimum wasted mat... |
Retaining the names inside namespace will make compiler work less stressful!?
For example:
// test.cpp
#include</*iostream,vector,string,map*/>
class vec { /* ... */ };
Take 2 scenarios of main():
// scenario-1
using namespace std; // comment this line for scenario-2
int main ()
{
vec obj;
}
For scenario-1 where u... |
I have recently being reading a web site about clean code development (I do not put a link here because it is not in English).
One of the principles advertised by this site is the Open Closed Principle: each software component should be open for extension and closed for modification. E.g., when we have implemented and ... |
I've got a great idea for an open source project. What should I do before starting, to make sure that I'm not duplicating anyone's efforts?
Of course I've googled, but which keywords to use isn't obvious. Is there a site to discuss such ideas?
To address a common answer: My goal is not to be the author of a successful ... |
After reading both this thread and the linked paper, I don't understand how FRP (functional relational programming) is different from (FP) functional programming.
Does FRP augment or replace FP? Can FRP be implemented as a library in an FP language?
|
Possible Duplicate:
Is the 80 character limit still relevant in times of widescreen monitors?
I used to set a vertical line set at 80 characters in my text editor and then I added carriage returns if the lines got too long. I later increased the value to 135 characters. I started using word wrap and not giving mys... |
If I'm making a web application which integrates with a server-side backend, would it be considered best practice to use HTTP methods semantically? That is, for example, if I'm fetching data (e.g., to populate a menu, etc.), I would use GET, but to update data (e.g., save a record), I would use POST. (I realise there a... |
I'm only going on what I've read on SO, so forgive me, but all I read says that one major advantage of Git over Subversion is that Git gives all the source code to the developer locally, not having to do anything on the server.
With my limited using of SVN and TortoiseSVN, I had all the source code, or at least I thoug... |
In Scott Chacon's workflow (explained eg in this SO answer), with essentially two silos (development, and master), if, say I have a small bug to fix (e.g. can be fixed with a few characters) is the optimal way of doing that:
a) branch off of development a branch called e.g. fix_123. Push this branch to origin as I work... |
This seems like the sort of problem that must have been solved elegantly long ago, but I haven't the foggiest how to google it and find it.
Suppose you're maintaining a large legacy system, which has a large collection of data (tens of GB) of various formats, including XML and two different internal configuration forma... |
Is the ROR used only in startups or also in bigger companies as well?
What should be the reasons of their preference of Java over ROR?
|
I recently saw this question over at math.SE. It got me thinking. Could Pi be used as a crude random number generator? I mean the results are well known(how long has pi been computed to now?) but, Pi does seem to be quite random when taken 1 digit at a time.
Does this make any sense at all?
|
I believe that if you have your repositories use an ORM that it's already enough abstracted from the database.
However, where I am working now, someone believe that we should have a layer that abstract the ORM in case that we would like to change the ORM later.
Is it really necessary or it's simply a lot of over head t... |
Ruby by default does not include the method [] for NilClass
For example, to check if foo["bar"] exists when foo may be nil, I have to do:
foo = something_that_may_or_may_not_return_nil
if foo && foo["bar"]
# do something with foo["bar"] here
end
If I define this method:
class NilClass
def [](arg)
nil
end
end... |
I use Linux and other open source software in my home. As I'm not a professional coder, I usually report bugs to developers as my skills are not enough to solve problems on my own.
What kind of things you want me to check before I send a bug report? I mean, once I thought I found a bug in Gedit and I couldn't find simi... |
I have an Item class with the following attributes:
itemId,name,weight,volume,price,required_skills,required_items.
Since the last two attributes are going to be multivalued, I removed them and create new schemes like:
itemID,required_skill (itemID is foreign key, itemID and required_skill is primary key.)
Now, I'm co... |
Is it conceptually correct to sum a vector of booleans? From a mathematical point of view, I would argue it's not: True + True != 2. But it's quite practical to do so still! Example using the vectorised Python library numpy:
In [1]: X = rand(10)
In [2]: large = X>0.6
In [3]: large.dtype
Out[3]: dtype('bool')
In [4]:... |
I was asked to build a tool that can identify if a string match a pattern.
Example:
{1:20} stuff t(x) {a,b,c}
would match:
1 stuff tx a
20 stuff t c
It is a sort of regex but with a different syntax
Parentheses indicate an optional value
{1:20} is a interval; I will have to check if the token is a number and if it... |
I have created an annotation-based validation library called regula. There seems to be some amount of interest around the framework and the next thing I'd like to do is to support HTML5 validation. Originally I figured that I would check to see if the browser supported the HTML5 validation that has been specified and t... |
Looking at the code of Joomla I see that in the first line of the index, it defines the base path of installation with dirname(__FILE__).
Is this a possible risk for the site? If a non controlled error message show the internal path of the Joomla directory, because of, for example a failed include, can it be used to pe... |
Have you had any experience in which a non-IT person works with a programmer during the coding process?
It's like pair programming, but one person is a non-IT person that knows a lot about the business, maybe a process engineer with math background who knows how things are calculated and can understand non-idiomatic, p... |
I have a big dataset (100Mbs/day) and a bunch of console a TCL/TK tools to view it - I want to turn it into a web app that I can build, and others can maintain.
In long:
my group runs simulations yielding 100s of Mbs of data daily, in multiple (mostly but not only) text forms.
We have a bunch of scripts and tools, mos... |
There are some programming languages for which exist a package management system:
CTAN for TeX
CPAN for Perl
Pip & Eggs for Python
Maven for Java
cabal for Haskell
Gems for Ruby
npm for NodeJS
bower for frontend Javascript & CSS
nuget for C#
composer for PHP
Is there any other languages with such systems? What about ... |
I am amazed by the Linux project and I would like to learn how they administrate the code, given the huge number of developers. I found the Linux repository on GitHub, but I do not understand how it is administrated. For example the following commit: https://github.com/torvalds/linux/commit/31fd84b95eb211d5db460a1dda85... |
I am in a big dilemma here.
I have a League, Team and Player entities. I have created a repo for the league only as a Team cannot exists without a League. At first I had bounded the players only with the team but then I realised I would have a problem with free agents so I also bounded the players to the league. Then I... |
Very often I see in C code negation of returned error codes, e.g. return -EINVAL instead of return EINVAL. Why used negation?
|
The various talks I have watched and tutorials I scanned on REST seem to stress something called 'discoverability'. To my limited understanding, the term seems to mean that a client should be able to go to http://URL - and automatically get a list of things it can do.
What I am having trouble understanding - is that 's... |
I was looking into lipsync on a Dropbox clone. I was looking at the diagram on how it works here.
It shows that a cronjob is used to keep files in sync between client and server. Does that mean that every sec/min/hour, a cronjob runs and checks to see if there is a difference between client and server? Is that how Drop... |
Possible Duplicate:
(Why) Should I learn a new programming language?
I came across a line in this article which is,
Learn one programming language every year
Why do good programmers suggest to learn more programming languages . We can be a jack of all and master of none too in this case.
|
So I have been reading about DDD for some time and trying to figure out the best approach on several issues.
I tend to agree that I should design my model in a persistent agnostic manner. And that repositories should load and persist my models in valid states.
But are these approaches realistic practically? I mean its ... |
I'll get straight to the point:
I was wondering if there is a common pattern to use portable areas as a components of a plugin-like architecture.
Example:
We've got 3 plugins (portable areas) packaged and distributed via NuGet feed.
Each of them is following the standard MVC structure (has it own Models, Views and Con... |
Possible Duplicate:
Where do you draw the line for your perfectionism?
I see that the development community is very focused on doing things the right way and personally I would like to do the same too, however, is it a good or bad idea for a newbie to focus on design principles, design patterns, and commenting code ... |
I decided to learn about balanced search trees, so I picked 2-3-4 and splay trees.
What are the examples of splay trees usage in the real world?
In this Cornell: http://www.cs.cornell.edu/courses/cs3110/2009fa/recitations/rec-splay.html I read that splay trees are 'A good example is a network router'.
But from rest of ... |
I very often hear the following: "If you want to test private methods, you'd better put that in another class and expose it."
While sometimes that's the case and we have a hiding concept inside our class, other times you end up with classes that have the same attributes (or, worst, every attribute of one class become a... |
This question is really based on PHP, but could be valid for other dynamically typed, interpreted languages and specifically the methods of generating code insight and object browsing in development environments.
We use PHPStorm, and find intellisense invaluable, but it is provided by some limited static analysis and p... |
I am designing an application that allow users to highlight areas of a geographical map using a tool that is like brush or a pen. The tool basically draw a circle with a single click and continue drawing those circles with mouse move.
Here is an example of drawing made by moving the tool. It is pretty much same as Micr... |
I have a Silverlight application with WCF and entity framework.
Is it possible to have one database per user. So when the the user log in, the user will use his own database?
|
I am evaluating Google Protocol Buffers for a Java based service (but am expecting language agnostic patterns). I have two questions:
The first is a broad general question:
What patterns are we seeing people use? Said patterns being related to class organization (e.g., messages per .proto file, packaging, and distrib... |
I'm trying to give a sound structure to a PyQt application that implements a card game. So far I have the following classes:
Ui_Game: this describes the ui of course and is responsible of
reacting to the events emitted by my CardWidget instances
MainController: this is responsible for managing the whole
application: s... |
I have some friends telling me that Dropbox can be used as a version control tool. I have always used SVN or Git. I was looking around Dropbox and couldn't find anything that tells me about is characteristics as Merging, Fork and other characteristics for a complete VCS.
Can someone point me what I'm missing.
|
My mother did her college thesis in Fortran, and now (over a decade later) needs to learn c++ for fluids simulations. She is able to understand all of the procedural programming, but no matter how hard I try to explain objects to her, it doesn't stick. (I do a lot of work with Java, so I know how objects work) I think ... |
Google trends shows what query has been searched how many times and some other properties of the said query. But how is this data stored in a database?
Storing a new row for every search does not seem right. They also tell the query on a time graph, so they must have some way to look for individual searches made by use... |
There is an open source project that I want to fork for my own reasons. It currently has a Git mirror of its main SVN repository which I can use.
What are the best techniques for forking a project whilst still maintaining the ability to merge future changes from the original project into your own forked repository usin... |
I'm in the process of learning how to use WCF (Windows Communication Foundation) to allow a client/server desktop application to communicate. The application's UI will be implemented using WPF, and we will probably use SQL Server for our database.
What I'm struggling with, is understanding how to structure such an app... |
Some colleagues of mine have told me that having business logic in stored procedures in the database violates the three-tier separation architecture, since the database belongs to the data layer whereas stored procedures are business logic.
I think the world would be a very grim place without stored procedures.
Do the... |
When designing data structures for an application, what are some best practices to make sure it can be sharded?
In particular, which of the following is better:
Creating relationships in databases
Establishing relationships in SQL queries as necessary?
|
I am currently planning to implement a little painting app using OpenGL ES 1.1. I believe this question applies to any OpenGL ES project. I am starting development on Android and I would like to know if you would recommend writing the drawing logic (using OpenGL) in C++ with the NDK so it will easier to port to iOS, ... |
Given this sample code
import java.util.ArrayList;
import blackjack.model.items.Card;
public class BlackJackPlayer extends Player {
private double bet;
private Hand hand01 = new Hand();
private Hand hand02 = new Hand();
public void addCardToHand01(Card c) {
hand01.addCard(c);
}
p... |
My client wants to do an iPhone app because she's found that people are significantly more likely to use the iPhone app over a mobile optimized site. The iPhone app is very simple - it just displays a couple images and some text. As a programmer I'd much rather do a mobile site given the simple nature of the content. F... |
What should be done exactly when the most obvious class name for a component is taken by a framework? In my case, I need to make a class that describes an HTTP request. Of course, the most common name is "taken" as System.Web.HttpRequest. What should I do? This project will be used in a web context, so I'd really rathe... |
Note :
I know we have Django ORM already that keeps things database independent and converts to the database specific SQL queries.
Once things starts getting complicated it is preferred to write raw SQL queries for better efficiency.
When you write raw sql queries your code gets trapped with the database you are using... |
I've written a .NET bitwise operations library as part of my projects (stuff ranging from get MSB set to some more complicated bitwise transformations) and I mean to release it as free software. I'm a bit confused about a design aspect of the library, though.
Many of the methods/transformations in the library come wi... |
Although servlets does the task of sending the HTML code to the client programmers weight JSP over servlets for that. Even a JSP code is compiled into servlet before giving the response to the browser then why is JSP preferred? If servlet is used then a lot of computation work can be saved.
|
I am having some trouble coming up with a good solution to limit sub-processes in a script which uses a multi-processed library and the script itself is also multi-processed.
Both, the library and script are modifiable by us.
I believe the question is more about design than actual code, but for what it's worth, it's w... |
I want to build a generic rule parser for pen and paper style RPG systems. A rule can involve usually 1 to N entities 1 to N roles of a dice and calculating values based on multiple attributes of an entity.
For example:
Player has STR 18, his currently equipped weapon gives him a bonus of +1 STR but a malus of DEX -1.... |
I recently created a .net web app that used over 200 custom validators on one page. I wrote code for both ClientValidationFunction and OnServerValidate which results in a ton of repetitive code.
My sql statements are parameterized, I have functions that pull data from input fields and validates them before passing to ... |
On some generic functions, it seems that accessing a function on mainform directly from the usercontrol is easier than raising an event. For example: A function on main form that displays one desired usercontrol centered and tweaked.
Making this function static, or access this function by reference from the user contro... |
I'm storing some phone numbers in the database which should kept totally secret (they're supposed to access via web). BTW, because of the position of these people, I need to prevent any chance for leak of their numbers. So, the only solution I could thinking of is Encryption.
As the database could contains bunch of dat... |
I used to be a fan of requiring XML comments for documentation. I've since changed my mind for two main reasons:
Like good code, methods should be self-explanatory.
In practice, most XML comments are useless noise that provide no additional value.
Many times we simply use GhostDoc to generate generic comments, and ... |
I'm pretty well sold on the "singletons are evil" line of thought. Nevertheless, there are limited occurrences when you want to limit the creation of an object. Roy Osherove advises,
If you're planning to use a singleton in your design, separate the logic of the singleton class and the logic that makes it a singleton ... |
I'm trying to convince my employer to let us use the Microsoft ASP/AJAX toolkit since it simplifies the implementation of many controls. However they have rejected the idea on the grounds that it produces "AJAX code" which is not ADA compliant. However the same employer requires webpages to be written in ASP.NET Web Fo... |
Possible Duplicate:
When is a BIG Rewrite the answer?
Software rewriting alternatives
Are there any actual case studies on rewrites of software success/failure rates?
When should you rewrite?
We're not a software company. Is a complete re-write still a bad idea?
Have you ever been involved in a BIG Rewrite?
This is a... |
I'm looking for different ways to ensure that each instance of a given class is a uniquely identifiable instance.
For example, I have a Name class with the field name. Once I have a Name object with name initialised to John Smith I don't want to be able to instantiate a different Name object also with the name as John... |
We need to generate a release in 3 weeks, and for the planning we are doing today we don't have coherent logical user stories from the backlog tasks. Is valid to match say each development task is equivalent to an user story?
Methodologically what is the correct way of handling this?, because anyway we are going to hav... |
LSP states that classes should be substitutable for their base classes, meaning that derived and base classes should be semantically equivalent.
But does LSP also apply to classes implementing an interface? In other words, if an interface method implemented by a class is semantically different from what user expects it... |
All this started when I was looking for a way to test my webpage for JavaScript conformance like the W3C HTML Validator. I have not found one yet. So let me know if you know of any...
I looked for the official JavaScript page and find ECMA Script. These people have standardized a scripting language (I do not feel like... |
I've been programming in C++ for a while now, but mostly things centered around the low-level features of C++. By that I mean mostly working with pointers and raw arrays. I think this behavior is known as using C++ as C with classes. Despite this, I only having tried C recently for the first time. I was pleasantly surp... |
According to the research done here http://imageoptim.com/tweetbot.html, Xcode's conversion of PNGs to the proprietary Apple CgBI format does not create a noticeable performance improvement. Their claim is that the conversion only reduces PNG loading speed by 1 nanosecond.
If this is true, why does apple bother with th... |
I have a website that takes two primary get strings:
?type=GAME&id=SomeGameID
?type=SCENARIO&id=SomeScenarioID
for reasons unknown, I have recently begun receiving requests for erroneous get strings from both Yandex and Baidu. They are always in the form of:
?type=GAME&id=SomeScenarioID
None of my users are triggerin... |
I was looking at how file systems are designed and noticed that most places say that the directory hierarchy can be implemented using a hash table.
Could someone please explain me how using a hash table to store a directory structure works?
For example, what would happen if I add a file/ directory or move a directory, ... |
As the title states, I'm thinking of making a simple-card-game based website, using persistent connection technology (Something like signalR) for the actual game part of it.
I've never planned a site to use this technology, and wondering for those who have, are there any additional things that need to be taken into con... |
Isn't scope just a way to organize classes, preventing outside code from accessing certain things you don't want accessed?
More specifically, is there any functional gain to having public, protected, or private-scoped methods? Is there any advantage to classifying method/property scope rather than to, say, just public-... |
Today my lecturer mentioned the reason why the aircraft system is programmed in assembly language is due to the program being written have less error . Is this statement true ? Because when he asked about our opinion I said assembly can create faster program thus it is a good language for real-time oriented aircraft sy... |
I have seen lots of articles but none really help me. That is because I want to use dapper as a DAL. Should I create repositories with special functions? Like getStaffActive()?
If I use repositories
I can implement with dapper-extension a generic crud
I have no idea how to handle database connection. Where to open th... |
In my Domain I have an entity Activity which has a list of ITasks. Each implementation of this task has it's own properties beside the implementation of ITask itself. Now each operation of the Activity entity (e.g. Execute()) only needs to loop over this list and call an ITask method (e.g. ExecuteTask()).
Where I'm hav... |
I am thinking about writing a GAE app but am a little hesitant because the EULA gives Google full rights to change their APIs anytime they want, for any reason. Obviously, they'd be out of business quick if they just 'upped and refactored their entire APIs, so I have to imagine they have some kind of notification syste... |
I need to standardize coding practices for project that compromises, among others, of pl/pgsql database, that has some amount of nontrivial code.
I look for:
Code formatting guidelines, especially inside procedures.
Guidelines on what constructs are considered unsafe (if any)
Naming conventions.
Code documentatio... |
I know about static final equivalent to #define , But I am not looking for it
I have used #define REP(i,n) for(__typeof(n) i=0; i<(n); i++) in C++ and after that I can use REP(i,10) instead of for(i=0; i<10; i++) in the whole program.
But is there a way to do this in Java? I want a version of #define REP(i,n) for(__typ... |
Cloud computing is a model of renting resources - servers and data storage. Both servers and data storage have been around for much more than a decade so far. Yet cloud computing offers only appeared several years ago.
What's the deal here? What was the critical change that triggered massive adoption and massive market... |
I know you can sell apps using your own personal tax information, but what if there are several people working on the app? Our plan is to just have one of us register for the Google Merchant account and then we'll privately divide up any revenue that comes to the PayPal account.
Is this legal? Or do we need to actuall... |
It's an idea I've heard repeated in a handful of places. Some more or less acknowledging that once trying to solve a problem purely in SQL exceeds a certain level of complexity you should indeed be handling it in code.
The logic behind the idea is that for the large majority of cases, the database engine will do a bett... |
So, I am having to deal with seemingly archiac language (called PowerOn) where I have a main method, a few datatypes to define variables with, and has the ability to have sub-procedures (essentially void methods) that does not return a type nor accepts any arguements. The problem here is that EVERYTHING is global. I'... |
I'm working on a game, and without getting into any details I am using MVC "patterns", "rules" or whatever you want to call it to make the game.
The view includes everything needed to draw things on the screen, the controller passes input to the model. And the Model contains game logic.
Here's my problem, the game is ... |
So i have to store daily attendance of employees of my organisation from my application . The part where I need some help is, the efficient way to store attendance data. After some research and brain storming I came up with some approaches . Could you point me out which one is the best and any unobvious ill effects of ... |
I have some projects that are in a very early development state. They are nowhere nearing completion but I do host them (as public repos) on GitHub because:
I have multiple computers and I want access to my code everywhere
I want a backup for my code
I want it to be easy if someone wants to collaborate in some way
I u... |
I'm writing a program for a company that will generate a daily report for them. All of the data that they use for this report is stored in a local SQLite database. For this report, the utilize pretty much every bit of the information in the database. So currently, when I query the datbase, I retrieve everything, and... |
I've been trying to write an algorithm that will print separately the digits from an integer. I have to write it in Pseudocode. I know how to write an algorithm that reverse the digits.
digi(n):
while n != 0:
x = n % 10
n = n // 10
print (x)
But I don't know how to write an algorithm to print the digi... |
So, I'm writing a C# managed wrapper around a native dll. The dll contains several hundred functions. In most cases, the first argument to each function is an opaque handle to a type internal to the dll.
So, an obvious starting point for defining some classes in the wrapper would be to define classes corresponding to e... |
OK, say I have a data class for a user:
public class User {
private String firstName;
private String lastName;
private long personCode;
private Date birthDate;
private Gender gender;
private String email;
private String password;
Now let's say I want to validate email, whether names are not empty, whether birth date i... |
How can we give dial-up users in some remote places or less developed countries, a good experience while using dynamic websites.
|
I am designing a simple webservice and want to use HMAC for authentication to the service.
For the purpose of this question we have:
a web service at example.com
a secret key shared between a user and the server [K]
a consumer ID which is known to the user and the server (but is not necessarily secret) [D]
a message w... |
In Scrum/Agile, the complexity of a user story can be estimated in story points. After completing some user stories, a programmer or team of programmers can use those experiences to better estimate how much time it might take to complete a future user story.
Is there a methodology for breaking down the complexity of u... |
I have attended to many SOA related sales pitches and presentations through the years. SOA projects have died because of lack of interest or because of grandiose scopes. The very buzzword has lost momentum.
Has someone seen SOA implemented ? Or is it a kind of utopian vision one must strive for ? Do one have to believe... |
I keep getting to test this kind of code (language irrelevant):
public class Foo() {
public Foo(IDependency1 dep1) {
this.dep1 = dep1;
}
public void setUpListeners() {
this.dep1.addSomeEventListener(.... some listener code ...);
}
}
Typically, you want to test what when the dependency fires t... |
I'm building a REST API which allows inserts (POST, not idempotent) and updates (PUT, idempotent) requests to add/update database to our application.
I'm wondering if there are any standards or best practices regarding what data we send back to the client in the response for a POST (insert) operation. We need to send ... |
I'm working on a WordPress plugin to manage rock climbing data, and I need to think of a way to store rock climbing grades from all of the different systems in a unified way. There are many different systems, all of which have some numerical system.
A comparison of all the systems: http://en.wikipedia.org/wiki/Grade_(c... |
Is there a set of industry-approved rules to avoid vendor lock-in?
I mean, something one can show to a manager, or other decision maker, that is easy to understand and easily verifiable.
Are there any universally accepted set of rules, a checklist or set of conditions that helps detect and prevent vendor lock-in in an... |
I'm really curious right now. I'm a Python programmer, and this question just boggled me: You write an OS. How do you run it? It has to be run somehow, and that way is within another OS?
How can an application run without being in an OS? How do you tell the computer to run, say, C, and execute these commands to the scr... |
Typical situation in UI design: you do design of some UI and, say, came up with some bright new idea like "ribbon" or "kinetic scroll past end".
What would be the strategy about such thing? Register patent, don't like it, but anyway would like to ask: how long it takes to do all this stuff and how much it will cost in... |
On November 13, 2006, Sun released much of Java as free and open source software, (FOSS), under the terms of the GNU General Public License (GPL). On May 8, 2007, Sun finished the process, making all of Java’s core code available under free software/open-source distribution terms, aside from a small portion of code to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.