instruction
stringlengths
34
19.9k
The major online IDEs are hosted on the service provider's server. Examples are Kodingen, Cloud9, ShiftEdit. Hence they would be unavailable if the external server was down for some reason, and I prefer to do my computing on my own computer anyway. Does anyone know of an online IDE or editor (preferably just an editor ...
Initial note: This question got closed after several edits because I lacked the proper terminology to state accurately what I was looking for. Sam Tobin-Hochstadt then posted a comment which made me recognise exactly what that was: programming languages that support intersection types for function return values. Now t...
I realized there could be a lot of bad code in a system while writing Java. I wonder why schools don't teach what programming practices are bad. For example, in Java, using a big try/catch block that catches Exception is bad, but no one told me. And we see the typical "String + String" concatenation appear in every cor...
I am currently learning about bitwise operation, so bear with me. I understand AND, OR, and shifting. What I don't understand is bit flipping. So, 5 is 0101. When someone says to me "flip those", it would result in 1010 which is 10. So why does ~5result in -6? I think I got this very wrong. Can someone enlight me? (I...
Suppose you were given an integer number in decimal notation. This when represented in binary will be a series of 0's and 1's. This sequence varies in length with the magnitude of the number. Now suppose you wanted to flip the 'n'th position bit in this sequence of binary numbers, how would you do it? The result of the...
Is it necessarily if a software released under both of LGPL3 && GPL3 terms have to include both license header notice top of each file? Or just put GPL header notice? or simply put LGPL3 license text in some file like COPYING.LESSER ? EDITED: I am the copyright holder of the project!
We're in a bad situation of having very little documentation on customization our past workers made to a business critical system. Lots of changes were done to Crystal Reports, database entities, and proprietary configuration/programming files for our ERP software. The current documentation generally reads something li...
After browsing the apple docs, I came across this sample of their MVC pattern: Using NSNotificationCenter and without using KVO, would this diagram below represent a correct implementation of the MVC pattern? If not, what’s wrong and how can it be corrected or improved? App starts with the left light set to on, and...
At my company, we have a quagmire of disparate cron jobs (on multiple systems) and manually kicked off processes which keep our business functioning that is a result of years of expedient development and subsequent neglect. Someday, we will need to come up with a more centralized solution for obvious reasons. One thoug...
I am writing an application that takes some file specifying an adjacency matrix and uses this to construct a graph (in this case, a directed social network). What I would like to do is specify the size of the matrix and then have it generate an adjacency matrix with one of these topologies: ring, hierarchical, fully-co...
I don't know if it's the right place to post this question but, to improve my productivity I need to install an open source issue-tracking system to keep tracks of all bugs and information about the completion. There are a lot of open source systems to do that but I'm looking for one which could be hosted on PHP / MyS...
We've recently moved to a better password storage strategy, with it came all the good stuff: Passwords are stored after going through bCrypt User is sent an activation link on account creation to confirm ownership of address Forgot password without security question, a link is sent to their email. The link expires aft...
I've been wondering about code reviews recently, based on how many questions I've seen on here talking about them. Between my internships, contracts, and full time jobs, I've worked for six different companies, and only one of them has done code reviews. At the last two places I've worked, code was good (or at least go...
Usually in a domain model, you'll have objects, and those objects will have properties that are mutable and properties that are immutable - for instance, a instance id/name will be immutable, while some other properties (specially properties that depend on relationships with other objects) can vary in the lifetime of a...
Possible Duplicate: Library vs. framework vs API? I am having hard times understanding what these concepts really mean. This software stack thing is very confusing. Can you please help me with this question, or if you can refer me to some article/book where I can learn in details about this software stack and how th...
Given a binary search tree, I understand why I can use breadth-first and pre-order traversal to list the entries of the tree in such a way as to reconstruct the tree in the order in which its traversed. However if we now consider an AVL tree and we want to traverse the tree in such a way as to recreate the same AVL tr...
I got one project with some requirements. Basically my client provide data entry work. In that he converts image files(scan copy of articles, forms etc) to document file (MS word) by typing manually. For maintaining quality of that work he set some roles on documents text formatting like specific font, font size, pap...
Context I'm developing an application using a Domain Driven Design approach. I want to use a design pattern wherever appropriate and apply all SOLID principles. Scenario I have an order and I want to allow clients to add order lines to it. Consider the following pseudo code: class Order OrderLines[] (readonly) ...
Is it a good practice to call a method that returns true or false values in an if statement? Something like this: private void VerifyAccount() { if (!ValidateCredentials(txtUser.Text, txtPassword.Text)) { MessageBox.Show("Invalid user name or password"); } } private bool ValidateCredentials(string ...
A comment on this question: Checking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional? says that you should use !boolean instead of boolean == false when testing conditions. Why? To me boolean == false is much more natural in English and is more explicit. ...
I was reading Paul Graham's essay - Beating The Averages (2003) and here's what he had to say: The more of an IT flavor the job descriptions had, the less dangerous the company was. The safest kind were the ones that wanted Oracle experience. You never had to worry about those. You were also safe if they said th...
I am using PHP. I'm building a fully modular CMS, which is destined for the public. Some people might view this as a framework, but I intend to write a set of extensions for it, extensions that will make it a CMS :P Because it's completely modular I have a problem figuring out how to load extensions. Practically I nee...
The model is defined first, then the controllers are fired based on the user request, and they will generate the views (the output). So it should be M->C->V, right?
Just wondering (now that I've started with C++ which needs a compiler) why Python doesn't need a compiler? I just enter the code, save it as an exec, and run it. In C++ I have to make builds and all of that other fun stuff.
I am working with a history teacher on a history app. He has like 200 flowcharts that he wants to put into the app (among other things). The two likeliest-looking ways to do it: HTML/CSS. The big minus here is that neither one of us is a big HTML/CSS person. Though I do know a bit about them. Adobe Illustrator. The in...
My friend and I usually don't have time to meet up in person to do some real pair programming. Since we want to program together anyway, we turned to the world of collaborative software editing. Sadly, most of the solutions we have tried are either lackluster or don't work at all. Cloud9 (fusion of Mozilla Skywriter, ...
If I have a number of classes, lets say a variety of buildings of some sort. Each of these buildings have various properties and do some stuff etc Now there is a set of operations I need to do on these buildings that are all conceptually the same. Lets call this conceptual group of operations Move building effluent...
I just started a diploma in software development. Right now we're starting out with basic Java and such (so right from the bottom you might say) - which is fine, I have no programming experience apart from knowing how to do "Hello World" in Java. I keep hearing that mathematics is pertinent to coding, but how is it so?...
A lot of questions get asked here about interpreted vs compiled language implements. I'm wondering whether the distinction actually makes any sense. (Actually the questions are usually about languages, but they are really thinking about the most popular implementations of those languages). Today almost no implementatio...
I've started toying with some Mac development and wonder where the best place to store the code is? Generally on my windows box, I'd store all my code in c:\Code\ On the Mac it's in /Users/Liam/Code/ Will this cause me any issue with permissions when running web code?
Possible Duplicate: Is there any reason to use C++ instead of C, Perl, Python, etc.? When to use C over C++, and C++ over C? I am going to enter university next fall in computer sciences, but have been programming already for a few years. I am currently doing web application development. I use Python and Java mainl...
I have essentially a data model class that represents an XML data structure that we use to model our system. The model class is in a shared project that is used by a number of different solutions in order to generate a common XML data structure for usage by any number of applications. In one application I am involved ...
So I've been creating a data access layer via TDD and have approached somewhat of a concern. I'd rather not start down the wrong path, so I figured I'd ask you guys to see if my thoughts were in line with a clean architecture. The methods within my Data Access Layer (DAL for short), are pretty simple. They are in line ...
We are designing a website/web application where we hope to to achieve high user counts and, in general, lots of use. More specifically, we intend to be using PHP as the programming/scripting language and MySQL for the relational DB needs as a start. We have not yet figured out whether to use a NoSQL database or not. R...
In C, I often come across errors with code like this prio_queue->head[index] = newEntry; Yields a " "Cannot assign Entry** to Entry* " How do you prevent/debug errors of this type, in general?
Greenspun's tenth rule (actually the only rule) states that: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. My memory is that there are some papers on the topic, perhaps for Borland's Quattro (spreadsheet) project and p...
A large system has already been done in visual fox pro. They want to add more requirements to a module and make some changes to the system.At the same time they are thinking about migration to .net. Some parts like report generation has been done in .net using visual fox pro database and loaded in vfp. Is it a good ide...
I've heard it said that gantt charts are a relic of waterfall project management techniques. I typically use an agile-like approach to project planning and tracking progress which provides good visibility into feature-time trade-offs as the project progresses. We're at the outset of a project in in which, while the e...
I am in a distributed system project written in java where we have some classes which corresponds to very complex real-world-business objects. These objects have a lot of methods corresponding to actions that the user (or some other agent) may apply to that objects. As a result, these classes became very complex. The s...
I'm creating a vector editing program in C++, and I need a Shape interface which other concrete classes will implement. There is a requirement that no implementation inheritance is allowed. The design doc says that if you need polymorphism, use interfaces. If you need code reuse, use composition. The Shape interface is...
Code Complete states that you should aways code into a language as opposed to code in it. By that, they mean Don't limit your programming thinking only to the concepts that are supported automatically by your language. The best programmers think of what they want to do, and then they assess how to accomplish their obj...
Clean code recommends to name methods to be a verb, and classes to be a noun. I am developing an c++ application using boost::signal as some kind of event framework, and have defined various events, but naming them to make the code cleaner seems to be problematic. So, how to name event types?
I want to contribute to open source projects on Github. Mostly, I'd like to just start out fixing small bugs or adding features. I don't have a particular project in mind. I'd like to work on C, C++, Python, .NET, Java, etc projects. However, my problem is I can't figure out how to find anything on Github. I did find a...
Possible Duplicate: What does mathematics have to do with programming? How often do you have to solve pure mathematical or algorithmical problems? I heard that math can be very important in programming. I am a confident python programmer, and have started C++. So far I have not encountered anything where I need to us...
This is really perplexing me. We have a 'definition of done' and it includes dev 'done', unit tests 'done', dev test 'done'. However we also have a user acceptance test that needs to be 'done' but the business wants to know when users stories are complete so that they can see stuff (the uat really isnt a priority until...
I'm new at computer science and programming, and I was wondering, is there a difference between computer science and programming? and do you get to choose to study only one of them at the university, or both of them?
I was looking through the AvSol Coding Guidelines for C# and I agree with nearly everything but I'm really curious to see what other think of one specific rule. AV1500 Methods should not exceed 7 statements A method that requires more than 7 statements is doing too much, or has too many responsibilities. It also...
<HTML> <HEAD><TITLE>Login Page</TITLE></HEAD> <BODY> <CENTER> <FORM method="POST" action="http://yourserver/cgi-bin/login.py"> <paragraph> Enter your login name: <input type="text" name="login"> <paragraph> Enter your password: <input type=password name="password"> <paragraph> <input type="submit" value="Connect"> </FO...
I want to generate code documentation in a simple format. The key items are Method Signature, members, constructors, methods. I am taking various applications in .NET and creating documentation for them. I will be adding notes to each item. The end result should look similar to MSDN or Java API documentation. So, I...
In Java, which is more highly recommended, and why? Both types will throw exceptions, so in that regard handling them is the same. assert is slightly shorter, but I'm not sure how much that matters. public void doStuff(Object obj) { assert obj != null; ... } vs public void doStuff(Object obj) { if (obj == ...
The Problem I am hunting down a bug in a web application related to multi-uploads using a Flash movie/applet. Sometimes, the progress bar that is used in the Flash applet to indicate file upload progress will read over 100% for a progress and causes the entire upload system to halt. Aside from the logic errors associat...
I've been programming for a while, I've written some rudimentary programs, and I want to keep learning. I've reached that point where you just don't know what to learn next, and I'd like to ask a question for my own curiosity. The question, in a nutshell, is if you can combine multiple programming languages into 1 resu...
According to this Python code visualizer, Python strings are allocated on the stack and not on the heap. Why is this? I thought they would be similar to Java where Strings are allocated on the heap.
In this Stack Overflow question: https://stackoverflow.com/questions/9471332 I learned that Jscript is not dead after all. Yay! But what is JScript.NET good for? According to this article, you can use it to provide C# with an Eval function. That's neat, but it seems like kind of an edge case. If you were after fir...
According to this, "Scrum highly relies on a highly motivated, closely collaborating, cross-functional and self-organized teams." So how do you handle co-workers who may not be as motivated to take ownership of the code? How do you get someone interested in taking ownership?
A weird title, yes, but I've got a bit of ground to cover I think. We have an organization account on github with private repositories. We want to use github's native issues/pull-requests features (pull requests are basically exactly what we want as far as code reviews and feature discussions). We found the tool hub ...
This might be a little open ended, but I heard an explanation of this talk on how GP could be used to fix bugs, and I wonder: How does this differ from the infinite monkey theorem?
I have created several hand written compilers for very simple languages but now I want to try my hand at developing a dynamic language, similar to a simplified Python or Ruby. However, it was easy for me to wrap my head around how compilers work. Primitive compilers just translate. But I can't do this if the languag...
java.util.Arrays.sort(/* int[], char[], short[], byte[], boolean[] */) is implemented as a 'tuned quicksort' rather than a radix sort. I did a speed comparison a while ago, and with something like n>10000, radix sort was always faster. why?
Possible Duplicate: Should newbies use IDE autocomplete (Intellisense)? Since I moved on to actual IDEs for C++, Java and Python, I noticed they automatically try to complete my code. For example if I write System.out.pr[...] I am automatically offered a list from which I can select the item I want to use. As a begi...
Mocking the DAL/Repository that I pass to the BLL/ViewModels for testing purposes is not much different than creating an in-memory DAL. Right now I'm using an in-memory DAL in a new project instead of mocking it and it's working very well so far (even easier than setting up the mocks I'd say). Since I haven't seen this...
We have three applications developed in Flex and all these use BlazeDS. These applications have their own authentication implementations (Database). Also they will be deployed in tomcat. Deploying all these applications in the same tomcat instance is acceptable for us. We want to bring the authentication credentials of...
I am looking into designing a system where users build a template item and then create many instances based on this template.They then need to be able customise each instance but I also need for them to be able to make changes to the template and have all instances updated. These items are fairly complex, each consisti...
We are currently deciding on a consistent naming convention across a site with multiple web applications. Historically, I've been an advocate of the 'lowercase all the letters!' when creating URLs: http://example.com/mysystem/account/view/1551 However, within the last year or two, specifically since I began using ASP....
How much experience is considered enough for a developer to become a team leader? For IT managment what is the measure to check if the current team member is good enough to become a team leader (technical level, interpersonal level) updated: removed second part of the question for being duplicate (see comments)
Look here: a typical holy war on tabs vs spaces. Now look here: elastic tabstops. All problems solved, and a bunch of very useful new behaviours added. Are elastic tabstops even mentioned in that tabs vs spaces discussion? Why not? Are there drawbacks to the elastic tabstop idea so serious that nobody has ever implem...
Currently at my job, we have a large suite of unit tests for our C++ application. However we don't use a unit test framework. They simply utilize a C macro that basically wraps an assert and a cout. Something like: VERIFY(cond) if (!(cond)) {std::cout << "unit test failed at " << __FILE__ << "," << __LINE__; asserst(fa...
I'm pretty new to JavaScript, but one of the things that's been frustrating is that our AJAX callbacks have been getting packed with different functionality, making it difficult to keep everything separated and organized. I'm really new to programming, I have a feeling learning MVC a bit more would help me, but for no...
And I don't mean Autocomplete or automatic code snippets as inserted by modern day editors, or polymorphic code. But what is the state-of-the-art in programs that can go through given inputs and types and information of the desired outputs and output a valid piece of code in a language of choice. I am aware of Genetic ...
My team is going to add new team members and my manager doesn't want to take any risks. I don't think it's a large problem but my manager is concerned that a new programmer would sabotage and accidentally destroy parts of the code or the data e.g. cause data disaster. I say that probability is not very high but still I...
In my years of programming Java and more recently Scala, I've never used Ant, Maven, Gradle or any of those build tools for Java. Everywhere I've worked there was a build manager who took care of all of that -- I'd compile locally with the IDE for development and unit testing, then check in the source code and notify ...
Is there a term for performance issues caused by someone creates a loop that performs hundreds or thousands of actions that could have been done in bulk? My example is that I keep running into loops that loop through a group of IDs and then perform a single query for each ID to retrieve the associated row instead of cr...
I'm sure we've all been in the situation where we've inherited code that was "overly public", becomes obsolete or needs to be refactored. In these situations, it is easy to spend many days analysing the API surface to see where methods or classes are consumed; with the .Net runtime, it seems logical that it should be r...
I love the immutable "pattern" because of its strengths, and in the past I have found it beneficial to design systems with immutable data types (some, most or even all). Often when I do so, I find myself writing fewer bugs and debugging is much easier. However, my peers in general shy away from immutable. They are not ...
For years, I have been doing Algorithmic stuff, writing scalable data structures for internet search, for example Randomized Binary Search Trees for Auto Recommendation, BitMaps, Wisdom of Crowd based Algorithms using Graphs, writing some interesting Machine Learning Algorithms like Clustering, Anomaly Detection, worki...
I'm learning new languages as I go along, I write code for very basic programs in multiple languages, and I go to classes. I've read books, articles, lessons, videos, you name it, however I can't seem to get the hang of certain things. For example I never understood pointers - what they are good at. (NOT PART OF THE QU...
From my research, many obfuscation/optimization packages include a feature called pruning where the software will remove dead code during processing. The following packages include both obfuscation and code pruning as a feature (to name a few): RedGate SmartAssembly (.NET) Preemtive Dotfuscator (.NET) Inquartos Obfusc...
I'm reading the Wikipedia page on first normal form, and am confused about the last bullet point: 5) All columns are regular [i.e. rows have no hidden components such as row IDs, object IDs, or hidden timestamps]. Does this mean "all information about a row is contained in its values" (my words)? I understand the re...
Is there a sane way / best practices way to swap out a DB from MySQL to SQL Server in a multiple large projects? Some of the projects are ASP projects, some of them are windows services, some are standalone windows apps. I don't think any ORM is used. I think its just SQL statements all over the place.
I am trying to find an approach for a project, where A user can edit records, and be able to see past versions of those records. Here is a simlified example schema, using a list: TABLE list ( id int auto_increment primary key, user_id int, title varchar(255) ); TABLE list_tasks ( id int auto_increment primary...
I am going through Abelson and Sussman (Structure and Interpretation of Computer Programs) and I am a little confused about when normal order evaluation is used and when applicative order evaluation is used. This sentence throws me off: Lisp uses applicative-order evaluation partly because of the additional efficiency...
I'm a PHP developer with familiarity with Rails and a focus on MVC development. My company is moving more and more to SharePoint and I feel I need to learn to build application within the SharePoint system. I have some brief introduction to C# but that's about it. I've used some SharePoint Designer and the web interfac...
When writing tools for the CLI of UNIX, how should I make the program print out help and/or usage? I usually use fprintf(stderr, "help text here");, but there are several issues with that. First, I'm not sure, whether I should use stderr. Is that OK, or should I use stdout? As you can imagine, the help text is quite l...
What I will say might be a tad controversial in nature but I am very disheartened today - and so I will ask this. I just had an interview with a major tech firm for an internship position, where I was asked a lot of typical algorithm oriented interview questions. Now, given my background, I consider myself to be strong...
I'm just learning about using cgi in html files. I've read a lot of stuff on the web, but most of it is all about the trees and not enough about the forest. I'm a top-down learner and I'm having trouble understanding what's going on with cgi, apache, and html. At the moment I'm using python as my cgi scripting language...
Even though developers have switched from junit 3.x to 4.x I still see the following 99% of the time: @Before public void setUp(){/*some setup code*/} @After public void tearDown(){/*some clean up code*/} Just to clarify my point... in Junit 4.x, when the runners are set up correctly, the framework will pick up the ...
So I'm very close to releasing an app I've been working on, and the server I integrate with allows me to register users. So I was wondering if I should require users to register with the app before they use it. The app wouldn't "need" the registration for any of the features (although I have some ideas about future u...
I have a few project ideas that I'd like to deploy on GAE. I'm interested in developing a logging application for amateur radio contacts, shortwave, and utility monitoring. More complex projects include satellite tracking, audio streaming from multiple radios, and radio remote control including transmitting and receivi...
In JavaScript, PL/SQL and some other languages, functions can be nested, i.e. declared within another function. This could be used to break a large function into smaller pieces, but keep those pieces within the context of the larger function. function doTooMuch() { function doSomething () { ... } fun...
AFAIK, my class extends parent classes and implements interfaces. But I run across a situation, where I can't use implements SomeInterface. It is the declaration of a generic types. For example: public interface CallsForGrow {...} public class GrowingArrayList <T implements CallsForGrow> // BAD, won't work! ...
I'm selling software that lets users manipulate critical information. In my licence contract (drafted by a lawyer specialized in this field), I've got a standard clause reading: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRA...
When switching to a functional style of programming after coming from procedural and OOP, what things do I need to know upfront about "this new way of thinking"? How do you prepare yourself for diving in the FP world and get it first time around? What are the basics to learn and set straight first?
We have a series of hardware and we have decided on a common API to be given to the customer for use. The customer will use this API in order to program the hardware. The API includes functions for establishing a connection with the h/w like X_Open,X_Close,X_SetConfig, X_GetConfig, no of hardware connected, error handl...
Why would there be any pressure if everyone knows what they are doing and the projects are accurately estimated? If there's pressure, or even high pressure, then it implies what they are currently doing is not working, why would any good programmer want to join a team like that? Are these kind of job posting failed at ...
Many people recommend that we should code against interfaces and avoid statics for testability. Interfaces are not just for testability, they are sometimes a requirement. But sometimes we introduce new interfaces in application only for testability. If type mocking frameworks help us to isolate dependent types, then wh...
I am switching from C#+Visual Studio to Ruby+Vim for a few months. The only thing that I am missing from C#/Visual Studio is intellisense, especially when I have a new ruby gem to familiarize. As a programmer with a below-average memory like Joel, I miss the a happy time in Visual Studio that I can Ctrl+Space everywhe...
I have a complex object (call it BusinessLogic) which provides an RPC interface to semi-trusted users. The functions in the RPC interface have to decide which procedure to call, check authorisation for that function, perform some argument checking, and then call private functions to carry out the required functionality...
I have been researching into when data is being accessed or shared by multiple threads within Java. And looking into the problems such as: Thread Interference Memory Consistency Deadlock Starvation From this, solutions to solve these problems. So far all I seem find to fixing these problems is by using a synchronizi...
I want to model a Thesaurus using the ANSI/NISO standard relation description like "broader term", "narrow term", etc. (see this Wikipedia article for details). Is it valid for a Thesaurus item in this description standard to have more than one "use" relationship?
We have a PHP intranet site that we run with warning/error logging on (as it's not under heavy load and there's a number of bugs/bad code left to find). Because the site is relatively unstable and in active development, I've been clearing the production error logs when each new version releases so I get a clean look at...