instruction
stringlengths
34
19.9k
I'm trying to hack on the ROS bloom build system (https://github.com/ros-infrastructure/bloom). After I've made some edits, I build it and install it to a virtualenv to test using python setup.py build python setup.py install --root /path/to/my/virtualenv However, once in my virtualenv, it doesn't work since pkg_reso...
I can not come up with a good architecture for my card game. I need help to understand how games usually are designed. First, I will describe game rules. Game Rules Setup There are four players, each two player form a team. Each player gets 12 shuffled cards There are 4 blinded cards on table(river) Players order ar...
To illustrate the question, let's say we have two programmers of comparable skill that both solve the same problem. The code they turn out has roughly the same lines of code, but one programmer uses 5 classes while another programmer uses 20. Both sets of code get comparable wtfs per minute in code review, implying tha...
I was just wondering why does Java compiler decide whether you can call a method based on the "reference" type and not on actual "object" type? To explain I would like to quote an example: class A { void methA() { System.out.println("Method of Class A."); } } class B extends A { void methB() { ...
I was reading Towards Architecture-based Self-Healing Systems, and came upon the term first-class connectors. What are they? Searching some more finds this paper Systematic Construction of Software Architecture Supported by Enhanced First-Class Connectors, which looks like it might have an answer, and I might read it i...
I am building an application in C# that works with a Progress database. The passwords that are stored in this database are stored using a hash algorithm that Progress has not made public. However, I would like to authenticate using these hashes. Is it feasible to reverse engineer such a hash algorithm and how would I g...
It is an error if you do anything in a constructor before calling the superconstructor. I remember that I had problems because of that. Yet, I do not see how this saves us from errors. It could save you from using uninitialized fields. But, the Java compiler that checks for using uninitalized variables does that and th...
I'm focusing on trying to understand UML diagrams and learning to interpret them in order to implement the designs they describe. In the following diagram, I am not clear on what the implementation for Port Operation should be. It looks like it should be a class/entity the same as the others in the diagram. I underst...
So i'm looking for some input/consensus on what terminology we should be using to describe something that looks like this: class Printable { public: virtual void printTo(Printer *) = 0; virtual double getWidthInPoints() = 0; virtual double getHeightInPoints() = 0; }; So this is a class that only has pure...
I've been developing a custom PHP template engine to suit just my needs and also to get a little more practice with PHP. What I did was to create a Template class that simply receives as constructor parameter a path to a template file and a string that should be the placeholder for the contents of the pages. In that c...
If my solution has both a "dataservice" project and a "business logic" project, where do the entity models, which represent database tables, belong? At first i thought putting them in the dataservice layer, but then i would need duplicate models in the business logic layer, if i wanted to provide reusable logic dealin...
I am migrating a 10-years-old big CVS repository to Git. It seemed obvious to split this multiple-projects repository into several Git ones. But the decision-makers are used to CVS, therefore their point of view is influenced by CVS philosophy. To convince them to migrate from one CVS repo to different Git repositorie...
EDIT After a good amount of thinking and self-reflection on the topic, I realised that most of the issues I raised in this question was coming only from a personal, rather than a professional perspective. Hence the moderators put this question on hold because of the highly personal, subjective nature of the problem I t...
Should tests in some project be written by the actual person that does the coding (usually senior in our team) or it can be done by junior coders with less experience?
When is it absolutely necessary for a controller to be async? Should all controllers be async or is it bad practice to make all of them async unless it is necessary. Just looking for some general guidelines.
I have this dynamic data in PHP, but for each array record, I want to allow a downloadable option to save a zip archive of all records (each as a separate file). These are actually DNS zone records that are housed in a database. It wouldn't make much sense if they're in a single text file, so I'm looking to somehow hav...
I was recently refactoring a method that was both a command and a query method. After separating it into a one command method and one query method, I found that there are now multiple places in the code where I am calling the command then getting the value from the query, which seems like a violation of the DRY princip...
I'm using JavaFX for gui of my app. Its license is GPL+Linking Exception. GPL requires me to release my source code. But what's the linking exception?? (I'm just using it as a library. Not modifying or using its source code.)
I was reading about the rules for royal succession of the British monarchy and thought the easiest way I could understand it is with code (or pseudo-code). I came up with this (in a C# like pseudo-code): EventHandler CurrentMonarch_Died { CurrentMonarch = SuccessorRootedAt(Person.Electress_Sophia_Of_Hanover); } e...
If I have a file config.php with some configurations in some variables and in some page I include this file, each time the variables will be loaded again in the memory of the server? I think the answer is yes, but I'm not sure, I don't know to much of the PHP lifecycle. I don't know if I made myself clear, so here is a...
I've been trying to see a way to get a measure of how much a PHP script costs of memory to the server. Well, I've found some solutions out there that requires some software to make tests and even require to install something on the server. Those solutions are not what I'm looking for, as I just want a simple measure of...
Today I was asked this interview question and could not answer. If you have two instances of a Person class which has a setAddress method that is synchronized. Now if it was only one object and multiple threads were accessing it, the synchronized will make sure that only one method can access it at a time. But if there...
I've done a spot of Googling, and all I can find is information on using code under the MPL in a larger GPL licensed project. What I really want to know is: can I included GPL(v3) licensed code(/binaries) in a larger MPL(2.0) licensed project? My understanding so far is that I can't, and that any project which uses GPL...
In Java, I'm used to declaring collections using the most-abstract interface possible and then constructing them using the concrete implementation that makes sense at the time. It usually looks something like this: public class MyStuff { private Map<String, Address> customerAddresses; private List<ToDoItem> tas...
I have just started learning about recursion but I'm having a hard time understanding it. Please would you recommend any links or books that explain recursion in detail.
I just have a quick licensing question about PSEXEC by sysinternals. As some of you may know if you have ever used PSEXEC, it is confusing to learn at first. I have created a program that makes it easier to use, and was wondering if I am allowed to sell that program (even if PSEXEC is included with it?). I looked in th...
Looking at different collection constructors the question comes to mind. Why does ArrayList() construct an empty list with an initial capacity of ten and ArrayDeque() constructs an empty array deque with an initial capacity sufficient to hold 16 elements.
I have been in this problem for long time and I want to know how it's done in real / big companies project? Suppose I have the project to build a website. Now I divide the project into sub tasks and do it. But you know that suppose I have task1 in hand like export the page to pdf. Now I spend 3 days to do that , came a...
How would one approach the following question: We have two strings: a normal alphanumeric string and a pattern string. the pattern string can be composed by alphanumeric chars plus the char "?" and "*" We want to check if the first string match the pattern, where the ? means that every char (alphanumeric) is permitted...
When designing a RESTful API that uses JSON to respond to requests, I usually return an object like this when an error happens: { "error": "Something bad happened", "error_code": "XXX" } Do I need to have a "error": "" or "error": null in my object when there is no error?
Single Page Apps strips server down to a REST api. If SPAs are the modern and better way of developing web apps, then would someday JavaScript rule the world and server-side languages like Java, C++ etc would not be the prominent skill companies look for? Or are there still parts of huge and prominent web apps like you...
I have read Would a NoSQL DB be more efficient than a relational DB for storing JSON objects? and am building a small test project in Asp.Net. I have a webapi up in Azure. It returns a List<Company> and Company is my object which has several properties and child list and a lat/long value. //id, name etc. public List<Ce...
I asked this question a while back on SO (https://stackoverflow.com/questions/15506040/maximising-the-features-of-php-and-mysql-when-used-together) but it's a recurring topic, so I thought I'd ask in a different way over here. Basically, we are stuck with the infamous php and MySQL combination (for various reasons), an...
I was looking into concurrent programming in Erlang and Go programming languages. As per my finding they are used Actor model and CSP respectively. But still I am confused with what are the objective differences between CSP and Actors? is it just theoretical different only but the same concept?
Can SQL queries be compiled into byte code or equivalent to enhance performance? I know that most database servers support prepared statements, but is that the same thing as compiling? Most applications have to prepare statements on run-time so there is no benefit of pre-compiled byte code. Since it's prepared each ti...
I was asked to sell the source code (along with existing users) of small utility app I created years ago. I've investigated how to put a price on the source code but so far haven't come up with a good solution. I've searched the net, but haven't found anything useful. Then I came across a few others who also sold thei...
I'm about to improve my skills in all that is related to designing applications from scratch using proper OOD principles, involving MVC pattern and using TDD approach to do it. I have a project for that. I also finished reading a book by Matt Zandstra: PHP Objects, Patterns and Practice And my question is still left un...
I was going through the PhonGap Documentation about how to package your HTML/JS/CSS to a platform specific "native app". They have maintained separate documentations for the separate Cordova versions which seems fine. I essentially understand most of the things there. But the confusion I have is the disparity or the lo...
The experts in clean code advise not to use if/else since it's creating an unreadable code. They suggest rather using IF and not to wait till the end of a method without real need. Now, this if/else advice confuses me. Do they say that I should not use if/else at all (!) or to avoid if/else nesting? Also, if they refe...
I have the following : public Class A { public void methodA() { .... } public void methodB() { .... } } I don't have control over Class A. I would like to create subclasses of Class A with a restriction that it must override methodA() (super.methodA() call must run the implementatio...
I will be involved in a project where all the software design is made by a local team and these designs are sent to an offshore team for coding. This is the first time I face a project with this characteristics and for me it feels kind of odd: The managers expects us to make very detailed design documents so there's no...
I was asked this question "How would you find weight of Aeroplane" in an interview and I am not sure why this question was one of the two question asked in the interview. I tried to answer it using all possible ways but could not give the correct answer.(found the correct answer after google search) How much such quest...
I am currently developing a product that is broken up into a few main parts: A Server, an Android client, a Desktop client, and a class library for providing common data structures. Currently my team is using Maven (with a private Nexus repo) and TeamCity to do continuous integration, but we're having a ton of problems...
I'm getting pushback from operations for having a server process listen on a dynamically-assigned port number (i.e. it binds a socket to a port number of 0, triggering a dynamic assignment by the OS, which it retrieves using getsocketname()). The argument was that is "creates all kinds of issues for firewalling, routi...
I read in a book that both methods and fields are considered the attributes of a class in Python. However, recently I was told by a friend of mine that methods may not be considered the attributes of a class. Then I decided to check this out again, and found this question mentioned on Wikipedia saying that this is a Py...
I would like to know if I am expected to memorize coding in a workspace or am I allow to fall into references whenever I am unsure. In a week of non-stop self learning, I feel I can understand the basics html and CSS, but am I required to memorize every single code once I get a position in this field or is it fair to u...
How should I handle deploying web applications to multiple servers? Constraints I have a dev, test and prod environment. No build server is available. Developers can't deploy to prod. The people that do deploy to prod copy files from test to prod. They don't have VS installed. Currently The way it's handled is using ...
Some software producers provide minimum requirements, some examples: Skype, Diablo III, Ubuntu-Server and OpenOffice. I wonder how those minimum requirements are determined, especially RAM, CPU frequency in general? Is there a logic behind it or is it just determined by testing the program with different hardware to fi...
I'm working on software that uses the following libraries: Biopython SciPy NumPy All of the above have licenses similar to MIT or BSD. Three scenarios: First, if I don't redistribute those dependencies, and only my code, then all I need is my own copyright and license (planing on using the MIT License) for my code. ...
I am looking to create a simple code generator to convert XSD definitions to C# classes. This is partly as a learning exercise, but I would also like to get some practical use out of it eventually. What would the general design of such an application look like? I assume that I will need to use one of the XML parsers ...
I am working on an e-commerce website. There is a case where I need to fetch the whole data in database through a third-party API and send it to an indexing engine. This third-party API has many functions like getproducts, getproductprice, etc., and each of those functions will return the data in XML format. From there...
I've been a developer since 2009 and I've learnt a lot of languages since, but I've always wanted to understand and be able to code in the lowest level language so I can directly (or at least very close to directly) speak to machines through my code. There was a point in time when someone showed me how to do an if stat...
I want to develop a rather simple app using windows 8 metro style for GUI. But i need this app to have the same appearance, GUI, for both platforms, so that end users that uses it both on PC and a mobile device to have the same visual experience and a flawless navigation. So, does anyone have knowledge of a Java framew...
I'm trying to understand OOP so I can write better OOP code and one thing which keeps coming up is this concept of a delegate (using .NET). I could have an object, which is totally self contained (encapsulated); it knows nothing of the outside world... but then I attach a delegate to it. In my head, this is still quit...
Do Areas in ASP.NET MVC end up being a help or just a drag in the end (because of the URL construction)? Would it be better to have subdirectories inside the main Controllers folder? or are there any other options to organizing a project? EDIT For example, this is your average link without Areas: @Html.ActionLink("Home...
My question is on the best way to cluster a graph of class instances around specifically marked objects (objects are the graph nodes and the references to each other are the directed edges of the graph). To better explain my question, let me explain my motivation: I currently use a moderately complex system to serializ...
I'm building an application in PHP, using Zend Framework 1 and Doctrine2 as the ORM layer. All is going well. Now, I happened to notice that both ZF1 and Doctrine2 come with, and rely on, their own caching implementation. I've evaluated both, and while each has its own pro's and cons, neither of them stand out as super...
I'm in a situation where I have a list of items that need to be displayed depending on their properties. What I'm unsure of is where is the best place to put the filtering/grouping logic of the viewmodel state? Currently I have it in my view using converters, but I'm unsure whether I should have the logic in the viewmo...
Are buffer overflows acceptable from a graduate developer? Are we setting the bar too high? What are the expected capabilities of graduate/junior engineers? Context: We are currently recruiting for a Junior Developer position working mainly in C on Linux. As part of the process, we require candidates to complete a code...
I've inherited a .NET project that has close to 2 thousand clients out in the field that need to push data periodically up to a central repository. The clients wake up and attempt to push the data up via a series of WCF webservices where they are passing each entity framework entity as parameter. Once the service recei...
My problem is as follows. I have an array of n strings with m < n of them distinct. I want to create a one-to-one function which assigns each of the m distinct strings to the numbers 0 ... m-1. For example, if my strings are: Bob, Amy, Bob, Charlie, Amy then the function: Bob -> 0, Amy -> 1, Charlie -> 2 would meet ...
I've been using a single scheduler to handle all my scheduled tasks (Quartz.Net). I'm starting to rethink how this operates because if I need to update 1 task, I have to stop the entire process, release the update, and start it back up. My Question: Is it better to have many Windows Services running individual tasks (...
I was reading a book on OS and got confused between different terminologies. I hope i will get my doubt cleared here. These questions might be very basic for some experts, but i find this platform best suitable for such clarifications. Processes are run by CPU and this whole operation is managed by OS. For Single core...
What happens when one process has child threads and a child process, will child process inherit all child threads of parent process? Assume OS is Linux. Let it be Java Threading model.
Brief History I am new to Automated Unit Testing and Mocking objects world; previously we used to do Unit Testing (including Integration Testing and we mistakenly referred that as Unit Testing) manually, but now we have planned to change all of that to I am pushing our organization to do Automated Unit Testing. Problem...
I am developing an application that consumes data from an external service. The application is being implemented following a typical layered architecture with UI, Presentation, Domain and Data layers. The service client resides within the Data layer. As is typically the case, I do not want the UI to 'lock-up' while w...
A discussion has come up at work and I want to get the opinion of other programmers. During my time in college, we only used SVN for sourcecontrol. Everybody commits to the same server and all changes are pulled to all machines. In this system, it's easy when you should push your changes: when you're done with your cha...
I have a class called Timeline. I want to allow several defaults in my code, such as a Timeline with a Start event (The details are not needed. All that matters is that I have a class, and I want to be able to have a few different default setting). Here are the options I thought of: 1) Following a GUI/Swing inspired id...
I've just found something strange in a code written by company which I work for. In an embedded software where dynamic linking doesn't exists, shared library (released on a GPL licence) is copied into an object which is statically linked then. Here is a piece of a makefile: $(TARGET_DIR)/$(PHOST)_P_LIBxxxxxx.o: $(TARG...
I found one JAVA project useful to our commercial software which is developed using C#. The JAVA project is under LGPL. My understanding is (please correct me if I am wrong) if I use one compiled LGPL library (for example, .dll in Windows), I don't even need to disclaim the license information. But if I need to make so...
In the past usually I have only had to estimate web applications based on browser support. But for more recent projects device and platform support are also very important as well (screen resolution). I am having a hard time providing an estimate to account for "responsive design". How much additional time (estimate ...
How can I describe the growth function in terms of n for the following algorithm? What is the bounding function (the Big-O)? Is it O(n^3)? for(i = 0 to n - 1) { c = i + 1 for(j = c to n) { arr[j] += arr[i]; for(k = c to 0 step -1) // what does the keyword "step" mean? { ...
I have several small projects running on different embedded hardware, and about 50% of their code is identical (typically some drivers, their operating system, and some libraries). I want to merge those small projects into a single git repository so that it becomes easier to centrally maintain them, for example to upda...
Given the following code: public interface IUserDataProvider { ICollection<SomeClass> getSomeClassRecordsForUser(int idUser); } Is it possible to define (via documentation) an expectation that any implementing class returns null instead of an empty collection (or vice versa) when no records are found? I re...
I am in process of planning web application by following the best practices and approaches of software development. I am building this application using zend framework 2 and going through its documentation and best practices of building applications through zend framework 2 and MVC patterns. Right now I am confused abo...
I have been working on a framework for years. It is solid, extensive and tested. It is exactly what the employer needs for the foundation of its new project. There is no point in rewriting the whole thing from scratch or using a competing open-source alternative. My desire is to give a free, non-exclusive, non-redistr...
I wanted to get an idea of categorizing bugs based on how easy is it to solve and how much benefit it will give me. for e.g., if there is a bug which will take say an hour (double file close etc.) to solve vs another which takes a day (segmentation fault). But if solving the first bug is not very important, then I'll p...
I'm wondering how to write BDD test cases for a real system. All examples I can find are trivial and do not answer the question. Sample use case/story basically goes like that: User is on the main application page He clicks retrieve to fetch some order to work on He fills 4 textboxes and hits submit. Something happens...
Windows 8 seems to have chosen to silently shutdown applications that misbehave, there is no message informing the user something bad happened and no information on why the application closed. I heard through the grapevine that employees at Microsoft are tired of customers blaming them for crashes and that they believe...
Is there a way to prevent the editing of HTML and CSS contents in a page using Firebug-like tools? I found that some users are editing some values in hidden fields and some contents which written between a div or span tag for gaining some profits. They are doing mostly by editing with help of tools like firebug. Is the...
Our Scrum Master keeps referring to bugs as technical debt. Is he right, are bugs considered to be technical debt in the world of Agile?
I have rather specific question about licensing but first of all I would just like to state that I already read a lot of Q&A's here but I'm still not sure about the problem in that particular scope. As I've understand from other Q&A's, you are allowed to distribute your commercial application even with LGPL library as ...
Out team is at the cusp of a new project. One of the components at the boundary of the system is the component which interacts with a printer through an external COM component (referenced as a usual dll). The COM component returns integer codes if there were an error whilst command execution. Lets consider a concrete c...
Is flat addressing model generally superior to a segmented one? If so, why? If not, what instances would call for each over the other and why? My understanding of memory models surrounds the IA32/x86-64 Architecture. So if you give architecture specific examples, they will be most helpful if kept relevant to that.
Part of my job is working on line-of-business applications built around client-side databases, such as Access or FoxPro. Other times these local LOBA's have direct document access, such as an exact one-to-one mapping between a logical object an an XML node or references to bookmarks in Word Documents or ranges Excel s...
While it takes a turing complete language to create any imaginable program, is it possible to compute most "useful" programs with a non-turing complete dynamically typed language? For example, is there a non-turing complete language capable of solving the Project Euler problems?
Occasionally in code at GitHub I see tags "cc", "vv" and "^^". Do these have any special meaning? Example: // cc MaxTemperatureMapper Mapper for maximum temperature example // vv MaxTemperatureMapper import java.io.IOException; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import ...
I'm looking at the wiki on ExtJS, the wiki on List of rich Internet application frameworks, and the wiki on Comparison of web application frameworks. I'm confused. The first line of the ExtJS wiki page says: Ext JS is a pure JavaScript application framework for building interactive web applications[1] using techniques...
I am reading the first chapter of the Gof book. Section 1.6 discusses about class vs interface inheritance: Class versus Interface Inheritance It's important to understand the difference between an object's class and its type. An object's class defines how the object is implemented.The class defines the object's i...
What is the difference between a Future and a promise? (In Akka and Gpars.) They look the same to me as both block and return the value of the future when get is called and a promise is to get the result of a future.
I am currently doing an internship in a large corporation and they are undergoing many changes in software delivery structure (moving to Agile). In the past couple of months I have noticed this religious attachment to Clean Code practices and the book being like a bible for the developers. Now, one of the most importa...
I'm reading the "Effective Java" book which suggests to favor composition over inheritance. The example it gives shows something like this: public class InstrumentedHashSet<E> extends HashSet<E> { // The number of attempted element insertions private int addCount = 0; public InstrumentedHashSet() { } ...
I develop a mobile app that displays information about the bus system in one U.S. city. The de facto official language is English, but there are many students from other countries—China and South Korea, especially—and I’d like to internationalize and localize my app, both to make it more appealing to non-native English...
Asynchronized programming seems to be natural in Javascript - it is the "first choice" to do many things. But in most other programming languages, asynchronization is more like a second choice rather than first choice. What makes asynchronizated programming so popular and natural to Javascript?
I am new to Agile and scrum and want to ask few things. Suppose I havetwo user stories 1, 2 Suppose I finished story 1 in sprint 1 but while doing sprint 2 I did something which breaks something so that my things in user story 1 broken and I need to spend more time on that again. What do I need to do for that case?
I read quite a few resources on the internet and now I am quite confused about the existence of pointers in Java. Some claim that there are pointers and some claim that there is no such concept. So what is the truth?
I have WCF webservice which serves to various mobile application. This was implemented with typical HTTPS/SSL. But there are some cases like Replay Attack needs to be considered in the security aspect. OAuth 2.0 looks like a viable solution for this problem (using nonce). And I can see some examples on web using Dotnet...
What is the real use of interfaces in Java? What is meant by programming to interfaces? I heard these things several times but I don't know what it is and why it is used.
I was wondering how we could ingest CSV files located on a Red Hat Linux server into SQL Server database tables. I know we can write a stored procedure/bulk insert to read the files that are located on the same Windows server as SQL Server and update the database, but not sure how to do it when the files are present on...
So usually when working with the MVC you have a controller that controls the input a model that process it and makes it ready for the user and a view that display the "result" to the user. Now when creating this pattern you seperate the code into their relevant place. for instance the controller code goes into the cont...