instruction
stringlengths
34
19.9k
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...
I have a list of integers. Also, I have a function which returns True when the element is non-zero, and returns False when the element is zero (let's call it FUNCTION1). So, how to define another function (using FUNCTION1), which will give us a new list and only include the non-empty elements? For example, we have [1,2...
I'm writing a handy library (we'll call it Thinger) that goes off and fetches an XML document, does some X-Path query on it and does something helpful with the result of that. (What I'm actually doing is far too boring to bother you all with, this is just a simplified example.) Because I'm a wise and lazy programmer I'...
I have sets of probing data from an internal monitoring tool which represent the availability of different services (databases, webservices and so on). Now my task is to visualize this data and I reached a point where I should make a decision concerning the data interpretation for the most recent data set. Quick overal...
I've just been told by my boss that I will receive a negative performance review on Monday. He wants to talk to me about why I am so slow and why my bug fix rate is so low. I love programming and solving problems but I actually do find my job really really hard. I've actually been a programmer for about 10 years. But t...
I would like to know how transparency is defined, and what is the measurement for this in the context of a broker architecture. For example : from a developer point of view, [in the broker architecture] distribution is transparent. you talk to a broker one way or the other and it introduces an object model in which dis...
I have seen and used both of the methods to hide the on screen keyboard while coding Android: getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); and: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(myEditTex...
We build products which often integrate with third party systems. Sometimes these systems error, which in turn causes our system to error. For example, we call a web service when a user updates their data after we've saved to our own database. While testing, the service on the other end is not functioning correctly....
In my PHP web page (index.php), I have a simple script that calls a "page" class, and then builds the page from it. Index.php executes methods within an instance of the 'page' class, such as "add_to_body("bla bla bla")". It can then call a "build()" method, where the page class will return a string with the user input ...
Based on this page, I can see that only Apache License 2.0 is compatible with GPL v3. Now my question is, in layman's term, how do I make those two work together? My current situation is that I am developing an application that is made from a GPL v3 licensed programming language. I want to put some form of security on ...
I'm working on a legacy system that has a helper class that is symbolically linked into many different .Net projects within a solution. The logic is riddled with compiler directives that change it's internal behavior based on which .Net project it happens to be compiled in. For instance, there's a compiler directive t...
I'm a team leader of a team of 8 programmers in a company of about 20 technical people. They're working on a range of projects, these projects also involve people from other teams that are outside of my control. My organisation is not doing proper agile development, and they're somewhat resistant to change, but I've be...
What notation do you use for the average time complexity of an algorithm? It occurs to me that the proper way would be to use big-theta to refer to a set of results (even when a specific try may differ). For example, average array search would be Θ(n+1)/2. Is this right? Explanation of average search time being Θ(n+1)...
This is a question driven by curiosity. I am learning Oracle database and Oracle database handles Blob data in a separate tablespace, which I believe reduces overhead while trying to read large Blob data. I am wondering how MySQL handles Blob? I am actually planning to start a project and I wish to give a try on saving...
I do not see how the MoSCoW Method's "Must, Should, Could, Would" prioritisation is better that simply 1,2,3,4? If I receive the requirements from the customer, they already are prioritised, usually using this range. Also what is so interesting on this MoSCoW thing, why it is so 'famous'?
I'm thinking of making a Python-JavaScript converter/compile. I've been wondering about the pros and cons of the following methods to parse the Pythonic code, into JavaScript equivalent. Working with the output of ast.dump(ast.parse(code)) Working with tokens. I've been trying weigh the pros and cons of these method...
I have a situation where I would like your input and think over / solve algorithm. The specs There are inventories with a specified amount of capacity. 'X (width) and Y (time)' creates together a total space. '60 * 100 = 6000'. In reality "width" are a business value unit, but we can talk width here. Now there a...
I am writing an interactive program in which it takes speech input from the user for a specific list of commands. The list of commands will be stored locally in a graph and based on the usage their weight will be modified. The speech input is taken and processed into text and then it's executed by bash scripts. I am th...
I have a commercial application that uses a Qt Solutions component. Until recently, this component was licensed under the LGPL license, so I was forced to use the component in the form of a shared library. According to this post http://qt.digia.com/Product/Qt-Add-Ons/Qt-Solutions-Archive/, the Qt solutions have been r...
There is a good example on Wikipedia regarding the violation of SOLID principles. The ISP was first used and formulated by Robert C. Martin while consulting for Xerox. Xerox had created a new printer system that could perform a variety of tasks like stapling a set of printed papers and faxing. The software for ...
tl;dr How would I represent GUI as agents in a multi agent system. I am learning more about Multi Agent Systems. I like the concepts of such systems, it makes a lot of sense and it sounds very useful when I want to create a large system devised of smaller parts for the Web. So, I created a basic Agent class, taught my...
I hope this is the right place for this type of problem. An Object of my class Movie can have several keywords ( like 'fight club', 'brad', 'fincher'), and be part of different categories (like 'Drama', 'Best Movies Ever') I implemented them as ManyToMany: @OneToMany(targetEntity = Keyword.class,fetch=FetchType.EAGER)...
I am attempting to create an list which should be sorted by a particular field in a colon separated string. I have an array of strings with the following values: name1:535 name2:697 After sorting this list, I would have it sorted by the number in the second field: name2:697 name1:535 How should I go about doing this...
I have an exam coming up and I'm looking at past papers to get some ideas of what to expect. I'm a bit stuck on the following one and would really appreciate if someone could give some example answers. Write preconditions and postconditions in OCL for each of the following operations (included in the Stack class in th...
RSpec allows users to share context across tests / examples, which would reduce the number of code lines in my app by a significant amount. On the other hand, somehow related to the question of sharing codebase between tests, one of the reasons why I'm using Factories and not Fixtures is because I don't want tests to b...
I'm trying to learn node.js and create a web application, and although I'm doing my best to just use only node.js to create it, I'm having a very difficult time finding resources and examples that describe the process without using other frameworks or libraries. Specifically, how can I serve HTML and CSS content withou...
Since a few days I am fighting my way through implementing arithmetic coding. I found a really great source of information which made me understand how it should work. Long story short, it implements arithmetic coding on integers using two registers: HIGH and LOW. Those register store a fraction, ex. HIGH = 98765 //me...
I have a Season class. This Season has a few properties: among them, a list of Games. This should be populated from the same source that populated the rest of the Season properties. I have a test to ensure all items in that list are of type Game. There is no hard requirement that a Season must contain any Games, so t...
In C# if i declare a constant variable is any memory allocated to it as it acts as a compile time replacement? How long is the variable's life?
The advantage of using tabs for indentation is that people can configure their editor to use the tab width they are comfortable with. The only argument against this seems to be that people don't want their code to look differently based on editor settings. However, since code is ultimately being written to be easy to r...
I've been working on this project for my company. Currently I am embedding my SQL statements inside the program itself as and when they are needed. I do have two seperate classes - QueryBuilder Class (Contains all the queries) DbConnection Class (Executes the queries against the database, takes care of connectivity a...
I have a main template like website I have made that will allow me to quickly roll out and make new websites on demand when I need them, for my personal use. I'm wondering what is the best practice when using a Git repo is for this practice. My goal is that if for example down the road I'd like to make a change to all...
I'm preparing a presentation about Agile methodology for managers (not programmers) and I'm looking that, from a side, the Agile talks about functional perspective*^ (in Scrum we have planning game) but, from other side, it lacks any (standard) definition of **functional measure. In my opinion it's strange: how I can g...
I have recently been moving through a couple of books in order to teach myself Java and have, fortunately, mostly due to luck, encountered very few difficulties. That has just changed. I read a section on the following under inheritance and the whole superclass subclass setup When a new superclass object is created, i...
As mush as FP has done, in the end, all our programs are structured. That is, it doesn't matter how pure or functional we make a them - they are always translated to assembly, so what actually runs behind the hoods are instructions, states and loops. We are kind of emulating FP. As a hardware noob, my question is: why ...
It's time Haskell had a modern REPL like Mathematica's (or better). Make each calculation run in a separate thread, so user has control over each computation box's resources (ability to pause, play, cancel, replay, set memory/stack/time limits, etc). Allow for graphics output as well (how?). Then detach these boxes fr...