instruction
stringlengths
34
19.9k
I am currently designing a web/mobile application the bulk of whose users will be distributed across the different U.S. time zones with a potential of scaling up to other countries and time zones as well I have worked with several other globally used apps and noticed they all used datetime to record timestamps with the...
Assume there is an HTTP server which accepts connections and then it has somehow wait for headers to be fully sent in. I wonder what is the most common way of implementing it and what are the rest pros and cons. I can only think of these: Many blocking workers are good because: It is more responsive. Easier to introdu...
In .NET Framework, localized strings are located in an XML file (or multiple files). Those files are part of the project and are committed to the source control as any other source code file. Usually, Visual Studio is used to display those files as a table and edit the localized strings. I work in a small team on a pro...
I have a simple C++ RPC that lets you have remote class instances that support live members (data structures) update as well as method calls. For example I had a class declared like this (pseudocode): class Sum{ public: RPC_FIELD(int lastSum); RPC_METHOD(int summ(int a, int b)) { lastSum = a + b; ...
My company uses a mix of onsite and increasingly offsite contractors for development of websites and online applications. Our platform uses a mix of open source software and libraries that we've made a number of modifications to over the years. Some of the modified software is licensed GPLv2 without the linking except...
I've seen it stated several times that AOT can run some more expensive optimizations that take too long to be used by a JIT. But I've never seen it stated what exactly these optimizations are. So I'm wondering, what are these optimizations?
The General Question What are the differences between algorithms using data structures and algorithms using databases? Some Context This is a question that has been bugging me for some time, and I have not been able to come up with a convincing answer for it. Currently, I am working on strengthening my understanding ...
Why is it that when I try to make an array of ArrayLists: ArrayList<Integer>[] arr=new ArrayList<Integer>[40]; there is an error and java does not allow this? Is there a reason related to java's implementation of generics, generics in any language, or something arbitrary?
The wikipedia articles are too advanced for me to understand, could someone give me a simple explanation please?
Background I have a business question regarding web-based software licensing. A number of web sites offer software as a service for various APIs. A good example is Google's Custom Search API. The process to use web services typically resembles: Account. User creates an account. Server. User defines the IP address(es) ...
I gave up on programming a little over a year ago when I kept hitting this wall. I am revisiting the subject because I want to create basic Android application. But I feel that my limited knowledge will not suffice. Here is my problem. I have read a few books and watched video tutorials on C#/Java, followed examples, ...
ROM - Read Only Memory Does this term mean the memory which should only be read and not written to , or the memory which can only be read ? "ROM in PC's and laptops are usually seperate chips in the motherboard where BIOS is present (Please correct me if I am wrong) . Can they be overwritten (I guess we can) ? When we ...
During a recent code review I was asked to put default cases in all the files wherever switch block is used, even if there is nothing to do in default. That means I have to put the default case and write nothing in it. Is this the right thing to do? What purpose would it serve?
I've basically stared to do the following when creating a REST service: HTML is requested service returns the desired web page but without the requested "resource", eg. data web page contains JavaScript that issues AJAX request to the same service (different content-type) service then returns the actual data (JSON) an...
Could Ruby on Rails have been created in another language like PHP, or are there some functions in the Ruby language that make the difference?
We're trying to move our project documentation process from Google Documents to a set of self-hosted Git repositories. Text documents are Git-friendly enough, since we usually do not need any fancy formatting, we'll just convert everything to, say, multimarkdown with an option to embed LaTeX for complex cases. But spre...
I'm to write an event correlator module for the device we produce. When a fault occurs the resulting avalanche of logs about derivative conditions from various modules is readable only to a person skilled in the task - a layman will be utterly lost. The event correlator is supposed to solve this problem - find root cau...
Lately there have been some kind of revolution against singletons, but is there something wrong with them if they are stateless? I know the overuse talk and all... this applies to everything not just singletons.
I want to apologize in advance if my headline is not specific enough, but I think this is a general question, although I have a very concrete example: In my team we maintain a test specification which we use every time we release software. The specification is written in Word and, as a consequence, we occasionally have...
I presume it's that way so it could be extended with custom algorithms, but wouldn't it be more convenient to apply, let's say, factory method pattern here and avoid the whole NoSuchAlgorithmException thing? Something like: MessageDigest.getMD5Algorithm(); or MessageDigest.getInstance(DigestAlgorithmFactory.getMD5Al...
I have just started reading C++, and I came across a term "Null Terminated String", I read about it but couldn't understand what it actually stands for. I also want to know what is the difference between a c-string(also referred as "Null terminated String") and a c++ string.
Let's say I have a product that has different features, or different feature access depending on things (i.e Premium User, Beta, Demo, Logged-in User, etc..). What's the best way to organize a system to where it's not a set of static checks (i.e a bunch of if statements, for example)? The platform isn't important, I'm ...
How to represent rules for a rule engine as objects? A rule would be if (booleanExpression(input)) then a chain of generic actions" else next rule ...where the generic actions might be e.g. passing the input to a different chain of rules, returning a conclusion (terminating analysis with result), or gathering additi...
gdb implemented support for reverse debugging in 2009 (with gdb 7.0). I never heard about it until 2012. Now I find it extremely useful for certain types of debugging problems. I wished that I heard of it before. Correct me if I'm wrong but my impression is that the technique is still rarely used and most people don't ...
I'm trying to do research on these css preprocessors. Are there any advantages of using sass over less as a css preprocessor? Factors that i'm looking for include community size, software project maturity, etc. I know there was another question related to this, but it was not constructively written and closed. Update L...
I have a print operation to perform for my customer documents. I need the other standard operations to be performed as well, like add,update, delete. so, I have following: For creating new customer:URI = /customer/{id}, type = POST, Methodname = CreateCustomer() For updating:URI: /customer/{id}, type = PUT, method = ...
Edit *We have a heart monitor hooked up to to an msp430 with a roving networks wifi module. I would like to connect send some type of a datastream to a webserver so that someone could watch it offsite. I would like to have a datastreaming connection or something to the webserver because I was thinking it is more natura...
In some javascript code I'm working on refactoring I've handled cases where I wanted to default an object property to true without having to go through the code-base and add the property to every instance of the object by doing something like this: if(typeof(thisBool) === 'undefined' || thisBool) { //do cool stuff ...
This question branches out of this question, What are the differences between algorithms using data structures and algorithms using databases?. The General Question Should a database table(s) structure match its intended data structure(s) in the logic? Some Context The simplest example (and it may be oversimplified) of...
The Two Projects I work at a pretty small software company, and I'm currently in a situation where I'm at the end of development for "Project A", about to start development for "Project B". Project B is supposed to be an "extension" of Project A (both are primarily web apps). In Project B, the plan is to not only add b...
I often hear people say that C++ programmers should expose their library's/product's public API as a C API. What does that mean and what are the advantages of that?
Where I work I see lots of classes that do things like this: public class ClassThatCallsItsOwnGettersAndSetters { private String field; public String getField() { return field; } public void setField(String field) { this.field = field; } public void methodWithLogic() { ...
Theoretically, if I were to build a program that allocated all the unused memory on a system, and continued to request more and more memory as other applications released memory that they no longer need, would it be possible to read recently released memory from another applications? Or is this somehow protected by mod...
I am interviewing for a PL/SQL position with a large corporation. I will have to write a multiple choice exam. I am wondering whether the exam will likely use old-style joins (joining happens in the 'WHERE' clause) or ANSI ones. My apologies if this is not the correct forum for this question.
I'm trying to really master Haskell error handling, and I've gotten to the point where I don't understand why I would use Control.Exception instead of Control.Monad.Error. The way I can see it, I can catch Control.Monad.Error exceptions in both pure and impure contexts. By contrast, exceptions defined in Control.Excep...
I have written an extensible c++ wrapper around a very hard to use but also very useful c library. The goal is to have the convience of c++ for allocating the object, exposing its properties, deallocating the object, copy semantics etc... The problem is this: sometimes the c library wants the underlying object (a point...
Consider someone is writing a message (or a question at StackOverflow). The context is following: In my code, I have the following line: int foo = Bar(); However, the compiler returns an error: line 42: Bar() is unknown function I'm puzzled to choose a proper verb instead of "returns". I've seen people using various ...
I need to write a web application that acts as a configuration interface for some system services. Meaning it will probably change some kind of configuration file and has to restart (linux) system services. I was wondering how to design such a thing in a secure way. It is very similar to router web interfaces and such,...
I am building a tutoring application that multiple students can sign into the same session with a tutor. My question is, for example, if I sent out a command to draw a line, do I need to wait to see that all connected students propagated the command. Now, it relies that requests will be processed in order. But consid...
When I read about frontends, it always mentiones webpages. Can it be used in different contexts, e.g. desktop applications?
I'm a bit surprised by a sentence found in the book "Clojure Programming" (1st [and only as I write this!?] edition), page 78: It should be obvious that it's impossible to deterministically test a function that depends upon a random number generator Well, to me it's not obvious at all. First in the context the book...
I am frequently tempted to wrap integers, etc, solely for the purpose of writing methods that can return null. Negative 1 can work in many cases, but too often (especially in sound) it's a valid return value. Often, to get around this, I am returning a reference to a larger object that contains the primitive in questio...
I would like the answer to explain what impact, if any, does the type of company/industry have on the rigor, depth and breadth with which software engineering is practiced. The best would be some links to support the answer with references. As a control point, let's declare an assumption that a company which follows t...
I've been learning SQL recently and practicing with MySQL/Postgres and soon Oracle DB. I've also search the web for a 'road map' study of databases but couldn't find one, unfortunately. I want to understand where and why particular database concepts fall on the scale from beginner to intermediate and advanced. I'm thi...
Our team is going to adopt scrum and agile technics. We've got a product, which we develop for multiple customers. This customers supplied us with necessary requirements, so everithing is fine to adopt agile techinics. But at some moment (for example during sprint), new customer apears, and he wants to get a demo of pr...
I have a method which has external dependencies within the method. Please help me in writing a junit test case for the below program. @Override public void methodToTest(String user){ //fetch the values from the properties file. Config class has a static method called //getProperty which reads the v...
If 2 classes have the following in common: part of how their state is represented (both have a linear container) multiple identical methods (identical code, not just signature) But are not substitutable, ie: they play different roles. Then how do I avoid repeating those methods? The obvious solution would be inherita...
In JSF if I have a component that conditionally renders based on a number of variables what is the optimal way to handle the render statement... should the logic live in the component declaration or in some form of helper class? The text woof is only displayed when an animal is an elephant or dog and the animal is not ...
Can python be efficiently implemented in big data field? To be precise I am building an web app that analyses really big data in medical health care field consisting of medical history and huge personal information. I need some advice on how to handle very big data in python efficiently and with high performance. Also ...
How does the Law of Demeter applied to object-oriented systems with coupling and cohesion? I was reading a book "Software development and professional practice" and came across the chapter about LoD, and was curious about how that principle is applied into object oriented systems.
I have some confusion regarding the use of static variables/references in a class. It feels like I may not have entirely figured out the implications of keeping something static. When I say a variable is public static, is it one instance of the variable per class or one instance per assembly? For example, I have a user...
Context: Finding company to do the job The use case of an application I want to write is that a user will describe a task to be performed by some company, e.g., I want to move 10 boxes (30x40x50cm) of books and clothes from London to Bristol next week. How much would that cost? and the application will find candida...
I'm building a little framework, currently it is just for fun. I'm wondering how should I implement classes that should be instantiated by the framework and be passed to the controller to use? For instance: I have an "input" class that houses functions which take POST and GET data and filter it. The class is also used...
After you have done a good normalization, do you still need to index the table? How is this going to affect the performance? Will it even affect the performance in some way after a good normalization? Which columns are usually indexed if you already have the primary key and the foreign key? It's seems like it's alread...
I want to implement a security system into my web-based Intranet application which allows security administrators to 'fine-tune' exactly what type of access a user/role has to an object. For example, an ACL-based solution might allow a receptionist access to Create, Read and Update an appointment but not Delete it, sim...
I think this article, A Successful Git Branching Model, is very well known among experienced DVCS users. I use hg mostly, but I would argue this discussion is fine for any DVCS. Our current workflow is each developer clones the master repo. We write code on our own local repo, runs tests, and if all goes well pushes t...
I am trying to find best way to validate a mobile number with in a country. Currently my understanding is: User can enter whatever format they want in mobile numbers and its a waste of time and energy to validate it against a set of regular expressions. My application is not a critical one like banking application and ...
My clients wants to take pictures with their iPhone's and place them collectible on their server, suggested by FTP. I can see there is two solutions: Directly upload from the iPhone to the FTP server. My colleague can make so the get the ActiveDirectery username and password, so they do not use the same password all o...
I've recently found myself frequently in the position where I'm checking both bug fixes by other programmers, and bugs raised by the QA team. Any bug fixes frequently end up having 'collateral damage', and I've found it invaluable to go through any recent fixes, and analyze what other parts of the system could potentia...
I just refactored my project's entire codebase. So much so that even though it uses most of the same code base, things work in a radically different way. If the old version was 1.0, the new one would be 2.0. The project itself is just under 1mb in size (its a tiny little lib). I started the project a long time ago and ...
We might be interested in starting to incorporate a unit test suite to our project, which is coded in Python (and it uses Redis, PostgreSQL and some third-party libraries, if that bears into the solution). The benefits we want to achieve are: Once the project is up to speed, we want to be able to specify new behavior...
I recently created a site in SharePoint and I need to setup a maintenance/support agreement for the site. In addition to the site, there are some custom modules that were developed that we monitor. What considerations should I be making when determining how much to charge for supporting the SharePoint site and any cust...
I want to publish a small web project that is supposed to contain some of my research results to present it to the scientific community. All my analysis I ran so far have been written in python already, thus I considered to use django web framework to provide the results. This is, because I plan to show some visualizat...
I've written an iOS app, and I'd like to release it on to the App Store. I'm an individual so it's not being released via a company or anything, just me. Is it typical to just release a free app under your own name? If so, what would be appropriate copyright information to submit?
I'm rather new to C, and I'm wondering if code duplication is a necessary evil when it comes to writing common data structures and C in general? I could try to write a generic implementation for a hash map for example, but I'm always finding the end result to be messy. I could also write a specialized implementation ju...
One of the differences between svn and git is the ability to control access to the repository. It's hard to compare the two because there is a difference of perspective about who should be allowed to commit changes at all! This question is about using git as a centralized repository for a team at a company somewhere. ...
Overview I am working on a client-server application. The client is written in C++ (working on Windows, planning to support Linux) and the server is a .NET RESTful service. I need to HTTP POST some data to the server. The data is a unicode string that I need to compress using any fast compression algorithm (needs to be...
I have a tiny project (<1k but let's say its <5k of lines). I made it open source and put it on github. I did this once before and I didn't get a single download nor fork but that was very specific and this tiny project is very useable to other programmers. It's open source (let's say LGPL, GPL, public domain or somewh...
Having read a post yesterday, I realized I did not know much about the origin of exceptions. Is it an OOP related concept only? I tend to think it is, but again there are database exceptions.
I remember once reading some research where a body of C code had been analysed, and the findings were that the vast majority of for loops could be categorised into about five categories, corresponding to the functional equivalents of map, filter, fold, etc. I can't seem to find this paper/article anymore. Can anyone po...
As far as I understand, both Scala and Clojure have been designed as new languages that depend on the JVM, and easily integrate with Java code, in the sense that they allow to use Java classes inside Scala and Clojure code. Starting with Java 8 (and maybe even more strongly with subsequent versions of Java), there wi...
I'm writing a GUI application. The user selects item from a comboBox (non editable). The suitable input data control is then enabled and user enters data. Then the appropriate object according to the comboBox selected item is created. I've thought of using String[] array to display the list of choices and then using ...
For developers with extensive experience using mocks, is it okay to mock multiple objects in one class (ie satisfy multiple interfaces) or is this not recommended? I am wondering because mocks are stubs anyway, from a testing perspective, it doesn't seem to make a big difference if I consolidate mocks. However, I do wo...
Here's an API concept which could be useful for performance optimisation. It's an example of key-based cache expiry applied to a broader internet-wide context instead of the internal Memcached-style scenario it seems to be mostly used for. I want to make API calls almost as cacheable as static images. Using a news/feed...
I'm developing an application handling DB parts. I retrieve the data from the DB with stored procedures and prepared statements. Now I want to display the data in the GUI. What is the current technology used for that? Does one still use DataSet and DataTable for that?
I am building an app that analyzes posts by people by pulling their Tweets and Facebook posts. I need to process all the posts and find useful phrases. What I mean by useful is that, any word or phrase that is a noun/adjective/verb that would represent a discrete object or an idea, or in other words, I am looking for k...
Currently I want to structure a tracking/history table like this: PrimaryKey - ID OtherTableId - fk fieldName - name of the field its tracking OldValue NewValue UserName CreateDateTime So basically I want to have a table that will track another tables history, store the column name of the changed field with the new a...
I'm a Web Developer about to unlock the "First Class Library Published" achievement in my career and I'm sweating bullets (I was up all night stressing out). I'd love to tap the experience of the community to see if anyone has any suggestions or recommendations for making sure this goes as smoothly as possible. Are t...
So every number in the code that we are sending to a method as an argument is considered as a Magic Number? To me, it shouldn't. I think if some number is let's say it is for minimum length of user name and we start using "6" in the code...then yeah we have a maintenance problem and here "6" is a magic number....but ...
This image is taken from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET This is the class diagram for the State Pattern where a SalesOrder can have different states during its life time. Only certain transitions are allowed between the different states. Now the OrderState class is an abstract...
Persistence ignorance is ability to retrieve/persist standard objects, where standard objects are considered as classes focused on particular business problem and thus don't contain any infrastructure-related logic. In DDD a Repository pattern is used to achieve PI. Assuming we don't use ORM's POCO objects to model th...
I have recently witnessed more and more problems similar to the ones explained in this article on feature intersections. Another term for it would be product lines, though I tend to attribute these to actually different products, whereas I usually encounter these problems in the form of possible product configurations....
Possible Duplicate: How to open-source a project whose git repository has copyrighted media in the history? Our company has spent a year working on an internal web application and has decided to open source the project and host on github. The application was originally versioned with Bazaar and we are going to prese...
I have developed a website in asp.net and I have some additional tasks, improvements to develop. In order to get experience in asp.net/mvc, I want to create an admin panel using asp.net mvc. Is this a logical next step? P.S. The project is small and 20% of the website is mine, so there are not any restrictions. Ther...
In this talk, Guido van Rossum is talking (27:30) about attempts to write a compiler for Python code, commenting on it saying: turns out it's not so easy to write a compiler that maintains all the nice dynamic typing properties and also maintains semantic correctness of your program, so that it actually does the s...
I'm fairly new to the MVVM concept but like a lot of the flexibility it gives me so far. However, I'm struggling to find a good way to manage my code. I have several classes that are just sitting in a folder in my solution such as xxxView.cs, xxxViewModel.cs, yyyView.cs, yyyViewModel.cs, zzzView.cs, zzzViewModel.cs y...
This is about the use of personas, primarily in the agile development realm. What value, if any, do personas give during implementation? On agile modeling, the discussion about personas remains in the context of requirements investigation. On wikipedia, the benefits are described to "assist with brainstorming, use case...
BACKGROUND: I am starting to architect a web project using asp.net mvc. I'm going to use a very common architecture where I have the following layers: Service Biz Data Domain The Service layer interacts with the Biz, Data and Domain layers. The mvc controllers will have the service layer injected into them using ...
Question and Context I am currently working on a project where the main question is, how do we insert an API between the database and end-users who may develop applications/scripts of their own that will work with or on top of the database? The database type I am working with is Postgresql, and this project is in-house...
Take a look at Google, Windows 8, etc. Why does everything look so plain now? Looks really ugly to me. Is it all because of smartphones and tablets? Do I have to follow that trend?
In a sense, 10! (ten factorial) represents an approximate dividing line between things which are practical to compute and things which are not. This is from Knuth's TAOCP Fundamental Algorithms book (1973). Is this still a valid statement or has computing power rendered it obsolete ?
To get an idea of the quality of a project that I've never seen before (usually open source projects that I'm considering whether or not to use), I often start by opening random files and eyeballing fine details of the code. I look for things like: Style (does it follow accepted conventions for the language and is it ...
On my mobile app, I am storing the username of a logged in person, and downloading some data for the given/stored username. When the user checks for updates to his data content on the server, the server dishes out a delta of the content, based on the username. The app then updates its local display accordingly. The pro...
In a program I am developing, I need to use an improved ListView. The ObjectListView seems to satisfy my needs, except it is GPL and thus unusable in my commercial application. I believe, however, that we can develop our own replacement in-house, using the documentation from the site, without looking at the code. Is th...
Recently I realized that the most popular social platforms on the net are in the hand of just a few companies, Google, Twitter, Facebook, to name just a few. Taking into account the world changing power of these frameworks I am looking for a non-profit, democratic alternatives to these sites. (Mozilla is a non-profit p...
I am writing unit tests for a library written in Qt/C++. The library is rather big, with lots of functionalities. I have a separate unitTest folder which I have my UnitTest.cpp in there. Having all test case / unit tests in the same file, makes it one very big .cpp file. I was wondering what is the best approach to uni...
As per my knowledge daemon thread is a thread that runs in background(low priority thread) and also a child thread runs in the background when the parent thread runs foreground so where does the difference lie between a child and a daemon thread? It's in case of java and can you explain referring to other languages too...
I'm to write an event correlator. A fundamental part of the system will be a decision tree that recognizes the origin of the fault basing on recorded states and log files. Often many accidents will differ with minor details and many decisions taken will be made basing on fuzzy, incomplete or unreliable data, but most o...
My team and I are using Scrum to manage software development projects. In my company there has been a move towards more structure in all IT projects using a waterfall methodology. This is fine by me as there are lots of non-software-development projects which will benefit greatly from this and it is not threatening ou...
Obviously, testing methods are language-independent. An integration test stays an integration test no matter what the technology. But platforms implement some kinds of testing support. And the details vary between implementations, so a programmer has to learn how to use the tools of their framework. And platforms evol...