instruction
stringlengths
34
19.9k
See top answer here: Obfuscation at source-code level more effective than obfuscators?, specifically "Code it in a language so not easy to decompile such as C/C++" I'm looking to write a new application that will be sold for $500 per license, so I'd like to prevent decompilers. Should C# be avoided, or is using an obfu...
I do a lot of development in my own time. These projects I work on are all just for fun and learning (so far). I commonly do Java development with Maven but I have also been known to dabble in .NET and Python. All of the projects I work on use open source licenses, although most of them are not on any public code repos...
Is there are any standards or conventions on naming methods which add something if it not exist into another something. For example: Store.instance().addItemIfNotExist(item) IfNotExist is really ugly part. What workaround may be?
Say I have a typical MVC setup. The controller passes on some input to the model, and asks it to do something with it. But the validation of the data fails, or there is some other problem. What's the best way of getting these errors passed back to the controller, which will then pass them to the view to be displayed to...
I come from c++, where one declares all assets to be included at the top of a file. That is what I have been doing with php as well. Lately I have been tempted to stray from this rule: I have a script file where I put functions I use throughout my projects, sort of like a library script. There are some functions includ...
I have been programming in google Golang and have been enjoying it due to its brevity but I find it surprising that almost all its Math standard library methods are for the floating point type. Is there any particular reason why these methods do not exist for ints?
I'm conceptually trying to understand if I should be doing this: item = Model() screen = View() brain = Controller(item, screen) or this.. brain = Controller() item = Model(brain) screen = View(brain) or this.. class Controller(): def __init__(self): item = Model(self) screen = View(self) or some...
Is it a good idea or a bad idea to create an interface for data transfer objects? Presuming that the object is usually mutable. Though my example is in Java, it should be applicable to any other language that has similar concepts. interface DataTransferObject { String getName(); void setName(String name); } ...
I guess this is more of a "comfort seeking" question than legality one. You see, for the past couple of months I have been brainstorming and developing a product, all by myself. I was planning to release it under some kind of free license. While I know no idea is ever a unique one, I was quite happy to note that the wa...
I have been told that the average number of bugs/defects per line of code is "constant" for different programming languages. 10 KLOC of Ruby would have the same number of bugs as 10 KLOC of c++. The argument is usually used to promote the use of expressive languages (think python/ruby over c++/assembly) since the numbe...
I just wanted to know what is the significance of SRS(Software Requirement Specification) in programming? and what are the techniques used in preparation of an SRS .. also who writes the SRS.. is it the programmers?
Possible Duplicate: Where did the notion of “one return only” come from? I got into a little argument with a coworker about whether a method should be written like this: public Thing getThing(int key){ if(!things.containsKey(key)) return null; return things.get(key); } or this: public Thing getThin...
I mean, it is possible to create application without source code - for example using HEX editor or some debugger that can assembly instructions (actually every decent debugger can). Creating programs this way is of course hard, but possible for small applications. I even can imagine cases, where it is the only possible...
I've been toying around with Ruby lately and I found myself wondering if in pure object oriented languages (and even those that are not pure) making methods that take only one parameter and then get chained together is equivalent to currying in languages with a functional style? If not, why not? I'd appreciate a detail...
Understanding what a pointer (an address) is, is fairly easy and an eleven-year old can understand it. But how do we express why we have a need for a pointer to a pointer? what is a very pedagogical example? Does it extend to pointing to a pointer to a pointer (and/or onward)? Example problem T[][] does not decay to a...
Our software implements a layer of role-based security to secure data access, in the form of access control lists. Whenever a user tries to do something that isn't allowed, the software layer will receive an "access denied" error code or exception. Having seen how our customers react to such "access denied" messages, a...
I am trying to implement the trapezoidal rule programmatically but am having trouble finding a good way to input the function of x and then have a loop which will iterate through for each sub-interval finding the area of the trapezium and adding the results and returning it. Any help would be awesome.
Possible Duplicate: Understanding the bridge design pattern I have read lots of material about the bridge design pattern: http://www.codeproject.com/Articles/3151/Illustrated-GOF-Design-Patterns-in-C-Part-II-Struc http://sourcemaking.com/design_patterns/bridge http://en.wikipedia.org/wiki/Bridge_pattern Understandi...
The automated bell system of Stateless University should ring every hour during Mondays, Wednesdays, and Fridays. It should ring every 90 minutes during Tuesdays and Thursdays, and does not ring at all during weekends So the equivalence classes for these are: Mondays, Wednesdays, Fridays Tuesdays and Thursdays Saturday...
I'm producing a binary distributable for my Java project. I'm releasing it in two ways: Maven Central Zipped distributable on Google code My project is licensed under the Apache 2.0 license. I use a small number of third-party parties, one of which is MIT licensed. I believe it's my obligation to make users of my pro...
Let's say you're writing a Yahtzee game TDD style. You want to test the part of the code that determines whether or not a set of five die rolls is a full house. As far as I know, when doing TDD, you follow these principles: Write tests first Write the simplest thing possible that works Refine and refactor So an initi...
I understand the benefits of injecting dependencies into objects, but have not found much guidance on the types of objects to inject and when to make them singletons. If we take as as example an application with the following types of objects: Services (including repositories and business services such as calculatepri...
I'm researching engineering approaches to software development based on the type of software, for example: Custom one-off software (e.g. space shuttle software) Whitebox application requiring customised (e.g. Apache Ofbiz ERP - source code is usually downloaded and customized for each implementation) Blackbox applicat...
We have transcripts of around 8000 videos. However, these transcripts do not have any timed text (ie: they are not time coded to the video) We are trying to ascertain whether software exists, or what approach to take to automatically time code the transcript to its associated video. Does software exist to do this? If ...
After going through a lot of articles and this post, i know Why doctypes are used for and also about the different modes triggered by the browser like standards, quirks etc. I downloaded the a strict doctype from this url - http://www.w3.org/TR/html4/strict.dtd but couldn't understand a thing of what is written inside ...
As a follow up to Does a BSD-licensed project need a signed statement from each contributor?: There are several reasons why an open source project might want to get copyright assignments from its contributors. For example: To allow the project author to sue for infringement (as only the copyright holder can do so). Th...
My team of about 70 programmers is developing C and C++ code for embedded, multiprocessor, image-processing project. We have a coding standard, and hold design and code reviews. The problem is that we don't have solid design review checklist. Currently we have scattered design checklists, but most of them are vague. Fo...
I am currently working on a web app and want to design the interface between nodejs / mongoose and the backbone app. A short description of the app: A user signs up to the application and gets a user account where he can create an organization (e.g. footballclub). Within these organizations you can set up projects. Wi...
Our team redesigns the legacy software and there are a lot of design meetings going on. Many of them are not very effective and lack good analysis of the proposed design. Is there any formal way to approach this kind of discussions to make them more effective? I heard about SWOT for example, but afaik it is used more f...
I have a list of english words. I'm trying to come up with a data structure that allows me to do fast StartsWith filtering, like: var words = dictionary.StartsWith("foo"); I was thinking of creating a data structure like this: But I wanted to ask first: a) Does the above data structure already have a name? b) Is this...
When you are working with a multi-tier application very often you run into task of converting objects in one layer to objects in another layer. This could be converting database objects into domain objects, service objects into domain objects, domain object into view models, etc. I've seen it being done in multiple way...
There are essentially two camps of library designers concerning the design of the final header file inclusion: Provide a single header file that includes every other header file that makes up the public API. For example, GTK+ dictates that only gtk.h shall be included. This does not mean that everything is explicitly...
We have to develop our own file management system in Java web application. We need to sync files between our main server and client severs and find out whether all the client server has all the latest version of files. Our files are in pdf, doc and xls format they changes every now and then as and when it is required. ...
I just started learning Haskell and it seems like you can't get too far in the language without being comfortable ( or at least exposed ) to certain branches of mathematics. Unfortunately I have major holes in such areas and am wondering what is a good introductory textbook that covers all the concepts Haskell uses? Fo...
until now I was using dropbox as my main vcs (it is not, but for a single dev does the job pretty decent). However I decided to give git a go and see if it fits my needs. Today I was reading this tutorial and at some point it says: One of the things you should get used to is doing development in a separate area, no...
When I first started to learn programming I remember having an argument with my teacher about If Else statements. I was arguing that: if { ... } else if { ... } ... is basically the same as: if { ... else { if { ... } else { if { ... }...
We have tried to introduce developer automated testing several times at my company. Our QA team uses Selenium to automate UI tests, but I always wanted to introduce unit tests and integration tests. In the past, each time we tried it, everyone got excited for the first month or two. Then, several months in, people simp...
I have created a very tiny framework to be able to get away from all the clutter while developing. The point of the framework is not to replace any library of choice but simply segregate the code to it's correct logic. You can see the source on github along with a few code examples: https://github.com/erik-landvall/sh...
My programming professor has told me that it is a good programming practice (at least in C/C++) to declare a function with the inner loop when nesting loops (not for loops, since when, i.e. looping through a multidimensional array this is very intuitive). For example, if I write int main() { while (cond1) { ...
I have to create a validation system(I don't want to use Data Annotation or any other system) for my C# application using .Net Compact Framework, where I have an object which contains many other objects. Many of the properties are dependent on each other means they have some sort of dependencies. I can write a simple v...
So I have a program I'm worked on back in 2011 and all through 2012, but the last release was in December of 2011. I've been actively working on it, but feature creep lured its ugly head and now it is filled with tons on unfinished features. The bad part is that as I implement a feature, a new one creeps in. What can I...
I sent out an email earlier reminding our developers that the use of the word "shall" in your derived requirements should not follow over to your functional requirements. When writing functional requirements the word "must" is used to describe the function a derived requirement must do. Derived = System Shall be req...
I have encountered (even in literature) two contradicting opinions related to path vs condition coverage (not branch or edge!). Some say Path coverage is stronger than the condition coverage, some say the opposite. Having code like this: If(X<0 OR X>100) DoStuff(); Path coverage - 1 test case is needed to cover the...
In TDD, is it good practice to keep the tests in the same directory as the code its testing or is it better separate the tests in either a different directory or a separate project. Would it be the same for a web site where you have the aspx/c# pages in one directory?
Basically, we have three main projects, two of them are web services, and the other is a web application. While I'm satisfied with covering as much as we can of our web services with functional tests (all three projects have their proper unit tests), functional tests for the web application are taking a lot of develope...
Recently my company was asked by a customer to develop a control board that includes firmware and PCB layout development. After finishing development the customer will buy the control boards at certain quantity every year. We are now at making contract stage, the customer is wanting my company to handover both the firm...
I like that SourceForge can also let people browse your code using Git. But, before I even set up the project on SourceForge, I had a GitHub repository for it. Now that I have created my SourceForge project, I had the option to use the Git tool. The problem is when I did that it made a new repository from scratch. I wo...
scenario: I have an entity called Member. Members fall into multiple types. Some types are below. Supporter Volunteer Sponsor Player I can create class for each type and inherit from the base Member entity. But when a Member has more than 1 type in a given time, it is not the right way. can I use decorator pattern t...
One of my team members consistently avoids making comments in his code. His code is not self-documenting, and other programmers have a difficult time understanding his code. I have asked him several times to comment his code, however he just gives excuses or claims that he will do it later. His concern is that adding ...
I am a Software developer who works on J2SE (core java). Often during our code reviews we are asked to reduce the number of lines in our code. It's not about removing redundant code, it's about following a style that focuses on doing the same things with fewer lines in the code, while I believe in having clarity in cod...
Now and then I use the Python lambda. Is it so formal that it is safe to say that you can do formal lambda calculus with it? I just used it but I didn't fully understand whether the python lambda and the lambda calculus like I read was done by Alonzo Church. I also used it in Javascript, I think. Isn't this more common...
Before I start this question I know the java 'goto' is a big no go. So I've been writing a program and I have some indented Loops and statements and I need to BREAK multiple on command. Rather than having a load of boolean variables and if(!<booleanName>) BREAK; statements throughout these loops and statements what is ...
This is a problem me and my team faces in almost all of the projects. Testing certain parts of the application with JUnit is not easy and you need to start early and to stick to it, but that's not the question I'm asking. The actual problem is that with n-Threads, locking, possible exceptions within the threads and sha...
I have been doubting for a long time whether or not to have a logger in methods (usually helper methods) like the one below. Whether we can print it in the method or print the response where the method is called. public String getAddNewUserUrl() { String url = null; String mode = null; try ...
I've had some discussion with colleagues who chose to go with JRuby along the following line of argumentation: JRuby can make use of anything that is available in Java, ergo such programs are more portable bc Java is more portable. Arguably, the breadth, capability and speed of C/C++ libraries that have been wrapped fo...
Each time I see a question posted on Stack Overflow on C#, I see at least one or two answers posted that solve a problem with LINQ. Usually people with very high reputation seem to use LINQ like pros. So my question is, what problem domain is LINQ supposed to be used for? Also on side notes: Are there any purposes in w...
A friend and I have started a project using code from another project, that is covered licensed under GPL. We have distributed it freely on our website, and under its download button, we've added a direct download link to the modified source code also for free. At the about section of the application, we have credited ...
I am building a web application and RESTful web service. I have been reading various articles about the best way to authenticate the requests to the web service. The best option for me seems to be to use HTTP basic authentication. Pretty much every article ive read says that authentication should be encrypted over SSL ...
Let's say I'm trying to find a number from 1 .. 100. All numbers in this range are "valid", in that they could be interpreted as potential solutions. Let's say the ideal number is 50. And all numbers >= 50 are "feasible" in that they actually solve the problem. And all numbers < 50 are "not feasible" (but still valid)....
Hypothetical scenario: Let's say we are downloading JSON from Facebook with details of a user's friend's checkins, posts, etc... These come in as one document per friend per activity, so with 8 activities a user with 300 friends will cause our system to make 2400 requests to Facebook, downloading 2400 JSON documents. ...
I'm using .Net technologies and because ASP.Net "instant translation" is not really easy to do with ResX, since it has to be compiled after every change, there are a few hacks available (http://www.onpreinit.com/2009/06/updatable-aspnet-resx-resource-provider.html), but as it is, they're hacks... and they seem to have...
Here's the scenario: Say you have millions of JSON documents stored as text files. Each JSON document is an array of "activity" objects, each of which contain a "created_datetime" attribute. What is the best way to merge/sort/filter/page through these activities via a web UI? For example, say we want to take a few thou...
I am trying to design an application where users can make posts with Django on the backend. Right now I have to refresh the page with JavaScript every 20 or 30 seconds to check for new posts that might be available for that page. I was wondering if there are more effective ways to do this? Maybe with a JSON response? ...
Possible Duplicate: I’ve inherited 200K lines of spaghetti code — what now? For my next project, I've been tasked with "overhauling" a large legacy web application with many parts. It is a JSP application written in 2004 and it is used heavily by my company. This application was designed badly in that there is no...
I'm developing software for about 10 years. I began on QBasic and now I'm developing .NET using C# language. I'm always trying to follow the best design patterns and principals like SOLID. In short I'm very happy with my work while as a tiny ISV I'm free to choose between technologies. Of course we almost develop mid-s...
I've come to understand that long before Haskell, O'Caml or LISP, higher order functions were an academic research subject and in mathematics, Schönfinkel (in 1967) and Haskell Curry (in 1968) already applied techniques such as currying, but that was before it was available in any programming language. Scheme, accordin...
Summary: Should a function in C always check to make sure it is not dereferencing a NULL pointer? If not when is it appropriate to skip these checks? Details: I've been reading some books about programming interviews and I'm wondering what the appropriate degree of input validation for function arguments in C is? Ob...
I find my self in a situation, where I need to program a service, that can determine if two object in a huge database are the same. For simplicity, let's say it's used cars, and I want to determine if they are the exact same, based on various attributes e.g. brand, model name, year, milage, price, color etc. The proble...
I am working on open source project, that uses the source code from FlatAssembler project, which uses following license, based on BSD 2-clause with one additional clause added at the end of the text. So, the questions are: What this additional clause changes? Is it legal to use this code and to license my project unde...
In one of my interviews I was asked a vague question, I'm still not sure of the answer. We have a client and a server they are placed apart. The network that connects them has high latency, which is dominating the performance. How can we improve the performance. Note that we can't change the network's topology. I was t...
I am developing an application for my universities student research symposium around the idea of polyglot persistence. I have read Martin Fowlers book and done some other research online about the verious different types of NoSQL db's. I am curious as to what the different use cases are for the different NoSQL database...
I've had an internal promotion interview for gain a higher level programmer title, something like Senior plus. And I've been interviewed by around 7 people using different technology, and people using the same technology with me(.Net) tend to ask very technique detailed question which can actually easily been found vi...
I am a Java (Web) Developer. Having knowledge about c#, PHP and Ruby. I am getting confused how to keep myself updated with very fast changing the programming language and their implementation. Like, in the mobile, you can see around 7-8 OS. There are very much finer example of event-driven programming to make scalable...
So I'm doing a fairly involved javascript/html client with lots of ajax calls and other involvements of callback-ism. I'm entertaining the thought of using Fay for this purpose. I'm aware of Elm. Tried it and liked the FRP elements. Now I'm looking to know if similar structure is possible in Fay. Are there any concrete...
I am working on a product for a client that must be valid and fit for purpose. It's built on a LAMP stack (PHP/Cake), so there's GPL, MIT, PHP, APACHE licenses: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, ...
I'm an electrical engineer that was kind of thrust into the digital world and learning as I go. I'm programming a TI processor to do a PID (proportional-integral-derivative) loop, illustrated by this diagram: I'll also describe it: Negative feedback op-amp, with non-inverting terminal grounded. Input through negative ...
I am aware of some of the problems of the concept of "releasing a work to the public domain" (as mentioned here and here; I haven't listened to this specific discussion yet). IANAL, but the main problems seem to be as follows: Releasing to the public domain doesn't exist in many jurisdictions; rather, a work becomes p...
Somebody explained to me that since in agile development, policy and the application logic should be more important than details such as persistence method, persistence decision should be taken at the end. So it might be a good idea to start with simpler persistence such as flat files, until we reach the point the weak...
One of my company's applications still requires a hardware key to run, but we're currently in the process of removing that requirement and replacing it with an online check. The issue we are having is that we allow our customers to set up test systems with copies of their live databases. With the hardware keys, that ...
One interesting issue appeared for me today. In a distributed SCRUM team when do you start enforcing an unitary work environment in terms of code format, IDE plugins (checkstyle & co), VCS, CI? The team is in an exploratory phase and thegoal is not production quality code but rather proof-of-concept. Isn't it an overhe...
Background / The Problem I need to make a (large) application with a certain set of core functionality, and certain functionality for multiple clients within it. Each client has different requirements and while they may share some functionality, I need to separate the code for each client, so a change to one won't affe...
Following a standard framework of project management, for a software development project we will provide deliverables (documents and software) at the end of each month : My question is: From May to June, while software is in development, what would be the deliverable for each month? Each document starts as version 1....
I'm classically trained psychologist, not a programmer, so sometimes the more advanced aspects of programming escape me, in particular regarding program efficiency and/or certain best practices, in this case with regard to the use of variables. Here is some pseudo-code: var a; var b; var c; function GetSomeInformation(...
I come with a clear agenda on how to code correctly. I used to be a team leader, and I managed using significant amount of mentoring to create a team that creates high quality code. Now I have 3 teams under me, each one has its own team leader. My time is mostly spent on strategic meetings and I can't devote enough of ...
I am currently doing a project (in PHP) that has the following requirements: There is a list of people, sorted in a certain priority. Work should be allocated to them by this priority. e.g. If the list is T1, T2, T3, T1 should be allocated work, before T2. And T2 is allocated work before T3. In the event that are only...
In an answer to another question, I suggested creating a randomized value for input to a specific method. In my experience this has been useful for making tests more readable and it lets you skip the "trivial phase" where you hardcode specific results in a method. Here's the unit test code pasted from the other answer...
This question & its answers are useful but not sufficient for my problem. My Question is if I want to add a javadoc as @Deprecated As of version x.y, replaced by {@link SomeClass} in my current file's javadoc then what should be the version no. in place of x.y ?? Let my current version is 1.2 & after CVS checkin it wil...
In Java,C++,Objective C, C#, and all other similar OOP languages, Why don't we use a class with static methods and vars instead of going through a singleton syntax having to deal with various scenarios ?
I've seen a lot of advice for freelance programmers which advocates quoting your rates in periods of a minimum of one day. That means that when someone asks your rate, you would say "$500 per day" rather than giving the equivalent hourly rate. If I agree to do 10 days of programming work for a client at a particular da...
Every year in january we process a big task with our system. While the performance during the task was above average the maintaince follow up is currently having a lot of trouble with jobs running too long and out of their respective time schedule. Therefore I am tasked with the optimization of those maintaince jobs an...
I am creating an application which will be testable(unit + integration). In this application I have a FileHelper static class, public static class FileHelper { public static void ExtractZipFile(Stream zipStream, string location) { .................................. } public static void CreatePa...
I recently asked this question on SO, which quickly became downvoted and closed. Clearly I lack a deeper understanding of JS, which I'm hoping you'll help me fill here. I'm a perfectly capable web developer and have built plenty of visually and functionally pleasing websites but am struggling to get to grips with how I...
When applying the State Pattern illegal transitions should result in an exception being thrown (or at least that's what I understood from the pattern) I know exceptions are for "unexpected behavior" where an action isn't supposed to happen. Errors would be more appropriate if the required action is common (ex: user ent...
I am going to start a new project using Scrum and Jira and I have some questions regarding how to write proper tasks in Jira. From what I understand user stories are small non-technical descriptions written by the stakeholders (ideally) that can have the form: As a user I want to order monkies so I can earn money. Howe...
I'm writing a few libraries that I want to release as open source projects, but I want to find a licence that means I'll receive the credit when it is used in a project. Im not fussed about anything else, if people want to profit off of it then thats fine. So what licence is most appropriate? The only factor for me is ...
I'd like to read the documentation of Azure Active Directory on my kindle (or similar device), but don't want to use "Print to Kindle" for each and every page. Is the Microsoft documentation for this technology available in other formats? (.chm, PDF, etc). If an alternative format is available, then I can adapt that t...
I found this: http://msgpack.org/ But.. I've never used it, so I don't know what whether it is much good. Anybody has proposals? Basic requirements: serialize as many data structures used typically in both languages as possible, have no problem with nesting as reliable/unbuggy as possible high performance is nice to h...
I have filled that standard form where you list your previous inventions before starting your new job so the employer is legally aware you have the copyright over them. But if I want to use this invention (software code / framework) in my new job, would they have any copyright claims on it if for example I change / imp...
I'm just starting out with python and since I'm coming from a PHP background (thus have to adjust my mind to wrap around new concepts) one major question still stands without answer - why does Flask need a template engine? The way I was used to go about things, was to have a template.html that contained valid html with...
Should a programmer be able to perform all operations programmatically on a object that a user could do? By way of example, I'm working with a list selection object. To populate the list List.AddItem(itemData) is repeatedly called until it is built. A user can then: View the entire list Select a single item from the l...