instruction
stringlengths
34
19.9k
I am working as a software engineer turned team leader in a large software company. One of my areas of strength is node.js, and we are in the process of moving a lot of our services to separate node.js services, which is proving to be very successful so far. However, I am supposed to stop day to day development of sma...
I'm reviewing my notes on Kruskal's algorithm and have a question about getting the runtime down to O(E lg V). By using a PQ with edges and a boolean array of which vertices we have added to our tree T, the running time is O(E lg E), but in my notes there is also a variant with running time O(E lg V), by using a PQ wit...
I have an application that consists of a set of Java and C++ of processes running on one or more systems and need to ability to monitor and control the components as if they were one complete system. My requirements: runtime statistics (messages per second etc..) log of events control: "service X set rate to 1000 mps"...
I usually feel reluctant to use any third party or open source controls while coding in Objective-C iPhone due to following reasons. Open source controls are developed in incremental manner. So once integrated I have to keep looking for update and will have to update my code. Will increase effort. Open source controls...
I am working, with a co-author, on a data modeling toolbox that will someday be sold. Part of the functionality is the extremely common PCA, which we are doing in a more robust way. Thus, we need a PCA function that has the usual algorithm with some modifications. For non-commercial peer-review academic research, I cou...
I have a rather odd problem. I love the practicality of PHP - specifically that I can fairly safely assume that on any random server I'll have access to the MySQL libraries, and that I can go between PHP/HTML with <? and ?>. That said, I find the language atrocious - Ruby and Python are considerably more expressive, ye...
In refactoring a lot of MVC code, I have run into an issue with my URL design. For example, let's say we have a Venue object public class Venue { public long ID { get; set; } public List<Event> Events { get; set; } } and an Event object public class Event { public long ID { get; set; } public Venue V...
It's a common issue to see a company's sales team promise new features in order to close a sale. Many times these new features are still in development or are still being designed. Sometimes features are sold before the development team even knows about them. If the customer understands the features are not yet impleme...
I am reading "Javascript : The good Parts" to improve my Javascript bases and knowledge. I was reading stuff about prototype and I encountered in this function : var stooge = { ... } if(typeof Object.create !== 'function'){ Object.create = function(o) { var F = function () {}; F.prototype = o; return new ...
Is there a guide out there on how to choose when to pay for web hosting vs. hosting your own? Assuming that root access is a must I would like to compare things like cost, scalability and personal stress. Here is what I could come up with. Paying for web hosting: Benefits: Much cheaper for a small scale. I assume any...
Given that we do not know the encoding of a string what is the best way to make sure that it is transformed to say ASCII? Also in such situations we are willing to accept potential loss of data.
How do I include the copyright/license for a library if I use on 1 function? Say if I have a class that I have taking 1 function from another library: class MyClass { ... public function someOtherLibrariesFunction() {} } And the at the top of the file I took the function from it says: /* * This file is part o...
I have been working freelance for a few years, and before that I worked as an entry-level coder for a non-technical company. I "understand" how delegates, and MVC, and how to make an app and make it work, but I have done a few interviews recently and they are throwing questions at me that I don't know the answers to. T...
I developed a pretty big website. I tested it myself to the best of my ability, but I cannot test all scenarios that my users may run in to. I found a testing team in India, but they don't seem to have any systematic approach to testing website functionality. They test each individual page rather than the full process ...
I am new to Clojure. I can understand the code I write but it becomes too difficult to understand it later.It becomes difficult to match parentheses. What are the generic conventions to follow regarding naming conventions andindentation in various situations? For example I wrote a sample de-structuring example to under...
I started reading some tutorials about OOP, because I want to learn the basics. I have a question about it. I understand how you can have a object "Car" and give it a color like this $oCar->setColor("white"); But there are some things unclear to me. Let's say I have a database with all kinds of cars. What is the best ...
This is part of a series of questions which focuses on the sister project to the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. The sister project is called OILexer, which aims to construct a parser from grammar files, without the use of code injection on ...
I wrote a comparator for a custom class of mine and when I ran my code I realised the output of my list of these objects was in the reverse order as to what I wanted. It was "ascending" as opposed to "descending". This was because I stuck to the spec of compare where a return value of less than 0 means the other object...
I've extracted interfaces from my repository classes, like ICustomerRepository, IProductRepository and so on. The project which contains the repositories is named X.DataAccessLayer. Should I call the project with the interfaces X.DataAccessLayerInterfaces, or what is better? And I definitely have to keep the interfaces...
Do you write your code then optimise it? Or do you write an optimised code from the beginning. I always believe in writing optimised since I really dont like to rewrite code, But please share your thoughts.
I use eclipse for coding, and the language which we use is Java. Once it was suggested by someone that to properly format the code, using the auto formatter(CTRL+SHIFT+F) While this command does format the code, but sometimes I feel that overall look becomes weird, and it is not actually very readable. So is this a rec...
This is in summary the TDD method: Write a test check if thes test fails write production code run test I think that TDD as presented works only in ideal circumstances. I'll take a simple example: Specification: Write a program that calculates the square root of a number, the user must enter a number. If the number...
I have a large project with a driver part and about 5 libraries doing various associated tasks. Many of the libraries require access to 'global' configuration data which is read from a database at startup by the driver code. By driver I just mean the part which contains the main function. My idea on how to handle thi...
I have an application, where font size, font type, color, background color, image and a lot of things change based on theme. I realised in the beginning itself that using enums to denote themes and then checking the theme everywhere was a horrible mistake. So I have two approaches now and I am confused which one to go ...
I've created an app that has some sound file that I've downloaded from Macloops. The user can only listen these sound files (he can't create any new sound files using them) with the app. Now, I want to distribute the app over the internet and I'd like to know if I can do this legally. I've only found the following the ...
I am currently reading a draft of the C11 specification. The new introduced keywords: _Bool, _Alignof, _Atomic all feel like custom extensions, instead of standard reserved keywords like struct, union, int. I realize that the standard basically consists of standardized extensions ... but still, this is awful! Maybe we ...
My team is just getting started integrating agile practices (we've chosen kanban) into our dev, test and design teams, but we have a lot of bug cases and feature cases not written in user stories left over from the old system and we're trying to find a good way to take care of the bugs but still keep the devs that need...
I currently have four projects in my website's solution: Project.Data This holds the EntityFramework DbContext object and also the Repositories that interact with it. It references Project.Models. Project.Models This holds the business objects and doesn't reference any other project Project.Web This holds all ViewModel...
I have a DAO that brings data from a web service, that data comes in a string, in the likes of: *NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...) I have a DTO that I wanna fill up with the parsed data (the DTO has fields in the like of name, birthdate, id...) So, my question is, what is the best practice: Parsi...
I am developing a web application based on a proprietary (but free) JavaScript API. My company is considering releasing our application as "Open Source", but we are unsure of the different licensing options and how they will work considering we are using a third-party proprietary API. Can anyone help me with the follow...
I am test-driving a method that is to generate a collection of data objects. I want to verify that the properties of the objects are being set correctly. Some of the properties will be set to the same thing; others will be set to a value which is dependent on their position in the collection. The natural way to do this...
I'm jumping back into ASP.NET development after spending the past 7 years playing manager, dba, and winforms developer. I've dabbled with a few things web related, primarily maintenance of existing webforms apps, but I haven't done anything with newer technologies. My, how things have changed! After watching a lot of...
I am trying to convert decimals, (0.05, -0.28, 25.00, etc), to a 17-bit 2's complement Signed Number. The parameter data I am sending is SysEX Midi Data (to some external Synthesizer). The data parameters are composed of 3 bytes. For example, the example given is as follows: The parameter data to set the value to ...
I was looking over the evolutionary history of Unix and Unix-like systems on Wikipedia and one operating system name stood out to me: OpenServer. Judging from the image, SCO's OpenServer is completely closed sourced; so why does SCO OpenServer have the word "open" in its name if the operating system is proprietary and ...
I see all the examples that demonstrate unit testing code and mocking the calls to the DB since you are not suppose to touch the DB. But it seems to me having a set up tasks that uses the actually schema, loads the lookup tables and then populates it with data using the methods to be tested... This way it is more real ...
Recently, it was suggested that many projects (where I work) should be implemented using some combination of stored procedures (on SQL Sever / T-SQL), SSIS, and SSRS. In one specific project, SSIS would get a file from a SFTP server. The file contains the daily price of ten stocks. A data warehouse will store the dail...
I've started to work with web development using PHP as server side programming language. In that time I didn't know the benefits of object orientation and had a hard time trying to write more maintainable code (for instance, spliting presentation from logic, and etc). After some years I knew about ASP.NET MVC and I gav...
In the Go Language Tutorial, they explain how interfaces work: Go does not have classes. However, you can define methods on struct types. The method receiver appears in its own argument list between the func keyword and the method name. type Vertex struct { X, Y float64 } func (v *Vertex) Abs() float64 { re...
I just came across the article "Rule of Three" in wikipedia Rule of three is a code refactoring rule of thumb to decide when a replicated piece of code should be replaced by a new procedure. It states that the code can be copied once, but that when the same code is used three times, it should be extracted into a...
I'm using iPage as my cloud based server provider. I haven't had any problems with them yet. They hold the scripts for my RESTful services for the mobile app I'm developing. My problem however is that tonight the service went down. I got a "This is a 500" error. I'm wondering how do I build redundancy into my RES...
What is the time complexity of the algorithm to check if a number is prime? This is the algorithm : bool isPrime (int number) { if (number < 2) return false; if (number == 2) return true; if (number % 2 == 0) return false; for (int i=3; (i*i) <= number; i+=2) { if (number % i == 0 ) return fal...
At projects.eclipse.org Mylyn Build 1.1.0 is slated for June 2013. At www.eclipse.org/mylyn The "news" says Mylyn 3.8.3 was released on March 1st. Why is there little or no correlation between the two?
I have a sparse matrix that contains several islands of unknown size. I would like to find the highest peak of each islands. Consider this matrix as an example: 0 0 1 0 0 0 0 0 0 1 2 1 0 0 0 0 0 3 2 1 0 0 1 0 0 0 0 0 0 2 3 4 0 1 0 0 0 1 1 0 1 0 0 0 0 0 0 1 0 In this case I would like to get the position of 3 at (3, 2)...
Background: I'm an apprentice and am handling the project of developing a particular IS-System. Currently I'm only managing the requirements analysis and the information-processes design, but as a Software Developer, I would also like to implement the concept as an actual Web-Portal. When it comes to choice of technolo...
Hopefully this question will be a good suit for P.SE since it is a whiteboard-level 'how can this be done' conceptual question. I'm trying to build a product that needs to be available to someone on the move with a mobile device when their connection may be quite poor (due to travelling between cities where 3G coverage...
We were trying to figure out the optimal sprint length for our project. After working on a 3-weeks basis we thought that cutting the sprint to 2-weeks would provide better velocity. The advantages were clear - shorter feedback loop, small stories (with user value) and so on. On the other hand, there are a lot of disadv...
So as a general rule to avoid a stack overflow, big objects should be allocated to the heap (correct me if I am wrong). But, since the heap and the stack expand towards each other, wouldn't this cause heap overflow or alternatively limit the space for the stack and higher the chances of stack overflow?
I never coded on VS and I'm a junior programmer in C# and I would like to know if the entity framework is available only for ASP .NET applications ?
Ok, I have this human here, but what can it do, how would you discover its special abilities? And when you find out what kind of expert you've got then how would you actually make use of its unique responsibilities? An example for this architectural pattern question: Base Interface with Characteristics Common to All in...
I plan to write an network application whose use steps is the following : Connect to the server and choose a name (and enter your email "id") The list of others "free" (not playing a game) players is shown to you : so you have to select one. The server use the two players ip adress in order to connect them But I thin...
Context: I was looking to see if there was a tool to do something (in my case I was looking for a proxy that would allow for http log inspection from a python test framework). There turned out to be a tool that would require only minor adjustment, and it seemed to be reasonably stable/mature, with no updates in the pas...
Different types of dependencies have particular names, such as linear dependency, circular dependency, self-referencing object, etc. What is the name of the dependency where those rules are true? A has zero or more B, B has zero or more C, and: A has zero or more C. If there is no particular name for such relatio...
I am working on adding test coverage for an application that previously didn't have any. One additional requirement that emerged is that one of the background processes should be able to process 100,000 rows at a time. I've written a unit test that ensures that the background process is able to work with the 100,000 e...
TL;DR - I'm trying to design an optimal data structure to define units within a unit of measure. A Unit of measure is essentially a value (or quantity) associated with a unit. SI Units have seven bases or dimensions. Namely: length, mass, time, electric current, temperature, amount of substance (moles), and luminous...
What I am doing is creating a DBProject.. importing a DB.. then creating scripts in the PostBuild that are DATA scripts for each table (so that the post build can populate the tables after the schema is generated.. Then problem is some of these tables containg 50,000 rows and when you put a 50,000 row insert into ONE ...
I work in a fairly large team (~15 developers) which is currently discussing our working methodology. The software we work on is quite feature-rich and expanding rapidly in terms of scope so the number of developers has increased lately and will continue to increase. At the moment the different developers have differen...
In reading this blog post about Photoshop 1.0 I was surprised to learn that it was written in Pascal (Object Pascal to be exact). But you never hear about Pascal anymore. Why is that?
This question is purely hypothetical. I use WordPress a lot and know the filter structure from an implementation point of view. I'm now wondering what's the best way to implement such a structure (not the way WordPress uses, but the best way). I will give a short overview of what the WordPress filter structure is. Aft...
I know that std::vector uses a contiguous block of memory, but I often see people use vectors of vectors, even when they modify the number of elements in these vectors contained within an outer vector. Won't this lead to efficiency problems when an inner vector need to be resized as all the following vectors will have ...
I understand services should have no state and no business logic. How can you implement a service like AuthentificationService considering these rules? All the methods in a service should be static?
I have a Bird class. A bird can learn and a bird can fly (methods). A bird can only fly after it learns. Considering both methods are public. How can you make this clear to another fellow developer. Usually they should take a look at the public method names and understand what they do. But how can he understand without...
My boss asked me to alter our Java Webapp such that users cannot go to places in our Webapp by typing URLs into their browser location bar. I told her that I can not disable their location bars. I told her the way this is usually done is to launch a WebApp in a new customized browser window sans a location bar. That wa...
After over two years of working in a highly siloed, "lone-wolf" development department structure, we're adopting Agile SCRUM. Great. I like Agile; as a dev it keeps you focused, busy, and productive without having myriad stakeholders shoving project after project down your throat with the expectation they all be done y...
I am reading this article on a new feature of ECMAscript 6, generators, that are landing in the V8 JavaScript interpreter. Not too far from the top, the author suggests an analogy: generators are like functions, with their bodies taken to the first derivative. Calling next integrates between two yield points. I rea...
The first answer to an old, recently active question linked to a video which talks about how Google repository is done. One interesting thing which was mentioned is the fact that everything is build from source, without relying on binaries. This helps avoiding issues with dependencies becoming obsolete but still being ...
I'm working on a VB.Net WinForms project and found myself writing code like this: this.Fizz.Enabled = this.Buzz.Enabled = someCondition; I couldn't decide whether that was bad code or not. Are there any .NET guidelines for when/when-not to do assignment chaining?
We have a research project with idea->prototype->statistics development cycle. Anyway, our final product is a prototype, so the statistics collection suite is not used persistently. Supposing I have following class: class Transform { private: someData; public: transformForward (inp_block, outp_...
UPDATE 1 as requested by Brendan. We are developing a Unix batch application for storing millions of customer records into a relational database. In order to allow multiple batch jobs to run in parallel, and to achieve a certain amount of concurrency while processing an input record, we've distributed the work across ...
So from what I've read about combinators I can't quite tell how they're different from simply chaining function calls. I know I must be missing something but I'm not figuring out what I'm missing. I mean would g(f(x)) (where f and g are functions) effectively be a combinator if I gave it a different name?
Is it ok to call a webservice from a Domain object?. As I write the question I am thinking that you should never do that, as it is poor design, but the situation is the following: I have a domain object called Postman that works very closely with a Message object. This Message is provided by a web service. Without the ...
I am working on project that deals in customer support. This website actually sells products ( so it is commerical ), and provides customer support. So in this project/website I was about to use select2 . Select2 License: This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the...
Normally I start a project working on a site, I'd do the basic html skeleton and then start tweaking the styles using CSS. Slowly I'd just add one CSS rule after another with no "organized structure" or groupings in the CSS rules. And at the end of the project I look at the CSS document and the abomination I have creat...
I have a class, called PolicyProvider, at present with the following (abridged) interface: public interface IPolicyProvider { List<Policy> GetRenewalPolicies(Client client, int financialYear); } The purpose is quite obvious - every year, the insurance renews for the client, and they will get a number of new polici...
Is RESTful API appropriate for the following scenario? A time-limited token is obtained, which will last for one minute only Image is uploaded to a server Server performs some CPU-heavy image processing upon request, within the time limit The result is available for download, within the time limit When the token expir...
If I download a module for Python (such as alglib) and installing is simply a matter of running python setup.py install Where should I be keeping the files I download, or the files that get created after I run setup.py? Is there some neat folder in the python directory that people put these modules before running setu...
What work path do there exist to identify reasonable vertical slices of a classic n-tier platform code base and infrastructure (enterprise size)? Regardles of refactor or a new solution I think there will be the same approach (more or less?) So i'm primary interested in steps and definitioning of modules, functions, th...
In FP languages, calling a function with the same parameters over and over again returns the same result over and over again (i.e. referential transparency). But a function like this (pseudo-code): function f(a, b) { return a + b + currentDateTime.seconds; } is not going to return the same result for the same para...
My friend and I decided to create a large programming project together. Before that, I have never worked in a pair (I had quite many projects on my own and at work the boss defined the task for me). But now we have an idea of what kind of app we are going to do, how to plan it...but how can we divide the responsibility...
I'm thinking of building a language for PIC microcontrollers. I want to be able to use non-fixed size arrays, like this: Declare the variable as int[] Wait for input from serial connection Make the variable input long I think such a feature would be useful, but don't know how I should go about implementing this in a ...
I'm in the middle of moving away from PyroCMS to a custom solution built on Laravel. Wont go into the details as to why here, but it is a necessity. I'm toying with the idea of caching things like pages and posts into flatfile once they are created, and then loading them (if they exist) and falling back to the mysql d...
I am in the process of writing a library that is used to be able to access data from a database. The library requires the initial definition of all the tables that the application will be using in the form of classes that extend an abstract class within the library. These classes contain the database connection the tab...
Scenario: One data input feed (call this Source) Multiple objects (call these Layer1) read this Source, and analyze the feed. This analysis is stateful. Layer1 objects have configuration parameters. For example, new FooLayer1(10, 20) will do different analysis than new FooLayer1(20, 20) will do different analysis than...
Exception handling in C++ is limited to try/throw/catch. Unlike Object Pascal, Java, C# and Python, even in C++ 11, the finally construct has not been implemented. I have seen an awful lot of C++ literature discussing "exception safe code". Lippman writes that exception safe code is an important but advanced, difficult...
I am reading Clean Code by Uncle Bob. Because I am not a native-English speaker, I couldn't understand following statement: Classes and objects should have noun or noun phrase names like Customer, WikiPage, Account, and AddressParser. Avoid words like Manager, Processor, Data, or Info in the name of a class. A cla...
I am trying to write a system log parser. It will receive messages from the FreeBsd syslog daemon through stdin. It will use those messages to determine if an ip should be banned or not. The problem I have is that after x seconds the ban should be removed, but if I won't get any input from stdin, my program will just b...
I'm trying to make a case for not putting the structure in the parent BaseModule class I've shown below. I'm more for a Strategy Pattern, and minimizing inheritance in favor of has-a relationships, but I am not really sure of what principle of OOAD this pattern is breaking. What principle of OOAD is this pattern bre...
With no time to refactor, when you are working on legacy code, with the most awful conventions, what is the best practice? Will trying to follow better coding style would improve readability or actually hurt it? For example, in java method names are usually camel cased: myGoodNamedMethod But in the repository there ...
So I'm finishing up refactoring some code to remove a number of previously-mutable objects and add a better generic processing for all the classes in the domain. Just as I thought I was finishing I eralized that there is one sub-class that has some additional state. The additional state is a link to other classes that...
This question could be titled "Place password hash and salt in query string?" as well to be less subjective, but the point remains the same: I want to create kind of a launcher application for my web application, which should allow the user to specify his credentials to auto login into my web application. Now since pla...
I am interested to know what other peoples' experiences are with managing development infrastructure are. I am talking about things like the build server, the central git repo etc etc. Any infrastructure which end users would probably not even know existed, but which are essential for the development team. Do your d...
From the basic Angular tutorial, it seems like all it does is fetch some JSON from an API and display it. Also, there's its double binding magic. But why would I use it instead of a backend solution (like Rails) that builds the view in the backend and serves it to the user, with everything in place already? What are th...
So in the javascript app, we have a lot of repeated chunk of menu items with the specific settings: URL, Name, Title, etc etc (these settings sometimes can be optional). Here is the gist of the menuItem and we have tons of them. The client pushes new changes every month or twice per month on these items, either the men...
I have created a utility library and open sourced it on Github, and I'd like to document the HTTP utilities. I created this around some apps I've developed, but none of the APIs I use are for public consumption. I want to use a well known public API in my documentation so that code samples will work and be really eas...
I think it is just my thinking that is off here. Suppose I have two entities: question and choice. A question can be a parent or child, or both (in relation to other questions). It seems that this model is too simple and is an unresolved many-to-many, but I think my thinking is the problem here so this is more of a con...
I am trying to find a way of classifying different types of PHP functions. For example that fopen, fwrite, fclose and so on are all part of IO, and the MySQL functions and MySQLi class is all for mysql related things but something more automatic was wondering if there is some sort of function class mapping in PHP
Haskell core language is really simple. Coming from an OO background, the main difficulty is to adapt to the pure functional paradigm. While learning "basic" Haskell, I have always considered language extensions as toys for CS people or as experiments for future versions of the language (like from future import ??? in ...
I read in the Dennis Ritchie's The C Programming Language book that int must be used for a variable to hold EOF – to make it sufficiently large so that it can hold EOF value – not char. But following code works fine: #include<stdio.h> main() { char c; c=getchar(); while(c!=EOF) { putchar(c); c=g...
I am writing some agile user stories and acceptance stories for the first time, and was hoping for some feedback from an experienced product manager or developer. I only need to capture the main points in the acceptance criteria. User Story AS A registered jobseeker, I WANT TO create and edit my CV on the user interfa...
First, I believe I've seen this question discussed here before, but I cannot find it. My apologies if you do find it. I'm starting a new project, and trying to figure out why IsResolved and/or ResolvedOn make more sense to me than Resolved. Obviously, when something is named "CompanyName" (for example), I'm fairly conf...
I am a developer in a 5-member team and I believe our project is headed for disaster. I'll describe why in a moment, but my question is: how should I behave? The deadline is in 1.5 months, and I feel no matter what we do, this project will fail. I'm of the opinion that we should just terminate the project and stop was...