instruction
stringlengths
34
19.9k
I have a team that works on multiple technologies. I want to know how can I automate the process of code review for .Net, .Net MVC, Python, PHP, Drupal and HTML5/CSS with JavaScript. I have read about and have used some tools like StyleCop/FxCop for .Net and PHP Code Sniffer and likes for PHP and pyLint for Python. I u...
My company recently started doing formalized code reviews. The process goes like this: you submit into a github, request a pull request, code gets reviewed by approximately three people, then if all passes, your code goes in. The process seems fair, however the three people who do the code reviews don't seem to be fair...
Admittedly new to this but I wanted to understand why there is a gap between Red Hat's JBoss EAP project (their enterprise version) and JBoss AS/Wildfly/community project. Looking at this post from Red Hat, it seems that they don't withhold the source/patches. Makes sense since withholding the source would be a GPL vi...
I'm sometimes suppsed to demo work and I wonder if the Scrum methods have specified something about how demos should be done? I've done quick demos and I've been asked to demo on-the fly while it's not realistic to expect that programming always moves only forward. SO I'd like to know if you can tell me since I follow ...
I am currently developing a new library for RESTful web requests in Puredata, and am about to release version 1.0.0. This version will not implement all HTTP verbs, only GET, PUT, POST and DELETE. In the next version, this library will most likely include the other HTTP verbs for RESTful requests, PATCH, HEAD, OPTIONS,...
For a software, I have two different branches, that only differ in using different library versions of a package, that my software uses. The API of this library has changed between the versions in a non-compatible way. I am currently developping using both versions with the identical functionality in different branche...
Single responsibility (from SOLID) is like making me create classes with only one public method. But if it's so, it would be possible use static methods, and go back to procedural programming. What's the difference?
Let's say I have a model that has 'purchase' method. The purchase method should take care of purchasing a product. Signature of purchase public function purchase($token, Model_Member $member, Model_Product $product, Model_Recipient $recipient); To call this method, I need to make $member, $product, and $recipient in m...
When I'm looking at questions asked on sites like stackoverflow on how to make a particular piece of code "more pythonic" there are usually suggestions offered to use complex list comprehensions or generators or other python features that aren't available in, say, Java. I am a casual Python programmer, and sometimes I ...
While working to build software products for early stage startups, I have seen two very common schools of thought that define an approach to application design. Those 2 paradigms typically include designing an application predicated on an "extendible codebase” or a "throw away codebase". What factors should one consi...
Background: I am familiar with xUnit family frameworks and have had experience with (shunit2, PhpUnit and simpletest). I am currently trying to find a testing framework for C++. I did a quick search for frameworks using Wikipedia's list of documented frameworks; however, the framework I would like to use is very diffic...
This may or may not be a silly question, but I really would like to know the answer to something which has been bothering me for a while. I quite often see programming examples/conventions where the programmer has created a directory called acme to put stuff in. What does Acme mean? Why Acme and not Emca or other? Is A...
In my case joining table inside subquery or outside subquery gives very few difference with COUNT CASE 1: about 6202 rows. In this case table_c is joined inside subquery, but is only joined (No other actions for the table, not selecting any data or filtering whole query with that table). CASE 2: about 6235 rows. In th...
I'm currently trying to cover our shopping cart with unit tests. Class ShoppingCartItem has property Term. It also loads available terms for this item upon object creation. Currently this is done using call to static class in constructor. Current state: public class ShoppingCartItem { private Dictionary<Guid, Shopp...
I'm using Visual Studio 2010 to amend a C# project. Part of the application requires the user to be able to save and read a settings file (1 Project reads them in (as read only) from a file. The other project reads them in from the file to be shown in the GUI and when saved, the file is to be overwritten). If both of...
I'm trying to design a small web platform that would host several "applications", with a common user pool. My reflection is now focused on the authorization system. I define an application as an interface that allows users to perform CRUD and more custom operations on a set of resources. I tend to prefer to model an ap...
I have an interface Serializer with methods serialize and isSerializerFor. I created a first implementation of this using TDD, and ended up with a nice clean test case fully covering a nice clean implementation. To get a more concrete idea, here is one relevant commit. Now someone else (who is not used to doing TDD) st...
I am building a Comparator that provides multi-column sort capability on a delimited String. I am currently using the split method from String class as my preferred choice for splitting the raw String into tokens. Is this the best performing way to convert the raw String into a String array? I will be sorting millions ...
I have an exercise in Python as follows: a polynomial is given as a tuple of coefficients such that the powers are determined by the indexes, e.g.: (9,7,5) means 9 + 7*x + 5*x^2 write a function to compute its value for given x Since I am into functional programming lately, I wrote def evaluate1(poly, x): coeff = 0...
I am starting to design the database schema for the eCommerce element of a web service I am creating. The thing I'm trying to get my head around is how to deal with the use case of a seller (user of my web service) deleting a product. The issue I have is that this product could be referenced in a customers basket, to b...
I have some objects that will be created an entered into the database. There is no guarantee that any of their fields will be unique except for the auto-incrementing primary key. I would like to be able to access these objects later in the program using their primary key. What is the best way to get this key out of the...
This breaks nothing (in my experience), but lots of things "don't break anything" and are still wrong. #! /usr/bin/env python """Short description of this module.""" def preferred_exit_method(*args): #code for exiting as desired try: import foo import bar import eggs except ImportError as e: #code...
When unit testing I often find myself debating how much of the data I feed to, and expect back from my units under test, I should include in the actual test files. The tradeoff I constantly struggling with is: If a large portion of the test (in code volume) consists of input and output data, it seems difficult to act...
I have been a Rails developer for a year now, and I really want to start diving in to Ruby and pure programming without using a framework. However I am having trouble conceptualizing little programs I can build on my own. I guess it's because I'm so used to having a GUI (the web browser) to interact with the classes th...
Firstly I would like an answer from an experienced person (not a one man band), someone whom has worked in a medium/large team and had to battle with this burning question before. The problem: I am constantly being asked to not submit empty rows by rows = I mean a list of items and properties. A good example would be,...
Take from wikipedia, aliasing is defined as accessing a data location through different names. Also taken from wikipedia, indirection is defined as referencing something "using a name, reference, or container instead of the value itself". Am I missing something here - Are these two one and the same? If not, how are the...
I was recently tasked with building a Name Entity Recognizer as part of a project. The objective was to parse a given sentence and come up with all the possible combinations of the entities. One approach that was suggested was to keep a lookup table for all the known connector words like articles and conjunctions, remo...
I am a .NET developer who has recently started working in a LAMP environment. I know that if I go to www.somedomain.com/files/test.php, then (1) DNS resolves the URL to my server (2) my server handles the request on a given port (3) the server looks in /files/test.php and somehow runs test.php and returns the output of...
I recently created a version of Snake, the classic game popularized by Nokia, and I am planning on using it as an example of my game development skills. I just want to know if there are any copyright issues that could come up if I do this?
I am senior developer/architect who knows the business domain really well. My new manager wants me to manage a team (yet to recruit of around 5 people) and in the past I have worked in an agile environment but as a developer. So I was involved in the writing user stories, working with stake holders, estimating via stor...
I've just started writing unit tests and I'm not sure am I doing it the "right way." Should I test every class "by removing dependencies"? In other words, does unit testing mean: "test part of a code with assumption that provided dependencies to other modules are correct and test these dependencies as single modules la...
I want to create a lookup table for this data: The "input variables" (what is used to "lookup") are 4 different doubles that can each take on 1 of 200 numbers (the numbers range from 1-1000 but there are only 200 possible numbers that each can be (these 200 possible numbers that each of them can be are known to me)) th...
A block is a list of statements to be executed. Examples of where blocks come up in C are after a while statement and in if statements while( boolean expression) statement OR block if (boolean expression) statement OR block C also allows a block to be nested in a block. I can use this to reuse variable name...
I've been reading about D and Go and how they aim at being compiled to machine code yet be convenient (like garbage collection, no need to manipulate pointers unless needed) and I agree that there is a need for such a language. However designers of both Go and D for some reason decided to invent a new language. Why? Wh...
I am developing a game in JavaScript where you start with a user input, stored in the variable "controller". The options for the user consists of start to start the game or about to learn about the game. I was going to use the following code if(controller === "start"){ // Game code sitting here } else if(controller...
I'm working with a team building a RESTful web service, and our current implementation utilizes the user's email as a unique identifier for the user resource, yielding URIs like the following: https://www.domain.com/users/example@gmail.com/resource Emails are guaranteed to be unique in our system, and we've handled whe...
Does putting the view logic inside the controller increase page load speed? Because I have a controller action calling a view which I am loading through ajax and I am getting a very slow response. Why is that happening? Does putting the view logic inside controller like... echo "<div>View echoed</div>" a good way to ...
I am currently writing a transformation from model space to clip space for use in OpenGL. From what i have seen, programmers typically use a traditional rectangular frustum to define the clipping boundaries in their model space. I personally had in mind a shape like a frustum, except the near and far planes are spheres...
Suppose we are in a distributed environment, and mutual exclusion is not implemented yet. So how would we be able to detect race conditions? When I researched, use of non-blocking algorithms was found as a solution. That is using datastructures like stack, queue, etc. So that we could avoid mutual exclusion. But how do...
I am currently working on an application (basically its a kind of execution engine capable of running user defined jobs and generate output in real time) that needs to handle rollback functionality, it might sound crazy but is it possible to have such thing at the application level? e.g. imagine some user tries run a j...
Why did the team at LMAX design the LMAX Disruptor in Java but all their design points to minimizing GC use? If one does not want to have GC run then why use a garbage collected language? Their optimizations, the level of hardware knowledge and the thought they put are just awesome but why Java? I'm not against Java or...
Question title can be a little confusing but I didn't have a better way to put to put it. In Java you can have this: JLabel HoHoHo = new JLabel(); ... HoHoHo.setText("Ho Ho Ho"); And this: JLabel HoHoHo = new JLabel("Ho Ho Ho"); In both cases, it gives a label with Ho Ho Ho on it. Question How is that possible? I me...
I'm looking at a very large (5-6 digit LOC), very complex, code-base, full of interacting bulky, interdependent, views and stored procedures (multiple 4-5 digit count silos). The source SQL has been touched many times, by many different people, and no formatting constraints have been enforced. This led to wildly differ...
I've been working in an application with about 100k LOCs and basically We have been reworking features to comply with a new architecture based on a new technology stack. This work is almost finished but we had to keep the old code because we had to guarantee a stable environment in case of critical bugs in the new . Th...
Would simply using AWS to build an application make this application a distributed system? For example if someone uses RDS for the database server, EC2 for the application itself and S3 for hosting user uploaded media, does that make it a distributed system? If not, then what should it be called and what is this applic...
I have two objects, one is a User object and the other is a Content object. The User object has properties like 'reads_articles' or 'reads_books'. The Content object has properties like 'is_article' or 'is_book'. If the two properties match up (i.e. the User reads_articles and the Content is_article), then the User can...
I'm writing a semi-automatic scheduling application. Given some existing bookings and some resource requirements, it needs to find the times at which a new event can be scheduled. A human user will then evaluate the results and choose one of the options. It does not need to optimise a timetable for multiple events and ...
We are a team of 8-10 developers working on different parts of a Sitecore instance. In the past we've used SVN and more recently (and successfully) Hg, but are moving to using Git as our primary source control. We're working with Sitecore 7, and using the latest TDS from Hedgehog. In case it matters we're also using th...
Why is it that the IEEE 754 standard provide 8 bits for the exponent but puts a range maximum of 38 on the largest acceptable exponent? Seems kind of ridiculous to have the data storage there but not allow it to actually be used. I wanted to pack data into this exponent for some encoding I'm doing, but I can't use all ...
Why is there no exponentiation operation in hardware, even though many languages have builtin operators for it? Is it because even hardware implementations would need to use the same algorithm as software (i.e. no hardware implementation could be significantly more efficient), or because it is rarely used, or another r...
In quite many assemblers, a value copying instruction is usually named "MOV" and its description in manuals usually also contains "move" (however, other words can be used, like "load", "store", "extract", etc.) It's uncommon to find an ISA ) which doesn't follow this convention. On the other hand, in other contexts, "m...
Suppose I have a list of objects sorted by a person based on that person's subjective taste. Let's assume that this person is being somewhat consistent in their sorting and that there are quantifiable attributes of these objects that I can identify. For example, a person might sort cheese based on how much they enjoy t...
I've been a Rails developer for a year now (originally self taught), and am at the point where I want to improve. I've been reading books on how to improve the quality of my Ruby code (I read Design Patterns and Practical Object Oriented Design in Ruby). I'm trying to improve the quality of my code and to add to my po...
I have my enum like this. enum Size{PAGE_SIZE=20, HEADER_SIZE=30 }; I only use them as constants(No enum variable created) in my program. i.e= int x = PAGE_SIZE + 20; So what is the better way to declare the constants in this scenario? (enum or const)
I've never built a RESTful API before and I am wondering how discrete should it be? For example lets say I have a customer which has a name, address, phone number, email address, language, etc. Does it make sense that there is a way to update each individual field (update address, update email address, etc), or should ...
I'm working (slowly) on a small Flask project. One of my models is a class called Post, which is a lightweight namedtuple. Post objects are created by a PostFactory, because creating a Post involves hitting a database. The PostFactory holds the necessary database connection, so the Post objects can be serialized. What...
When you have to iterate a reader where the number of items to read is unknown, and the only way to do is it to keep reading until you hit the end. This is often the place you need an endless loop. There is the always true that indicates there must be a break or return statement somewhere inside the block. int offset ...
What would be a good use case to use a native XML database such as Apache Xindice and eXist-db? I have used XML features of SQL Server in the past and they were of great value, but there it is possible to use XML for 5% and traditonal storage for 95% of the application. Which application types would benefit from a 100%...
Most functional programming languages such as Scheme and Haskell use lists as their main data structure. Queues are identical to lists, except for the fact appending to the end - not to the begin - has constant time. Every algorithm that is written elegantly using lists with head and tail can be written elegantly using...
Is there any special reason that to construct list in Scheme you use (cons 1 (cons 2 (cons 3 nil))) instead of (cons 3 (cons 2 (cons 1 nil))) ? While the first seems more obvious because it reads in the right order, the second is the one which actually reduces in the right order. Also, it seems more natural to const...
Where should you manage a users session in a SOA? Should you manage it in the Web Service or in the client and why? My application is SPA (Considering that this will be the stacked that will be used Apache CXF for Web Services AngularJS for making REST calls)
Many dekstop apps have this, such as dropbox (windows version). You right-click the dropbox systray icon and there are shortcuts to the features of the main app. Right now, I want to keep it simple and just want to run a exe(?) and have a custom icon appear in the system tray notification area. How do I build this?
I am a beginning programmer and I was recently working on some primitive GUI apps in Java. That's where I encountered different layout managers. I browsed the web and it says that for advanced GUI creation there are NetBeans and Qt and a lot of other stuff. My question is: Do I really need to learn all ins and outs of ...
I've heard that methods are more Object-Oriented than functions. I was wondering if someone could show me an example of a function and a method and explain the differences between methods and functions? I have taken 3 quarters of Java programming and functions have never been mentioned, I want to know the differences,...
class A { public: int i; }; // A.h and defined in project libA.vcxproj (libA.dll) I'm using class A in multiple places at various projects as below. Apporoximately 100 projects. include "A.h" class UseA { public: A *a; UseA(){ a = new A(); } ~UseA() {delete a;} } My problem is whenever I add a member variable to clas...
I have identified a couple of open source projects on github.com that are not being kept up to date for many months. I have used them for personal use, and now want to make enhancements to them and start maintaining the code base and write sample clients that use these projects. I've sent pull requests to the authors a...
I have a method to be tested which depends on the OS, what's the best approach for testing the method depending on the OS? Is it to test on every OS that I have I require? Is there a better approach for running the tests on only one system? Some more specific information is that I have a method which is dependent on t...
The guidelines discuss the service layer with its service interfaces and data/message/fault contracts. They also discuss the business layer with its logic/workflow components and entities as well as the 'optional' application facade. What is unclear still to me after studying this guide is where the implementations of ...
Main excuse from the developer for not having a good unit testing is "Code is not designed in a unit testable fashion." I am trying to understand what type of design and code that can't be unit tested.
I need to create an information service on trains to deliver live information. I am looking for some ways to go about this. There are already existing LCD monitors in many of the train wagons. They are powered from the battery. When the train is moving, I would like the screens to display the following information: ...
I was having a think tonight while pondering over some application I need to change and it got me thinking. Entity Framework Entities are POCO (Plain old CLR Objects) and models used in ASP.NET MVC are usually also POCO. This basically means just properties, no methods. Now OO programming normally allows an object to e...
I've been working through this article to organize my front-end code. It references articles on BEM / SMACSS, which in turn reference other articles. I'm really trying to understand what the best practices are ... I have a few days to lay down this "standard", and then have to burn through a high-priority / high-visib...
Premise: I know that such a game would be better solved by MCTS, however, from a theoretical point of view, would it be possible to apply minimax to a bayesian multiplayer game where the order of playing is determined by result of the previous turn? Game description: Players: {A,B,C,D} (A and C are the maximizing team...
We concatenate CSS and JavaScript files to reduce the number of HTTP requests, which improves performance. The result is HTML like this: <link rel="stylesheet" href="all-my-css-0fn392nf.min.css"> <!-- later... --> <script src="all-my-js-0fn392nf.min.js"></script> If we've got server-side/build logic to do all this for...
My office department logs in to the ISP Server through a keep-alive-browser login page. This, for better performance, is encapsulated in to a small python script. This is what it does (Pseudo code) 1.CheckForActiveInternet 2.if not active Login KeepAlive 3.else report In step 1, a host like "www.google....
I am doing a restful web api with asp.net Web API 2 I do not want to use any form of cookies or basic authentication (send user/pass in cleartext thus SSL needed) I do not use/need claims stuff. I have not decided yet about asp.net self hosting or IIS. I just want to send an encrypted token between client server via SS...
In my search for a practical non-turing complete programming language, I've been paying attention to lambda-calculus with disallowed self-application - that is, x x forbidden. After taking that language and augmenting it with lists and the foldl and range operations, pretty much any algorithm I've tried so far is imple...
I am interested in developing a program that generates an endgame table-base for the chess. I have gone through the technical papers of the greats like Shannon and Ken Thompson. I have found that retrograde analysis is used for the generation. How can I generate all positions in a KBBK chess endgame which are mates in ...
I am confuse about scrum .it is methodology or Framework?. I want to use scrum for development but i want to develop scrum tool but i am confuse scrum is methodology or framework?
I am new to c++ and have been making the good old Calculator. I have gone forward from a 2 value calculator to a 3 value calculator and wondered.. How is it possible to make a 10 digit calculator (purely using +,-,*,/) that doesn't forever to code.. I have a if statement which returns what happens if the operators are ...
Consider the following program: #include <stdlib.h> #include <stdio.h> typedef struct S_s { const int _a; } S_t; S_t * create_S(void) { return calloc(sizeof(S_t), 1); } void destroy_S(S_t *s) { free(s); } const int get_S_a(const S_t *s) { return s->_a; } void set_S_a(S_t *s, const int a) { int ...
I need to design an online exam server for an exam like GRE in which question difficulty increases if you answer correctly and decreases if you answer wrong. Questions are multiple choice questions Difficulty scale of question is 1-10, 1 being the easiest and 10 being the hardest. If two continuous questions are ans...
I need to design an online exam server for an exam like GRE in which question difficulty increases if you answer correctly and decreases if you answer wrong. Questions are multiple choice questions Difficulty scale of question is 1-10, 1 being the easiest and 10 being the hardest. If two continuous questions are ans...
I was once told to read the books titled 'The Pragmatic Programmer' and 'The Mythical Man Month'. I have very little experience programming (basic HTML, CSS and JS). If I were to purchase these books, read through them, would it be beneficial to me with such a limited understanding or would I benefit from them? I ask b...
I need to track permissions and access requests to a file server in a database. I'm given the full path of the folder and am considering parsing the path (splitting on the "/" character) and creating a self-referential link to the table... in addition to a column intended to store the full file path. What is the ideal...
Let's say I have the following classes: person, widget, foo_bars. A person can have multiple widgets and foo_bars. When an admin deletes a person, I want my code to do a cascading delete... and remove all related records in the database for this person In my widget class, I have a delete method... and the same is tr...
I'm writing a card/ board game in Java. Since the game has lots of cards that interact in different ways, my Player class has become sort of bloated with all these different fields used for keeping track of data that specific cards need. However, not every card is used in every game, so many of these fields are not u...
I'v developed an internal singe-page web-app (unix, apache & postgresql) protected by a simple login page. Currently, the users have their own login role with a password. This is starting to get cumbersome for a couple reasons: Users have multiple passwords (for my web-app and Active Directory, the company-network is ...
A lot of issue trackers support something called "milestones". I've never found a use for them. It seems that milestones are only useful when you do big, scheduled pushes, but not if you roll out new features and bug fixes as they're completed. When/how would you use milestones to organize agile development?
This is more of a conceptual question. I have learned about Neural Nets, and I have some clue as to how Support Vector Machines work. I read somewhere however that given the appropriate kernel (is that right?), the SVM is identical to the Neural Net. Could someone who understands this please enlighten me as to how that...
Which one is considered better: having a directive that interacts with services directly or having a directive that exposes certain hooks to which controller may bind behaviour (involving services)?
I would like to know arguments for/against this concept. Technologies in use from the bottom up: MSSQL 2012 DB (exclusively accessed via sprocs) Entity Framework WCF Web Service ASP.NET Webforms Someone on my team would like to use Entity Framework to map the sprocs to ComplexTypes, and then use those ComplexTypes...
Aren't both just a set of instructions that get executed by some interpreter? (contrary to a full-fledged program, which runs (gets executed) at some computer system?
This claim by Aleks Bromfield states: Almost every language with a static type system also has a dynamic type system. Aside from C, I can't think of an exception Is this a valid claim? I understand that with Reflection or Loading classes at runtime Java gets a bit like this - but can this idea of 'gradual typing' be ...
On this blog post aphyr (who is a brilliant programmer) states: Clojure macros come with some important restrictions. Because they’re expanded prior to evaluation, macros are invisible to functions. They can’t be composed functionally–you can’t (map or ...), for instance. The classic example of this is: (reduce and [...
All programs I have seen organize their data memory into one or more call stacks (usually fixed size, but sometimes not), the heap, and static memory. Lately thread-local static storage has been added to this as well. Have there been any attempts to organize data memory layout in a radically different way, e.g. withou...
This is an open-ended question which I am analysing while doing some fun projects in leisure. Websites like Google, Facebook do store user activities and perhaps sell them or use them for advertisements. But I believe anonymity is maintained. For instance, I need to expose that there are 5 people between age 45-50 who ...
I am a bit new to DDD and bear with me if my understanding seems way off. My question is about Udi's solution to domain events, particularly the class DomainEvents (see code below) An excerpt from Udi's code. It lives domain model as a static class. public static class DomainEvents { [ThreadStatic] //so that each ...
I am creating a program (mostly just for fun) that displays live prices for horse racing markets and the prices that several models predict they should be. I am very interested in the optimal way to structure this kind of data. I need a Dictionary<int, (something)> to store <raceId, data> where the key (raceId) is a nu...
I have a class with a validId($id) method that is called by the constructor and by public function load($id). The method queries the database to see if the id exists and returns true/false. The constructor optionally takes an $id (if no $id, then the object will be empty). The constructor checks the $id with validId($i...