instruction
stringlengths
34
36.1k
In some cases, I fail to see that a problem could be solved by the divide and conquer method. To give a specific example, when studying the find max sub-array problem, my first approach is to brute force it by using a double loop to find the max subarray. When I saw the solution using the divide and conquer approach wh...
I have been browsing some OpenJDK code recently and have found some intriguing pieces of code there that has to do with bit-wise operations. I even asked a question about it on StackOverflow. Another example that illustrates the point: 1141 public static int bitCount(int i) { 1142 // HD, Figure 5-2 ...
I have spent the best part of a month working on the jQuery Calendar plugin. The setup is such that all the calendar entries are stored in a table inside SQL Server and im using a single "Select As" statement to construct the json data within the SQL query itself. This has an execution time of less than one second. How...
I've been a software developer (whether part time or full time) for almost 3 years. I've always been the type of person to have that knack for taking a lead on things, and providing the organization around getting things done. Ever since I was the lead on my senior design project back in college, I felt that this was m...
I have diagnosed ADD. Mild but enough to affect my work: Easily distracted Can't concentrate on one project at a time Addicted to the web Procrastination etc. What strategies do you use to compensate? One clarification I have real ADD. I was diagnosed with it when I was a child and have wrestled with it all my li...
I use quite some "non-commercial" applications when working on software projects. For clarification, I mean developing applications here, for example smartgit, not libraries or anything that gets shipped. Is it legal to provide a donation button for projects made using the non-commercial of certain applications? I know...
I've worked with a number of professional teams and it seems that class code structure ranges from highly organized to completely cluttered. I did a project with the State of California recently and they required using specific Regions in my VB code, along with inline XML comments for auto-docs. It was very structured,...
A bit of context: I'm in 3rd year of college. students are divided into teams of 4. Almost everyone will be working under windows (except a few like me who are on linux). As part of the school curriculum, we will soon start working on a project for a real client, but me and another team are wondering which way would be...
If I understood, the actor model is just like the object model, but with a few differences: EVERY object spawns it's own separate thread and its not a problem even when you have thousands of objects. Actors don't interact by calling functions and getting return values but instead by sending and receiving messages. If ...
Has anyone ever tried Freelancer.com (former GetAFreelancer.com)? Does anyone have any opinions/feedback on the site? I would like to start some projects as a freelancer but I would really like to get some opinions on the site to get started.
I've seen people do neat little PowerPoint shows that show data flowing in and out of a system that they use to wow a customer. Is this something you've done before? like show data in from source 1 and out to source 2? I've used mockups and DFD's but never presented anything in motion and I wonder if that adds value o...
I am interested in learning of the different procedures and environments it takes to maintain a large application. For example, in my case I use a CentOS local server, where I develop my applications and I use a version control system on some applications, then I upload it to my host-gator account and launch it live. I...
When an application allows emails to be sent to it to either reply to comments or add todos, trimming those emails for just the relevant text becomes a problem, since there are many different standards. Many times you'll end up seeing things like this: Hey Joe, good to hear from you. Let me know when you'll be back ...
SSL certificates often advertise varying amounts of warranties or guarantees, for example $500,000 or $1m. My question is, in the history of SSL, has anyone ever actually successfully claimed one of these warranties? Has there ever been a case? If not, is it fair to assume they are just marketing gimmicks?
As a result of the comment discussion here, I wonder whether you can learn Functional Programming in C?
SO has quite a few questions using the word "truthiness" to mean the truth value of an expression, when evaluated as a boolean, regardless of its original type. It's very useful in dynamic languages. So my question is, is this a real term, and if so were we using it before Stephen Colbert made it popular? Or did we jus...
I know a little about how to use message passing and shared memory, but I still don't know when to choose one or another. Can you tell me about their traits (not the implementation)?
When it comes to line length, Google's Closure Linter, Prettier, etc recommend not exceeding 80 characters per line. Can anyone recommend the max number of lines per file? I think most would consider a file with 100 pages of code, or 1000 lines to be too large
I can not see why the heapsort is considered an inplace sorting algorithm. I mean an extra data structure populated with the elements of the array to be sorted i.e. a heap, is used to assist in the extraction of the min value and the sorting process. So may be I am misunderstanding the definition of inplace here? ...
I'm considering re-reading Steve McConnell's excellent "Software Project Survival Guide" and perhaps applying it verbatim to my next project. However, one thought struck me: the book was written in 1998, before Scrum and other agile methodologies became popular. Are the teachings of this book still relevant in light of...
I participated in a coding competition today, and I found that almost all of the command line input our programs needed to receive would start with an integer representing the amount of data sets to follow. There were 6 different problems, and they all started this way. For example, one sample problem had: "Input to t...
I have two questions: Question #1: Is there any well known project to VBify C? VBify here means to make it as easy as in VB.NET and to make C well supported in IDE just like VB.NET, i.e. with following features: word completion, function's argument description and everything just as with VB.NET development using Visua...
I am building an app that communicates with my website with ASIHTTPRequest to a PHP-based REST API on the server side. Naturally, in my app I have different endpoints on the server side, and usually return JSON data. Is it unethical to log counters on how many times each endpoint was hit? I'd like to capture how the a...
(First of all, I should make clear that compilers and virtual machines (aka) are a completely unknown field for me) As I understand it, every time a Java/C#/... application is run, a VM is invoked and translates intermediate code (bytecode, CIL, etc) to machine instructions. But why can't this operation done only once ...
I am working on an iPad app. It needs to contain some very large files. I could put them into the app, but they would push it well over 20MB, which means that it would not be downloadable over the air -- only via iTunes. Is there a way around this without too much pain for me? I don't have a server or anything like ...
I have started an open source project and would very much like to have a cute and catchy icon to label the project with. My dilemma is that I have little to no experience designing vector graphics for use in such a project. To compensate I thought I might purchase a graphic from one of the stock photo service (shutte...
I understand the difference between syntax and semantics - Syntax: how the symbols are combined to form a valid expression or statement. Semantics: the meaning of those symbols that form an expression or statement. But what is the grammar? For example: sometimes I hear people say that some construct is "grammatically i...
I've been trying to experiment with coded user interface testing (CUITS) lately and I get the following error whenever I try to create one. The following package failed to load: C:\Users[File Path Goes Here]\Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll. Coded UI Test is now in an inconsistent state. Re...
I feel like anything that can be developed using OO/functional languages can be generally made 'better' using a prototype based language, because they appaer to have the best of them all: high order functions, flexibility to simulate any OO structure, productivity (low verbosity) and scalability because of concurrency....
I'm a project manager for a team of firmware engineers making the transition to adopting Scrum and I'm moving to support the team in a Product Owner role. We've just gone through Scrum training and are beginning a month of coaching which is going to be invaluable. Coming from a technical background I can already see th...
After having seen (and asked!) so many questions similar to What does int (*f)(int (*a)[5]) mean in C? and even seeing that they'd made a program to help people understand the C syntax, I can't help but wonder: Why was the syntax of C designed this way? For example, if I were designing pointers, I would translate "...
I don't understand why Java uses the reverse of a (probably hypothetical) domain name as the name of a package, while mostly there is no connection between the domain name that some people uses and the products that they have. A lot of developers don't even have any domain. What are the reasons of this naming conventio...
my question is rather a matter of English language. For proper commenting my code I want to know when you do for example the following code, what comment you can write for it? public class TestClass { public double volt {get; set;} public double curr {get; set:} } Somewhere else in the same namespace public c...
I wanted to know the experiences others have about doing the Agile way of "Release Early, Release Often" with iPhone and Android Apps. Its not a problem with webapps as the update happens at the server and user does not have to do anything specific for updates It may not be a big problem with Android, as the approval p...
I was wondering what is the reason behind pagination? Is it used because it lessens the burden on the servers since we would technically limit the amount of rows returned per page? I wanted to do something without pagination but given that I am new to this (I am an amateur) started wondering if its OK technically or no...
By researching around (books, Wikipedia, similar questions on SE, etc) I came to understand that Imperative programming is one of the major programming paradigms, where you describe a series of commands (or statements) for the computer to execute (so you pretty much order it to take specific actions, hence the name "im...
Thinking about Kanban, I realized that the queuing-theory behind the SW-development-methodology obviously also applies to concurrent software. Now I'm looking for whether this kind of thinking is explicitly applied in some area. A simple example: We usually want to limit the number of threads to avoid cache-thrashing (...
It's understandable that after a big development effort, some OSS authors deem reasonable that the project users should make an effort too in order to get started. Can the source code effectively be the project's documentation? Does it need to be structured in a particular way in order to achieve this? And how often is...
I have heard several times that every programmer should learn one of each type of language. Now, this is not necessarily true, but I believe it is a good idea. I've learned a Procedural Language (Perl), but what are the other types? What are the differences between them and what are some examples of each?
Following the Pareto rule, a programmer spends only 20% of his time for really useful things. I spend 80% of my time debugging, fixing small things to get everything working. Is there a way to spend less time debugging?
We currently have a 'global catch all exceptions' section in our application. When an uncaught exception is thrown, the stack trace is displayed and the application continues running. More often than not, this leaves the state of the application invalid going forward. Especially with NullReferenceExceptions, and thre...
I ran across a problem where goal was to use dynamic programming (instead of other approaches). There is a distance to be spanned, and a set of cables of different lengths. What is the minimum number of cables needed to span the distance exactly? To me this looked like a knapsack problem, but since there could be multi...
I'm porting to C++ and adding a lot of functionality to a numerical application written in Fortran 77. While I hate F77, I have to admit that the thing goes very fast. Now, I'm implementing practically the same structure and algorithm, but nevertheless the difference in the execution time is noticeable. Not big, but it...
Is it good/bad practice to do the following: public class MyClass { public MyType MyProperty { get; private set; } public void SetMyProperty(MyType myProperty) { MyProperty = myProperty; } } My intention is to prevent MyProperty from being accidentally changed outside the class. However, it can be changed i...
I started to write a hand written parser just for fun. For simple rules it is working, but I have problem with the optional grammar rules. I marked the optional rules with a question mark. Here is a simple rule: rule1: "AA"? "AB"? "AC"? "AD" So AA, AB and AC string is optional, but AD is required. ex.: "AAABAD" is ma...
This is how my solution looks like right now. And it get's to the point where my Controls need reference to Model. It get's real tough to keep Infrastructure, Constants, Controls and Model separated. For download size and modularity MAIN and Modules (there is many) will stay separate. But those core libraries seem to b...
Possible Duplicate: What does the suffix after software engineer/developer job titles mean? (i.e. Software Developer III) work advancement titles I've been struggling to understand job hierarchy in software engineering. The system is further complicated because of the lack of consistent naming conventions when assig...
I just want to know how long would it take me to become proficient enough (in let's say C#) in order to be able to get into the job market as a junior/entry level programmer. I have read all those articles and discussions about "how long would it take" but the answers always seem to be like "...it will take you two wee...
I want to know whether saving row count in a table is better than counting it each time of the proccess. Quick Example : A visitor goes to Group Clan, the page displays clan information and Members who have joined the group,Should the page look for all the users who joined the clan and count them, or just display the n...
as a programmer I live with Trac, how do you go about accessing trac projects via a mobile phone, nokia/android/iphone/windows mobile, the mobile platform is not important, I can get a new phone but trac is there to stay.
Steve Yegge mentions it in When Polymorphism Fails: ... I think this implies that type is best represented via properties rather than classes, because of the inherent inflexibility of classes. But in "traditional" languages like C++ and Java, this makes code sharing a bit harder, because of the lack of support for syn...
I have been modifying an application to have a cleaner client/server split to allow for load splitting and resource sharing etc. Everything is written to an interface so it was easy to add a remoting layer to the interface using a proxy. Everything worked fine. The next phase was to add a caching layer to the interface...
I was wondering, is there an economic rationale in developing and marketing a small tool (standalone or rather plugin)? Of course, let's assume that the tool does indeed solve a real problem from the production process. And by small, I mean an application that can be developed by 1-2 developers within 2 years. Do you k...
I'm a java developer that is tasked with creating some scripts that will handle large xml document file transfers by hitting some web service api's from windows xp client machines. There may be other document formats involved like .pdf, .doc, .xls or .txt, but I'm not sure on that at this point. I've looked into power...
I seem to be repeatedly stuck in a situation where release dates are set not based on anything technical, but because someone in Sales has committed to a customer by then. Based on discussions with friends in development at other companies, the same thing seems to happen. "Here is the committed feature set and here is...
I feel that the often seen C/C++ doesn't really describe my skills in my CV. So I'm planning to separate it into advanced C++ knowledge and mediocre C skills. Do you think this is confusing for the reader? She could think: "C is a subset of C++, so what is this guy trying to tel me?" Well, what I'm trying to tell is: I...
In order to create a (Lucene) query, an "incomplete" domain object is used. All properties with a value are used for the query, the rest is ignored. In the absence of a better name, we call it "search by example", but as with many other "original" approaches there is probably a (standard/agreed upon) name for this ap...
Possible Duplicate: Which problems domains are more suited to functional programming solutions I've been reading about functional programming. I've been using mostly C#.net recently, and I would like to know of a good real-world example of where a functional language such as Lisp or F# would be a clearly superior ...
Normally what happens is that I work on something for a while and then when I am done I check it in(After the test/review process of course). Sometimes I have to go back and fix something that I got wrong the first time due to me not understanding the problem enough, lack of testing, etc.. What is an acceptable rate f...
I have read that the Model is responsible for maintaining state among HTTP requests, for example in this article: The Model is responsible for maintaining state between HTTP requests. Basically any data whether on a database, in a file, stored in the Session, or cached inside APC must be preserved between requests an...
In a lot of cases I might have an existing class with some behavior: class Lion { public void Eat(Herbivore herbivore) { ... } } ...and I have a unit test... [TestMethod] public void Lion_can_eat_herbivore() { var herbivore = buildHerbivoreForEating(); var test = BuildLionForTest(); test.Eat(herbivore)...
I am reading (Cormen) on counting sort. I understand the structure of the algorithm but the statement: In practice, we usually use counting sort when we have k = O(n), in which case the running time is Theta(n). Is not clear to my mind. k is just the range of integers expected in the input. Why is the asympto...
We are currently working on our new product/project, it is a client-server application directed towards certain specific industrial/service enterprises. We are building a server (C Language and Linux Only) running a custom protocol on top of TCP with a Java front-end. We are about 20% into the coding work and are faced...
I need to be able to demo our production application to prospective clients. The way I have it setup today is simple. The demo application is an exact duplicate of the production system, except that the data in the database is obfuscated to protect our current clients' data. This works great because it doesn't requir...
Should ActiveRecord-based domain models have visible properties? Why or why not? My experience and studies have always lead me to believe that object properties should always be protected, and that data should only be manipulated/accessed through methods. This ensures that if the internals of the class need to be refac...
I've seen a lot of talk about how awesome Node.js is for realtime web apps -- things that need sockets, Comet, AJAX-heavy communications, and so forth. I know that its event-driven, asynchronous, thread-driven model is also good for concurrency with low overhead. I've also seen Node.js tutorials for more simple, 'tradi...
I have been reading "Clean Code" by Robert Martin to hopefully, become a better programmer. While none of it so far has been really ground breaking it has made me think differently about the way I design applications and write code. There is one part of the book that I not only don't agree with, but doesn't make sense...
This is a legal question with mixing code I've written in my own time with code I've been paid to write for an employer. I'm employed at a company with an employment contract, and am paid hourly. This is in Ontario, Canada in case that that affects matters. I've been working on a project for my employer, and in this pr...
Is Entity Framework 4 a good solution for a public website with potentially 1000 hits/second? In my understanding EF is a viable solution for mostly smaller or intranet websites, but wouldn't scale easily for something like a popular community website (I know SO is using LINQ to SQL, but.. I'd like more examples/proof...
I am thinking on creating a Mercurial repository under a Git repository. e.g. ..../git-repository/directory/hg-repo/ The 2 repositories Is it possible to manage (keeping your sanity)? How similiar is it to this? I am a computer science student at University. I manage my work in Git, mainly as a distribution mechanism...
We have outsourced the html and css design to an external company. We want to make sure the quality of code is good. What benchmarks can we set to achieve this.
I just came up on xpath recently while writing a greasemonkey script and immediately fell in love. I haven't done any benchmarking yet (coming soon), but according to a couple sources that I read, xpath is faster than using the DOM API. After checking out the internals of a couple of libraries (Swizzle and jQuery), I n...
Since Python was written in the C programming language, does it mean that if I know C I will learn and master Python faster than it would take me to learn it without prior knowledge of C? Or will Python coders find it easier to learn C than programmers from other languages not related to C?
I've been wanting to try out graphics in Haskell. From what I've seen, the available libraries are either front-ends to C/C++ libraries, or an abstraction of them with minimal features. The high-level libraries do not seem to suit my needs, and so I'm left with lower-level front-ends. What I need is to render tiles and...
There are various versions of Eclipse IDE available at Eclipse Download. Since, I am not concerned with Java development, I downloaded the Eclipse Classic 3.7.1. Now, I want my IDE to be setup for Python and PHP development. 1) Have i downloaded the correct version ?? 2) What tools should i download next. NOTE : I hav...
I have a database of calendar events, that can be administered by the user through a web application. I would like to offer to the user, functionality for viewing their calendar in any client of their choice (to the extent that open standards are implemented), primarily Outlook and Google calendar. I would also want fo...
My current client has several internal products which the IT-department supports. All product owners are non-technical and each application is always developed by one developer (and so is all change requests). The current methodology is a bit like waterfall. All uses cases are defined first by the product owner. Then t...
I need a small clarification about StreamInsight, I know by doc's that StreamInsight can handle multiple concurrent Events. But will the event producer be a separate function, for ex: I need to watch a folder for new Files because all my sensors will write readings every day in a new file in particular drive. Method 1:...
I am reading Effective Java and it has the following sentence. The disadvantages of wrapper classes are few. One caveat is that wrapper classes are not suited for use in callback frameworks, wherein objects pass selfreferences to other objects for subsequent invocations (“callbacks”). Now what is a callback frame...
The system we are developing, using .NET, is extremely large, complex, and some modules are poorly written. We have a large user acceptance test team that is aiming for 100% business scenario coverage, which takes about 6 weeks. Can we use behavior driven development to replace some of the manual tests being done by th...
I am currently on a paid internship, and have been tasked with maintaining an obsolete system that has been developed by multiple developers (at different times) over the course of the past 5 years. Management agrees the "system is on life support", and I receive a fairly regular supply of bug reports from end users cu...
Are there any guidelines for deciding when a class should be in its own assembly/DLL? I often see two schools of thought: 1) Every "grouping" of classes belongs in its own DLL e.g. Repositories, Services, DTOs, Infrastructure, etc. 2) Everything should be in a single DLL but separated out via namespaces/folders e.g. h...
We have developed a WCF service which acts as an API to our system. some of the methods expose functionality which eventually writes and updates data to DB. Lets say that the client sent one of those requests, the service performed the needed operations while the client disconnects for some reason and did not get the r...
The answers to this question might be different than the generic, "I graduated. Duh, now what should I do?" Living in an area with a low population presents limited opportunities compared to those in more urban or suburban communities. On the other hand...maybe the answers will be largely the same. I'm asking you f...
I am working on a library which had several headers that are meant to only be used by the library itself. I also have a few classes and functions in headers that I do not want the client to use. For instance, I have a header that contains debugging functions, but they should not be used outside of the library as it cou...
I think most people would agree that pointers are a major source of bugs in C programs (if not the greatest source of bugs). Other languages drop pointers entirely for this reason. When working in C, then, would it be best to avoid using pointers whenever practicable? For example, I recently wrote a function like this:...
When creating a web service API, how much should I count on the developer to act by my rules? We are really aimed on creating an API so the developers shouldn't develop client side logic too much... for example, if in one of my methods we require the client to send us a unique ID - we are relying on the client that the...
A common pattern I see is what's known as the Mapper pattern (not to be confused with DataMapper which is something else entirely), which takes as an argument some kind of "raw" data source (e.g. an ADO.NET DataReader or DataSet) and maps the fields to properties on a business/domain object. Example: class PersonMappe...
If an estimate is not a promise then as a product owner how can I deliver my projects without knowing how long it will take? Does a Scrum team work more efficiently if we treat time estimates as a promise? How much research (preparation, effort to understand the problem) in a story is enough to come up the right estima...
I am creating a RESTful JSON API to access data from our website where the content is in German. A handful of the fields will return formatted HTML while most are single lines of text although they are highly like to include special characters. To make it easy to use I wanted consistency throughout. As the text in the ...
I am a member of some online coding website and today when I submitted a solution in C++, I saw there were much better answers in C++ itself which took considerably less time. The solutions were open so I went on through some of them and found all of them using map datastructure. I could not figure out where exactly i...
What are combinators? I'm looking for: a practical explanation examples of how they are used examples of how combinators improve the quality/generality of code I'm not looking for: explanations of combinators that don't help me get work done (such as the Y-combinator)
I'm creating a dynamic popup menu whose contents depends on the state of what the user clicked on. Is it considered a better practice to create a template menu in html and modify which options are displayed in javascript, or to create everything in javascript on the fly? I'm using jQuery. code example: HTML: <div id="m...
I am very new to Visual Studio and C# and am wondering how best to create a repository of sorts for utility methods. For instance, we need a method that returns the current fiscal year and other company specific values. Would it be best to create utility class file that is imported into every project? Or, create a new ...
Not looking for any code snippets here, so here goes: Let's say 100,000 users on my web app have authorized my application to connect to facebook (with or without offline_access). I want to build a sort of "pull" mechanism, whereby when a user posts to their facebook wall, I can grab it from the Graph API and store it ...
I don't know if this is too broad or not, but I am a youngish programmer still in college, its my Junior year. I feel like I have a pretty good grasps for different languages and have a pretty good base. But I am stumbling to think how if for example, I am trying to create a program and say I wrote one part in python j...
I am contributing to a library that is licensed under the MIT license. In the license and in each class file it has a comment at the top saying: Copyright (c) 2011 Joe Bloggs <joe.bloggs@example.com> I assume that he owns the copyright to the file, and can change the license of that file as he sees fit. If I contrib...
This is mostly a hypothetical question, but it's something I've been tossing around and I wondered what other people though. Here's a contrived example to illustrate: Let's say I'm building an app that lets users pick a few keywords and then shows them photos that are tagged with those keywords. On one hand, I could c...
Are there any studies on the relationship between software testing practices (unit and/or integration tests) and developer productivity?
I've taught myself always to handle any data access code in a completely separate 'layer' to my business logic and UI code. This has always been a very good architecture for me and any 'rules' or best practices I see, still manage to fit into this style of coding, especially Single Responsibility Principle. For most of...