instruction
stringlengths
34
19.9k
Should making debug-checklists be an essential part of development process? How it can be integrated with unit-tests? Update Debugging checklist: Think about it as your troubleshooting checklist -- like what you do for your network connection, this time for your developers and your source code. For example if you're tr...
One of my potential customers is operating an open market in their town. From what I'm told, they make a decent profit by renting out the individual locations on that market to small merchants who come there every day to sell produce and other goods you normally find in such places. Each merchant needs to pay some fixe...
When using TDD, is it bad practice to pass a newly written test with code that could also pass another test? For example, take the following test (in PHP) public function WhenSomethingIsNull_ThrowsException() { $input = null; $this->module->someMethod($input); } This could be made to pass with the following co...
I'm in the process of integrating a Unit Testing Framework for an existing code base in C++. I've zeroed down on CxxTest, but as it turns out we can use other Mocking Frameworks (like googlemock) in conjunction with CxxTest too. After reading tutorials on CxxTest (Mocking) and googlemock (the infamous turtle example), ...
I need help creating view models for the following scenario: Deep, hierarchical data Multiple views for the same set of data Each view is a single, dynamically-changing view, based on the active selection Depending on the value of a property, display different types of tabs in a tab control My questions: Should I c...
I have built an application which acts as an interface between an EAI layer and third party vendor applications. I am using REST-ful web services for this, making use of JAX-RS API and Jersey framework. Although the web services can do different operations like Cancel, View, Create, Reschedule orders, I have implemente...
Let me describe my background. I am currently a software developer co-op working at an architecture firm that has a large focus on research and development, mainly in mathematical modeling and physics simulations in better aid architecture design. I am one of the three main software developers. Realistically, we're a...
I first learned about the existence of syntactic sugar languages, like CoffeeScript and SASS while working in Rails. This got me thinking... why do we not have well-known (if any at all) syntactic sugar for languages like C, C++ and Java? Imagine a language that reads like Python or Ruby that can be preprocessed to C, ...
I'm building a repository for a large CRM schema that has a high number of relations between entities. Some of the entities are referenced by almost all entities, e.g. Person and Company. Where I have an aggregate root such as Order, that addresses Order Header, Order Lines etc. In the case where the Order is from a ne...
I am making a simple web app mostly in JavaScript. I was wondering as to how do I deploy settings/preferences? Do I just store user preferences somewhere and make use of if...else... statements all over the code? I think that there must be a better alternative. I am know JS, jQuery & PHP and willing to learn anything n...
I am wondering if when developing a product backlog do tasks have hours estimated for them. To confirm, i can talking about a product backlog here not a sprint backlog as I know it does have.
I have to read a text document with data formatted as follows: (a couple of examples) 07 M W F 1400 1450 C 2004 M W F 0900 1030 EN 2036 06 M T R 1300 1350 EN 1003 17 T R 0900 1015 EN 1052 The problem I'm having is, once splitting up these strings with .split(" ", -1), I get a different number of tokens for many of the...
Starting with Kanban, I'm not sure about how granular my work items should be. While you find lots of concrete recommendations about how to choose the WIP, most of the Kanban tutorials I've read stay quite vague about the size of a work item (= a card on the board). For planning and estimation, people often recommend ...
About a year ago at my workplace we decided to get into developing a web app for internal use (as part of a more intricate system which is irrelevant to this question). No one really had experience in web development, so probably some of our decisions were wrong, but all in all we've had success with the tool we were d...
I have been developing a database-driven web application with extensive contents. The application is set to release using a GNU GPL v3 license. Whereas the content would be licensed using a Creative Commons license. To provide a brief context, this is an e-learning site, where I provide some kind of learning materials....
In below code i placed internal style sheet with in body tag, instead of having in head. For Single-Page-Application I am considering to do this for styles that is only applicable to that page alone, rather than having separate pagespecific.css file. Is there a scenario where this has downside as i am not putting the s...
We work in a Java shop here and our web application uses an implementation of the MVP architectural pattern. Our manager comes from a .NET world, where he has been exposed to the MVVM design pattern. Our manager is advocating changes in our MVP implementation, including that the Presenters should be decoupled from (or ...
I am going to start a project, which in the BLL would have something like: Jumper Map Record I need to keep track of all those, so I will make probably classes which hold them, e.g.: JumperList MapList RecordList First of all, is that a good practice to hold all the objects and is it good if I separate them like: ...
I understand why floats served a purpose in the past. And I think I can see why they're useful in some simulation examples today. But I think those example are more exceptional than common. So I don't understand why floats are more prevalent in simple simulations rather than very high precision integers. A classic a...
Trying to make our shop an agile environment, we struggle with some bits and pieces of that world. While not making it waterfally, we do have to have some sort of agreement on what a new feature needs to do. We follow the KISS and "minimally viable product" principle. Still, after discussing a story, we end up with: U...
I have coworker who refuses to accept the reality that Turing machines (and Von Neuman machines by extension) cannot solve their own halting problem stating: You can do anything with enough time and money. He also dislikes theoretical problems arguing that: In our field, we'll never run into those questions. We're ...
Stata is a proprietary statistical program used largely by economists. I want to write a basic multiple regression package that uses the same commands as Stata, e.g., regress var1 var2 var3, robust if var4[_n - 1] < . Is it legal (in the US) to distribute source code that does this under an open-source license? In othe...
Resharper offered to turn my loop: foreach (JObject obj in arr) { var id = (string)obj["Id"]; var accountId = (double)obj["AccountId"]; var departmentName = (string)obj["DeptName"]; i++; } ...into a LINQ statement. I acquiesced, and it produced this: int i = 1 + (from JObject obj in arr let id = (strin...
I'm currently learning about various application design approaches and there's one thing I can't really get my head around. Let's say I have a physical device in my network, an IP surveillance camera. I need a model that represents 'IP surveillance cameras' to work with them in my application, which might look like thi...
I am looking for a solution for having revision control on framework code and project code at the same time. If I am using a MVC framework, there may be specific directories where I should put my project code. I want to easily apply framework updates using revision control while still keeping project code under a separ...
Please be patient and read my current scenario. My question is below. My application takes in speech input and is successfully able to group words that match together to form either one word or a group of words - called phrases; be it a name, an action, a pet, or a time frame. I have a master list of the phrases that a...
There has been a trend in the Ruby/Rails community to create lots of objects that have very small functionality (SRP anyone?) and live in their own file. These are often extracted from large, bloated model files. This could be good, but I think it is often changing one problem (bloated models with hundreds of lines of ...
When coding in low level languages like C I find that casting sometimes means 'reinterpret these bytes as if it had always been of this other type' and at other times as 'convert this value intelligently into this other type'. What is the original meaning of the word and is there any consistency in when to expect a con...
Reference to a literal is possible only if the reference is declared as constant. But why is a pointer to a const object not possible in case of literals? i.e. int const& ref = 5;// But why is the same feature not available for a pointer, pointing to a constant object?
i am a beginner to ruby . i just did some minor research about why RUBY ? why choose RUBY ? whats new in it. Whenever i do type in a word RUBY in google search there comes a suggestion like RUBY on RAILS . so my mind changed to learn stuffs about ruby on rails. I went through some forums but got the same answer from e...
I am fascinated to Lisp as it is simple yet powerful. I am just a beginner and I know there have been lots of discussions on removing parentheses from Lisp and its dialects. Yet I request Lisp ninja's to take few minutes answering this. Will there be any side effects in Lisp/Clojure if they had followed 2 conventions b...
In a 8X8 chessboard, I was wondering how to implement the symmetry of the board. A lot of positions are just mirrors or rotations of one another (with no pawns or castling capabilities left the directions are indistinguishable). By using a combination of vertical, horizontal and diagonal mirrorings of the board it is a...
As far as I recall, this has been the ongoing trend of the past, I'm just a student, so I might be wrong: Long ago: Integer numbers and calculations. Very precise, however cannot present a big range. At a later point: Added single-precision floating point numbers (floats), and also added FPU's which are incredibly fas...
I was thinking of a data structure that I cannot describe better than with the word "book", or more exactly "binder". I was wondering if this had already been implemented in libraries like Boost or others. Principle It's a data structure that allows constant-time random access and amortized constant time insertion/dele...
Is possible to create and download a video file only on the client side? Suppose that we have an animated canvas like in this JSFIDDLE. Please see this snippet: ... var stop = false; setTimeout(function () { stop = true; }, 1860); ... if (!stop) { requestAnimationFrame( draw, 10 ); } So, my animation duration is 1...
We need to do pre-check-in code reviews. We are using Visual Studio and TFS. The built in code review functionality, is a bit odd to me. If I "reject" a check-in and comments what needs work, the review goes away. When the developer then makes the changes, he requests a new review, and I start all over again. Now, let'...
So I just was hired at a place that had only one Developer and that was the co owner. Their employee handbook had something to the effect of the following. All IP, inventions or software you develop while at X company is the property of the company. Additionally you will have to provide a list of all prior invent...
As a side-effect of an embedded project I've been working on, I've developed a small operating system for an ARM processor. While the OS and my user code are in separate directories and have clean boundaries between them, they're built into a single image using a single Makefile. I'd like to release the OS as open sour...
I am designing a web app for a client who wants to keep some of his business rules private, we have an NDA. In a nutshell, customers use the app to book a service, and employees use it to keep track of bookings. Since the front end is public (and untrustworthy), all of the decisions that are determined by business rule...
I would like to know if CTRL+C (copy) keyboard shortcut works on all Windows versions above '98, all Non-English Windows and on all keyboards (English, German, Chinese...)?
I have a network I'm responsible for routing signals through. You can think of the network as a directed graph of nodes (hardware) but each edge is really a pipe capable of fitting a specific bandwidth, I can route signals to any index on that pipe and may have multiple signals of different 'size' going across the pip...
Is the visitor pattern useful in languages supporting class extensions? Why bother implementing it, when you have open classes or can subclass. If you want new functionality for a class you could just subclass it, so unless I'm missing something, is it still (very) useful in languages supporting class extensions?
I've gotta build a webservice for employee information, and I'm trying to plan it out. To clarify, we already have a REST-ish service for People and a separate REST-ish service for Companies. This service will specifically be for the relationship between those two (all the data will be delivered from services to the da...
I've been asked a theoretical design question with an eye upon the GoF patterns.: "Given a design for a tree using a standard visitor pattern, how would your design look to allow a user to choose between om pre-order, in-order or post-order traversals?" I'm thinkin of just letting the visitor be, but give the traversal...
I am trying to configure a mysql database table that I can use as a per user/group permissions table. Almost like what Facebook has, for a local company intranet site. What is the best possible way to design this table, that would allow me to find user permissions with the fewest amount or queries?
In Ruby, I have a use case for a few common configuration options, e.g. NOOP, TRACE, SILENT. Right now I am using local vars instead of globals and passing them around all over the place and it's a pain. I be perfectly happy to use globals for these, if I could run a block where the globals can be temporarily changed a...
I will be extracting certain bits from log files using regular expressions to filter out bit of data. Initially I was going to do this with Python. I later started to think about the fastest way I can perform this task. This lead me to parallel programming. I remember hearing somewhere that Python can't be truly parall...
I was wondering, without using any kind of user info (id, nickname, age, etc), what would be the best way to assure filename uniqueness using php in a large database with high traffic and most probably simultaneously between many users? I am using $file = time() for example but I would like to know if this should suffi...
Originally, I started off doing jQuery plugins, then moved onto Backbone.js applications, then been experimenting with MicroJS MVC modules, but these days I'm even wondering if there is any need for them at all. Recently, I've been prototyping a new application, and the code is slim, sleek, and beautiful. I then procee...
I am building an Android guitar application and I need a way for GuitarString objects to notify multiple listeners that it has just been played. This includes the current Activity and all instances of GuitarStringView that have it as their GuitarString (the guitar is displayed twice, zoomed in & out). I have so far han...
I have a domain model in which I use a few aggregation relations, i.e. an object of class A contains zero or more objects of class B. I use Java for the implementation and I represent such an aggregation as a field of type List<B> in A, and a field of type A in B. In this way, each object can be the root of an aggregat...
So while I was learning HTML I encountered CSS. It's interesting because with CSS you can make a webpage cool or more beautiful. But since it's more about colors, designs, styles etc., I can't know the results of my CSS codes. As someone who is visually impaired, why should I learn CSS if sighted people can always desi...
I want to create a changelog for my application to display the set of recent changes to the user. But I'm not sure where I put it. Do I create a text file and write in it? Where do I put this text file then? Or do I use an action in the menubar and display the changelog in a new window when clicking on the action?
AFAIK, the term dispatch means just a method resolution and calling. It doesn't matter whether it is static or dynamic. I saw many people are using a term like static dispatch and dynamic dispatch. What makes me confusing is there're also some mysterious descriptions. I was trying to understand what is multiple dispatc...
On a 2D plane, I have 2 rectangles. I want to find the closest pair of points (one on each rectangle), which are closest to each other. By points I mean the corners of the rectangles. And no, they do not overlap. Is there any way to do that other than checking all the distances between all the combinations of points an...
I am currently in the process of selecting a widget framework to be used for a new project. Current choices are Dojo/ExtJS4. We are leaning on ExtJS4 but might have some issues with the licensing. From the Sencha license page: Our open source license is the appropriate option if you are creating an open source applica...
When developing features with TDD, I create a test for each combination of feature and case. So, one test for creating user successfully, one for validation errors, and one for database errors. I don't test each one with many different types of data, in general, as I write the tests to flesh out features, less to catch...
With reference to iOS 7. I couldn't find any Apple documents with regards to this. Are we able to download any size of documents and manage them ourselves (within our app say < 100MB)? Example, we roll out new content every month. Thus after downloading contents for this month, we should remove last month's content to ...
The situation is this. I'm a junior developer for a small government IT project. We don't have anything of continuous integration or a automated testing framework. But the idea is to be developing this kind of thing/improving our developing environment. The product is a data processing algorithm that then displays in...
I'm currently working on a pet project with two of my buddies. This web service will provide basic functionality such as Login/Password Modification/Registration etc. All of us are comfortable with jQuery and ASP.NET. My friend's idea is to - Set up a web service on the same domain and send it data for registration, v...
I noticed Visual C++ 2010 (my current environment) and XCode both allow non-standard single-line comments in my C programs. Since these are both my target platforms, I assume it's fine to use it? VC++ 2010 doesn't support C99, so I'm limited to C89, though I know C99 added support.
My manager told me to include 15 line copyright notice on top of every file. I am not sure whether I need to include in sql, xml, txt, documention, config files or even html templates. In which files should I include copyright notice?
I am doing research on squares, and I thought of using constraint-satisfaction-problems solvers for proving or disproving some conjectures. As a simple example problem, consider the following task: Draw two green squares and two red squares, such that: - All squares of the same color are interior-disjoint; - All squa...
There is a finite set of points on a plane (about 1500 points in the current task). I need to construct triangles on those points such as each triangle lies completely inside one larger triangle: Now I want an algorithm to maximize the number of such triangles. Where can I start? I think one of the ways would be to ch...
Why is it not possible to set a function returning an address while it is possible to set a function that returns a reference. int* returnByAddress() { int x = 20; return &x; } int& returnByReference() { int x = 30; return x; } int main() { returnByReference() = 23; // possible int x = 23; ...
I have an app that is made up of multiple different components, each with their own version number and history. I would like to create a version number of the entire application, preferably somehow based on the version numbers of the components. I am not sure if this is possible at all, but I would like: The version n...
I am working on a highly customized shop software, based on a open-source one, written in PHP and usual web techniques (CSS, HTML, JS). I did a lot of customization in the past months/years and developed specific, individual features which are necessary to be successful at our branch. The shop and the project files are...
So, I'm trying to use an NTP server to help me synchronize an app across two Android devices (to have them perform some action at the exact same time, give or take < 20 ms). I'm using the SNTP client code here as provided from the StackOverflow post here and it works just fine. The problem is that at the exact instant ...
How would you unit test the PerformUpdate method in the sample below? This is a (very) simplified version of some code that performs updates against a database where the schema is dynamic and represented by the fields collection. EDIT: If it is not clear what I am asking, I would like to know how different developers w...
What do I need to consider to determine which design I choose when I have the following scenario? There are two cases to considerer; Given T a generic class, I have to do something with multiple T's (Iterating each one of them). In other cases, with the same T, I have to process just once. In both cases, independent ...
I have a general question on where to put validation. I have an asp.net mvc that gets/sets data from/to a DataSet. Currently, the fields in the form are validated by the form itself (e.g. for invalid length, range, etc.). Is it a good or better idea to transfer these validation checks into the DataSet? The downside is...
I am a big fan of agile development and used XP on a very successful project a few years ago. I loved everything about it, the iterative development approach, writing code around a test, pair programming, having a customer on site to run things by. It was a highly productive work environment and I never felt like I was...
I'm building free games in javascript, with my code is easily accessible by looking into the html of the webpage. I really don't mind people looking at my code (for curiosity, or to learn something). But I don't want anyone to use my code to make their own games, or steal the art I've done. With this goal in mind, what...
We have developed an application that is sold as an online service. After some time we realized that some of customers would need/prefer/require to have it installed locally on their intranet. However the application was developed using scripting language and we wouldn't want to allow clients to access the source code....
I'm working in a fairly old yet sufficiently unproductive code base that I need to create a(some) script(s) to help me out. For example: we add a version # and timestamp at the header of the file (yes we use a CVS based sys but this is beyond my control). we have duplicated layout code for different languages (this...
I'm using OOP and MVVM in a WPF c# application. The goal is for the resulting object (data-bound to user interface) to accurately represent a product. One specific area of the product is highly configurable. For conceptual purposes, imagine a boat which can have various means of propulsion. A submerged prop motor or ab...
I can fully appreciate the benefits of a package manager like Python's pip, Node's npm, or Ruby Gems since they're doing much more than adding files to your applications path. Maybe I'm missing the point, or I'm being obtuse, but here are the negatives I can see: Separate step when building a project Separate dependen...
How do you manage the dependency of one unit test on another unit test succeeding? So, supposed I have a class and this class has say 5 methods. I create like 2 dozen unit tests (test methods) for that class. each unit tests tests something specific and unique - so nothing is tested twice. So for instance I have a coup...
I've read in PHP Advanced and Object Oriented Programming by Larry Ullman that it is good programming practice to delete object immediately after use but reason is given nowhere. I am a student web developer and objects in web applications are deleted automatically as soon as the script finishes. So, there seems no goo...
I have been programming for several years now, and back then (learning PHP) I've didn't learn to program using classes, MVC-logic or using any frameworks. I found my self solving my problems very well using my own functions. Eight months ago I was recruited to a start-up, to develop a huge social platform. I have been ...
Suppose I'm writing some C++ code to visualize "Foo" objects. I have two ways of getting a "Foo": computing it from data, or from taking the pieces of a precomputed "Foo" and building a new "Foo". Now, once a "Foo" is computed it's guaranteed to be good for visualization, but changing it may break this assumption. Ther...
I'm used to working in a large development environment where code is peer reviewed and tested by the client, who is usually an IT person themselves. I am now working at a very small company where I'm not just the only developer, but the only IT person at all. I'm inclined to have my coworkers and/or boss take a look at...
Let's say I have a DatePicker control and I allow my US clients to type something like "1/1" in it and hit tab go to next control. So I will parse that date for them as "01/01/2014" and some more similar patterns. But they are all US-based so they are "MM/dd/yyyy" Now my question is about other formats? What If I wa...
I'm interested (for learning purposes) in creating an Namespace Extension for Windows that is similar to Dropbox or SkyDrive. What I'd like to do is integrate directly with Windows Explorer like those services that appear as a "connected drive": When clicking on the connected folder, I'll be interacting with my own si...
I have a visual studio solution that has, amongst other project the following three: NamespacePrefix.NancyFX.csproj: Some Nancy modules NamespacePrefix.NancyFX.IISHosting.csproj: A web solution to host the nancy modules NamespacePrefix.NancyFX.Selfhost.csproj: An exe to host the nancy modules In addition to rest serv...
Generally variables are named in the singular Car car; and arrays and list with the pluras: List<Car> cars; or Car[] cars; But what about nouns like fish or media* that are already plural? *already lost the battle to have the class called Medium.
I currently work as a .net developer and have coming up to 3 years experience in the industry as well as a degree in computer science specifically software engineering (I know that means nothing but just wanted to explain that I'm not your general back bedroom programmer). When I finished Uni, I started contracting fo...
If I do .1 + .1 + .1 in Python, I get 0.30000000000000004. (I am not asking about Python in particular, and do not want Python specific answers.) The only problem I can see with this is 0.30000000000000004 != 0.3, so I need to take care in how I compare floats. Are there any other problems I need to be aware of with fl...
After doing some (more-or-less) "low-level" async socket programming years ago (in an Event-based Asynchronous Pattern (EAP) fashion) and recently moving "up" to a TcpListener (Asynchronous Programming Model (APM)) and then trying to move to async/await (Task-based Asynchronous Pattern (TAP)) I've pretty much had it w...
I am struggling with naming convetions in C# I do not know when to use PascalCase or camelCase. I have read Microsoft's naming convention, but I got lost ther http://msdn.microsoft.com/en-us/library/ms229045(v=vs.110).aspx As far as I know this is correct: public int Number; private int number; public void Method(); pr...
I have a scenario where I will be receiving messages through a socket connection. I also need to keep a list of 100 messages (such as List) and periodically toss out old messages from the list when a condition is met. List<Message> MessageList = new List<Message>(); Message CurrentMessage = new Message(); public void...
I came across an enum definition :- typedef enum NSInteger { kBorderTypeNone = 0, kBorderTypeLeft = 1 << 0, kBorderTypeRight = 1 << 1, kBorderTypeTop = 1 << 2, kBorderTypeBottom = 1 << 3 } BorderType; and also (possibly) it can be equivalent to typedef enum NSInteger { kBorderTypeNone ...
I'm from the AS3, JavaScript, and similar "web languages" where loading means the code is being downloaded from the server, and can't run reliably until enough has been fetched to the user's computer. However, what happens during a loading screen in software and games in which all the information already exists on the ...
On Github, I've run across a pull request which it implements a feature I like but feel isn't quite intuitive and could be better. The maintainers of the original repo have so far declined to accept it (or explain why). It was requested 3 months ago so I suspect they won't take it without changes. I'd like to improve u...
In my database I have a table that looks like this Master(ID, Name, Attr1...). Every ID will have at least 1 entry in additional tables that have additional attributes. Those tables specialize the master table. Spec1(MasterID, Attr2,...) Spec2(MasterID, Attr3,...) ... So, not sure how to map this to object oriented de...
This is only anecdotal evidence but from my past encounters with programmers at various workplaces the programmers that understand the fundamentals of parsing and interpreting seem to be overall better programmers. They also tend to be less religious about their tools. My subjective experience indicates they tend to wr...
A colleague of mine works as a consultant. He is recently asked to help a software development company to improve their processes. The company is aware of some of the issues, like the number of bugs or the fact that they can't release their lead product more often than once per year, but nobody there knows what to do. ...
I have following C# code. It helped me to avoid some code repetition in a good way. The ExecuteQueryGenericApproach<T> method receives a Func generic delegate as argument. The delegated method has a parameter which receives IDataRecord as argument. That is, the ExecuteQueryGenericApproach<T> method provides the requ...
I have a software requirement, that needs to store the user that made the last modification to another object, for every object (assume that all objects are already mapped and into a BD). So we have the ParamBase an object that holds the basic data for every object, this will be a super class, every other parameter in ...
After reading this article I realized that I really didn't read any "serious" source code during my 3-years as a professional developer. Recently I started a new web-project which makes heavy use of AngularJS, so I decided to start my reading - or, better, decoding [as the blogger wrote] - activity from something that ...