instruction
stringlengths
34
19.9k
We are developing an ERP web application using Vaadin framework where each of the potential client companies will have their own data and file storage. Current implementation only allows having one client company per application instance, what consequently requires separate database schema and file storage. Some of the...
I'm not sure if this is an acceptable question, but compiler-os-design-where-to-start was, so I figured that I'd take a shot at it. I have taken no formal Computer Science classes. I have programmed in Python and attempted C# without success. My technical vocabulary is expansive, yet scattered over a very wide range ...
I'm working on a simple piece of functionality (actually a ruby gem, but that is beside the point) which can be used to receive and persist incoming messages send and persist outgoing messages supplies a hook to the implementing code for performing some action based on a received message. Could for example send a repl...
What is the best way or best resources or tutorials to learn Object Oriented Programming? For instance, when I begin a program with Java and all my code goes into just one class and I can't estimate when I need to create new classes and operate on these classes together.
If I have an ItemContainer class that contains, for example, items in an order, where each item is an Item object; is it best to have a method like: ItemContainer->getItems() that returns an array containing Item objects, or is it better practice to do something like: ItemContainer->getItem($itemNo) which returns a...
I'm rereading this http://docs.python.org/2/howto/functional.html document and hit this line, '...Unfortunately, proving programs correct is largely impractical and not relevant to Python software. Even trivial programs require proofs that are several pages long; the proof of correctness for a moderately complicated p...
Suppose I want to draw a class diagram of a DAO and an Entity. The DAO is used to load instances of the Entity from the database. How can I represent this relationship on my class diagram? Is this considered one? I think it should be displayed on the diagram somehow: TL;DR: should I draw something between them or not?...
I'm programming a jQuery functionality for doing a search on articles while the user is typing in the search field. I implemented a bind in jQuery that at every keyup, it sets a clearTimeout and a setTimeout to the actual function doing the post to the server. This is because users can be writing something and I want t...
Would you consider it appropriate if you were asked for your Stack Exchange username in a software job interview (or as a pre-interview screening question)? To me, it seems like a very reasonable request, and one that would be extremely informative -- I'm sure I could learn more about a candidate in five minutes by lo...
This could be either for the .NET or Mono compilers. I know that under certain conditions the compiler can inline functions (e.g. small, single call site, etc.) as an optimization. However, if the function is public, then it needs to have an external entry point. In these cases, is duplicated code generated (public ...
I'm a freshman Computer Science student and we just started doing some actual projects in Python. I have found I'm very efficient when I use the pen and paper method that my professor suggested in class. But when I can't write my problem down and work my algorithms out on paper I am really slow. During labs, I always s...
I am not sure if this is a clear question. I work on a python project that is based on terminal(console), for which I am planning to implement a GUI. I am not major in CS so I really have no idea about how to effectively design a message system such that: In console, it provide nice look info when runtime. In GUI, it ...
I have a question that I really can't find a straight answer to. Let me start by saying I'm not asking for a step by step tutorial, or even plan on doing anything. I'm just curious. I've been reading up all day on the development of operating systems, and how they're built from scratch. I have a pretty firm grip o...
I have recently started a new job and am being forced to use VS 2005 and .NET 2. This has been quite painful for a number of reasons, but the one big change from VS 2005 to its successors was the introduction of LINQ and extension methods. A common pattern that I used to follow when using enumerations was the following...
I've been using ASP.Net WebForms for the last year or two at work for development, but I've used PHP for personal projects for 10 years. So, I'm far more adept at developing with PHP. When it comes to ASP.Net MVC, I have no experience with it because I've avoided it because I assumed it would just be a more complicate...
Our SPA (plain HTML and Javascript) makes use of huge volume of javascript and other resources that are downloaded via XHR. Given the sheer number of components and browser simultaneous request limits, we're thinking for ways to deliver our resources in a more efficient manner. A method we're considering is bundling se...
Why do we still embed natural language descriptions of source code (i.e., the reason why a line of code was written) within the source code, rather than as a separate document? Given the expansive real-estate afforded to modern development environments (high-resolution monitors, dual-monitors, etc.), an IDE could provi...
While studying the C programming language and learning safe practices, I'm inclined to write a layer of functionality over several parts of the standard library. This would serve two purposes: I could use standard parts of the language in ways that feel more familiar or rational to me, and I could easily replace that ...
I have some difficulty understanding the concept of "fixture". I know what a test suite is, a test case, a test run, but what exactly is a "fixture"? A parameterized test case? It seems to me that the meaning or semantics of the term "fixture" can vary slightly by programming language or by testing framework? I think ...
I'm just wondering if anyone knows about some well designed .NET Open Source Applications using WPF? I have already tried to search at the usual sites like GitHub and Sourceforge, but I wasn't very satisfied by the results at all. Actually I'm interested in the right usage of MVVM, Data Binding etc. in the context of r...
I've recently applied for a position as C# developer, and during the interview, the interviewers asked me many times if I contribute to develop one or more open source project. Since they let me write a lot of code (from basics to TDD,MVVM,MVP), I didn't get the meaning of such a question, especially cause they insiste...
Which of below two shuffle algorithms (shuffle1 and shuffle2) is more random? public final class Shuffle { private static Random random; public static void shuffle1(final Object[] array) { if (random == null) { random = new Random(); } for (int i = array.length - 1; i > 0; ...
Currently, I'm developing an architecture for a system of the following kind: There are a couple of existing applications (front end) with which one can define UML profiles capturing some specific domain aspects. Since the tools are proprietary the produced models are not exchangeable by default. On the other hand ther...
I have a fiery debate running in the office. We have an app with two buttons of different size. (One is 40 px wide and one is 150 px wide). They have the exact same look in terms of background image. I would like to know which is best practice: 1: Make one image for the background that is 40px wide, and another image w...
Today I learned about eager boolean evaluation. In the following example, Bar() will be evaluated even when Foo() is true. if (Foo() | Bar()) This answer on SO has an example: if ((first = (i == 7)) & (second = (j == 10))) { //do something } The use-case here would be that you want to reuse the results, but I would r...
As I am reviewing a BSD license for an open source library to use it in my commercial product, I found this paragraph: Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising...
I am working in QT . Can a static library depend on another static library?(Static Lib is made by linking another static lib) If yes, is it possible that after linking to lib2, the generated lib(lib1) would not contain all the codes of lib2? In my Qt Project I am using a static library, which depends on multiple lib...
This may be a question more suited some Programming Meta Discussions. I was trying to delve deeper into the inner plugin management feature for QT Creator 2.x IDE provided by Digia Inc. So I effectively downloaded the source code for QT Creator and built it to debug how this functionality is implemented. Hence I used a...
I want to provide some library functionality and a reference application, which will run on a fully-featured, POSIX-compliant platform. The app and library will need bi-directional serial port communication, user input from keyboard, user display to text console, and probably timers. I also want to provide a porting gu...
When opening pdf's in Chrome and Firefox, the "view source" button is greyed out. "Inspect elemet," however, reveals HTML. Are the browsers simply downloading the file and generating html to display it?
I'm working on a Bitcoin-clone block explorer (specifically Mincoin) which has a block timer of about 1 minute. For those unfamiliar with Bitcoin, basically a new data structure called a block is propagated to the network about every minute. A block itself holds a lot of information, but three things are the most impor...
I've got a neat (so I thought) way of having each of my modules produce a unit-test executable if compiled with the -DTESTMODULE flag. This flag guards a main() function that can access all static data and functions in the module, without #including a C file. From the README: -- Modules -- The various modules were wr...
I have a legacy project which I have been approved to work in a knockout.js module. This is great, however the application is extremely complex and I need to use some of the pre-built form validation of our application. My form validators work fine until a dynamic template gets switched out. I can't for the life of m...
If I am loading a whole load of items (un-ordered words from a file or something) would it be more efficient to load them all to a Ruby array, and then use the built in sort! method or to do a binary lookup for the place of each item in the list as I load it, and add it in that position. Basic code: array = [] lines.ea...
Hi I'm developing a Wordpress plugin which accesses a couple of API's (Amazon Product API, Flickr, Freebase, Ebay). I've already started writing unit tests for it but I'm still wondering if its really the way to go since it takes a lot of time downloading data from the API primarily because my download speed isn't tha...
When doing table driven predictive parsing on an LL(1) grammar, (as explained in good detail here for example), how can we augment the algorithm to allow processing of semantic actions while doing the parsing. One technique could possibly use the same stack in the algorithm by defining the production rules with marker...
An interesting discussion about the distinction between callbacks and continuations over on SO has prompted this question. By definition, a continuation is an abstract representation of the logic needed to complete a computation. In most languages this manifests as a one argument procedure to which you pass whatever ...
I am developing an application which is using JTransforms to compute FFT and InverseFFT. I am planning to sell that application on Play Store. The JTransforms Library is covered under MPL/LGPL/GPL tri-license. Does that mean I have to disclose my application's source code to the community ? Does that mean I cannot use ...
I run a database for a sequencing centre. There are other developers getting data out of this and running automated and semi automated processes from the database. We are discussing a change to the database. At the moment we have a library that has a one-to-one relationship with a multiplex_index, which can be used t...
Apparently, there are some resemblance between objects in JavaScript and dictionaries in Python. Each language defines an object a little different (and there is some logic that all definitions to be the same as in physics). How are objects alike and how do they differ between JavaSscript, Python and PHP?
From some open source projects, I gathered the following coding style void someFunction(bool forget); void ourFunction() { someFunction(false /* forget */); } I always have doubt about what false means here. Does it mean "forget", or does the "forget" refer to its corresponding parameter (like in the case above...
Assuming I have an API to consume that uses JSON as a data transmission method, what is an ideal way to decode the JSON returned by each API resource? For example, in Java I'd create a class for each API resource then initiate an object of that class and consume data from it. for example: class UserJson extends JsonP...
I'm building an application with lots of components, a lot of which are third-party so I only know what I can get from their documentation. From time to time, by pure luck, I find out one of these components was pretty heavy and had an option to cache stuff. I can't stop thinking that if I weren't lucky, one of these c...
I have AS3/PHP background and some basic understaning of enums from C++. Saying shortly: I read this: http://haxe.org/ref/enums http://haxe.org/doc/cross/more_on_enum And though - good heavens! What the sorcery is this??? Enum Constructors Parameters? Enum Type Parameters?? Could someone explain with working examples...
This is in reference to the question posted here. As I would judge it, the question there should be closed simply because it seems to ask why the Borland developers made one thing a function and another a procedure (function that returns a void result). Now the example was given there of some string manipulation funct...
This question on SO talks about correcting what the OP thought is feature envy code. Another example where I saw this nifty phrase being quoted is in a recently given answer here in programmers.SE. Although I did drop in a comment to that answer asking for the information I thought it would of general help to programm...
Due to the diversity of Linux distributions, it is quite common for programs to be distributed in source format together with scripts in order to assist the configure, make, make install sequence. When it comes to commercial programs, however, distributing the source is usually simply not possible. So if anybody wants ...
I am working on a piece of code which performs a set task in several parallel environments where the behaviour of the different components in the task are similar but quite different. This means that my implementations are quite different but they are all based on the relationships between the same interfaces, somethin...
During 1990s when there were no advanced frameworks/paradigms available for S/W development , knowledge on data structures was critical... which I can comprehend. But nowadays, for most of the problems (at least from Java/Android development) we can rely on an existing class to provide solution. As such I believe, an i...
I asked this question on SO but someone pointed out that I would be better off here. He's most likely right. So here I go! So I just wanted an opinion. I have 2 different ways to approach the problem. Okay so I have a system that I wanna design toward the future. I have some types of objects wich takes as parameters an...
I need to find an approach to the problem of generating texture maps for non-convex polyhedrons without using a design tool like Maya. Specifically, I am mapping simulation results data onto a 3D surface, and I need to write code which generates the maps. One generic approach uses a gradient color brush as an overall ...
To my understanding, when you access a variable, that variable and the surrounding area of memory is put into the L1 cache. If I'm wrong here, please tell me. Now my question is, say I have an array of pointers, and I want to iterate through them all performing operation X. If I first have to access the pointer, to get...
Suppose I have a mesh of relationships, such as Friends who trust some friends and not others A IPv6 router that needs to locate peers across the Internet A PGP Web Of Trust that needs two people to locate each other's trust level I'm interested in determining not only the shortest path, but the cost of each (an ar...
In process concurrency and thread concurrency it's quite obvious how the kernel sees these as they map directly to real things that the kernel manages. When it comes to Golang goroutines and Ruby Fibers (these are similar things right?) I'm clueless as to how these are managed. Are they managed by the respective langua...
So someone peer reviewed my work, and he told me that I should always sign my commits and tags cryptographically. When asked why, he didn't know to explain it to me, and said "It's just a good thing to do". Trying to avoid an obvious chimpanzee scenario, why should I really? Are there really so many distinct advantages...
When making mockups for Responsive Web Design projects, should I separate them by Page or by Screen Size? Which one would be more helpful when I start writing the source code? What are the pros and cons of the following: Page based: All the home page mockups in all different screen sizes Screen-size based: All the pag...
In one of my projects, I have data for hotels, and other booking sites are able to book this hotel. For example: Hotel A - Booking (ID = 4002), Expedia (ID = 123), Priceline (ID = 147) The three booking engines each uses their own Id to reference to Hotel A. I would need to check manually and make the right reference t...
I recently wrote a couple of WordPress Themes in PHP and was wondering what license I should put on it. I don't mind users reusing my code, but I don't want them to be able to sell and redistribute my themes as I want to retain that right. I heard somewhere that an all rights reserved link would stop the distributing e...
Is it possible to build a custom email client for Gmail using Java APIs? Or only Google can do that?
Let say that library "A" is published under GPL. Library "A" exposes some API functions for dynamic linking. I wrote a wrapper library "B" for usage of "A" in another language. Library "B" dynamically links to the library "A" (calls are made to the exposed API functions) . I would like to publish my "B" wrapper libra...
[Potentially misleading title, but I'm not sure how best to word it.] Theoretical question on compilers and language design. Say I'm re-implementing a method in a code base. Instead of removing or commenting out the method that I'm re-implementing I leave it where it is, for reference and testing purposes, and just rem...
I need to escape special characters which are sent to Apache Lucene. Since the code will run on a production server, I want the code to be the fastest possible. I've seen multiple ways to do it: Using Pattern Using Replace Using Library See: http://www.javalobby.org/java/forums/t86124.html I'm wondering: For trivial...
A bit of background information: We have an old database application written in Access that lets users monitor their workload, and the code is... 'procedural' might be too kind. The vast majority of code is hard-wired to form events, there's a lot of duplication, and little to no abstraction. If it needs to fetch data ...
Sometime we really need to choose a multi-threaded design, because single-threading will block the UI or block another thread. But sometimes using multiple threads is just one of the choices, for example, you may able to replace multi-threading with timer. In that situation, you may want to avoid the effort of investig...
I have 3 solutions, one of them is a dataccess solution with all the repositories etc. At the moment when a change is made to it, the others have to go get the latest nuget version locally, we have a nuget server on the LAN. Its a pain to debug though. Would a git submodule work here to enable debugging and not worry a...
Given a constructor that will never, ever, have to use any different implementations of several objects that it initializes, is it still practical to use DI? After all, we might still want to unit test. The class in question initializes a few other classes in its constructor and the classes it uses are pretty specific....
Assume that I have library X which contains class A with method b and that library X is realeased under GPL licence. public class A { public void b() { // this is an example of b method's body. But assume that the body of method b // is very complex System.out.println("operation a"); System.out.p...
Please bear with me, I could only explain the problem in the comments of the code snippet below. Please read through them carefully. Question at the end: I usually tend to name the variables used in for loops with i, like this: for (var i = 0; i < arr.length; i++){ // do some COMPLEX operations here } This loo...
I am trying to convince the lead developer of an open-source project I'm contributing to, to conform to the PSR standards (PSR-2 in particular) created by the PHP Framework Interop Group. He is willing to adopt PSR-0 and PSR-1, but he is opposed to PSR-2. His argument is that PSR-2 is too inconsistent: opening braces f...
I'm trying use the PSR conventions in all my projects, but today I view some code of my co-worker and I disagree. if ($cond == 1 AND $cond == 2) { // to-do } For me, the correct is: if (($cond == 1) AND ($cond == 2)) { // to-do } What is the correct use of the PSR?
I would like to create a site where users can post articles with the following optional parts: A title Contents (text) Categories Keywords Articles will be stored in mongodb and the site will be built in node.js. Users can search the site using a normal search text box. I'm thinking about creating the following colle...
I'm having trouble coming up with a good way to structure the interfaces for two modules that are logically independent but whose implementations may be combined for the purposes of performance or efficiency. My specific situation is the replacement of the separate queuing and logging modules in a message routing appli...
I was reading the following article: Polynomial interpolation of GPS satellite coordinates, Milan Horemuz and Johan Vium Andersson 2006 and it states the following: "The estimation procedure of the ai coefficients is done with the Matlab function polyfit, which estimates the coefficients in a least squares sense. To im...
I saw this nice image here. I learned that all the compilers that support .net language convert the source code to CIL format. Now Microsoft is never bringing in .NET for all the operating system by writing a CLR for all operating systems. Then why keep such an intermediate code format and a CLR to execute that CIL. Is...
I am working on a project with a few file formats. Some formats are specified by .xsds, others by documentation on their respective websites, and some are custom in-house formats that have no documentation. Mwahahahaha. What's the problem? I would like to test my file readers, but I'm not entirely sure how to go about ...
static void Main(string[] args) { var c2 = new Class2(); var c3 = new Class3(); var c1 = new Class1(c2, c3); c1.Method1(); } class Class1 { readonly Class2 _class2; readonly Class3 _class3; public Class1(Class2 class2, Class3 class3) {...
I want to improve my multi-threading and design pattern skills. As such I'm designing an Instant Messaging server. I'm writing the Server first. My plan so far is to have Client "Proxy" Classes to handle the socket connection for each Client. I want to have an "Exchange" Class that takes a message from a Client Proxy a...
I am new to nopCommerce and ecommerce in general but I am involved in an ecommerce project. Now from my past experiences with RavenDB (which mostly were absolutely pleasant) and based on the needs of the business (fast changes with awkward business workflows) It seemed to be an appealing option to have RavenDB handling...
A HashMap allows only one null key. Is it because it allows only unique keys? Or is there another reason?
For some background of why I am asking this question here is an example. In python the method chain chains an arbitrary number of ranges together and makes them into one without making copies. Here is a link in case you don't understand it. I decided I would implement chain in c++ using variadic templates. As far as I ...
I'm involved in a project with several modules. I found that programmers have designed one module to be easily decoupled from its dependent modules using Java Reflection. If other modules need to call a method in this module, the programmers are expecting them to use reflection to call it. This has resulted in a lot of...
One minimal Kanban-like system has three places for cards: "To do", "In progress", "Done". As I've seen Scrum and Kanban on the web, it is maybe five or six categories. What are some of the common options for categories for Kanban and Scrum JIRA boards?
How can I unit test my generic repository? Unit testing code: [TestClass] public class UnitTestLanguage { private IUnityContainer _unityContainer; private IUnitOfWork _uow; private IGenericRepository<Language> _languageRepository; [TestInitialize] public void TestInitialize() { _unityC...
I'm learning C# using visual studio express 2012, and I cannot find a source online that explains window content convention. What I mean by this is, what's the appropriate way to change the context / pass variables from the main window to different contexts? I've been able to change the content of my window by creatin...
There are some well-known techniques for dealing with the notion of time in unit tests. These allow you to write unittests that always work with a specific time so the outcome of the test is predictable and can be verified. However, these techniques do not work with integration tests/UI test as the test and the applica...
I'm building a simple RESTful API for a web-based application I'm working on, and I'm wondering about the best way to go about exposing my domain models. Let's say I have a User class and I want to provide a JSON response with the various user properties. I obviously don't want to publicly expose every property of my m...
As Go seems able to performance match C and with Google obviously biased towards Go, I feel that it would be great way for Go to gain more traction. The way ChromiumOS/Chrome has jumped from an Ubuntu base to a Gentoo base, while they have the ability to avoid both and create exactly what they need from scratch, leads ...
I've noticed a lot of programming introductions (almost any language) usually include a heavy barrage of string manipulation quite early, such as: Count the number of "xx" in the given string. We'll say that overlapping is allowed, so "xxx" contains 2 "xx". Reverse the given string and remove all vowels from it. N...
I work for a company whose point-of-sale service uses IIS servers tied to static IP addresses at each of our stores. My boss wants a better real-time stat tracker than what the point-of-sale service provides. I would like to connect to these servers from a central location and retrieve the data. If possible, I'd like t...
I have recently started working for a pretty big bank writing internal apps. I am being subcontracted out by the company I work for (who I have also recently started working for). This bank has recently upgraded to Windows XP, they previously used Windows 2000. I have been tasked with re-writing a report viewing applic...
I'm currently managing and re-factoring a piece of software that has been used at my company for over a decade now. One of the elements of this application is a sort of admin or power-user mode which provides things like some additional/internal input as well as the ability to turn off input limits. Historically this ...
Here's the situation. I have an enterprise application that uses EF Codefirst to map POCOs to an existing database. This has been working fine so far. In fact I would say that it's been working really well. A situation has been introduced (out of my hands) that involves adding new tables to the database and/or new colu...
I'm a Java programmer, but I want to program in Jython. I've never coded in Python before, but have been looking through some tutorials and I'm fairly confident I can grasp it. My question is clarity over Jython. I understand with Jython you have the joys of writing Python code with the added bonus of accessing Java l...
Doctrine offers three ways to define the object mapping properties: in XML, in YAML and as inline docblock annotations in the code. The Doctrine documentation doesn't give any advice on choosing among them, but I'm specifically wondering if there is a generally accepted for best practice with regard to keeping mapping...
In the past couple of years, I've worked on two projects. The first one, we used a very agile methodology. It was very much developer driven. As such, changes were very quick and rapid. Code quality was high becuase it was a new system. There was an emphasis on group ownership of the project and knowledge sharing. Most...
I'm programming in Objective-C. I want to include a camera library, DLCImagePicker, in my project. There is a variable I need to change, but it is private and I have no access to it. I've thought of a few way to get around this, but am not sure on the best practice way to do it. I can just copy the code into my own cl...
I just started using GitHub to socialize some projects for simple chat and peer-to-peer apps. With respect to coding, is it customary to omit exception handling, error checking, logging, etc., to promote easy-to-understand and 'clean'-looking code, if those additions are not completely necessary to actually run the cod...
I want to create an application which is dependent on .NET Framework 4.5. If I am binding the framework with application setup the size of application increases to much but I need to bind the .NET Framework 4.5 with my setup. Is there any other option to bind the framework with application setup besides downloading it ...
This is part of a series of questions which focuses on the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. There is a sister project to Abstraction called OILexer, which aims to construct a parser from grammar files, without the use of code injection on mat...
I am working on a project where class internal calls are usual but the results are many times simple values. Example (not real code): public boolean findError(Set<Thing1> set1, Set<Thing2> set2) { if (!checkFirstCondition(set1, set2)) { return false; } if (!checkSecondCondition(set1, set2)) { return false...