instruction
stringlengths
34
19.9k
Reading about various techie sites, there is often a feeling that Microsoft Languages / Oracle etc. are considered "enterprise ready", while there seems to be more doubt about languages such as Python or Ruby. Why is this? Do Microsoft languages actually have less security holes or not?
To write Unit Tests we have to write extra bits of code. For several projects we do Unit Tests and for several projects we do not. As a Team Leader I face trouble to make the right decision. Is there any or list of terms by which I can take the right decision whether we will do Unit tests or not? EDIT: Please provide ...
Disclaimer: Opinions expressed are solely my own and do not express the views or opinions of my employer. I work for a small company, in which few people are developers, others are QA/Test and 1 is a Manager. I joined this company 1.5 years ago. 3 senior developers have 8+ years of experience. These are the observati...
This is a bit pedantic, but I've seen some people use Id as in: private int userId; public int getUserId(); and others use: private int userID; public int getUserID(); Is one of these a better name than the other? Why? I've seen this done very inconsistently in large projects. If I were to set a standard which would ...
I have a class in which I want to disallow other programmers from overriding one of it's methods, since it requires special knowledge of the inner workings of the class. Since I personally know how the class works, I would like to be able to make an exception and actually DO override the function in one derived class. ...
I read few articles about composite pattern and I want to know whether its applicable in following situation, I found that "A Composite Entity object can represent a coarse-grained object and all its related dependent objects" public class PatientRegistrationDTO { public string RegistrationNo; public string ID;...
Where does the word "argument" (in the programming sense) come from? i.e. Why are actual parameters called "arguments"? The meanings don't seem related, and I haven't found any explanation of it anywhere. Note on the terminology: "Formal" parameters (also known simply as "parameters") are the "placeholder" names ...
I would like to sell a software that has some open source competitors. Therefore I would like to include the source code with the binaries so that the company buying it can modify it as it wishes. The only catch is that the source code will NOT belong to the company, in other words, I would like to maintain the copyrig...
I've implemented an application using MVP with GWT, which is working out very nicely for views that have a single purpose. Now, it has evolved into views that are achieving multiple purposes in a single window. So now I have a view of views with each view having its own presenter. I used this example as my model for...
We've built a single-tenant webapp in PHP and as it stands each hosted 'site' has its own database. However we need to be able to run a script to create their database, assign a mysql user, and insert the default sql. Now, we've got the database and user stuff working fine, its just the importing of the SQL. From what...
As I find that UpperCase are really readable for first letter word separation in long complex names, I tend to give some of my Linux files names with some UpperCase. Mostly executables, some directories too. But it's been a few weeks I have remarked that the huge majority off all file names in my linux distrib are lowe...
I am writing an application to report to the user(devs) when their website fails. And what I mean by fails which is unfunctional or needs to report the problem to devs. I do understand that status code 2XX means 'Success' according to wiki. But does that really do? I have access my website once and returned 204 'No-Con...
Let's say we have a method setFoo that sets a flag in a Bar object e.g. class Baz { public void setFoo(String foo)( ... } } inside setFoo, the method is doing some expensive load of the Bar object from the database. class Baz { public void setFoo(String foo)( Bar bar = expensiveGetBar(); ...
I get stuck each time I need to write a constructor for any class I design. The reason is that I am not sure what should go into a constructor and what should not. On googling for this, I got the answer that the constructor need to do only as much as to make sure that the opbect created is valid. But my query is How ...
Considering how software is developed during a release cycle (implementation, testing, bug fixing, release) I was thinking that one should be able to see some pattern in the lines of code that are changed in the code base; e.g. towards the end of a project, if the code becomes more stable, one should see that fewer lin...
When having a continuous integration executing the tests at each commit, a common best practice is to have all the tests passing at all times (aka "do not break the build"). I find some problems with that: For example one cannot help an open source project by creating tests corresponding to tickets. I know if I propose...
my question is going to be somewhat philosophical and "architectural oriented" so bear with me. Right now we have existing Java web application built on top of Spring and JSF(facelets) with maven. These are basically our tools that limit our scope of possible solutions. Now to the point. We need to implement a fork of ...
Are there any practical references (with actual examples) for getting started implementing a small, lazy functional programming language with graph reduction? A reference that included the lexing and parsing steps would be especially helpful. So far I've read most of the Implementation of Functional Programming Languag...
When using a MVC pattern for server side code (in my case django), the model definition is defined once in the model component. When using a client side MVC based library(in my case backbone) the model definition or some subset is redefined. If I were to make a change to my server side model definition, let's say add a...
I am developing a Mojo(think it as just a usual class) for my custom Maven Plugin. There is an Abstract Mojo at top. I have some other custom Mojos in example which makes server side includes. I have some static variables and some util methods in example get operating system name, fix file separator in order to used op...
I've been researching puppet lately, and I think it could be useful to integrate into my deployment pipeline. Currently, I deploy my apps by manually adding users, creating vhosts, setting directories, and then git cloning my repo from GitHub. I deploy changes with a simple Git pull (Git hooks take care of database mig...
I am about to participate in a discussion with management regarding measuring our testing efficiency as a QA organization. The main reason behind this is that half of our team is contracted out and our business would like to provide some metrics of how effective/efficient we are, so that we have basis data on which to ...
My Project: I have employees who are required to go through a checklist when they encounter a duck, a cat, and a human. In our business, we have a set number of ducks, cats, and humans that come in and out of our doors. When they come in, we have to check that all of these features are present. The features: Here is o...
It seems like most of the Scrum articles and books that I've read as well as the lectures I've heard have very little to say about the process of creating the items on the backlog. How should a team on a medium or large project (i.e. more than a few team members) go about creating and detailing the items on the backlog...
I'm wondering what's the reasoning behind Bootstrap's decision to change all camel case names into hyphenated names in v3.0. I searched on Google, and looked in a few books, but I can only find opinions one way or the other - no hard data. Are there any studies that suggest camel case variable names are more readable t...
I've noticed that a coworker and I have opposite practices regarding the ordering of methods in our Java classes. One of us begins a class with its major public methods, and then put all of the private helpers afterwards. The other one of us makes sure that public methods are at the very end. Clearly, this is just a st...
I know this has a great chance of being marked as duplicate, but couldn't find exactly what I'm looking for This is a common problem and I'm sure it has some well defined best practice solution Background A single page SaaS app, has lot's of drag and drop, user can interact with it without much server communication fo...
I am currently working on a project that makes use of the OpenSSL library for secure communications. Since this library is a requirement for building the project, I am considering including it in the project's repository. Here are the pros and cons as I see them: Pros: Self-contained build - with one exception, everyt...
I have read at many places including this - http://msdn.microsoft.com/en-us/library/seyhszts.aspx - that you should use exception handling when something is truly exceptional. The .Net File.Open function throws FileNotFoundException, etc. instead of returning error codes. Now it can frequently happen that the filename ...
Consider the following code, in which the setter is deliberately broken due to a mundane programming error that I have made for real a few times in the past: <?php class TestClass { private $testField; function setField($newVal) { $testField = $newVal; // deliberately brok...
Let me preface this with saying I am not a Business Intelligence (BI) developer. I'm a .NET developer, and I have only a vague notion of what BI is, and encompasses. I've been an evangelist for a secure development lifecycle in our company, and recently convinced the rest of the development team that we should be doin...
C is the best language (or maybe the single language) suitable for operating systems, drivers, embedded systems etc. For more complex domains like computer graphics C++ is a better choice. But these applications have thorough performance requirements and they are only feasible to be built in C/C++. Now the question is,...
I wrote this class that does a few things (perhaps this is a violation of the Single Responsibility Principle). I realize now that some other part of the project needs a piece of that logic and the way I'm going to expose it is to extract a class out of my original System Under Test. I anticipate being able to do this...
I wrote a sync tool to synchronize folders/files from Alfresco to Windows. PROBLEM: In Alfresco, /files/can/have/very/very/very/long/filepaths/like/this.txt The Windows API prevents me from creating a path with more than 260 characters. In addition to telling the user there is a problem, what is the best practice in ...
Just moved this question from Stack Overflow. Since, adding my code snippets itself would make this question really long. Instead, I am pretty interested in knowing a better ways for data retrieval on application that needs to handle limited amount of data which isn't updated regularly. Let's take this example: I am wr...
I'm building a web-app where users can keep track of who owes whom money. I have users and debts. Given a user I want to be able to find out all the debts to other users, and all the loans to other users. Given a debt I want to be able to find out who the debtor and lender are. The asker of this question ran into a sim...
I have across a thread mentioning that Erlang would not be suited for a web application serving files. I was curious whether anyone had any experience building such webservice with erlang? Would Haskell be more suited for this, if so how ?
I have a site where a regular user can delete records, where what happens is that an IsDeleted flag gets set. On administrative pages, a privileged user can delete records where an actual SQL DELETE permanently discards such records. The difference is important for obvious reasons, and I want to use a consistent term t...
I have started a project where I need to design an application that will work as a code-block editor, much like lego mindstorms and this google project. http://code.google.com/p/blockly/ What are the possible approaches for designing such an application in Java? More specifically, assuming I have one block A, how can I...
I would like to study the source code of the standard command line functions in Linux such as ls, echo, cat, etc. But I have been unable to find the source code (a Google search was useless). Does someone know where it's available? I know it's a naive question but I really can't find this source code.
I am a young engineer recently employed at a small company that sells products to the general public. We use Ruby On Rails and MySQL. Our database has a lot of customer data, but a great deal more of "static" persistent data. This data is so rarely changed that some of the more senior engineers have begun to talk about...
I've always been taught that having side-effects in an if condition are bad. What I mean is; if (conditionThenHandle()) { // do effectively nothing } ... as opposed to; if (condition()) { handle(); } ... and I understand that, and my collegues are happy because I don't do it, and we all go home at 17:00 on a ...
In C# it is legal to write Animal[] a = new Giraffe[4]; //with obvious relationships Because arrays are covariant. However, this is a breaking relationship. It's a runtime exception to then apply a different type of Animal to this array because the backing store is a Giraffe. a[0] = new Cat(); //KABOOM Why doesn'...
Say I have: interface Thing { GetThing(); } class FastThing : Thing { public int GetThing() { return 1; } } class SlowThing : Thing { public int GetThing() { return GetThingFromDatabase(); } } Is this a violation of the Liskov Substitution Principle?
On a number line of length M, where 0 < M <= 1,000,000,000, you given N (1 < N <= 100,000) integer pairs of points. In each pair, the first point represents where an object is currently located, and the second point represents where an object should be moved. (Keep in mind the second point may be smaller than the first...
I am deeply confused the difference. I've read so many definitions and they always explain functional test as testing the requirement is satisfied. Well, that's just rephrasing the name functional test. That doesn't clarify the difference. I am interested in some real code to demonstrate the difference. Suppose we have...
Erlang, Go, and Rust all claim in one way or another that they support concurrent programming with cheap "threads"/coroutines. The Go FAQ states: It is practical to create hundreds of thousands of goroutines in the same address space. The Rust Tutorial says: Because tasks are significantly cheaper to create than t...
If a server certificate is published to Github, a la: -----BEGIN CERTIFICATE----- is that necessarily a bad thing? Is there ever a legitimate reason to do this? I ask because of a recent wave of attention Github has gotten since allowing users to search for certain things as .ssh/id.rsa and the like in public reposito...
I have a Silverlight application that uses Entity Framework. The application are protected with a login made in ASP, so only valid users get the xap file. Have do I secure the WCF calls to the Entity Framework? I have to make the calls over https, but have can i make sure that only valid users can get data from the WC...
I'm starting a game project in C++ using the SFML. It provides various classes for handling graphics, input, etc, but I would like to wrap it all up in a single Media class. I believe that by doing so, I could simplify my effort and have the class take care of the details, limiting the amount of code I have to write an...
I'm doing a full-time job (developer) and at the end of the day, I work on my part-time job (developer). How do you work, with different projects, without loosing focus? Often, my focus on the full-time job still remains at my head when working on my part-time job or the other way around.
I've read plenty of articles around different patterns in use with WPF and this is something I've yet to understand: should a code-behind file be considered part of the view? As a consequence, should code-behind files be allowed utilise knowledge of specific elements in the markup? I have a number of scenarios where th...
I'm rewriting somebody else's code at the minute, and I came across two classes which reference each other directly and call methods on each other. Like so (example in C#): class A { B otherClass; public A() { this.otherClass = new B(this); } // Other methods here call methods on B } class B { A otherCla...
I've been programming in various languages for about 10 years now. And I still haven't figured out when it is a good idea to import something into the global namespace (using x::y in C++, from x import y in Python etc.), so I hardly ever do it. It almost always seems like a bad idea to me, if only because it limits the...
I want to know the differences between normative and informative annexes in Ada 95. I am just able to find a list of each of them but not the differences. What are the differences?
I have a problem with Visual Studio 2012 and Environment Variables under Windows 7. I added a variable called {LIBS} with the value C:/libs/. In C:/libs/ are folders containing C++ libraries. So far, so good. I added the paths to the project's settings (linker etc.), like {$LIBS}boost to include the boost libraries. I ...
In the long debate of using arrays vs lists in the public API of Java classes, I tend to prefer lists in most situations. However, I also found convenient to use var arguments in many constructors and methods, which require declaring an argument of the method (the last one) as an array (implicitly adding "..." before t...
Years ago, I used to suggest Visual Basic 6 to rank beginners as a way to learn what programming is. Key point: This was NOT for career training, but just as a primer to the basic concepts of programming. I subscribe to the KISS principle (many programmers do not) Detest Microsoft as we may, the instant graphical...
I plan on migrating a website from PHP to ASP .NET MVC. However, since the website is large and this migration can't be done in a short time I plan to use both MVC and PHP pages together. So the idea is to replace each PHP page or group of pages with an MVC equivalent. I have to refactor each page and rewrite it overa...
I'm interested in the conceptual (programming language agnostic problem) process of sending a game object to another player of the game in exchange for another game object without a face-to-face online presence of both parties. This should be done so that in theory in game exploitation of inherent bugs of the trading s...
This is one of the definitions that I asw for user stories - When the time has come for creating user stories, one of the developers (or the product owner in Scrum) gets together with a customer representative. The customer is responsible for formulating the user stories. The developer may use a series of questions to ...
Some development teams in my company are switching to Agile development practices and their developers' work seem to be diminishing to discuss and program minutia about trivial software features because of two week iteration cycles. And also because of "any developer can fix any bug" mentality. I have recently joined o...
I'm developing a suite of software tools that I need help with which is why I want to release my software open-source. People should be able to use and modify my code as they please while contributing to my project. Ultimately, the tools that I develop will require a paid commercial license, but may be free to those fo...
When I read pro and con lists of using Entity Framework (or any modern ORM really), I'm surprised that the following point doesn't arise (self quote): Using strongly-typed domain entities allows for type checking at compile-time which essentially performs a verification of all your database operations. This is so...
I am doing some research on the ScalableColor descriptor in MPEG-7 and I came across this passage: The descriptor extractions starts with the computation of the colour historgam with 25 bins in the HSV colour space with the Hue (H) component quantised to 16 bins, and Saturation (S) and Value (V) quantised to 4 ...
What traits / skills does the Business Intelligence Developer role expect over a traditional Web Developer role?
I'm currently working on a project that need to be dynamically scaled on demand according to the need. My question is about scaling spring context. My web application has a classical multi module core (service, persistence, domain), which use use by client application (webapp, api). The user end application could be cl...
This may be very naive, but I was wondering, it the context of binary trees (plain, sorted and balanced), of all the traversal types: depth-first pre-order depth-first in-order depth-first post-order breadth-first what's the actual utility of pre and post-order ones? I mean, is there some type and/or configuration of...
Recently i was re-visiting the basic concepts of operating systems. Since I am a java developer, I have inherently started looking at everything from java point of view. I am also reading 'Inside the JVM fundamentals' from http://www.artima.com/insidejvm/ed2/jvm.html so when I see the basics of operating systems and JV...
We have a tricky question in a project using Java & Hibernate, with a model containing bi-directional relationships. As it's a small project with few users, few entities, and few rows involved in relationships (not more than 100 in 1-n relationships), we don't really need a 2nd level cache. Operations done with entiti...
The organisation I work for has recently employed a testing officer to run manual tests, but when I asked about being given time as a developer to write unit tests the response was that the manual testing would provide a bigger bang for the buck. That is something that feels wrong to me and I'm looking for a means to r...
I know that when building applications (native or web) such as those in the Apple AppStore or Google Play app store that it's very common to use a Model-View-Controller architecture. However, is it reasonable to also create applications using the Component-Entity-System architecture common in game engines?
I have a list of varying length where items is strings of varying length. I want to print them by (a mirrored N)/order by column. Major points being: Columns shall have fixed width == widest data in that column. It shall be as compact as possible. Number of columns is varying/induced by available width of canvas. Or...
I've recently been working on a project and I've been seeing two different forms of url's being used. src="../MyLinkUrl" and src="/MyLinkUrl" We are using MVC .NET and the times I have seen the .. usages have been in Javascript code files and not when it's been generated by the MVC URL helpers. Typically the usages ...
Has anybody got an idea why the area of main memory where objects are allocated is referred to as the heap. I can understand the rationale for that of the stack LIFO but would like to know what the rationale is for the 'heap' name.
I'm using Shiro as my security manager for a Spring MVC web application. The login basically happens in these lines: Subject user = SecurityUtils.getSubject(); user.login(new UsernamePasswordToken(username, password)); Where should I put this logic? login() can throw exceptions if the requested user doesn't exist or ...
This website is supposed to be a game where the players have some 'buildings' and these buildings produce resources. E.g. an iron mine may produce 30 pieces of iron ore per minute and automatically add it to the user's inventory. It doesn't matter whether the user is online or not, it should be running 24/7. So when th...
I have a silverlight app that connects to a entity framework over WCF ria service. These calls have to be secure. What can I do so only valid users can call the ria service, and to make the call secure? The user has to log in to get to the silverlight app, so maybe that login in some way can be saved for authenticatio...
I've read in multiple places that the requirements must not be influenced by solution and must not contain solution. So in the below example , please can you help in letting me which is correct - Application A is interacting with Application B to install a new service / change the service type and disconnect a service....
Do you think that using akka actors in front of transactional service beans, is a good idea ? Actors are waked up by a facade used by a client application, and actor use a message to handle right service call. Is it a good practice ? This article (http://honeysoft.wordpress.com/2012/08/05/akka-actor-dependency-injecti...
I recently started at a new company, with a handful of programmers. Its a medium sized company, with around 70 employees, but IT only has 9-10, and there are 3 "programmers" beside myself. However, these guys have very limited experience and are doing a lot of stuff really terribly. For example, one of our projects is ...
I currently report my production exceptions to a mysql database, where they have been collecting dust for the most part. The problem I faced is grouping the stack traces. I would like to be able to see kind of an aggregate of the stack traces that are the same, so that I can work them into the workflow. I know one issu...
I just learned you can write '{}{}'.format(string_a, string_b) instead of '{0}{1}'.format(string_a, string_b) in Python, i.e. you can omit the numerals for the string format parameters when you want things to slot in one by one in order. Is this considered Pythonic? NOTE: "Pythonic" is a commonly used term among Py...
I am working with a trading application (reading data from the exchange) which generates a bucket load of data on a per second basis. We have different "log-levels" but even the minimal log-level generates so much data ! This process of log creation is quite I/O intensive. Since I can write assembly using __asm__ , I ...
Firstly, I'm not exactly sure if this question is a better fit over here, or on workplace.SE. So forgive me if it is in the wrong place. We are interviewing some candidates for a development position, and currently they are not in our city. We would like to give them simple coding tests to see how they will perform on ...
I'm working on refactoring a legacy application where I implemented the State pattern successfully as shown in the following diagram: As you see there is a common behavior between the 3 states, so I decided to extract the common method Refund() to a parent abstract class RefundableState where I implemented it: Refact...
One of my team members, a junior programmer, has impressive programming skills for his level of experience. And during code reviews, I believe in emphasizing learning, not pointing out mistakes. But should junior programmers be involved in code reviews for more senior programmers? Or should code reviews be attended on...
As an example, if I have a Post service and have a method to retrieve all posts for the logged in user, is it OK to have a findPosts() method that uses an injected Security service to get the user ID and then pass that user ID to my post DAO to get the records? Or should the findPosts() method explicitly require the us...
I recently started at a company and am working on statistical data analysis and data handling (market research). A lot of my tasks were previously done entirely by hand, so I created a few tools to automate much of my work. My boss asked if I could go ahead and look for other automation-possibilities. I certainly have ...
I'm a complete beginner to Java, only in my second quarter of classes. I'm having trouble understanding our current chapter about calculating big-O for methods. So I thought I was right in saying that the big-O for these two methods is simply O(N), since there is only one loop that loops through the entire list, but ap...
What are the major obstacles (and potential solutions, if known) for implementing "continuous delivery" software development when an application relies on varied programming languages or modules... especially when the same version-control and/or automated testing packages do not exist for those disparate platforms? For...
I've been wondering about applications that have a set of checkboxes or radio buttons, even collections of form fields in their UI. At this moment I'm handling all the choices separately but of course this becomes a complete mess very quickly. There has to be an established way to deal with this that I don't know of. I...
I have come across many blogs and books where it is stated that it is bad for a system requirement to contain conjunctions like "and". However in reality I am often coming across scenario where a requirement is satisfied when a certain set of conditions are met. For instance, Shopkeeper should sell alcohol only if the ...
I have a very basic game loop whose primary purpose is to check for updates & changes to a list. I have contemplated using event driven programming to replace the game loop/list idea with an ObservableCollection, however I just have this big cloud of doubt on event driven programming. I'm posing these questions to tho...
I'm currently re-designing my Entity System, for C++, and I have a lot of Managers. In my design, I have these classes, in order to tie my library together. I've heard a lot of bad things when it comes to "manager" classes, perhaps I'm not naming my classes appropriately. However, I have no idea what else to name them....
According to the Wikipedia article on Spurious Wakeups "a thread might be awoken from its waiting state even though no thread signaled the condition variable". While I've know about this 'feature' I never knew what actually caused it until, in the same article "Spurious wakeups may sound strange, but on some multi...
I have read in few blogs that as part of agile development , the product owner closely interact with developers to state their requirements and come up with a solution. However in case of a large project (in terms of number of applications involved) involving multiple systems , is this possible? Shouldn't the project h...
I have an abstract class called Address and I am deriving three classes ; HomeAddress, Work Address, NextOfKin address. My idea is to bind this to a usercontrol and based on the type of Address it should bind properly to the ASP.NET user control. My idea is the user control doesn't know which address it is going to p...
I am writing a library in C++ (making use of many C++11 features) that (as far as I can tell) implements the promise pattern. The library consists of a class that makes asynchronous network requests. When a user of this class invokes a method that issues a network request, an instance of another class (we'll call it th...
Functional Requirements state "WHAT" needs to be done from a user's perspective Functional Specification state "HOW" it needs to be done from technical standpoint. Do QA teams focus and Functional Requirements whereas development team focus primarily on functional specification though they need to have an understanding...