instruction
stringlengths
34
19.9k
I have a git repository, and I'd like to make a "debug" branch. In the "debug" branch, I'd like to add a line: debug = true; But I want to make sure that any merges back to master ignore that change. Is there any way to set that up in way that doesn't require me to manually handle all future merges?
In my organization we almost never finish all the stories in the Sprint, and most of the stories are finished about 80%. One reason for this, is that many times testers don't have enough time to test all the stories, and developers don't want to test. Another reason is that the teams are usually too optimistic so they ...
JavaMail sends e-mails using an e-mail server, typically through the SMTP interface of an e-mail provider. Is it necessary to use an e-mail server to send e-mails? I have a web site that will send e-mails and if possible I'd like to send the e-mails directly from the web site code without using an e-mail server. The ...
I've recently convinced the team that we could upgrade from php5.4 to 5.5 -- but, unfortunately, it seems I overlooked that php-apc is no longer supported in php 5.5 -- which is fine and dandy, but we could use a replacement for apc_define_constants() Thus, I've heard about the wonders of hidef -- but, I cannot seem to...
I'm somewhat new to programming (I'm a mechanical engineer by trade), and I'm developing a small program during my downtime that generates a (solidworks) part based on input from various people from around the plant. Based on only a few inputs (6 to be exact), I need to make hundreds of API calls that can take up to a...
When reading about the various options for working with things like ARC / GC, I often come across explicit wording about which weak references are zeroing (ie, your reference becomes nil/null/0 when the object is collected) and which non-zeroing (you get a dangling pointer). This leads me to ask: What possible use coul...
My company uses an application called TotalHRWorks for time keeping and what not. They have an Android and iOS application; however, there is no Windows Phone application. Since there is an Android and iOS app, I figure that I should be able to create a Windows Phone app; but I don't know where to start with trying to ...
On a side project I'm working on I came up with a way of handling exceptions that's adjustable by configuration. So a try/catch block might look like this: try { fileHelper.MoveFile(file, destFolder); } catch (IOException ex) { if (exceptionHandler.HandleException(ex)) { return ResultCode.Fail; ...
I have a class that will have a number of external methods that will all call the same smaller set of internal methods. So something like: obj.method_one(a, c) and obj.method_two(a, c) where obj.method_one calls obj._internal_method(a, c, y) and obj.method_two calls obj._internal_method(a, c, z). They're nearly ident...
We have a project with a few release branches and a trunk. Lately we've been adding bugfixes and new features to the release branch, while doing simultaneous infrastructure development on the trunk. This has caused us some problems. Today I was told to merge changes from branch to trunk, using HEAD as starting/end revi...
I'm writing a piece of software in python that will communicate with a bunch of devices via an I2C bus. Each of these devices are going to need some sort of a module or class to handle the communication and data conversion in some sensible way. The operations that each of the device modules perform are drastically diff...
I am developing a single-page web application using AngularJS. Data for this application is consumed over a REST API which is well tested in its own right. The Angular application has a bunch of unit tests that test e.g. individual controllers and their methods. It also has a bunch of integration tests that currently v...
If I have 2 tables in my database, let's say for instance 'buyers' and 'sellers' but I collect a common set of data for both for instance telephone number, email address, address etc. Is it better practice to have one common table for 'contact_details' with a reference to the table and row that the contact details are...
So, I am a noob in assembly language and machine instructions. When the discussion came up as to how funtion calls are implemented at the processor level, someone said that the CALL instruction pushes the address of the next instruction to be executed on the stack before updating the EIP and then someone asked how do w...
How does assembly relate to machine/binary code. For example here is how to print to the screen in mikeOS(a small pure assembly OS), mikeOS it uses NASM to assemble. BITS 16 ORG 32768 %INCLUDE 'mikedev.inc' start: mov si, mystring call os_print_string call os_wait_for_key ret mystring db...
I don't find the docstring to be very clear: def compileUiDir(dir, recurse=False, map=None, **compileUi_args): """compileUiDir(dir, recurse=False, map=None, **compileUi_args) Creates Python modules from Qt Designer .ui files in a directory or directory tree. dir is the name of the directory to scan fo...
With reference to this answer: At the end of the day, we are delivering a product to a paying customer. This customer has needs and expectations, realistic or not. Often the sales team gets us into trouble just to get a commission. I realise there are processes (mainly with communication and project managment) that c...
Before you answer, yes I know that other languages have no native javascript object support, but neither do they have native support for json. So wouldn't it make much more sense to modify the json spec to allow identifiers without "" and allow comments? Very sensible things because you don't have to serialize/deserial...
I'm not liking how my JQuery is after making some dynamic buttons, or other dynamic things. For example, when I have checkboxes marked, I add a button that is called "Download Selected" and "Remove Selected". Of course, there are many more JQuery + HTML things in my site. I'd like to know how I can make my code better,...
In a multi server system, e.g. a load balancer, multiple web servers and a database server, where do you store the files / images users upload when each web server will need access? Before now I've just used a single web server, or maybe one web server and a MySQL database server. But if you have multiple web servers I...
I use java language to develop android application, after static analysis, the tool warns about high efferent coupling. What is the reason of this warning? Is it about AComModel which is extended by other class? There are 4 classes below which the tool warns us about them. I hope I asked logical question, but I really...
One of our developers has an opinion that all client data should be validated before using it. Even non-input data. Say, our web service has an internal protection against database injections. Examples: machine generated codes, various integers, indexes, calculated values. We use ORM (Django). As I know there is a next...
As a programmer, I have always wondered whether it is preferable to write (a) short modular functions that are each stored in their own script (i.e., file) or (b) long comprehensive scripts that contain all of their relevant functions. For example, if I code a data analysis stream that includes a variety of operations ...
We have had a situation with a scrum sprint where a team member went on vacation for a few days at the beginning of the sprint. This led to us being behind the ideal trend on the burndown chart at the beginning of the sprint, although we caught up later since we knew we had slightly less resource and as a result had co...
We have a number of tasks that need to be completed, but are probably not real user stories, or if they are, they are very developer-centric user stories which will never be visible to the end-users. The problem is that because they do not get estimated as a part of a sprint and very little gets done on them. Eventuall...
A terminology question appeared when I was comparing EJB 3 and Spring. Wikipedia says that Enterprise JavaBeans (EJB) is a managed, server-side component architecture for modular construction of enterprise applications. and also The Spring Framework is an open source application framework and inversion of contro...
I was told that atomic operations are a dynamic language feature. I was too afraid to ask in that context what this actually means because I didn't want my coworkers to think I'm stupid. But I actually don't really understand this statement. My understanding of the term "atomic operations" is any operation that is eith...
Why does cursor = connection.cursor() cursor.execute("... return cursor.fetchall() return the expected non-empty result whereas connection.cursor().execute("... return connection.cursor().fetchall() returns an empty list the SQLite3-command being identical in both cases? EDIT 2014-02-19: Added the last "...fetchall()...
Is it possible to develop private apps for iOS (iPhone/iPad) and Android? With "private apps" I mean apps that do not appear on the public app store, but can be downloaded and used only by selected clients.
Device targeting for product XML catalog We currently have a webservice that outputs an XML of products based on get parameters in the request. The webservice is consumed from a windows mobile application. In front of the webservice we have an HTTP accelerator/cache that caches the results for identical URLs. The busin...
Well I'm no expert, but as a student, I'm curious about languages and their design patterns / goals. I'd like to know, whether there are any points I miss in the following examples, and why techniques like this are not widely used in popular languages. Why is it a better idea in a real-life program to explicitly define...
I want to learn OOP. I know Python and I know very little things about OOP. But when I search for "learn OOP" in forums I saw a guy saying that "Python is so new that's why you can't learn OOP on Python. you should learn Java then understand OOP on Java" Is it true? Is there any difference understanding OOP on differen...
I'm trying to find a clean, intuitive way to implement this problem. Basically, I have three numbers, and based on relationship (less than, greater than, and equal to) among these numbers would change how I execute the next set of code. For example, if there are numbers A, B, and C. Here are some examples of relationsh...
I am currently designing a graphics library in Java and now it's come to making the frontend I am curious why I have never seen libraries using global variables for their settings/properties - in-fact some go out of their way to protect them such as JavaScript libraries, and of course choose to use getters and setters ...
It's not clear to me what benefits there are of declaring your stack variables as constant in C++, I was hoping somebody might explain the benefits and purpose for this technique. For example: void func(const std::string& arg) { if(someCondition) { const std::string foo ("some string plus " + arg); st...
Please read the question carefully: it asks how, not why. I recently came across this answer, which suggests using a database to store immutable data: It sounds like many of the magic numbers you describe - particularly if they are part dependent - are really data, not code. [...] It may mean an SQL type database, or...
I have a slightly complex SELECT query which uses a number of JOINs and variables inside it and the query is run frequently throughout the application. The result varies when one column is updated. Eg: When the product quantity is updated only, the result set changes. So my question is, is it a good idea to run a trigg...
imagine given a project business object and such (simplified) rules: it's lifecycle is divided into several stages of evaluation; stages flow lineary and represent an evaluation chain; each stage provides its own reward value/algorithm; promotion of the project is controlled by other user's decision; the resulting rew...
I often use the following syntax: std::vector<foo> vec; vec.push_back( someClass.getFoo(...).modifyAndReturn() ); Considered about exception safety, I quote the standard on vector's push back behavior (23.3.7.5): If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or...
With the current project I'm working on there's an architecture question being asked which feels like it might just be asking too much. System Basics: HTML/JS MVVM Asp.net MVC Web Services EF SQL 2012 The Web Services deal with DTOs passed back and forth either to the presentation layer (MVC or mobile app) or to va...
I developed a Windows software about an year ago. Part of it was to monitor few configuration files for manual changes by user and if any of these change restart a particular service. So, I used the simplest approach. I load them as a string in memory and after few seconds, I read the latest file and compare it with th...
I am making a Game in HTML5. In one part of it, I want the users to be able to customize the avatar they get by default. For sample, let me share a screenshot from Zombie Lane on Facebook (now this game may not be in HTML5 but that's not the point): My question is as to how do I include the images in the HTML5 page an...
In our company, we are going to deliver a new product which will be used for mass notification, so it is an embedded software project and we are going to use the SCRUM as a framework for the product. We have started to write down the product backlog. Based on what I understood the product backlog should reflect a busin...
I stumbled upon a discussion between senior engineers and people from non-technical backgrounds and this seems to be a strongly held belief in some places. I'm of the opinion that such a situation is purely down to incompetence on the side of the developers and project managers, those involved in creating the original ...
We have a User class which handles all things related to users within a Content Management System. As you'd expect, the class contains a function login(). This function accepts three arguments: $username, $password and $remember (the latter defaulting to true). My question is: what is the best way to handle login erro...
What data structures can you use so you can get O(1) removal and replacement? Or how can you avoid situations when you need said structures?
It's very common in .NET for an exception to be wrapped in several layers of "outer exceptions" which give marginally more contextual data. For example, in EF if your update fails, you get exceptions wrapped similar to this: EntityException DbUpdateException SqlException The data I need to understand what failed is ...
With jquery very slowly being phased out you get into more and more situations where library X will run with either jquery or zepto.js (but at least one is required). No package managers that I can think of however allow you to express dependencies like this. If I was to propose this feature to - say - bower, is there ...
I work for a small company that hasn't done much work in bespoke development. It's something we're growing into. With all our projects, whether a bespoke development piece of work, or a simple brochure website, we plan out how long we expect the job to take us and then multiply that by our daily fee to give us a quote ...
Thinking about Access Control Lists bound to a web MVC architecture, I have a doubt on where the verification should be done. Within Models? Controllers? FrontController? Imagine a multiple module web application (like a website). I have a public site and a restricted admin zone. All public site pages are acessible b...
I'm currently working on a web mail client. When a user logs in, I'm fetching all the mails from the INBOX from the beginning of time. As expected this is pretty darn slow. I'm planning to implement some sort of a filtering/caching technique and was looking for some ideas. If I fetch all the message numbers, trim them ...
I read in this question that functional programmers tend to use mathematical proofs to ensure that their program is working correctly. This sounds alot easier and faster than unit testing, but coming from an OOP / Unit Testing background I've never seen it done. Can you explain it to me and give me an example?
def printMax(a, b): if a > b: print(a, 'is maximum') elif a == b: print(a, 'is equal to', b) else: print(b, 'is maximum') printMax(3, 4) # directly give literal values x = 5 y = 7 printMax(x, y) # give variables as arguments I'm learning python via the byte of python book, and the author uses this e...
I am trying to better my understanding of polymorphism. Say I have a base class called baseClass with one method called foo() and I have three derived classes called derived1 , derived2 and derived3 which all override the and implement their own versions of the foo() method. If I have an array of baseClass objects can...
(I see there are a lot of similar questions, but answers are not really what I am interested at.) The thing that is bugging me is indirection. If I'm writing something, I do tend to inline as much stuff as possible. I might be less strict about it in compiled language hoping that compiler will do all the inlining for m...
Effective Java provides 2 ways to implement swap: // Two possible declarations for the swap method public static <E> void swap(List<E> list, int i, int j); public static void swap(List<?> list, int i, int j); Then, Mr. Bloch says: Which of these two declarations is preferable, and why? In a public API, the second...
I have been experimenting with creating a website that leverages MVC with JSON for my presentation layer and Entity framework for data model/database. My Issue comes into play with serializing my Model objects into JSON. I am using the code first method to create my database. When doing the code first method a one to...
I'm creating a website which will publish one or more articles a week. I'd like to be able to rank the articles based on popularity. In order to do this, I need a formula to calculate a score for each article. This formula should reward popular articles (those that receive many views), while also bringing new articles ...
In my application users have lists. They can either add a new item to their list or add an item from a previous list. The set of all items I'll call G (global) (each user's global list is their own). G = { a1, a2, a3,...,an} After (or during) a user has created a list they can sort it. This has been no problem. The pro...
I'm developing a set of simple widgets for a small (128x128) display. For example I'd like to have a main screen with an overlay menu which I can use to toggle visibilty of main screen elements. Each option would be an icon with a box around it while it is selected. Button (left, up, right, down, enter) events should b...
When working on a requirements document, how do I capture system roles and responsibilities? E.g. "I'm a manager and I will only use the system to generate reports on xyz". I was looking for an example online but couldn't find one.
I tried to understand how objects can be passed as parameters but it was difficult for me. How can we pass an object as a parameter to a method of another object? I need to understand the idea behind this. updated: public class Student {} public class Admin { private ArrayList<Student> students; public voi...
I'm looking for information on common patterns for initializing and executing Javascript page by page in a "traditional" server-side MVC website architecture. A few months ago, my development team began, but abandoned, a major re-architecture of our company's primary web app, including a full front-end redesign. In the...
Quoting from Selenium Architecture A natural implementation would have been to provide a database connection to the underlying data store, using something like JDBC. Eventually, we settled on an API that closely models the underlying Javascript implementation because something that modeled typical database acc...
I'm developing a mini framework and I want to perform changes to existing methods. I know in order to deprecate a method I can use the @deprecated annotation. However, what annotation should I use to let the users know that I'm going to change the amount of parameters a method will receive or maybe the returned result?...
Usually I use std::unique_ptr to convey ownership and pass in raw pointers as parameters when no ownership is implied. However, I almost never consider a nullptr to be acceptable as an argument, so it would be nice to use references to avoid this, but I'm not sure most people would expect that the object the parameter ...
Recently, I've spent a lot of time trying to dive into, and understand, Javascript Promises, especially those adhering to the Promises/A+ spec. What I'm trying to understand is whether or not Promises actually give developers additional tools specifically when compared to CPS based async, or whether it is mostly syntac...
For example, take the case of Fibonacci number to calculate nth number you require n-1 and n-2 term. If I do it with bottom up approach, is it recursion as f(n) depends on f(n-1)?
Is there any difference if I were to write something like this: int row,col; for(row = 0; row < data.length; row++){ for(col = 0; col < data[row].length;col++){ //do something }//end for loop(columns) }//end for loop(rows) for(row = 0; row < data.length; row++){ for(col ...
I hope I can explain what is troubling me. Example: I have an object basket with a list of fruit objects. So normally I would build my routes like this baskets/{basketId}/fruits/{fruitId). But fruit is an interface and there are different implementations like apples and oranges that all require their own resource repre...
I have a c++ program with opencv library which takes an image as input and perform pose estimation,color detection,phog. When I run this program from the command line it takes around 4-5sec to complete. It takes around 60%cpu. When I try to run the same program from two different command line windows at the same time t...
I am redeveloping an old ecommerce website which is currently written in C# ASP.NET 2.0. Because this is a reasonably high volume website and has suffered performance issues I want to develop in the most efficient manner possible. To minimise database trips (using SQL Server 2012), as database performance is the usual ...
I saw often people use this code like interface IAnimal { void die(); } class Cat : IAnimal { void die() { ... } void meow() { ... } } IAnimal anAnimal = new Cat(); Cat aCat= new Cat(); C# knows for sure anAnimal.die() works, because die() is defined in IAnimal. But it won't let you do anAnimal.meow() ...
taking for example an application that holds Companies and as we move along time, more and more features are needed. I do tend to hold everything in the Companies table, but I rather get some input as I'm starting a new project and was wondering if I should keep those in a CompanyFeatures table: Should I have 2 tables...
I don't understand why the switch or equivalent is so popular in languages. To me, it seems like it had a place back in the days when the alternative was lots of nested if statements in the else part of other if statements. Now that we have else if, why do we need it? If we take the following: switch (expr) { case "O...
Surely most of you remember the Norton Commander application where similar (sometimes the same) data is displayed in separate decoupled views. I'm building a web application that follows the same principle. The amount of data is too big to be fetched/displayed entirely on the page, and potentially overlapping subsets o...
Writing a single var declaration per function is considered to be good for readability and maintainability. But, when I went through some of standard libraries, their dev version doesn't strictly follow this. For example, Underscore code has multiple var statements in many function which are spread randomly and declare...
For a given class, where should the comments about the purpose of the class go? /// <summary> /// <----------------- describe the class here (1)? /// </summary> public class Message { ... //class members here ... /// <summary> /// <--------------- or here (2)? /// </summary> public Message() ...
I am developing an iOS application, in which I have to draw some patterns on a view based on option selected by user. Let me explain you more clearly. User will be shown number of images as options to choose from. On selecting an option, a view will be drawn. This view is inheriting from a class say ParentClass where ...
Is it possible to use the framework behind the Windows 8 Metro UI to make Exposé-like application for Windows? I tried Mac and I really like this feature, on another side i like that I can drag the screen from the top of the screen into the Metro UI, but that is completely useless. So imagine if it is possible to use t...
I've recently ran into some issues where some reports were not generating the proper results. We already have a QA department that reviews the reports and then our business owners review them as well; this hasn't prevented the issue. I'm trying to figure out a decent way to have a test harness to ensure reports are giv...
Recently I've been reading and learning quite a lot about scrum and I like it a lot. However, I do have a couple of likely scenarios in my head to which I don't know the solution. So let's say that I might want to organize an agile team of (for instance) four web developers (one of them UI/UX designer). This team would...
Before I get started I need to issue a pre-emptive apology: It is very likely that some of the terminology / vocabulary I use in this post is plain wrong there is also a good chance I have entirely misinterpreted some of the keys aspects. I am new to this so don't be too critical, more than welcome constructive feedb...
Passwords exposed in URIs An application stores URIs to be used for file transfers via SFTP, FTP, FTPS and SCP. Many of these URIs contain passwords, for example: sftp://someuser:sekrit@host.example.com/ These URIs are visible to too many people. We cannot hide email addresses from these people. A mini-language to g...
I've currently got a browser talking via an "API" to the server. API is scare quoted because the API really wouldn't support another user interface very well, because it consists of every call our UI happens to need, in the form it happens to need it, and nothing else. Which could be fine. However, we are starting to h...
I have been trying to understand what it means to say "scope of a named entity". In reading about scope, there are terms like visibility, lifetime, accessibility and more that are used. What is confusing is the fact that the terms are at times used distinctly and at times interchangeably. Quoting from this IBM articl...
(Don't believe this is a "best practice" question as I believe there will be a single better choice). I need to choose a data storage option to store specific site data to allow easy management and re-usability: array; class; DB; Other; but am not sure which one would be adequate. The data in question is my Service...
We are currently working on a project that heavily relies on a database. Among many tables the main focus is on table "data" which is linked to another table "data_type" as many-to-one, which is then linked to table "data_operation" as one-to-many. The last table defines specific set of operations that has to be proces...
I want to organize tests for a project large enough that build time matters (especially for the CI server). Say I have this code that I would like to test : //foo/greet.cpp #include <stdio.h> #include "foo/greet.h" int greet() { return printf("Hello, World!\n"); } And I have this main program that is boilerplate that ...
I am in the middle of creating a Bundle for PHP application based on Symfony 2. I want the bundle to be clear and good designed, so I constantly move and refactor code, rename methods, reorder classes, move them to other folders, add some factories and adapters, proxies, and follow other oop design concepts. I'm thinki...
With bytecode-based virtual machine languages like Java, VB.NET, C#, ActionScript 3.0, etc., you hear sometimes about how easy it is to just go download some decompiler off the Internet, run the bytecode through it one good time, and oftentimes, come up with something not too far from the original source code in a matt...
Sorry if the title is hard to understand, it is easier if I describe the scenario to get the question across. I have a service that collects data, performs business logic and does all the normal stuff. I now have to perform an integration that will provide a set of data (for sage accounts) via an endpoint (http://examp...
That is if we were to see how Microsoft wrote this method what would it look like? I'm mainly interested in the use of the StringSplitOptions enumeration with the other parameter and how they probably structured their code to account for each option.
I have an application that allows the user to place a string of text into a PDF document. I have three different ways that they can do this: Use a Form Field. Then they have four properties to define: Provide field name provide instance of the field provide an X-axis Offset provide a Y-axis Offset Search for a st...
I am working on a real time multiprocessor scheduling algorithm. I found very few results via google research related to it. A few simulators are available but are not robust enough. OpenMp is an API I have previously used for small parallel application development. But I am not sure if it provides any support for re...
I make web applications, mostly MVC, object oriented and database enabled. I always have trouble going back to project after a few months of release and work again. I don't even remember what I made on that project. How should I overcome this problem? I can't afford too much time consuming documentations and so many di...
It is clearly a bad practice to incorporate several issues in a single bug. It is not convenient, hard to maintain, difficult to keep track of what is done and what is not, etc. But does all this concern bugs associated with documentation as well? By documentation, I mean only external documents (user guides, architect...
I was looking at cross-domain requests for a design and stumbled upon something that puzzles me. From a local site I'm firing an Ajax request to another domain (with jQuery and vanilla XMLHttpRequest). Sure, the request fails and I can only get a fail event, which seems perfectly normal du to same-origin policy. But I ...
I'm after a bit of OO design advice... I'm about to start developing a Windows application that communicates with an external machine via RS232. The machine has an onboard "system controller" consisting of registers (addresses). You can write a value to a register (e.g. to turn a pump on), or read a value from a regist...
Is it good practice to use __ convention while declaring the member variable? This also imparts private kind of feature of that data member. There have been cases when I found that its good to have hidden members of a class. This is certainly exposes only that feature that will help the the object to behave in more pr...