instruction
stringlengths
34
19.9k
I am new to ORM, and we started developing a new system using NHibernate as the ORM. I think this question may refer to any ORM and any language/platform. The Team Leader has said we should use NHibernate only when retrieving our domain data model objects, ie, not to use any of the built in NHibernate selection or aggr...
I am the Studies Coordinator at a College and we currently have somewhere in the order of 100-200 unit outlines that are created at the beginning of each semester. Those outlines need to have information like: Unit Name Unit Code Course Type Assessment Item 1 Name Assessment Item 1 Distribution date... And the list g...
I'm developing a web application and we are using XML as a database and I'm using Linux as a platform and centos 6.5 as a server. Changing some value would make a lot a lot of changes in about six XML files. So here's the problem: Pressing button save after editing, adding, deleting takes about one or one and half minu...
The Problem: Two developers => three opinions on indention, braces on new line or not etc. We usually work with three or four people on our projects and each of those has it's own code style. I know, the common solution is to agree on a code style, everybody has to use, but I don't want to force creative programmers in...
I stumbled upon an article named Programming With Assertions. And beside the mechanism of turning on and off assertions after compile time, I don't get it. Why were assertions introduced on language level, which is quite a big deal, isn't it? I have never used assertions in production code, was never taught to use them...
While developing web sites it can be annoying that I have to login to the site. Every time the session runs out I have to go through a flow like... Open logon page -> enter username/password -> click link to navigate to my page. I sometimes use Selenium to record this flow, and then automate it. But Selenium doesn't wo...
When I write code like this, where obj is a local variable: if (obj is IMyInterface) { var result = (IMyInterface)obj; // .... } Resharper offers to change it into code like this: var result = obj as IMyInterface; if (result != null) { // ... } I prefer the former, as it offers no opportunity for accidental ...
I have a class Image and another one ImageStore. The Image it's just a value object containing the package name and the image name. The ImageStore does all the actual work: calculates the real path of the image (based on the package and image name) and loads it from the server. Now I have a quite big (and deep) hierarc...
I work in a PHP based company. There is a project where we want to create a backend service. Senior members here are going for PHP, even though it is slower than Java. Their only point of contention, that Java is heavier than PHP in both memory and cpu load standpoint. Jvm is more like a container environment, if u bri...
I have a website e-mail form. I use a custom CAPTCHA to prevent spam from robots. Despite this, I still get spam. Why? How do robots beat the CAPTCHA? Do they use some kind of advanced OCR or just get the solution from where it is stored? How can I prevent this? Should I change to another type of CAPTCHA? I am sur...
Do not declare interfaces for immutable objects [EDIT] Where the objects in question represent Data Transfer Objects (DTOs) or Plain Old Data (PODs) Is that a reasonable guideline? Up to now, I've often created interfaces for sealed classes that are immutable (data cannot be changed). I've tried to be careful myself to...
I'm in the process of creating my own programming language, which I do for learning purposes. I already wrote the lexer and a recursive descent parser for a subset of my language (I currently support mathematical expressions, such as + - * / and parenthesis). The parser hands me back an Abstract Syntax Tree, on which I...
According to ECMA-262, part 11.13, following is the exhaustive list of compound assignment operators: *= /= %= += -= <<= >>= >>>= &= ^= |=. According to the part 11.11, var c = a || b will put a value into c if ToBoolean(a) is true and will put b value into c otherwise. As such, the logical OR is often used as the coal...
This article shows that for Android apps, software developers use between 30 and 50 different devices for compatibility tests. I tried to find information about tests of applications on "classic" computers, for example PC games or graphics-oriented business applications: how many different hardware configurations are t...
I have one one software system which allows developers to specify an ID or name to create NodeReferences. Both work fine, but ID's are not guaranteed to be the same across different environments. I've tried in documentation and in conversations to stress that ID's should not be hard coded (since they will break when de...
It has just dawned on me, that a system I am developing exposes a users username in the URI. This is a problem, since some of the users pages are public. Therefore people will know their username. I thought that this would be a security issue, but then realised that big names like twitter do the same thing. Pretty much...
I am working on an open source project on GitHub. It has a subdirectory /Vendor in which it has a copy of several external libraries. Original maintainer of the project updated this directory with newer copy of external library once in a while. One developer send me a pull request with idea to replace this copy by git...
I am looking for resources to turn to when I don't have the answer for something. I lead a team of software developers. We have been rolling out new software releases on a monthly basis. When there is a bug that my team cannot fix, it lands on me. Most of the time I can resolve the issue, but there are times when I get...
I was wondering how the cover flow effect is coded. I used this link which gave me the code on how it all worked out : http://luwes.co/labs/js-cover-flow/. I am completely new to complex programs so I had a hard time in understanding how it all works out. Why do we program each file separately and place them in separ...
I've documented my code for doxygen, but I don't want the default HTML it gives. I know I can customize it by providing custom CSS, headers, footers, etc. (like GNOME does), and how I can add common PHP code to the files and tell it to save as .php, but that isn't really what I want. What I want is output like MSDN. I ...
I am new to caching and trying to understand how it works in general. Below is code snippet from ServiceStack website. public object Get(CachedCustomers request) { //Manually create the Unified Resource Name "urn:customers". return base.RequestContext.ToOptimizedResultUsingCache(base.Cache, "urn:customers", () ...
I have a jQuery Plugin that I use myself which modifies the selected value of select items on a page. In my own code the plugin automatically executes as soon as it is included in the page this code in the plugin file. jQuery('Document').ready(function(){ jQuery('select').SelectOptions(); }); this automatically execut...
Quoted from MSDN about StackOverflowException: The exception that is thrown when the execution stack overflows because it contains too many nested method calls. Too many is pretty vague here. How do I know when too many is really too many? Thousands of function calls? Millions? I assume that it must be related in som...
Background I revisited an old (but great) site I had not been to for ages - the Alioth Language Shootout (http://benchmarksgame.alioth.debian.org/). I started out programming in C/C++ several years ago, but have since then been working almost exclusively in Java due to language constraints in the projects I have been i...
Backstory I graduated less than a year ago with a degree in Computer Science (with extra courses in software engineering), and another degree in Software Engineering. I'd like to think that I'm familiar with modern software development methodologies (CI, Scrum, XP, etc). The problem I got my first (and current) job at ...
Although I suspect the answer to this question may be something along the lines of "popularity is irrelevant; each algorithm has its trade-offs", I'm interested in a list of popular sorting algorithms used in practice. I was browsing Wikipedia's page on sorting algorithms and while there are not that many algorithms li...
This seems like a simple question, but after a lot of reading on the subject, I still haven't found a definitive answer (perhaps because it is so simple). My question is this: when a garbage collector compacts objects in the heap, how are the references to those objects in the stack updated? I can think of two possibl...
I have a .NET (C#) application that I am releasing soon, which also has some support files. Right now I am storing those files as .txt files, and I update them as necessary whenever the application version changes. I am wondering if a better solution might be to store the information in those files in a central datab...
We are an organisation consisting of around 200 developers that are working continuously on one single product (using the revision control Git) which is planned to be released at a certain date. Due to the huge number of developers, we are trying to create "cross functional" teams with around 10 developers in each team...
For background information, see "Some background" further down. I have a list that looks like this: Start-Time-In-Seconds;End-Time-In-Seconds 1;2 4;6 12;15 ... This works together with a wave file by acting as a cutlist. So the desired parts are 1->2, 4->6, 12->15, ... If the distance between End-Time-In-Seconds of th...
I have a form that includes an area for putting in address information and a table that shows the addresses that have been added. I've separated out the ActionListener for the "add address" button on the form into it's own top level class and I'm finding it tricky and cumbersome to refer back to the form that has the ...
First, it is clear that the right to sublicense doesn't give you the right to relicense. Let's say that we have a library licensed under the MIT license(1 file), someone adds some features to the library but puts them under GPL(in the same 1 file). Or, if someone wants to sublicense, do they have to separate the code? ...
Should bash be expected to change in ways that break non-trivial amounts of existing scripts at some point in the (near/<5y) future? How much change has it gone trough in the last ten years compared to, say, python or perl?
I am considering using a NoSQL Document database as a messaging queue. Here is why: I want a client to post a message (some serialized object) to the server and not have to wait for a synchronous response. I want to be able to pull messages off of the "queue" based on some criteria, which may be more sophisticated t...
I wonder, would it not be possible for an IDE to detect any shared mutable objects that are used in multiple threads? You could flag types as either [ThreadSafe] or [Immutable] using attributes in .NET for example, and then those variables would never cause warnings, but any other variable that is used inside of a meth...
I have to create a program that compares two or three different methods (FEM FVM FDM) for solving an easy pde. Is there a program language in which I could do this easily? (i need to operate with vectors/matrix and perform inversions on matrix)
The first application (web-based) will be located at site1 and once the information is processed, it will be sent to the second application(web-based) located at site2. Application2 needs to be able to do the same thing as application1. Because of this, there has to be a way to share the database to keep data in sync. ...
I am trying to create a very simple evolution algorithm for a creature simulator, what I would like to have is, both creatures have a trait and a dominance level, both noted by ints. their child's trait will be a random number between creature A's trait and creature B's trait then skewed to the more dominant. So if A h...
From what I've read, LGPL 3.0 allows you to use the license together with other licenses, more permissive about that(Not even sure about that). From https://www.gnu.org/licenses/gpl-faq.html#AllCompatibility it says that it is not compatible with GPLv2, while LGPL 2.1 is compatible with it. That's a bit contrary to the...
I'm reading a book on Objective C, and I was wondering how important the subject Working with files for learning to develop iOS in particular? On you tube the tutorials are very short, maybe 10 min of video that teaches you how to do stuff with files and URL's. But in the book its a very long chapter with lot's of deta...
Edit: Point of clarificatioon, IDs and classes as separate hooks is just one form of the applied idea in question which is to never use the same hooks for CSS as you do in JS. I've also seen people want things like js-combo_box and css-combo_box as classes on the same element. This is one I've started running into more...
I'm reading a book on Objective C, and I was wondering about 2 things: Should I take the time currently to read a whole chapter on memory management? If you are doing a really good job on manual management, can you get to better performance than using ARC?
All of a sudden the need for proper formal documentation has become a thing in our organization. A lot of work I do are enhancements and addition to an existing system. Generally a quick fix or a new method, etc. I am just not sure what kind of diagrams I should/could use for small projects. For instance I am adding a ...
I came across this license: /** * The author disclaims copyright to this source code. In place of * a legal notice, here is a blessing: * * May you do good and not evil. * May you find forgiveness for yourself and forgive others. * May you share freely, never taking more than you give. */ Can a programmer reall...
I have been searching for a practical programming language that has no reserved keywords but I haven't had any luck finding one. I am working on a programming language for my own edification and entertainment and I haven't needed to include any keywords yet, that is what led me to my search and the question: I don't se...
First of all I am not after legal advice. This is a bit TL;DR but I have a summary at the bottom, I'm explaining it all so people can offer insightful advise. Situation I need to explain my present situation to explain why I've decided to go the route that I have. I have recently been asked to find another job, due to ...
I have a big database controller which is written in Java. The controller reads information from the database, and interprets it into data structures which are then displayed in a CLI. Java was chosen because writing code in it is fast and easy. Now I want to create an RPC server on top of the controller (XML-RPC or ...
We know that some design patterns are found so useful that they become features of the language itself. For instance, the interface IEnumerator which is implemented by Array object. This helps in separating the iterator from the collection object. The internal representation of the object is encapsulated. The pattern: ...
At first, please forgive probably offtopic and/or notconstructive question, but I truly have no idea where to ask it. At first I targetted StackOverflow there's at least some PIK-related traffic visible, but Programmers seem more relevant (although there seems to be not a three words here about PIK..). Some time ago I ...
I've been developing a little language in my own time, and I've got a fairly bare-bones prototype that implements some of the most basic features. Now I'm looking at scaling up, and I don't want to make a nasty architectural mistake where I have to massively refactor everything to support these features. So I'd like to...
I have seen some tutorials and some stackoverflow discussions on how to send data from android to php page. most of the cases i have seen people sending data in string format but returning in json format. My question is that is it better to send data from android to php in json format. or in what cases i should use jso...
We have a very large, 10 year old LAMP (Linux, Apache, MySQL, PHP) web application that is out of control and poorly written due to a large number of patches and possible hundreds of programmers. If we were to do a re-write, what are alternatives to the LAMP stack? One of the reasons behind LAMP was that it's easy to ...
I would like to use another author's work in my commercial project. That author's work is licensed under GPL v2. I'm not using full code. I'm using only part of the code. Also I modified it as per my project needs. Now i'm confused about what kind of license information I should include. This is the full license tex...
We are developing a ReSTful HTTP API with Servicestack(.NET). Some of the API clients, which have a subset of the actions, demand a service which could be easily added with all the entities, like with the "Add Service Reference" with Visual Studio. We are thinking about creating a simple asmx web service, but our thoug...
I have the following problem. Given A=1, B=2 , ... , Z =26 I need an algorithm that given a letter combination, like the column order in excel, returns me the number/ AA=27 AB=28 ABC? Thanks a lot This is my algorithm so far, I dont like the switch inside the for. Any help is appreciate it, I will write it later in c#...
I'm developing a peer-to-peer dataspace application. For that I want to create a peer-to-peer environment locally (on a single machine, a laptop). Is there a any method or tool to do that?
I'm writing a new .NET portable library that can read a file format, and file I/O is not available for portable libraries. The article "How to Make Portable Class Libraries Work for You" states that I'll have to write platform-specific libraries to solve this for each platform. That's not a problem. So, I'll have the f...
I'm currently implementing an undo/redo mechanism using the Command Pattern. Everything works so far. My problem now is to implement the undo/redo functionality in a way that it is bound to a given context. Assume the following situation: You have win1 and win2. In win1 you execute action1; then you switch to win2 and...
I've been struggling with an increasingly annoying problem regarding our unit tests that we are implementing in my team. We are attempting to add unit tests into legacy code that wasn't well designed and while we haven't had any difficulty with the actual addition of the tests we are starting to struggle with how the t...
I have been exploring the new features in the JDK8, like the lambda expressions, the extension methods, and the new stream API. Evidently none of these features are new in the programming world and that made wonder why are getting all these things in Java until now. We had lambda expressions in Lisp (1958), SML (1973),...
Isn't daily commits (committing all changes before going home) an XP practice? What are the benefits of following this? What are the risks of not following this?
Right now building an app that authenticates using either email or different social accounts. Because it is going to function on multiple subdomains and domains, I'm wondering if there's a design pattern that's been used in the past to accomplish this without issue. Basically, it's for authentication only as we are usi...
When working on established systems, I've often found ways to improve a user interface to maximize user efficiency (example: legacy app maintenance screen doesn't allow multi-line operations where doing so could save the user hours per week over the "edit one line at a time" existing method). The challenge I encounter...
I know that N-Tier intended to separate layers on different network but I would like to have the same code separation in codeigniter I got this idea to have Model : for database CRUD - > Data layer REST API : for business logic—> Business layer that calls CRUD method from models Controller & View are going as before ...
I recently attended an online course on programming languages in which, among other concepts, closures were presented. I write down two examples inspired by this course to give some context before asking my question. The first example is an SML function that produces a list of the numbers from 1 to x, where x is the pa...
Uncle Bob's rules for TDD are specified here. You are not allowed to write any production code unless it is to make a failing unit test pass. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures. You are not allowed to write any more production code t...
I just made a commit that I want to reverse, but I want to keep the bad commit in history. So, I hg update to the previous (good) commit. Then I keep working. This leaves me with a new head: the abandoned bad commit. Is this bad practice? What's the best way to keep bad commits in history while not using them?
I know how to define exceptions and all, but I'm not sure if the way I'm doing it is the most intuitive and readable by another users. I have a very simple method I've written that I want to throw an exception, because it's easier then manually checking return values; the method is private and there is no way need to d...
I have never really done a large amount of C programming but am in the middle of teaching myself low latency C++. Would it do more harm than good to read the K&R C programming book? I am a bit worried I will be reading about C conventions which may no longer hold in C++ (especially with C's fondness of global variables...
When writing unit tests, it's common to use fixtures: little testable data, so we can say: 1. Get all clients should include Willy Wonka. 2. Delete client 3, and now get clients should not include Willy Wonka anymore. That's fine for unit tests. Use setup/teardown to re-load the fixtures or rollback the transaction. ...
I'm about to begin working on a project which involves creating an eBook-like website which will contain lots of large documents with text and images. The site should have a rather minimalistic design, but it will include a UI with some scripting and animations to make browsing the large documents easier. I've been thi...
I am trying to understand how to do the amortized cost for a dynamic table. Suppose we are using the accounting method. Let A of size m be an array of n elements. When n = m, then we create a new array of size 4m, and then copy the elements of A to the new array. When n = m/4, then you create a new array of size m/4, a...
In Chapter 33, Personal Character of Code Complete (Second ed.) McConnell cites some studies such as those listed below in support of the assertion that 10-1 improvement is possible from efforts in improving our programming as a result of personal determination to improve. Sackman, Erikson, and Grant 1968; Curtis 19...
We just adopted Scrum and completed our first sprint (yeah!) At the Sprint Review, we demoed a User Story for feature X. This feature X worked exactly how described in the User Story from initial business analysis and details we worked out during product backlog grooming and sprint planning. However, after the user sa...
I'm new to git. I'm using a development platform called automation studio. This development tool creates all sorts of files and directories which it needs to maintain runtime and IO information for the target processor. These informations are specific for each project. Therefore these file should not be under version c...
How long should the Continuous Integration process take (i.e. compiling classes and running unit tests + integration test)? On my current project it takes about 30 minutes, is that OK? What's the ideal length of build time? Integration tests take most of that time, if the 30 min is too long what can be done here? What...
I'm working on a web application that runs on node.js and uses MongoDB. It's important to mention that I plan to release the application as commercial software. The way I wrote the installer, it asks the user to confirm the location of the node and mongod binaries (after autodetecting first). I figured I could skip thi...
This is a rather philosphical / theoretical question. I am interested in the question, how language (in this case programming languages) and thoughts (= solutions of problems) are connected. I want to know, whether the programming language influences the solutions, I can come up with. For example: I program something i...
Recently (I believe some weeks ago) with the latest update of the Twitter app for iOS, all links found inside tweets are opened in Twitter's build-in browser. My question is how to find Twitter's browser agent so I can display custom messages. For example: If browser is Twitter's in-app browser then display a custom m...
It seems like Python is used as a coding language for part 2 of Kent Beck's book Test Driven Development. I have read the first part of that book and started appreciating the value of TDD . First part was easy to understand as the examples were in Java and that is the only language that I have worked on. How should I p...
“Why just think your tests are good when you can know for sure? Sometimes Jester tells me my tests are airtight, but sometimes the changes it finds come as a bolt out of the blue. Highly recommended.” - Kent Beck But I see that there is not even a tag called "Jester" in stackoverflow. So what is the modern replac...
I am currently implementing NASM-like preprocessor for my assembler, and I am wondering what is the correct way of handling recursively included files. From what I see, there are two ways to deal with it without hanging the preprocessor or even the OS: Set maximum include depth. Disallow including a file recursively (...
For many years our IT development group subscribed to the waterfall software development methodology with segregated pods of programmers specializing in database development, logic layer and presentation layer development. Of course we also had a small quality assurance group which handled all testing responsibilities....
When working with an immutable set or map, like the ones found in many functional programming languages, operations that would otherwise modify the container generate a new container instead. I know that most list operations in functional languages do not result in a copy of the list and just rearrange pointers. This i...
Anyone knows a solution that works something like this: #include <stdio.h> #include <gcc.h> /* This .h is what I'm looking for. */ int main (void) { /* variables declaration (...) */ /* The following line is supposed to be equivalent to: * $ gcc main.c -o main */ results = gcc_compile_and_link("m...
Publish-subscribe and Reactor patterns looking very similar to me. How they are different? In both patterns a message is getting passed to subscribers indirectly (listeners in reactor pattern). I feel observer pattern is very similar to two other patterns too. What are key differences between those patterns?
I have a terminal disease and there is a very high chance that I will no longer be in this world by the end of the year. I have developed a web application that it is extensively used in my family’s business (a small hairdressing shop). No member of my family has neither programming nor system administration skills. I ...
In a given execution context, the Variable object is the Activation object of that execution context. From my research online, I am able to find the previous sentence rephrased in different ways but no one is able to tell what it is. What is an Activation object?
I need some help on this ACM ICPC problem. My current idea is to model this as a shortest path problem, which is described under the problem statement. Problem There are N = 1000 nuclear waste containers located along a 1-D number line at distinct positions from -500,000 to 500,000, except x=0. A person is tasked with...
I was just reading a chapter about LOOP-computable functions and I have the following question: Is it possible to numerate every LOOP program with an algorithm? Formally: Is it possible to have a LOOP program M, s.t M(n,m)=P_n(m) (input is n,m. output is P_n(m), where P_n is the numeration of the loop programs).
I find that at times I get obsessed with finding the most elegant solution to a problem or task. I'll spend hours trawling the internet/texts for ideas and discussion on the right way to solve a problem or on the best pattern to use. I constantly go back and refactor my code and make minor and major changes when what...
There are some open source projects that I'd like to incorporate into a product at work. We don't have the bandwidth nor the subject matter expertise to do it ourselves. I found these by searching in Google. I'm unaware of any "major players" that utilize the projects, but I'm pretty encouraged by what I see. Now, I...
I am working on an algorithm to find possible fills for gaps in text. My function will receive as input: (example) [false,"o",false,"b",false,"r"] representing the string "foobar" with some values cut out. My function should find opportunies for the possible ways to fill the gaps given a set maximum characters (and a ...
I'm always trying to find new methods on development. So I looked into some websites and analyzed their ways of presentation. Returning part of the page using AJAX Normally I will use an array to return values, for example: //GET User details $user_id = $_POST['user_id']; $user_details = $this->get_user($user_id...
I develop a game library in javascript, containing many classes. I hesitate on the behavior that I should follow concerning method parameter validation: Should I check the validity of parameters passed to each method ? By example, when a method take only a number between 0 and 100 in parameter, should I check that the ...
I have 4 different commands in LOOP programming language: y=Zero() y=Val(x)=copy x and put it in register y y=Inc(x)=x+1 y=Dec(x)=x-1 Finally I also have loop n times { ... } How is it possible that there is an equivalent loop program to every other loop program which uses only Inc, Zero a...
In an old book I have, they say that "build" is either a process of converting source code into executable or the actual result - assembly. Is that correct? Is a build actually the assembly, I mean from terminological point of view.
I am working on a small functional library written in Java, which mimics the a functional style of programming. I am stuck with a undesirable type cast in one of my method definitions and would love some help. Ok, so we do not have first class functions in Java, so I define them as objects, with one method 'apply()' l...
Does there exist a dynamic programming algorithm to find the longest subsequence in a string X that does not contain Y as substring? Just that this problem seems so similar to other DP string algorithms such as longest common subsequence and string. It must be able to handle occurrences of Y that overlap. It seems tha...
I work on a fairly large software system and over the years it has accumulated a lot of entropy. There is plenty of scope for refactoring but there is always pressures to build the next features upon what's already there. This adds to more entropy, because design choices for implementing new features are typically made...