instruction
stringlengths
34
19.9k
I have often heard that I should not use the Unlicense because of issues regarding putting things into the public domain. However, I do not understand why this would be an issue for the Unlicense. The Unlicense attempts to put whatever is being unlicensed into the public domain, and if that works, awesome! However, the...
I'm currently a second year undergraduate Computer Science student. I'm having a hard time deciding to either apply for an internship or spend the summer back home, working on some fields I feel I haven't yet got a good grasp of (OOP, algorithms) + working on one or two open source projects I found really attractive. I...
If I'm using a switch statement to handle values from an enum (which is owned by my class) and I have a case for each possible value - is it worth adding code to handle the "default" case? enum MyEnum { MyFoo, MyBar, MyBat } MyEnum myEnum = GetMyEnum(); switch (myEnum) { case MyFoo: DoFoo(); ...
Consider a method to randomly shuffle elements in an array. How would you write a simple yet robust unit test to make sure that this is working? I've come up with two ideas, both of which have noticeable flaws: Shuffle the array, then make sure its order differs from before. This sounds good, but fails if the shuffle ...
The Java Authentication and Authorization Service (JAAS) defines that if a login module has the flag "REQUIRED", the authentication should proceed down the login module list on success or failure, and that the module is required to succeed for the overall authentication process to succeed. The question is: What could ...
I am recently building a basic ray tracer in C# from scratch, as a learning/teaching project. A previous release of the project (let's call it A) does reflections and diffuse shading. The program renders the scene at around 900ms. Now I've just made a release B which adds specular highlights. Naturally, I assumed rende...
Possible Duplicate: Do people in non-English-speaking countries code in English? Do developers who don't natively speak English still code using english property and tag names? Like, would a Japanese front end web developer still need to know what border-radius means in English to use it, or would Japanese sites use...
I'm a .NET developer comfortable with C# and web application development. I need to improve my knowledge of Winforms. What is a good book or online resource that particularly covers the Winforms life cycle. Which events to use for what? How does OnLoad compare to Form_load etc.
Recently I was contacted by someone interested buying a piece of software that I wrote to automate a process. The 'client' knows little about the program, except what it outputs and how easy it is to use. They are now interested in purchasing it, and I need to give a reasonable price. I've never done anything like this...
Every time my team begins to explore the scenarios that are possible with mobile device location data, location data that is part of user data, or even location data that may be retrieved or inferred from IP address or browser cookies, we are stopped dead in our tracks by the risk of violating a user's privacy. It's fr...
I'm working on some embedded code using C. Various pieces of functionality need non-blocking stateful functions, which are mostly implemented using a switch on various states. For example, a modem connection manager (pseudo-code): void manage_connection(void) { static states state = IDLE; switch (state) { ...
I have read a lot about the importance of unit testing, and testing in general. In particular I have read about TDD which, in theory, seems like a good way to ensure effective test coverage for a project. However, when I look at open source projects, or code that is available as open source, I am having difficulty fin...
This probably isnt' a Django specific question, but I'm wondering how those "Server over capacity" messages are displayed. Some examples: Twitter's fail whale Tumblr's Over capacity slash page Drawception's over capacity message when new games are created.
Reading about the Google v Oracle case, I came across these questions (apparently from the presiding Judge) ... Is it agreed that the following is true, at least as of 1996? The following were the core Java Application Programming Interface: java.lang, java.util and java.io. Does the Java programming language refer ...
I am currently developing an IRCX AJAX Chat Based system and have a few questions regarding the Server and Client implementation. Any suggestions are welcome: Server: Should this be implemented as a Web Service or a Windows Form application? I have experience in developing Windows forms based servers however I am wonde...
I was reading this article and was wondering, do we get rid of all switch statements by replacing them with a Dictionary or a Factory so that there are no switch statements at all in my projects. Something did not quite add up. The question is, do switch statements have any real use or do we go ahead and replace them...
I am working on a company's project alone at the moment, but the company is getting soon a junior developer whom I will be mentoring. Considering he will be learning a lot in first few days I am planning on using pair programming for first couple of weeks. I believe that doing pair programming would make daily standup ...
With a recent project our .Net based dev team has been tasked with integrating with a whole host of java based web services around the world, and we really have had a surprisingly (well, we are certainly not surprised any more) large amount of issues because the XML generated by WCF is not accepted by the java services...
Possible Duplicate: Functional Programming in Commercial Software Which problems domains are more suited to functional programming solutions I just wonder where do functional programming languages are used? Might be some good examples? Like rocket science or telecommunications?
Often when the syntax of the language requires me to name a variable that is never used, I'll name it _. In my mind, this reduces clutter and lets me focus on the meaningful variables in the code. I find it to be unobtrusive so that it produces an "out of sight, out of mind" effect. A common example of where I do this ...
The team I work with handles large amounts of consumer survey, and internal company metric data. Primarily the data is stored in a database, and we utilize various platforms and to work with that data, including MS Excel. My peer has developed a suite of Excel/VBA files to take the raw data we get and upload it into a...
I think this question related not only to agile but to teamwork in general. When we are working in a team and each member is working a user story to complete how to avoid creation of duplicate classes and conflict? I mean if my user story require the creation of class A and also my team member need the same class and ...
Suppose I was writing an address book application where the details of each contact were stored in an SQL database. A user wants to know all the details for a person whose name is "Bob [Someone]". In such a case, would writing a query like this be okay? SELECT * FROM contacts WHERE name LIKE 'Bob %'; I'm confused beca...
I've been reading some papers recently on domain specific languages (DSL), but none of them appear to address the advantages of a DSL over a rich internet application (RIA). In an RIA, instead of learning the domain language, the user is provided with domain objects as form fields, which abstracts the lexical definitio...
I have the project for work that requires me to send e-mails to people using our work mail server. The server doesn't require authentication. Part of my project is using a Java-Helper I'm developing on GitHub. I don't know if I completely understand how it all works, but I'm guessing it would be a bad idea to have the ...
I'm starting a new project, and trying very very hard to use TDD to drive the design. I've been pushing for years, and finally got approval to spend the extra time on this project to use it while I learn how to do it properly. This is a new module, to tie into an existing system. Currently, all data access happens th...
I'm getting a new computer and would like to minimize the time spent configuring and maintaining dev environments on my various machines. To that end, I'm thinking that creating a vm with my preferred ide and configuration and using that vm for development on all my machines. I'd like to use Windows 7 as the vm's os. F...
I am wondering which license the current JDK 7 (NOT the OpenJDK) is using as I know it was once under GNU GPL but with the change of the Distributor License for Java I would like to know whether they changed the allover license, too.
This is a related Q: Is use of finally clause for doing work after return bad style/dangerous? In the referenced Q, the finally code is related to the structure used and the necessity of pre-fetching. My question is a little different, and I believe it's germane to the broader audience. My particular example is a C# ...
I've never noticed this quirk until now, and it's screwing with my mind. Why was HTML 4.01 numbered with a leading zero, rather than as 4.1?
I have a very simple program in Ruby that opens a dictionary file, sorted-words.txt and prints out all the words in pig-latin. I tested its speed, and the first time I ran it, the program finished in about 1.6 seconds. The second time I ran the program, it took about 2.1 seconds. Between the two runs, there was maybe a...
Facing a situation where I can't possibly get all the features that are requested into each version of the LOB I support, I've evolved a number SQL query templates that users have and send to me, which I then execute. This then led to a password protected SQL execution dialog which users with write access can execute f...
I am working with a project in VC++ which involves co-ordinate system having x,y,z axis. I am trying to check for if a variable(Point with x,y,z values) is assigned on the coordinate system or its a default point(uninitialized) . Since a coordinate system I cannot assign a default value to the variable to be either neg...
I'm writing a database interface in PHP and I have a base dbTables class, as well as a base dbTableFields class. dbTables has a function, getFields(), that instantiates dbTableFields objects, each of which carries essential data on each table field, and puts it into dbTableFields->fields=array(); dbTables has several c...
I am very confused about this programming language, Objective-C, which I heard is used to develop iOS applications. I know that it uses the principles of OOP. Would it be easier to learn if I already knew C++? What about it's name? is it a combination between the C programming language and the OOP principles I use in C...
I'm developing small Java Web Applications on Tomcat server and I'm using MySQL as my database. Up until now I was using a connection singleton for accessing the database but I found out that this will ensure just on connection per Application and there will be problems if multiple users want to access the database in ...
In many projects these days most of the novel code consists of glue code that helps combine dozens of different libraries, plugins and helpers that are licensed under a variety of open source licenses. In many cases the licenses are fairly obvious as they carry the name of the license in the license file or comment. In...
I am contemplating a direction to take an application. The application is written in PHP which implements a MVC framework. Some of my clients will require web services. I was thinking even building the basic PHP web interface on top of these web services (SOAP) and stopping the PHP application from accessing the datab...
I am relatively new to web development and haven't had to provide estimates for many large projects yet (my last large project was just paid for by the hour without a strict deadline or budget). A client is asking me to provide a cost and time estimate for providing a myriad of changes to another developers code for a ...
I come from an ASP.NET forms background and have found server side coding very powerful in the past. More recently, however, I have been wanting to phase out the server side code of the front-end and replace it with pure HTML/JavaScript, which accesses the data through JSON webservices. I have no real experience in thi...
I've been wanting to try out VS2011 and .NET 4.5 beta, but the upgrade path is confusing at best. If I understand what I've read, the .NET 4.5 framework overwrites the .NET 4.0 libraries on your local machine, so libraries such as mscorlib.dll and System.dll will be replaced with the 4.5 version - fully backward compat...
Google is well known for the ridiculous amount of C++ they've coded over the years. Correct me if I'm wrong, but a large part of Google's core search engine is written in C++, isn't it? How does one take a program written in C++ and interface it with a website? Note: I'm not looking for how Google in particular does th...
I keep hearing people (Crockford in particular) saying the DOM is a terrible API, but not really justifying this statement. Apart from cross-browser inconsistencies, what are some reasons why the DOM is considered to be so bad?
When you build an application, is it better to design the UI first (in Photoshop or whatever), then implement the functionality following the UI you just designed, or do the programming and build the design as you go? Advantages I see using UI as reference: the app will end up very UI-friendly :) like pdr mentioned, i...
Last week, we had a heated argument about handling nulls in our application's service layer. The question is in the .NET context, but it will be the same in Java and many other technologies. The question was: should you always check for nulls and make your code work no matter what, or let an exception bubble up when a ...
Is it logical to estimate cost of project depends on source lines of code? Like those calculated reports from tools such as sloccount ohloh estimating * How to convince [somebody|employer|client] to pay depends on those reports ? The weird things come to scene when I see something like $83,862 based on my project. So...
Using spring mvc to create a restful api, Maven is build tool and tomcat with spring jars is deployment . Plan A: each webservice will be its own separate war file/project ? if required I would supply dependices as jar(s) (such as any dao's/dto's/service layer classes used in different webservices? I would share the s...
I'm 16. I started programming about a year ago when I was about to start high-school. I'm going for a career in programming, and I'm doing my best to learn as much as I can. When I first started, I learned the basics of C++ from a book and I started to learn things by myself from there on. Nowadays I'm much more experi...
Should the developers who creates programs with Delphi, FPC, Lazarus agree with the name of the language? This struck me since every possible variation not only adds confusion for new programmers, also when I write or name each of them, I feel that it's not fully correct. Pascal. We know how Wirth dislikes OOP, so thi...
I am working on a project (which includes JavaEE web apps and JavaSE apps) that has grown from a single developer to a team of three, and issues of readability and robustness are starting to emerge. One glaring omission from the Java language has been fine tuned contracts, and how easily these are exposed to other deve...
So I have a factored polynomial of the form (z-a)(z-b)(z-c)...(z-n) for n an even positive integer. Thus the coefficient of z^k for 0 <= k < n will be the sum of all distinct n-k element products taken from the set {a,b,...,n} multiplied by (-1)^k, I hope that makes sense, please ask if you need more clarification. ...
I've heard of probabilistic data structures like Skip Lists and Bloom Filters being immensely useful and I'd like to learn more about them in general. Is there a canonical reference on the subject on the level of Cormen et al.?
I'm a bit confused about if and when I should use typedef in C++. I feel it's a balancing act between readability and clarity. Here's a code sample without any typedefs: int sum(std::vector<int>::const_iterator first, std::vector<int>::const_iterator last) { static std::map<std::tuple<std::vector<int>::con...
I'm surprised to find that it might be possible to use Pascal with the Cocoa and Cocoa Touch frameworks. This is an interesting turn of events, as Pascal was the favored language for Mac development for a short while early in the history of Macintosh. It looks like someone has gone to a lot of trouble to make Pascal wo...
My apologies in advance if this is not a good forum for this question; pointers to others happily accepted. On the off chance it matters, I'm not going to commercialize this idea or anything; if anything in here is interesting to you, use it as you see fit. My basic problem is this: My favorite place to do non-code wri...
As a C++-programmer in interviews I repeatedly found myself in situations were the interviewer wanted to probe my knowledge of good programming style. These typically were centered around basic knowledge of OOP. I know OOP is useful to encapsulate concepts and I use it daily. However, since a language like C++ allows m...
I'm currently working with a professor at my university to develop new curricula for the Software Engineering and Capstone Design courses offered in my college. Up until recently, both courses used the waterfall model exclusively, and thus students spent a majority of their time writing lengthy reports. After much pres...
I'm trying to find a better solution for making a parser to some of the famous file formats out there such as: EDIFACT and TRADACOMS. If you aren't familiar with these standards then check out this example from Wikipedia: See below for an example of an EDIFACT message used to answer to a product availability request...
Today, the Internet Explorer Box Model problem is mostly a non-issue. Most web developers place a <!DOCTYPE> tag to enforce standards compliance, and nobody really cares about supporting Internet Explorer 5.5 anymore. However, some developers have come up with subjective, conceptual arguments in defense of the IE box ...
I have my Python source structured as follows: +-branchname/ +-dst/ +-src/ | +-library/ | | +-cleese/ | | | +-test/ | | | | +-__init__.py | | | | +-test_cleese.py | | | +-__init__.py | | | +-cleese.py | | +-palin/ | | +-test/ | | | +-__init__.py | | | +-test_palin.py | | +-__init__...
I'm developing a Killer Sudoku solver for a school project. I've programmed 10 human strategies showing what they are doing in order to be the most educational possible. It can solve hard Killer Sudokus right now but my teacher proposed that I use backtracking to solve every possible grid. I've been trying for one week...
I have loaded a .RAW file into a 2x2 array in my class. The way I am rendering it works fine but I am struggling to get the camera to move on top of the terrain. The terrain renders from 0,0,0 (x,y,z) as that is where I put my camera. My camera class allows to the "camera" to move through the scene. I want to be able ...
Are there any eye-tracking case studies, or similar research done to verify what code format is easiest to read, maintain and work with? I always format my code the following way: function thing() { if(something) { // do something } else { // do something else } } However, I never s...
Going through some old Hacker News items, I came across a post from a user that said Aguri trees, which marry a bounded-size radix trie (like you'd use in a software routing table) to an LRU list, and automatically synthesize aggregates (like, 10.0.0.0/16 from 1,000 observations across all IPs) from the pattern of ins...
In Java, why are nextInt() and nextDouble() instance methods of Random objects? I feel that these methods should be static methods of the Random class. What is the purpose of having to instantiate a Random object to generate random integers or double values?
Time to time, I have to work on a website that involves a huge background in size and resolution (1920 x 1080 in resolution, over 2mb in size). I've been using preloaders and it worked very well, except that users have to wait a little bit. I noticed that google map splits a big image into many pieces. I researched abo...
According to Wikipedia, a stack: is a last in, first out (LIFO) abstract data type and linear data structure. While an array: is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. As far as I understand, they are fairly similar. So, wha...
There are benefits to each and I understand the differences, but what is considered best / standard practice? And why? For example : "myString".equals(myStringVar) Avoids a potential NPE and does not require a null check. (Good thing?) Cleaner to read since a null check is not required. If null is not an expected va...
I'm a little new to Java Web Development. JSF, JSP, Servlets, Hibernate etc... I have really a good understanding of OOP and C++. I have years of PHP and MySQL web development experience. I also have experience with C# and ASP.NET and I'm a software engineering student. I don't want to continue my career with PHP, sinc...
I've heard swarming mentioned in the context of Agile or Extreme Programming. It seems to be a complement to pairing. What exactly is it? When should it be applied? How do you do it well?
I'm fairly familiar with where to use Stacks, Queues, and Trees in software applications but I've never used a Deque (Double Ended Queue) before. Where would I typically encounter them in the wild? Would it be in the same places as a Queue but with extra gribbilies?
Is there a Cormen-like reference on Hashes and Hashing? This particular structure has seen little attention in my CS education for some reason but I'd like to learn more as they seem to be everywhere. I know Cormen covers it but I'm looking for something more specialized and in-depth.
Why does the add method of a Linkedlist return true in Java? http://docs.oracle.com/javase/1.5.0/docs/api/java/util/LinkedList.html#add(E) Why not just make it a void method? I know it says "per the general contract of Collection.add", but why doesn't this contract/interface make add a void method?
I am studying OOP in C++ and, even though I am aware of the definitions of these 3 concepts, I cannot really realize when or how to use it. Let's use this class for the example: class Person{ private: string name; int age; public: Person(string p1, int p2){this->name=p1; t...
Over the past week, I've been struggling to adapt a Grails application to use the REST architecture. Problem is, I've had nothing but trouble throughout. For this application, the choice between using XML and JSON literally came down to a coin flip. Neither format offered much over the other, so I went with XML. Writ...
When we design applications, we generally end up with the same tiered sets of data structures: A persistent data structure that is described using DDL and implemented as RDBMS tables and columns. A set of domain objects that consist primarily of data structures, usually combined with business-rule level logic, that ar...
I sometimes prefer to work in a terminal. I use git, and sometimes have merge conflicts. Are there any merge-conflict-resolution tools that work in a command-line only environment?
Often when configuring settings, applications have both an "Apply" and an "Ok" button. Should the "Ok" button always perform the "Apply" before closing the window out? Are there pros and cons to doing this?
I'm currently looking into API documentation generation tools and I noticed that apparently there are no efforts going on in standardization. Javadoc style is kind of an ubiquitous convention... it is used for Java (duh), PHP (PHPDocumentor, doxygen, Stubbles), C/C++ (doxygen again)... and there is even IDE support fo...
I have read different opinions about the singleton pattern. Some maintain that it should be avoided at all costs and others that it can be be useful in certain situations. One situation in which I use singletons is when I need a factory (let's say an object f of type F) to create objects of a certain class A. The facto...
The Ecma-334 (ISO/IEC 23270:2006) standard corresponds to the version 2.0 of the language. Specification of version 4.0 is freely available from Microsoft, but Microsoft's open specifications list only lists the Ecma (version 2.0) version. So what about all the good features added in the later versions (LINQ, lambda fu...
Usually, tree data structures are organised in a way that each node contains pointers to all its children. +-----------------------------------------+ | root | | child1 child2 child3 | +--+------------------+----------------+--+ ...
I am maintaining a WinForms application, which talks to a SQL Server database. Sometimes I have to change database schema (for example to alter a sql procedure or add new one). For this purpose I have a SchemaChange.sql file, where I put the corresponding sql code. When I create an installer for my project, the msi pac...
I want to learn about null values or null references. For example I have a class called Apple and I created an instance of it. Apple myApple = new Apple("yummy"); // The data is stored in memory Then I ate that apple and now it needs to be null, so I set it as null. myApple = null; After this call, I forgot that I at...
We have a requirement in our project to generate a big CSV file every 2 hours using a Java program. This file will have around 60,000 lines (around 120 characters per line). I am not sure about the size yet. I would like to know if I would run into any memory issues because I will open the file using FileWriter and the...
I found two techniques for estimating user stories: by the size of the story, which is unit-less by the time estimate, which is measured by days The first uses relative comparison between stories to infer time, and it should be independent on developer experience, while the second depends on developer experience. I ...
We want to store some genomic variant data but there are some problems, more important ones like problem of the data's immense size and variability. Variant data can be huge. For example, a single individuals variant data could feasibly some day require a million rows of data in a table, or require of a gigabyte of r...
I'm creating a web app using web.py (although I may later rewrite it for Tornado) which involves a lot of file manipulation. One example, the app will have a git-style 'commit' operation, in which some files are sent to the server and placed in a new folder along with the unchanged files from the last version. This wil...
Sites like webpagetest allow users to enter a website url and a test location, to run a speed test on the site from multiple locations using real browsers. Can anyone give me a basic idea of how sites like this work? You also have plugin's like Aptimize latency simulator or charles web debugging proxy app, that simula...
Well, I started using some CSS3 animations a couple of days ago. After hardcoding I've started trying different tools like Adobe Edge Preview version. I made a short animation to get the functionality of the tool http://things.eyemade.ch/css3edge/ After that someone at Twitter took a look at it and said that it is wron...
I have a fairly large software project written in c++. In there, there is a class foo which represents a structure (by which i don't mean the programmers struct) in which foo-objects can be part of a foo-object. Here's class foo in simplest form: class Foo { private: std::vector<unsigned int> indices; p...
I'm a fresh grad, and I just started workingin real world projects. I'm basically using PHP most of the time. I just figured out that most of the solutions I came out with for most of the problems, is involving using an array in somehow. What Am I doing wrong here? How could I unlearn this and always think of something...
I have found a major security hole in one of my company's public facing site. This is our first public facing site that was converted from an intranet site. I brought this issue up to my boss and they essentially shrugged it off, saying that it would take a good deal of work to re-architecture the site to make it secur...
I'm trying to get a better understanding of Dependency. In Martin Fowler's explanation of the Data Mapper pattern, http://martinfowler.com/eaaCatalog/dataMapper.html, the UML diagram shows the Mapper being dependent on both the Domain Object and the Database. It seems to me, however, that the Domain Object is dependent...
Wikipedia says "software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification" The word functions caught my eyes, and I now wonder if we can assume that creating an overload for a method can be regarded as an example of the Open/closed principle or not? Let me explain...
I'm looking for good practices or any advice regarding file access transaction mechanisms. We will have multiple instances of an application spread over a redundant network (cloud) watching a directory on a 100% available NAS. I'm also looking for any alternative architecture that may be more appropriate. We will have...
I am developing a series of webservices (based on spring and spring mvc). For the first time in my dev career I do plan on replacing the dao layer in the future(I have always seen it mentioned but never had to do it). Currently I'm using spring annotations, so I could simply change the qualifier name of the injected da...
I am designing a programming language, and I would like to provide a complete documentation for it. So far, I have planned to write the following documents: An initial design outline, mostly as a reminder of the design and proposed changes to it, as well as an aid to construct all the other documents when the design p...
I recently read a blog post (which I lost the link) that really make me think. The writer said that the one of the biggest problem in software projects is actaully completing it, and most people will end up abandoning the work. I have been self-learning programming for over 15 years now, at this stage I actually feel p...
I was reading JDOM's website. Why is the JDOM API defined in terms of concrete classes rather than interfaces? Jason Hunter summarizes the arguments against an interface-based API for JDOM: With interfaces everything becomes a factory, elements have to be 'imported' into new documents instead of just added, features ...