Does Agile force developers to spend more time actually working?

Looking at common Agile practices it seems to me that they (intentionally or unintentionally?) force developers to spend more time actually working as opposed to reading blogs/articles, chatting, coffee breaks and just plain procrastinating. In particular: 1) Pair programming - the biggest work-forcer, just because it is inconvenient to do all that procrastination when there are two of you sitting together. 2) Short stories - when you have a HUGE chunk of work that must be done in e.g. a month, it is pretty common to slack off in the first three weeks and switch to OMG DEADLINE mode for the last one. And with the little chunks (that must be done in a day or less) it is exact opposite - you feel that time is tight, there is no space for maneuvering, and you will be held accountable for the task pretty soon, so you start working immediately. 3) Team communication and cohesion - when you underperform in a slow, distanced and silent environment it may feel ok, but when at the end of the day at Scrum meeting everyone boasts what they have accomplished and you have nothing to say you may actually feel ashamed. 4) Testing and feedback - again, it prevents you from keeping tasks "99% ready" (when it's actually around 20%) until the deadline suddenly happens. Do you feel that under Agile you work more than under "conventional" methodologies? Is this pressure compensated by the more comfortable environment and by the feeling of actually getting right things done quickly?


How does BASIC locate an out-of-order NEXT statement when the loop body is skipped

Set the WABAC machine, Sherman. This question is about BASIC in general, and Microsoft's BASIC-80 in particular. Old school basic. With line numbers. How do (or, rather, did) old-school BASIC interpreters handle FOR...NEXT loops when the loop body was not executed, and the NEXT statement appeared out of order? # An out-of-order NEXT statement from the before time: Here's a subroutine from the game Awari out of David H. Ahl's "101 Basic Computer Games":               200 K=M:GOSUB 600     205 E=0:IF K>6 THEN K=K-7     210 C=C+1:IF C<9 THEN F(N)=F(N)*6+K     215 FOR I=0 TO 5:IF B(I)<>0 THEN 230     220 NEXT I     225 RETURN     230 FOR I=7 TO 12:IF B(I)<>0 THEN E=1:RETURN     235 GOTO 220      and here it is with everything except the flow control redacted:               200 GOSUB 600     215 FOR I=0 TO 5:IF ... THEN 230     220 NEXT I     225 RETURN     230 FOR I=7 TO 12:IF ... THEN RETURN     235 GOTO 220      Does that bring back not-so-fond memories? Can you hear Dijkstra rolling over in his grave? Here are the interesting part of what's happening in this fragment:   * The second FOR loop, since it uses the same loop variable, replaces the first FOR loop   * The two FOR loops share the same NEXT statement   * _The second FOR loop's NEXT statement comes before it, in source order, but after it, in execution order_ You might suppose, then, that the interpreter, having started a FOR loop, simply runs statements until it happens across the NEXT loop. The order of the statement in the source does not matter in this case. But let's see what the basic80 manual has to say about FOR loops: # The basic-80 manual says "moo..." > The body of the loop is skipped if the initial value of the loop times the > sign of the step exceeds the final value times the sign of the step. So, the loop body can be skipped entirely. We have evidence, in the form of published programs, that at least some versions of BASIC were dynamically locating their NEXT statements. This is easy enough to do when the loop body is being executed. However, in the case where the body of the FOR statement should be skipped, as BASIC-80 permits, how did BASIC locate the NEXT statement, given that it might be _before_ the FOR statement in source order?   * Did the version of BASIC used in "101 Basic Computer Games" always execute the loop body at least once?   * Did BASIC-80 require a FOR loop's NEXT statement to occur after the FOR statement, in source order? PS: Yes, I'm writing a BASIC interpreter for old school BASIC. It's a sickness.


Which programming designs leads to more problems?

As a fresh programmer, one of the first thing for me to learn was to learn language and its syntax. Now my next training issue is to design my code heirarchy in such a way it is simple to maintain over time. One example I just encountered is below. It is in VBA for Excel but the concept extends to other languages too. As someone with very little experience, it seems to me that the 2nd option is much clearer and I should use that style. However, I know sometimes that to a beginner programmer what seems like a relatively benign choice can end up hurting their development in the long run. Are either of these two styles the better? I am not talking about personal 'stylistic' choices, I am talking about which one leads to more problems down the line, likely through over-complicating things.               For ws in Worksheets         remove duplicates         append remaining data to separate workbook     Next ws      versus               For ws in Worksheets         remove duplicates     Next ws          For ws in Worksheets         append remaining data to separate workbook     Next ws      Thankyou! EDIT: By the way, it is not important if the less-readable design style is faster. A small increase in performance is not worth a loss of readability for my purposes at the moment.


Challenging Job after Graduate Studies

I worked with an M.N.C developing web applications in Java/J2EE related technologies(includes JSF,struts,hibernate etc.) now I quit my job to pursue Graduate Studies in the U.S.A. So I am a student in the middle of my Graduate studies. I had enough of developing mere CRUD applications in J2EE now I want to work in something exciting. The problem is I can't say what exactly but I can give you an examples. Say developing new JDK libraries or writing a kernel for some O.S. or something like that. So I have five questions here.   1. Is it true that people in R & D often use C++ because of higher performance in that case should I consider switching my platform to C/C++?   2. How should I use my time I have one year to graduate to prepare myself for Jobs Interviews for such positions? (e.g. Reading books on Algorithms etc.)    3. How do I know about these jobs and how do I apply to those Jobs?   4. Is it the right time for me to think about Jobs?   5. Am I over ambitious because I am not in a Ivy League, just a normal school? (My GPA is not so high unfortunately).


How To Handle Login For An Unofficial API?

I am building a tool to access some data on a site (Fitocracy) and I would like to turn it into an unofficial partial API, as no official API exists. If you are not logged in, you cannot get access to any data, so my tool uses Ruby's mechanize to log in (with my account) and scrape some data from a page. How should I handle this when I turn it into an API? I am worried that people won't feel comfortable sending their login credentials through an unofficial API and I don't want to just circumvent the login to the site by giving everybody access through a dummy account.


Extreme Programming - documenting implementation?

In extreme programming methodology, what artifacts/ can be used to document the implementation? I have used an activity diagram to document the design steps for each activity. I have read that for XP, the implementation chapter is the code itself. I am developing an android application which consists of the GUI and java coding.


What methods of requirements elicitation are suitable when I do not have direct access to the user base?

I am working on an application to create invoices. There are some features that are required based on the type of the application and are common to all invoice applications. However, we still need to determine what unique needs the user base might have. We do not have direct access to the users to obtain requirements or user stories. What techniques are most suitable for eliciting high-quality requirements from users when direct or frequent access is not possible?


How would one go about reading memory from a process? Is it different by OS?

As an experienced web-developer, but a novice "low level" programmer, this stuff is sort of voodoo to me still. I'm curious about how one would even begin to go about finding a memory block, and then reading it (for example, reading the timer in a game of mines)? Is this different by OS / OS version? I've spent quite a bit of time Googling and unfortunately, other than some vague mentions of memory readers and `ReadProcessMemory` in Windows with C/C++, there's not a whole lot out there. Would be very happy if someone could shed some light on this subject so that I could get off on the right foot with respect to memory reading.


Why do we keep using CSV?

Why do we keep using CSV? I recently made a shift to working the health domain and despite the wonderful work in data transfer standards, all data transfer is in **CSV** , both for reporting to external organisations, and for data migrations when implementing new systems. Unfortunately the use of CSV is the cause of the endless repetition of the same stupid errors, with the same waste of developer time. (bad escaping, failing to handle null fields etc.) I know we can do better, and anything between JSON and XML (depending on the instance) would be fine. (Most of the time this is data going from one MS SQLserver 2005 to another!) I feel as if each time I see this happening I am literally watching one developer waste anothers time. So why do we keep shafting each other? When will we stop?


How do I support interfaces for different devices in the same input scenario?

I asked this question on SO but someone pointed out that I would be better off here. He's most likely right. So here I go! So I just wanted an opinion. I have 2 different ways to approach the problem. Okay so I have a system that I wanna design toward the future. I have some types of objects wich takes as parameters an object implementing an Interface wich can itself contain another object Implementing another interface and so on. In this way i have               A(InterfaceB B)->B(InterfaceC C)->C(InterfaceD D) ... Until i get to a point where the object does not contain another one. Every interfaces implement a common interface. So I have               Parent->InterfaceB   ---   Parent->InterfaceC   ---   Parent->InterfaceD But InterfaceD does not necessarily implement InterfaceB. Because an interface does not have only one implemention, I have multiple possible trees.               A(InterfaceB B)->B(InterfaceC C)->C(InterfaceD D)->... and               A(InterfaceB B)->B(InterfaceC Y)->Y(InterfaceZ Z)->... So my question is this : If i want to manage the possible trees, Am I better off using reflection to generate the possible trees on startup? Or would I be better off to hold the different trees in a xml file that I would parse on startup? I have to keep in mind that those Interface types and their implementations will keep coming on. So every time I add a new type, it has to be managed. I know both solution will work. My question is more like this : What would be the best approach to orient the system toward the future. To add some context to the situation, here's an example of a case All those interfaces expose an adaptor. Each adaptor may need another one to do its task. For instance, I have an adaptor wich parse some data. But then this data has to be communicated with a remote target. To do this it can use ethernet, serial port, etc... So I could have a generic parser wich takes a generic communicator. That's one of the different possibilities. If you need some clarifications dont hesitate!


Generate complex (non-convex) polyhedron UV mapping

I need to find an approach to the problem of generating texture maps for non- convex polyhedrons without using a design tool like Maya. Specifically, I am mapping simulation results data onto a 3D surface, and I need to write code which generates the maps. One generic approach uses a gradient color brush as an overall texture to just map colors, but if the facets in the polyhedron are very narrow or the mapped (u,v) coordinates are very far apart on the same facet, the image gets noisy. Another approach employs Phong or Gouraud Shading, but those features are missing in some 3D libraries which favor texturing over specifying colors at each vertex. So, I'm looking for a way to get a good texture map generated. If it helps in identifying a correct algorithm, all of the surfaces entirely enclose a 3-D space, there is no facet normal data, and I'll be able to identify a "parting line" which segregates one part of the surface from the other, as one might in order to create a mold for the shape.


Detect Order Changes in a List

Let's say you have a list of values that are   1. a   2. b    3. c   4. d   5. e The order on the list might be changed.   1. a    2. c   3. d   4. **b**   5. e How would you detect this change? We needed something like this when we were building a revision history page for our online form building tool. We found a quick and dirty solution but I am looking for a more elegant solution for this. Here is what the revision descriptions look like: ![jotform revisions page](http://i.stack.imgur.com/QKuTx.png) Here is the tough part: **Elements can be removed/added from/to anywhere on the list.** So, the algorithm should be able to ignore those changes.


Deploying Qt-based app on Mac OS X

I wrote a cross platform application and I distributed it successfully for Windows and Linux (and tested them on "clean" virtual systems, with no other additional software and/or libraries installed). I have already compiled my application on my Mac computer, but I don't know if my application will work on other Mac computers. I don't have two Macs, also, (as far as I know) it's difficult to install Mac OS X on a virtual machine with "legal" discs or without having to perform a process similar to building a Hackintosh, this means that I cannot test my app on a virtual machine (in VirtualBox). So may question would be: Is there any way of making sure that my application will actually run on other Mac systems (without the need of using another computer)? As an additional note, I wrote my application by using the Qt framework.


How to cleanly write a multi step process with user feedback and multiple callback

When you have some process that has several steps and you multiple entry points the code gets ugly pretty fast. I encountered this with Facebook integration in my mobile app: User wants to share something. Before that can happen, I need several things:   1. a session (if there's no FB session, start one, get access_token ...)¨   2. load permissions I have (or take from cache)   3. check if I have publish permissions for this user (if not, ask for it) With all these ready I can finally make the call to Facebook. The way I want this functionality to work ideally is just call something like `Facebook.post( ... , successCallback, failureCallback)` But with these four asynchronous operations it just looks really messy. Do you have any good patterns that might be useful in this situation?


Mixing declarative & imperative code (Implicit 'unit tests' ?)

Well I'm no expert, but as a student, I'm curious about languages and their design patterns / goals. **I'd like to know, whether there are any points I miss in the following examples, and why techniques like this are not widely used in popular languages. Why is it a better idea in a real-life program to explicitly define all unit tests, instead of using some declarative code. why don't languages use some declarations as tests and implementation as well in general? Why split these thing into two parts?** Suppose you have the following unit tests:               assertRaises(avg([]), ValueError)     assertEquals(avg([1], 1)     assertEquals(avg([1, -2]), -.5)     assertEquals(avg([1, 2]), .5)      If you take this pseudocode,               def avg(items):         if len(items) == 0:             raise ValueError         else if len(items) == 1:             return items[0]         else:             return sum(items)/len(items)      most parts of `avg` seem to do nothing, or very little more than just declaring the way to pass some unit tests. In other words, for me it feels a little like code duplication. Especially the first test seems to be superfluous in this example. I wonder if it would be a good design to get rid of some unit test this way:               def avg(items) {         len(items) == 0 => raises ValueError         len(items) == 1 => items[0]         len(items) > 1 => sum(items)/len(items)         (test) items == [1, -2] => $avg == -.5         (test) items == [1, 2] => $avg == .5         (test) avg(items) <= sum(items)     }      In this example, (test) indicates when a specific test case is not a useful definition (though maybe these could even be used for optimization in rare cases). Of course, this pseudocode is not well designed because it's less readable than the first implementation, but I think it's a more convenient way to declare unit tests. Actually the unit tests seem to be wrong here, since they do nothing but test the definition. And the last test is not trivial to perform. But it can be performed for example, when another test is run, which tests a code that has `avg` in it, so chances are, that it gives a useful set of test parameters. Also, for example, the last unit test has a secondary role too! If I have a code like this:               if avg(a) <= sum(a)      It's not necessary at all to evaluate the complex definition, since at runtime one of the test cases implies it directly. OK, in this case, it's not a real optimization (though an IDE could notify the user, that the expression will always be true, which is useful). However, I can imagine, that there are many complex examples, that can be optimized this way, without making the developer explicitly test for special cases at every single place where they are relevant. Maybe a better example for this optimization               def power(a, n) {         n == 0 => 1         n == 1 => a         n > 1 => a * power(a, n - 1)         (test) for any (x) power(a, n) % x == power(a % x, n) % x     }      It's not secret I think, that a clever compiler could use it in many cases, and a clever interpreter/just-in-time compiler could use these in much more cases. In order to understand tests and languages better, I'm curious whether my thoughts are useful, and if not, what am I missing, or if so, why popular languages don't implement such patterns.


Is there any difference learning OOP on different programming languages?

I want to learn OOP. I know Python and I know very little things about OOP. But when I search for "learn OOP" in forums I saw a guy saying that "Python is so new that's why you can't learn OOP on Python. you should learn Java then understand OOP on Java" Is it true? Is there any difference understanding OOP on different programming languages? like learn it on Java, C#, C++, Perl or Python?


Find number of occurrence of a word in a 2D matrix of Characters

Given a two dimensional matrix of alphabets, search the given word in all directions. Below is an example to search for the word `"TEAM"`: No of occurrences is 4 in matrix below. ![enter image description here](http://i.stack.imgur.com/vj6us.png) What is the best approach to solve this? Its not a dictionary word. Its simply sequence searching in all the directions.


Fixed duration Jobs need to be scheduled across fixed number of queues

* Say I have 9 jobs with estimates of how long they will take to complete, and 3 queues that process these jobs - this constitutes one batch. Note that all the jobs are allocated to a queue beforehand and not at run-time. So with poor-scheduling, some queues may remain idle while others continue to process a job.    * All these jobs should be distributed across the queues in such a way that the total time to complete all the queues is nearly equal.  Consider: 1.Below Q2,Q3 complete in 15mins and remain idle while Q1 takes another 10mins to complete. Batch1:               +------+----+----+----+     |  #   | Q1 | Q2 | Q3 |     +------+----+----+----+     | 1    |  5 |  5 |  5 |     | 2    | 15 |  5 |  5 |     | 3    |  5 |  5 |  5 |     +------+----+----+----+     | Time | 25 | 15 | 15 |     +------+----+----+----+     | Total| 25           |     +------+----+----+----+      2.Now ideally the jobs should be distributed as...               +------+----+----+----+     |  #   | Q1 | Q2 | Q3 |     +------+----+----+----+     | 1    | 15 |  5 |  5 |     | 2    |  - |  5 |  5 |     | 3    |  - |  5 |  5 |     | 4    |  - |  5 |  5 |     +------+----+----+----+     | Time | 15 | 20 | 20 |     +------+----+----+----+     | Total| 20           |     +------+----+----+----+      * * * This seems to be a straightforward scheduling problem, but I am dealing with hundreds of such jobs, divided into multiple batches. Where each batch will start only on the completion of the first. So I would require some algorithm to decide the schedule. Any ideas..? Thanks * * * **Update:** _Adding more information based on feedback..._   * The jobs in a batch are fixed.    * There are no dependencies between jobs within a batch, but there are dependencies between batches. _So we can look at solving the problem for a single batch and the solution will apply across all batches._   * Real-world problem: I am modelling a problem on loading data (ETL) and the entire load process takes 5-6hrs, which has several batches. Looking for ways to reduce the overall time.


Work opportunities in OpenOffice.org development

What is the market like for custom apps or scripts using the OpenOffice.org API? I started delving into it a while back. I found it a fairly painful environment to work in. Is there any demand for this skill set? I might keep at it if it seemed like there was money to be made.


Exceptions catching clutter code and make it hard to read

When I read well written code that checks to make sure all the input is of the correct format and type, and also catches all the things that possibly could go wrong, I find it difficult to understand the core of what the program is doing. It seems protection against the non-normal case obscures the normal case. This includes beginning and ending of array special cases, try-catch, using, handling null, 0, "", and all the other strange things. How can I write code that is clear, but isn't cluttered by non-normal events?? To make this a little more concrete, how can I do this in C#?


Alternative to Singleton when D.I. is not an option

I have been researching this extensively, and I am stuck. I am writing a Drupal module that uses a class that I have created. This class is a classic Singleton - it only needs to be instantiated once, since it is assembling a bunch of data from a database. Note that my potential Singleton will not update any data in the database - it will just read from existing data. Also, note that processes outside the context of my program may update the data. I know the take home answer here is 'use Dependency Injection'. However, I can not use Dependency Injection - Drupal uses hooks, and these hooks accept certain parameters. I.e., I can't (to my knowledge) insert a object that way. I should point out that testing is a concern of mine as well (although testing my module in Drupal has had its own series of challenges). However, I am willing to accept that a Singleton may be the lesser of two evils here. Here is an example:               function mymod_block_view($var) {         //$var is required by drupal         $obj = new Object()         ....     }          function mymod_block_info() {         ...          $obj = new Object()     }      My options right now are to use a global variable (not ideal) or a Singleton (according to my research, also not ideal, but may be my only option). Do I have any other options, besides declaring a new variable object inside each function?


How to help keep track of identifiers used both in the application and in the database?

For example:   1. I have an ACL (access control list) with keys in the database like `create_user` and `allow_booking_for_past_dates`. Each ACL entry has a corresponding method or function name in the application.   2. I have several 'controller' classes for a web application each of which may have one or more references in a 'pages' table in the database. In both cases whenever a change is made to the application, someone has to remember to update the database and vice versa. Updating the application after a database mod can be relatively pain-free by naming the keys such that they can be easily found by search-replace. Finding instances of an identifier in the database can be similarly pain-free. Everything else usually is either contained completely in the application (sub-classing, configuration files, etc) or entirely in the database (primary keys, foreign keys, indexes, etc). How to keep track of these identifiers that bridge the two domains? We currently have a Word document (of all things) with a table neatly describing the key name, where to find it and a description of what it is. This seems to work better than the "commit it to the application, create the entry in the db and cross your fingers for the future" approach.


Logging in a distributed system

We have several application servers (and different applications) running on Amazon AWS and our main method of logging is a combination of statsd, carbon/graphite, and an alert system based off of the metrics coming into carbon. This has been working great for a lot of different situations but I feel we need something else to complement this type of logging. Something that is not as much for streaming or visualization like graphite, but allows easy lookup by time/date, error type, etc... What are some techniques that make reviewing your logs quick and effective? My initial thought is to UDP all logging messages to a central server and insert them into a database (likely MongoDB). Is this a reasonable approach?


Unit Testing Wrapper (Facade?) Method

I have to write unit tests for some classes my group is developing. The classes are fairly simple, and I'm not sure how to best test them.               public class MyObjectRegistry     {         private myDataSetMapper = new MyDataSetMapper();              public boolean StoreObjects(list<MyObject> myObjectList)         {             myDataSetMapper.StoreObjects(myObjectList);         }     }          public class  MyDataSetMapper     {         public boolean StoreObjects(list<MyObject> myObjectList)         {             for(MyObject myObj: myObjectList)             {                 boolean result = StoreObject(myObj);             }         }              private boolean StoreObject(MyObject myObject)         {             //Store the object in a database         }     }      So my question is how to test the `MyObjectRegistry.StoreObjects` and `MyDataSetWrapper.StoreObjects` methods since there's no real logic other than a `foreach` loop and calling out to another method. I've looked around the web and found that I think I'm looking at a "facade" class/method, but I'm still unclear on what would I should test/assert in the test method.


How important is it to learn UML for an OO developer?

When studying OOP by myself I often encounter UML class diagrams. I understand them, but don't completely know how to write them. Meaning, I don't entirely know what each kind of arrow means, and things like that. 1- How important is it to learn the 'language' of UML class diagrams? If it is something worth the time, could you forward me to a good, cohesive yet sufficient source? 2- If/when I do learn to draws UML class diagrams: Are all the little nuances important, or is it that every developer draws UML diagrams a little differently?


What is better, MBA vs MIS, right after grad or gap?

Generally speaking, if a recent Computer Science / Software Engineering grad (bachelors) wants to be project manager in 5 years, what should he or she go for? A. An MBA part-time straight out of graduation (at the same time, working as a programmer) B. Wait three years and go for a masters in Computer Information Systems (which has the 3 year gap requirement) Thank you for the advice. I wanted to make this as applicable to as many gonna-graduate-soon students in our field.


Algorithm for inserting into sorted subset

`A` is a sorted list. `B` is a sorted list, and a subset of `A`. If an element is inserted into `A` at index `i` what's the most efficient way to determine the correct index `i'` for it's position in `B`? Given the fact that both lists are sorted, and that we know `B` is subset of `A` I would think we should be able to devise quite an efficient algorithm, but I'm not happy with what I've come up with so far. Thanks!


Could Go work with other user interfaces than Web?

Go seems to be made for doing server side stuff for the web. What could I do if my boss suddenly dictated that he wants a Windows GUI for a Go application?


Generally speaking can a Javascript-based application (iUI) be deployed without a webserver?

Suppose I have a Javascript based application written in iUI or Kendo UI. Can it be packaged in such a way they can run locally without a webserver? I have a few web applications, that with some rework and HTML5 LocalStorage, can possibly work offline (in an airplane or subway). My mobile development experience is limited to Blackberry Playbook, which I only did so I can get a free one a few years ago. That platform supports "mobile applications" based on HTML, and an additional out-of-band packaging set of tasks. **Question**   * Are other platforms (iPhone, Android, etc) similar in that I can simply package an iUI based application so that it can run offline or on a webserver?


What are the bundling/naming conventions for source-based packages?

Are there any conventions to use if I were to distribute the source for a C++ library I built? The plan is to use CMake as a build system, but for the rest I was wondering what are the standards in terms of file/folder/subfolder naming, inclusion paths etc. What I got so far:   * Put everything in the `$prefix` folder under `$prefix/bin`, `$prefix/include/libname` and `$prefix/lib`.   * Don't use caps for libname. Should all internal includes contain the `libname` folder? E.g. say there are two files in the project: `principal.h` and `secondary.h`. In `principal.h`, should the inclusion statement for `secondary` be : `#include "secondary.h"` or `#include "libname/secondary.h"`? Are there other standards that should be followed? Why?


How do I go about debugging a PHP error?

I am coming from .NET to PHP. I am playing around with a long file written by someone else (called "cryptographp.inc.php"). It builds and returns an image to the browser. I want to show the image that the file returns on my Cryptocode/index.php page --like this:               <?php     include './cryptographp.inc.php';      ?>      But when I load the page, firefox returns an error saying               "The image http://localhost/Cryptocode cannot be displayed because it     contains errors"      How would I go about debugging an error like this in PHP? I am used to stepping through code in visual studio. What techniques would people use in the PHP world?


What are examples of comments that tell you why instead of how or what?

First of all, in this question I'd like to stay away from the polemic on whether source code commenting is good or bad. I'm just trying to understand more clearly what people mean when they talk about comments that tell you WHY, WHAT or HOW. We often see guidelines like "Comments should tell you WHY; code itself should tell you HOW". It is easy to agree with the statement on an abstract level. However, people usually drop this like a dogma, and leave the room without further explanation. I've seen this used in so many different places and contexts, that it looks like people can agree on the catchphrase, but they seem to be talking about different things entirely. So, back to the question: if comments should tell you WHY, what is this WHY we are talking about? Is this the reason why that piece of code exists in the first place? Is this what that piece code should be doing? I would really appreciate if someone could give a clear explanation, and then add some good examples (bad examples are not really needed, but fell free to add them for contrast). There are many questions on whether comments are good or bad, but no one that addresses the specific question of what are good examples of comments that tell you WHY.


changing value of a private member of a class in c++ without using member or friend function

Using pointer, I am able to modify the private value of the class in the code below. Does it violate the C++ concept that private member can only be modified by member or friend functions?               #include<iostream>     using namespace std;          class demo     {             private: int info;                  public:                      demo()                      {                              info=10;                      }                           void print_info()                      {                            cout<<info;                      }     };          int main()     {               demo ob;          int* ptr=(int*)&ob;               *ptr=20;               ob.print_info();               return 0;     }


Do you get the benefits of a B-Tree in a managed language?

My understanding is that one of the key features of a B-Tree (and a B+Tree) is that it is designed such that the size of its nodes are some multiple of the block size of whatever media the data is stored on. Considering that, in a memory managed language like java/c#, we don't really have access to _how_ , _when_ and _what order_ , data is accessed from the drive... can we still predictably benefit from the major advantage of this data structure?


Number of Classes in a Namespace - Code Smell?

I have a C# library that's used by several executables. There's only a couple namespaces in the library, and I just noticed that one of the namespaces has quite a few classes in it. I've always avoided having too many classes in a single namespace because of categorization, and because subconsciously, I think it looks "prettier" to have a deeper hierarchy of namespaces. My question is: does anyone else consider it a "code smell" when a namespace has many classes - even if the classes relate to each other? Would you put in a lot of effort to find nuances in the classes that allows for subcategorization?


Team Organization for Small Team

Few friends (3) and I started a small company. But we weren't shure how to organize ourselves since everyone will work from their homes and in different hours of the day. How should we organize in terms of work to do, bugs, etc? Should we use an agile methodology like "adapted" for our small team?


Should an IDE include a gaming element?

As of recent I have becomne very interested in serious gaming. Today I ran into this little gem: visual studio achievements and it got me thinking. I actually think it could be very helpfull and stimulating to add such a gaming component to an IDE to improve code quality and basically make it more interesting to write better code and put your IDE to good use. Any thought on this? **Edit:** Just to be clear here: the link contains a funny take on it. I'm interested in the entire notion of adding a gaming element to an ide, with for instance achievements that stimulate the use of best programming practises. Not so different from what StackOverflow is doing.


How to use PostgreSQL on AWS - Ubuntu 11.10

I'm extremely new to cloud-computing, Linux, and PostgreSQL, so if this is a stupid question, I apologize. I've managed to create an m1.large instance running Ubuntu 11.10, connect via Putty SSH, and install PostgreSQL (`sudo apt-get install postgresql`), but that is as far as I've gotten. My goal is to run several python web-scraping scripts that I've written on this instance (so as not to eat up all of our bandwidth (smaller company at the moment)) and insert the scraped data into a PostgreSQL table on the instance and later retrieve that data to store on our local server (as I've heard AWS EBS is unreliable and I don't want to take chances). How can I configure PostgreSQL on my AWS instance? How can I access the data from my machine? I currently use PgAdmin3 to manage PosgreSQL on our local server. Can I use this same interface to manage PostgreSQL on my AWS instance? Any suggestions, solutions, links, etc is greatly appreciated. And again, if this is a dumb question, I apologize. Thanks!


Dealing with curly brace soup

I've programmed in both C# and VB.NET for years, but primarily in VB. I'm making a career shift toward C# and, overall, I like C# better. One issue I'm having, though, is curly brace soup. In VB, each structure keyword has a matching close keyword, for example:               Namespace ...         Class ...             Function ...                 For ...                     Using ...                         If ...                             ...                         End If                         If ...                             ...                         End If                     End Using                 Next             End Function         End Class     End Namespace      The same code written in C# ends up very hard to read:               namespace ... {         class ... {             function ... {                 for ... {                     using ... {                         if ... {                             ...                         }                         if ... {                             ...                         }                     }                 }                 // wait... what level is this?             }         }     }      Being so used to VB, I'm wondering if there's a technique employed by c-style programmers to improve readability and to ensure that your code ends up in the correct "block". The above example is relatively easy to read, but sometimes at the end of a piece of code I'll have 8 or more levels of curly braces, requiring me to scroll up several pages to figure out which brace ends the block I'm interested in.


Why do I need SCRUM vs. a less formal, more lightweight process for my team?

I'd like to begin my question by saying that I understand that SCRUM or some derivative of it is probably a good way to go for managing software development. It seems all the big companies and my managers use it or have used it, and I can't really argue with all that experience. However I'm struggling to understand the "whys" and all the reading and even my official SCRUM training at work is not doing the job for me. It's just all rhetoric. So I come here seeking answers. Until now, I have developed in teams of 4-5 members very effectively, completely self-organized and without the need for any training, methodology, or special software. Just discussions in cubes, ad hoc meetings, and one-on- one code reviews. I am now in a position at work where we're being told SCRUM is the way to go, and everything that comes along with it. When they describe SCRUM to me, I read stuff like this:   * Individuals and interactions over processes and tools   * Working software over comprehensive documentation   * Customer collaboration over contract negotiation   * Responding to change over following a plan That's great, but all of it seems like common sense to me. Why did this need codified? Then I'm told the methodology helps us respond to change. What **specific** aspects of SCRUM are allowing me to be so flexible that I was not previously achieving with my ad hoc meetings, cube discussions, and developer planning meetings? They explain the need to have a working deliverable every two weeks, or sprint. In my particular project, there is no "client", the software won't be finished for a year or more, and in the meantime I will probably only be demoing to upper management every month or less. So why the explicit need for a deliverable every other week? They emphasize the importance of the sprint planning meeting where the entire team lays out the stories and tasks for the next sprint. This is no different than the impromptu planning meetings I've had in the past. Why must it occur every other Monday, and why does the entire team have to be involved? I understand the concept of every member "owning" the product, but the fact is, only a few individuals can ever really contribute to breaking each story up into tasks, while the rest just watch idly. Again, I understand that the majority of people are behind this process, and so it must work, and I need to get on board. I'd just like to understand why. Is my issue that I already practice these things and just don't like unnecessarily codifying them? Or perhaps I've yet to see the advantages of these techniques because they're being done improperly? Any **real** , personal information or advice on this, as opposed to the spiel I'm used to receiving, would be extremely appreciated.


Can you learn OO programming without procedural?

I've seen a number of question asking whether someone should learn procedural or OO first. But is this even possible? Can you learn OO programming without first having an understanding of procedural programming? Obviously, they can learn to program in an OO language like Java or Python first. But you can write Fortran in any language. My impression is that such beginning programmers write procedural code in an OO language at least at first. But what do you think?


Can Powershell do anything that Iron Ruby can't?

I am torn between learning myself some Powershell or just leveraging my existing Ruby knowledge for the various Windows scripting things that I do from time to time. Powershell does look incredibly powerful, but from initial impressions the syntax is fairly ugly. Is there anything that Powershell can do that I couldn't just do with Iron Ruby?


Pros and cons of working truly remotely

Will I hurt my career as software developer/entrepreneur if a move to a remote location? Do I have better career prospects if I am based in a developed country or if I live in a remote end of the world with just an internet connection and laptop?


Why are some data types Deprecated while others Obsolete?

Why are some data types or functions made Obsolete in a newer version of an API and others are marked as Deprecated? Why not make them all Obsolete or why not make them all Deprecated?


As a programmer, do you care what method the development process uses?

I'm in the job market and I have a set of priorities for my next job including salary, line of business, etc. One thing that is nowhere on my list of requirements however, is the development process methodology. I feel my job is to create software and I view the process structure as something I can adapt to whether it's scrum or waterfall or whatever. Is the development process methodology a priority for you?


Is '@' Error Suppression a Valid Technique for Testing for an Optional Array Key?

_Rarst_ and I were debating offline about the use of the '`@`' error suppression operator in PHP, specifically for use to test for existence of _"optional"_ array keys, i.e. array keys that are being used as a switch here a their lack of existence in the array is functionally equivalent to the array having the key with a value equaling `false`. Here is pseudo-code for this scenario:                function do_something( $args = array() ) {        if ( @$args['switch'] ) {           // Do something with this switch        }        // continue on...      }      vs. this approach:                function do_something( $args = array() ) {        if ( ! empty( $args['switch'] ) && $args['switch'] ) {           // Do something with this switch        }        // continue on...      }      Of course in most use-cases, suppressing errors would not be _A Good Thing(tm)_. However in _this_ use-case where an array is passed with an optional element, it seems to me that it is actually a very good technique but I could be wrong and would like to hear other's opinions on the subject before I make up my mind. I do know that there are alleged performance hits for using the former approach but I'd like to know how they compare with the alternative and if they performance hits really matter in real world scenarios? P.S. I decided to post this because, after debating this offline with Rarst, he asked a more general question here on Programmers but didn't actually give a detailed example of the specific use-case we were debating. And since I'm pretty sure he'll want to use the out-of-context answers on that other question as justification for why the above is _"bad"_ I decided I needed to get opinions on _this specific use-case_.


Suggestions for a GUI library in Haskell

As the Haskell Wiki itself states: > There is a large number of GUI libraries for Haskell. Unfortunately there is > no standard one and all are more or less incomplete. In general, low-level > veneers are going well, but they are low level. High-level abstractions are > pretty experimental. There is a need for a supported medium-level GUI > library. A professor at my college asked me and three other computer science majors to consider working on a GUI library for Haskell. His initial idea for the project was to write a layer on top of OpenGL that mimicked the morphic library found in Smalltalk; however, this is just a suggestion and other system are definitely worth consideration. This brings us to the actual, multi-part question.   1. For what level of abstraction should our library strive? The Haskell Wiki seems to indicate strongly that a medium-level GUI library would be preferred; however, a high-level library would still be welcome.   2. Upon what should our library be built? (Ex. OpenGL)   3. What existing GUI library would you like to see our library mimic (if any) and why? (Ex. PyGame, Morphic, Swing, etc)   4. What features would you like to see our library implement or avoid? For example, the good people at Gnome might argue that the minimize button is unnecessary.   5. Do you have any general suggestions?   6. What clever name would you give this imaginary library? (Ex. HOT - Haskell Opengl Toolkit; HAWT - Haskell Advanced Windowing Toolkit)


Moving from a small to a large company

Does anyone have any tips, thoughts, warnings, or general wisdom for a application/database developer who is moving specifically from a start-up sized company to a large organization? Examples thoughts would include things such as:   * How might I interact differently with the management chain?   * Do you see trends in quality or speed of development that differ between large and small?   * Thoughts on team developent.   * Social Aspects.   * Anything else. **Addition:** Does anyone have any personal stories and experiences to share with a similar move? Please let me know if I can clarify in any way. I appreciate any thoughts!


Threading models when talking to hardware devices

When writing an interface to hardware over a communication bus, communications timing can sometimes be critical to the operation of a device. As such, it is common for developers to spin up new threads to handle communications. It can also be a terrible idea to have a whole bunch of threads in your system, an in the case that you have multiple hardware devices you may have many many threads that are out of control of the main application. Certainly it can be common to have two threads per device, one for reading and one for writing. I am trying to determine the pros and cons of the two different models I can think of, and would love the help of the Programmers community.   1. Each device instance gets handles it's own threads (or shares a thread for a communication device). A thread may exist for writing, and one for reading. Requested writes to a device from the API are buffered and worked on by the writer thread. The read thread exists in the case of blocking communications, and uses call backs to pass read data to the application. Timing of communications can be handled by the communications thread.   2. Devices aren't given their own threads. Instead read and write requests are queued/buffered. The application then calls a "DoWork" function on the interface and allows all read and writes to take place and fire their callbacks. Timing is handled by the application, and the driver can request to be called at a given specific frequency. Pros for Item 1 include finer grain control of timing at the communication level at the expense of having control of whats going on at the higher level application level (which for a real time system, can be terrible). Pros for Item 2 include better control over the timing of the entire system for the application, at the expense of allowing each driver to handle it's own business. If anyone has experience with these scenarios, I'd love to hear some ideas on the approaches used.


How To Teach Independence

In my IB Computer Science class I am routinely asked by... pretty much everyone how to do X or implement Y. I'm the only person with any significant programming experience in the class and I do not necessaries mind teaching people about programming but so many of the questions could be simply solved by doing a little investigating. What are some ways I could try to teach my fellow students how to be self- reliant programmers? All I can really think of is being a Google ninja & learning how to use an API.


Best language or tool for automating tedious manual tasks

We all have tasks that come up from time to time that we think we'd be better off scripting or automating than doing manually. Obviously some tools or languages are better for this than others - no-one (in their right mind) is doing a one off job of cross referencing a bunch of text lists their PM has just given them in assembler for instance. What one tool or language would you recommend for the sort of general quick and dirty jobs you get asked to do where time (rather than elegance) is of the essence? Background: I'm a former programmer, now development manager PM, looking to learn a new language for fun. If I'm going to learn something for fun I'd like it to be useful and this sort of use case is the most likely to come up.


Is it a bad idea to create a class which will only have one instance?

Is it bad coding practice/design to make a class which will only be instantiated once? I have some variables and functions that can be grouped together under a class to "look good" (for a lack of a better description) since they are somewhat related, but they can just be global variables and global functions. (Btw, I am using JavaScript, AngularJS, Express, MongoDB.)


Marking specific pieces of drastically changed open source code

I have taken a small chunk of open-source code, around a hundred lines, and found that for whatever reason, I have modified it so drastically that my end result has essentially no resemblance to the original. Maybe a line or two, and a few variable names, are carried over, but the diff is just one or more big chunks of `-` followed by big chunks of `+`. If I'm now distributing my code, it seems clear to me that I should globally credit the original author for providing a foundation, and include the license under which I acquired the code. I'm wondering what my responsibilities in the social or technical dimensions are to mark specific changes, though. Am I rudely misrepresenting the original author's work when I say that mine is derived from it without pointing out the particular lines that were carried over? Is it helpful for another coder looking at my version if I include comments annotating what I've kept and why? I've used someone else's code as a starting point, taking primarily the ideas and not the substance. Ignoring any legal aspects,* what kind of precise, targeted change documentation should I ideally provide? * * * What is proper etiquette for releasing a complete rewrite of an existing project? is closely related, but I've already chosen option 1. Ethics and best practices when forking code base is also related but doesn't address the specificity of attribution. * * * *Various aspects of which have already been covered here.


Designs for outputting to a spreadsheet

I'm working on a project where we are tasked to gather and output various data to a spreadsheet. We are having tons of problems with the file that holds the code to write the spreadsheet. The cell that the data belongs to is hardcoded, so anytime you need to add anything to the middle of the spreadsheet, you have to increment the location for all the fields after that in the code. There are random blank rows, to add padding between sections, and subsections within the sections, so there's no real pattern that we can replicate. Essentially, anytime we have to add or change anything to the spreadsheet it requires a many long and tedious hours. The code is all in this one large file, hacked together overtime in Perl. I've come up with a few OO solutions, but I'm not too familiar with OO programming in Perl and all my attempts at it haven't been great, so I've shied away from it so far. I've suggested we handle this section of the program with a more OO friendly language, but we can't apparently. I've also suggested that we scrap the entire spreadsheet idea, and just move to a webpage, but we can't do that either. We've been working on this project for a few months, and every time we have to change that file, we all dread it. I'm thinking it's time to start some refactoring. However, I don't even know what could make this file easier to work with. The way the output is formatted makes it so that it has to be somewhat hardcoded. I'm wondering if anyone has insight on any design patterns or techniques they have used to tackle a similar problem. I'm open to any ideas. Perl specific answers are welcome, but I am also interested in language-agnostic solutions.


How to refactor an OO program into a functional one?

I'm having difficulty finding resources on how to write programs in a functional style. The most advanced topic I could find discussed online was using structural typing to cut down on class hierarchies; most just deal with how to use map/fold/reduce/etc to replace imperative loops. What I would really like to find is an in-depth discussion of an OOP implementation of a non-trivial program, its limitations, and how to refactor it in a functional style. Not just an algorithm or a data structure, but something with several different roles and aspects - a video game perhaps. By the way I did read Real-World Functional Programming by Tomas Petricek, but I'm left wanting more.


Integrate a Python Project with a Visual Studio C++ Console Application?

I now have **a Python project** that is in charge of generating the simulation data and visualizing the simulation and processed data. **A C++ console application** is already available in my Visual Studio. The **processing sequence** is as follows:   1. Python project generates the raw data into `data.txt`.   2. Visual Studio C++ console application takes in `data.txt` and processes the data, and finally outputs `results.txt`.   3. Python project takes in `results.txt` and visualizes it with `matplotlib`. I am now doing it manually, and it works perfectly ok for one run. However, it becomes extremely troublesome when I want to have multiple runs. **Questions:**   1. How may I integrate them together? Integrate Python project into Visual Studio or integrate C++ console application into Spyder (my Python IDE)?   2. Currently, I manually enter the debugging parameters in the C++ console application debugging property. How may I make it automatic? i.e. After Python project generates `data.txt`, the `data.txt` gets automatically taken in as parameters by the C++ console application?


Are there any reasons not to cache an entire site permanently?

I am writing an uber simple blogging platform. The application reads a set of static files that are the articles in the blog, and serves them up. The **only** time any content on the site will change is when a new article is added, or an existing article is changed. I intend to load 100% of the content into the applications memory, and only update it if the static files are changed. I.e. a permanent cache. For a simple blog, the static files are never going to amount to more than a few MB, so application memory wont be a problem. Are there any reasons not to do this? And why do blogging (/other) platforms with content that only changes at set intervals not use this method?


Recommended solutions for integrating iOS with .NET, at the service tier

I'm developing an application, in iOS, that is required to connect to my Windows Server to poll for new data, update, etc. As a seasoned C# developer, my first instinct is to start a new project in Visual Studio and select _Web Service_ , letting my bias (and comfort level) dictate the service layer of my application. However, I don't want to be biased, and I don't base my decision on a service which I am _very_ familiar with, at the cost of performance.   * I would like to know what other developers have had success using, and if there is a default standard for iOS service layer development?    * Are there protocols that are easier to consume than others within iOS?    * Better ones for the size and/or compression of data?    * Is there anything wrong with using SOAP?  I know it's "big" in comparison to protocols like JSON.


How to choose a the correct license for a project?

The applications that I develop on my free time are getting bigger and I'm planning to launch some other projects that I'm currently developing, so I want to know how to choose the correct license for freeware and open source projects for this and some of my future projects.


How to get feedback from the community on large chunks of code?

Code Review.SE is great when you need feedback on a precise, short piece of code. But where to get similar feedback about the code itself when:   * you have thousands of LOC,   * don't have colleagues in your workplace ready or willing to review the code¹,   * don't have thousands of dollars to spend for a professional review by a third party developer?² Places like CodePlex are a good idea to get your project known³, but from what I've seen, the feedback you get on known projects are consumer feedback, i.e. concerns the bugs and feature requests, not the quality of the source code itself. What are the social way to get the community involved in the code review of the codebase of a certain size for an open source project which doesn't have the scale of Firefox or similar products? * * * ¹ Which is the case for most personal and open source projects, or projects done in companies where the practice of regular and complete code review is nonexistent. ² Which is, again, the case for most personal and open source projects. ³ Even if too many projects published on CodePlex never get known, either because nobody cares or because they are presented not very well.


Distinguishing repetitive code with the same implementation

Given this sample code               import java.util.ArrayList;     import blackjack.model.items.Card;          public class BlackJackPlayer extends Player {              private double bet;              private Hand hand01 = new Hand();         private Hand hand02 = new Hand();                   public void addCardToHand01(Card c) {             hand01.addCard(c);         }              public void addCardToHand02(Card c) {             hand02.addCard(c);         }              public void bustHand01() {             hand01.setBust(true);         }              public void bustHand02() {             hand02.setBust(true);         }              public void standHand01() {             hand01.setStand(true);         }              public void standHand02() {             hand02.setStand(true);         }              public boolean isHand01Bust() {             return hand01.isBust();         }              public boolean isHand02Bust() {             return hand02.isBust();         }              public boolean isHand01Standing() {             return hand01.isStanding();         }              public boolean isHand02Standing() {             return hand02.isStanding();         }              public int  getHand01Score(){ return hand01.getCardScore(); }              public int  getHand02Score(){ return hand02.getCardScore(); }          }      Is this considered as a repetitive code? providing that each method is operating a seperate field but doing the same implementation ? Note that hand01 and hand02 should be distinct. if this is considered as repetitive code, how would I address this? providing that each hand is a seperate entity


Interesting interview question

Today I was asked this question. We have 2 cases with code blocks A, B and C. These code blocks don't share any resources except an iterator (`int i`). Please give 3 possible reasons why case 1 could be faster than case 2, and 3 possible reasons why case 2 could be faster than case 1: **case 1**               for (i=0; i<N; ++i){      A;      B;      C;     }      **case 2**               for (i=0; i<N; ++i){      A;     }     for (i=0; i<N; ++i){      B;     }     for (i=0; i<N; ++i){      C;     }


What kind of Web development projects benefit from using ORM?

I'll start by saying that I've done 95% of my database work using SQL. Recently, I did some investigation of various ORMs, such as NHibernate and Doctrine. I can see the advantages of not needing to know much SQL and the database portability that an ORM provides. But I can also see that knowing SQL will make working with an ORM more effective and I can only think of one time in my career that an application's biggest change would be the database vendor. Because I'm very comfortable writing SQL and am apparently not realizing the often taught benefits of using an ORM, my question to heavy ORM users is this: **What kind of Web development projects benefit the most from using ORM?**


Best way to update UI when dealing with data synchronization

I'm working on a bug at work. The app is written in Objective-C for iOS based device, for the iPad. I'm the new guy there and I've been given a hard task. Sometimes, the UIButton text property does not show the correct state when syncing. Basically, when the app is syncing, my UI control would say "Syncing" and when its not syncing it'll display "Updated @ [specific date]". Right now there is a property on the app delegate called "SyncInProgress". When querying / syncing, occurring on background thread, it updates a counter. The property will return a bool checking expression 'counter > 0'. There are three states I need to deal with. Sync has started. Sync is updating tables. Sync finished. These items need to occur in order. My coworker suggested to take a state based approach instead of just responding to events. I'm not sure about how to go about that. Would it be best to have the UI receive a notification to determine what state its in or to pull every so often if state changed? Here are two posts that I put on stackoverflow, in the last few days, that relate to this. http://stackoverflow.com/questions/11025469/ios-syncing-using-a-state- approach-instead-of-just-reacting-to-events http://stackoverflow.com/questions/11037930/viewcontroller-when- viewwillappear-called-does-not-always-correctly-reflect-stat Any ideas that anyone might have to very much appreciated. Thanks, developerDoug


Objective-C and C++

Awhile back I posted a question about a kid I know and his dilemma about getting a college degree. He has decided to go for it and apparently already has some credits in computer science and math already (AP or something?), so he gets to move on to more interesting stuff. One of his choices as an elective programming class is to either take Objective-C for Mac or C++ programming. I am guessing that these classes won't teach programming concepts like a CS 101 course or something would but probably more how to build programs out with a specific toolset. He asked me which he should go for; he wants to do the Objective-C because he has a Mac and an iPhone and it would be a good way to get his feet wet, I think he should do C++ because it's more standardized and widely used in industry. Then again, maybe it doesn't really matter since it's all just experience anyway and that never hurts. Any thoughts about this? I always hate giving advice to aspiring programmers because I am always afraid that I'm just passing along what my ideals are and what I think is important when it might not be. It's been a long time since I did CS classes and I'm not sure what the curriculum is like these days. When I went to school it was C and then Java for OO later on; I never had a choice really it was what it was.


Instantiating objects in Java

I'm learning now Java from scratch and when I started to learn about instantiating objects, I don't understand - in which cases do I need to instantiate objects? For example I'm studying from TutsPlus course about it and there is example about "Rectangle" class. Instructor says that it needs to be instantiated. So I started to doubt about - when do I need to instantiate those objects when writing Java code?


What could be some pitfalls in introducing a style guide and documentation generating software in a development team?

I'm considering using appledoc, a flavor of Doxygen for use in generating Objective-C code documentation, in order to create documentation for my company's iOS apps. The idea is that a server will generate the docs on a post-commit hook, then publish the documentation on an internal network. Right now we have very little documentation of any kind, even comments in the code itself, so I'm expecting I will have to ask people to begin writing more documentation as they code. In this vein, I will also collaborate with my team in order to create a "style guide" for Objective-C code (like Google's), which will lay down some ground rules on how to write and document code. What are some potential pitfalls in the above plan? Are style guides effective? I see the benefits in adopting a coding standard, but will developers find it restrictive? And do documentation projects such as this one work? And if not, why do they fail? _(I've posted on Stack Overflow a few times with moderate success, but this is my first time posting here. Please let me know if I could improve my question in any way. Thanks!)_


Will it be okay to use Amazon Glacier for everyday data retrieval?

I am planning to use cloud storage for my app. What my app will do is retrieval of users data and user authentication and have the ability to sync data continuously. Is it a good idea to use Amazon Glacier? Is there a bandwidth limitation or request or any downside of using it?


Why is Tortoise SVN case sensitive?

I've recently encountered this using TortoiseSVN, but I assume it will be the same for CVS based programs (correct me?). Out of pure curiosity, is there any reason why the CVS filesystem is case- sensitive? I.e. the following URLS are different:               svn://repo/branches/PROJECT     svn://repo/branches/project      Is there some legacy reason for this? It gets more intriguing on a file basis. If 2 files exist in a directory, lets say `ProjectOne.vbp` and `projectone.vbp`, one will overwrite the other in a normal Windows filesystem (or, as I have encountered, throw a cryptic TortoiseSVN database error), but can co-exist peacefully in the repository. Now obviously it's up to the user to not use ridiculous naming such as the above, but are there any advantages that I'm missing to having case- sensitivity?


Graphically intensive silverlight design

I'm designing a silverlight application for showing sheet music from a midi file. I want to create a horizontally scrolling musical staff. At my job I maintain a winforms application that is a scrolling Gantt chart of airplane schedules, and it basically has a rows collection, and it maps the left-most pixel and right-most pixels of the control to datetimes. Then the paint method loops through what it determines will be the visible rows, and draws a screen that shows the schedule information between the two dates. Would I be correct in assuming that I would need to something similar in silverlight for my sheetmusic, or would it be better to just create a horizontal scrollviewer containing a canvas that I have drawn programmaticially on. Am I headed in the right direction? I havent seen any articles on designing such a custom control: can you point me at any?


Creating a Application in Winrt that requires Internet

I am making a paid App for Windows 8, c#. I am wondering which is better?     1. If my application doesn't need internet connection normally but does requires internet connection for the first time to download content data. --Makes my life easier   2. Load the default data when installing. Then ask the user if he wants to update in app. -- Making the default data will be pain. Now my big question is, is it safe to assume user has access to internet now- a-days when using application that shouldn't require internet?


How to get lookahead symbol when constructing LR(1) NFA for parser?

I am reading an explanation (awesome "Parsing Techniques" by D.Grune and C.J.H.Jacobs; p.292 in the 2nd edition) about how to construct an LR(1) parser, and I am at the stage of building the initial NFA. What I don't understand is how to get/compute a lookahead symbol. Here is the example from the book, the grammar:               S -> E     E -> E - T     E -> T     T -> ( E )     T -> n      `n` is terminal. The "weird" transitions for me are is the sequence:               1)   S -> . E        eof     2)   E -> . E - T    eof     3)   E -> . E - T    -     4)   E -> E . - T    -     5)   E -> E - . T    -      (Note: In the above table, the state numbers are in front and the lookahead symbol is at the end.) What puzzles me is that transition from (4) to (5) means reading `-` token, right? So how is it that `-` is still a lookahead symbol and even more important why is it that `eof` is no longer a lookahead symbol? After all in an input such as `n - n eof` there is only one `-` symbol. My naive thinking tells me (5) should be written as:               5)   E -> E - . T    - eof      And another thing -- `n` is terminal. Why it is not used at all as a lookahead symbol? I mean -- we expect to see `-` or `(`, it is ok, but lack of `n` means we are sure it won't appear in input? **Update** : after more reading I am only more confused ;-) I.e. what is really a lookahead? Because I see such state as (p.292, 2nd column, 2nd row):               E -> E . - T      eof      Lookahead says `eof` but the incoming input says `-`. Isn't it a contradiction? And it is not only in this book.


Running software as a service using unmodified GPL(v2+) program as a core dependency: must the SaaS source code be released?

I'm designing a software as a service project which will only be accessed online. I may have a hard dependency on an executable which is covered by GNU GPL (v2 or later). I understand that my code, if I were ever to distribute it, must be distributed under the GPL terms as well. I am pretty sure that running the service over the network is not conveying/distributing the code. Thus, am I correct in thinking that I may use the GPL dependency without having to disclose all my code? * * * Just so I can provide a concrete example: Let's say I'm designing on online document processing system, kind of like Google Docs. I want to be able to upload basically any file type into the system and have it get converted to whatever internal format. Instead of trying to scratch out a converter, I'd rather use an existing program I know about that allows for the conversion. This program is an executable with GNU GPL v2 (or later) licensing. Can I legally have a software-as-a-service without providing my source code?


Job at a Testing Solution Company

I have an option to join a company which is going to develop solutions to do load/stress testing . Its a startup and product is still under development . How do you think market for load/stress testing based product is now a days .


What is the difference between instantiating and loading a class in Java?

In Java world, there are some scenarios where I see developers used to load the class rather than instantiation. What is the difference between instantiating and loading a class?


How to prevent people from playing with your website?

I have designed my first website recently. I created my own blog like thing in PHP. I write articles and below the articles there is a place to add comments. Sometimes I get random comments something like 'sd$^&(87&(*2d10hsdasko' with no meaning. There are hundreds of them. I think some silly person with lots of time must be playing with my website for fun. I am thinking of finding his IP address and blocking it. Has someone faced such a problem? How do you prevent people from playing with your website?


What is an XML protocol?

I've been asked to provide something for a client and I'm not really sure on what they want. I wondered if anyone has heard the term used before. The situation is that we have a program which receives .xml files from a host system (the files are put in a directory and our program picks them up every x mins). The files contain various bits of information. The IT manager for the company who has the host system has requested some details about the XML protocol which is being used. I assumed he wanted an XML schema and some example xml files which I sent through to him. However he said he didn't want this and reiterated that he wanted to know what XML PROTOCOL was being used. Could anyone tell me what an XML Protocol is? I think I'm probably being really stupid about all this but I don't know what he means. Thanks everyone


What tools can be used to get a reference like document.frames.item(0).document.innerhtml?

I want to scrape things from a web page. The way I want to do this is to extract the text of a DOM element (I believe this is the correct description). This means that I will to retrieve the text of an element like document.frames.item(0).document.innerhtml. Now I am looking for a tool to do this quickly by clicking on the element in a web page. IE DOM Inspector can do this, but is not free and requires admin rights on the computer. I have not been able to get the reference to the DOM element using DOM inspector plug-in for Firefox. Are there any other alternative tools?


Developing a cross-platform interface for writing to hardware like PicKit OR USB over the web?

I thought long and hard on weather to put this question in programmers or stack overflow. Please let me know if this is not the right place and I will post it to SO. My friend and I am developing a display board that would need some configuration every now and then. e.g. setting contrast / backlight etc. Now this setting needs to be user controlled and we have prior experience of using PicKit2 in past. The way we programmed it was with use of command line / binaries available for both linux and windows. A front end would get the user input and then write to the pickit2 using these command line interfaces. Our target is to try and achieve this through a web interface. Now we want to discuss with the community if there is a real possibility of developing such a cross platform interface? As a backup option we are thinking of developing native application for all needed platform and using pickit2 with command line. Ideal way would be to just have the USB HID to do this. I looked into java USB libraries and ActiveX but nothing promising. Similar discussions around this topic are quiet old on StackOverflow so I thought I will ask this community to shed some light on possibility and limitations. http://stackoverflow.com/questions/3503244/controlling-a-usb-device-from-a- web-application http://stackoverflow.com/questions/2219378/control-a-users- usb-device-via-a-webpage-possible Is there any option we are not thinking about? Should we be happy that pickit2 is the backup solution and start developing different native apps.


Can I license parts of my code under different licenses

Can I license different parts of my code (different classes) under different licenses? E.g. I have downloaded and modified a class which licensed under the BSD 3 point. Can I then say, file AObject.class is BSD, and BObject.class is LGPL (or MIT, or MPL, or PD, etc etc)


Best approach how to create custom fields - dynamic forms

I'm wondering how can I create functionality of custom fields. Below I described what I want and solution which I consider. Case study: Let’s assume that we have 2 roles: Admin and User. Admin has possibility to "add custom fields to forms". User can open that form in add/edit/read-only mode. In addition User can see a grid with columns from that custom fields. Now I want to do following things as an admin: I add new textbox and this control should be available on add/edit/read-only view and value should be available in the grid(sorting functionality is required). Below I place problems which I see to this feature:   1. Where store form configuration – xml or custom tables for storing form view    2. Where store results – xml or custom tables for storing results    3. How to make grid with paging and sorting – If I’m going to use SQL Server then I will probably build some Views.    4. How to build UI – I will use MVC and I think this is the easiest step. Have you ever made something like this? Can you share with me some solution? Thanks in advance.


Detecting areas of isotropic vs anisotropic diffusion in a flood-fill (or similar) operation

Hello fellow programmers! I have a 2D graph which is best described as a Cartesian grid with traversible and non-traversible cells. I'd like to be able to detect subsets of this graph where the diffusion behaves anisotropically, i.e.: it is constrained by corridor-like passages. I initially turned to diffusion tensor imaging in neuroscience, but I'm having a great deal of trouble digesting the material. I'm wondering if any of this has already been distilled into a usable algorithm, or if there are other approaches that could be fruitful. Specifically, I'd like to be able to determine the following:   1. Areas in which diffusion is _anisotropic_ : highly constrained to two directions (think of water flowing through a 2D slice of a straw).   2. Areas in which diffusion is _isotropic_ : largely unconstrained (i.e., water is diffusing through a large, **though irregularly-shaped** space. Since the graph only contains very narrow or open areas, it would be sufficient to determine **either** anisotropic **or** isotropic diffusion and deduce the other one with a simple contrast. **TL;DR** : How can I find the "average" _direction_ of a diffusion in a flood-fill or similar operation? **EDIT:** Here's an example of my graph as an image: ![enter image description here](http://i.stack.imgur.com/LICSO.png)


Will getting a degree in mathematics help in game development?

I'm two months away from getting my degree in systems engineering, which is to say, I learned how to code and code well using managed languages. The only reason I got into this career was because I wanted to create video games. I know now that with my current skillset, I won't be able to create some of the things I have in my head. Would getting a second degree in pure mathematics would help me with this goal?


Reaction time of big companies to bug reports

I have submitted a bug report over a month ago to one of the biggest software companies about one of their flagship development products (I deliberately not include any more details about this bug report, so that the question doesn't turn into a rant). I only received an templated assurance that "we're working on it".   * Is it normal for big companies to react to bug reports at such pace?   * Can one define a "typical" reaction time?   * Is it typically longer than the reaction time of large & actively maintained Open Source projects, or not?   * Is there a cultural difference in the way they react?   * For example, maybe the commercial companies try to avoid engaging in discussions about the bugs in fear of bad PR?


Architecture for maintaining/executing multiple versions of same strategy / functionality in live application

So I am working with a customer who has an older application that has quite a few interesting quirks. Among other things, it has its own code version system for business functions, by storing the entire algorithm version in a database. The data is then retrieved and compiled on request (this is a web application, and yes, it compiles a ton of code each time you try to buy something). For obvious reasons, this isn't exactly fast. I am looking into migrating the code into normal code projects, but as you can imagine, this creates an interesting challenge in regards to versions of the algorithms. It is a business requirement that old quotes / deals that are up for review must use the same algorithm that was used when it was first created. Said quote should then be able to recalculate, with changed input etc (so we can't just store the results). How would you approach this problem? They are having such massive issues in production now that I have simply decided we will create a hot-fix by moving all the code to actual libraries and calling functions with name versioning (someAlgortihm6Jun2014 or whatever) which will solve the problem of immense bandwith use and wasted compilation time, but it is far from elegant. While I will be looking to implement much larger architectural changes in the future, for now I am simply looking for a good way to maintain multiple versions of the same algorithm in static code, without resorting to this naming convention. Thoughts?


Setting coding priorities

In the dev shops I've worked in, nobody has ever mentioned "coding priorities". I read this in a book or site somewhere, and sets the expectation of what priority should be first in the code. In places where this is not specified, what should the first priority be? It may sound simple to say " **do what the business need requires** ", but that could be at the expense of performance/maintainability. Many people say maintainability first, regardless, some say fulfill the need regardless. I am a young developer, so I am probably missing the point somewhere. Of course, programming is engineering and tough because you can never have the perfect solution. Thanks


Is it bad idea to use flag variable to search MAX element in array?

Over my programming career I formed a habit to introduce a flag variable that indicates that the first comparison has occured, just like Msft does in its linq Max() extension method implementation               public static int Max(this IEnumerable<int> source)     {         if (source == null)         {             throw Error.ArgumentNull("source");         }         int num = 0;         bool flag = false;         foreach (int num2 in source)         {             if (flag)             {                 if (num2 > num)                 {                     num = num2;                 }             }             else             {                 num = num2;                 flag = true;             }         }         if (!flag)         {             throw Error.NoElements();         }         return num;     }      However I have met some heretics lately, who implement this by just starting with the first element and assigning it to result, and oh no - it turned out that STL and Java authors have preferred the latter method. Java:               public static <T extends Object & Comparable<? super T>> T max(Collection<? extends T> coll) {     Iterator<? extends T> i = coll.iterator();     T candidate = i.next();              while (i.hasNext()) {         T next = i.next();         if (next.compareTo(candidate) > 0)         candidate = next;     }     return candidate;     }      STL:               template<class _FwdIt> inline     _FwdIt _Max_element(_FwdIt _First, _FwdIt _Last)     {   // find largest element, using operator<     _FwdIt _Found = _First;     if (_First != _Last)         for (; ++_First != _Last; )             if (_DEBUG_LT(*_Found, *_First))                 _Found = _First;     return (_Found);     }      Are there any preferences between one method or another? Are there any historical reasons for this? Is one method more dangerous than another? **UPDATE** : Please note, that the java version is capable of throwing exceptions with the line `T candidate = i.next();`and it's possible to get the same behavior in C# with the guard clause as it's shown in the second part of @ratchet freak's answer.


How do I resolve $ref in a JSON object?

I have written a single page application that uses rest services to retrieve JSON objects. The JSON objects being returned are C# objects serialized using the Newtonsoft.JSON library. The returned JSON object contains $ref pointers to specific $id objects within the same JSON object (The question here shows an example). I need to access the actual data that the $ref points to, but I do not know how to access it without locating the original source. I've found solutions such as writing a new contract serializer and writing my own implementation of resolving the references. I feel like there should be an easier solution than these two. I've also explored the Newtonsoft JSON serialization settings; I've tried setting PreserveReferenceHandling to None, but I haven't had any success there. I'm looking for solutions other than the ones I've mentioned. I'm hoping there's a simple solution that requires very little code to implement and no additional frameworks. UPDATE I've been reading some more about this and discovered that $ref is a JSON Pointer fragment. The reference number is an ID that references an item from a different schema. That appears to be the solution, but a schema needs to be defined for it to work. RFC for JSON Pointer Fragments Info about JSON Pointer Fragments References:   Resolve circular JSON references   Serialization Settings


Issues regarding new instances of controllers on view pages

Is there any issue with creating a new controller within the ascx view pages. I don't want to create a model, are there any issues with doing it this way. Normally, the controllers control variables within the model, and the model is the middle point between them, but I am creating a new instance of a controller class within the ascx page itself. Is this ok? **EDIT I want to know the implications of putting an instance of a controller class directly into the asp.net ascx code on a view page Thanks


Should a test plan account for configuration values?

Should a test plan for internal software account for the error states of all possible configurations? Ie: I have an app.config with some file paths. Should the test plan have steps for testing what happens when those values are incorrect?


distribution, release and version

1. Linux is packaged in a format known as a Linux distribution for desktop and server use. Linux distributions include the Linux kernel, supporting utilities and libraries and usually a large amount of application software to fulfill the distribution's intended use. I wonder if there is also a similar concept for a software application? A "distribution" of a software application? How is it defined?   2. For a Linux distribution can have many releases and versions. I wonder What is the difference and relation between release and version, for either a OS distribution or a software application? Thanks!


Separate trackers for features and defects?

At my company we use JIRA for new feature requests and then the QA department logs any bugs/defects in Quality Center. I find Quality Center to be very non- userfriendly as it requires IE because it uses ActiveX. Is this a common practice to use separate trackers for feature requests and defects? Is there any advantage to having separate trackers?


How to avoid context switching while developing full stack web apps?

To give some context, I've been a Ruby & Rails developer for the past few years, and just recently started doing quite a lot of JavaScript to add more responsiveness to the apps. When programming backend, it is quite easy (at least for me), to do most of the stuff test driven and just keep hammering out a bunch of code that works, while being able to focus. But I found that as I'm moving more towards the frontend, I am constantly context switching. Some JavaScript is easy to test (models), but the parts that are directly connected to the GUI seem just impossible to reasonably test automatically. This isn't as much of a deal when I first start with the GUI part with dummy data, but once it all gets connected, and the GUI is created based on data from a an external API and my machine is running two apps at the same time and I'm basically debugging both, it just seems like I'm constantly context switching, not really being able to focus on one thing. An example here might be a Node.js chat server that connects to another Rails application via some API. Now if the API was already done and set in stone, I could easily just focus on the Node.js part ... but trying to do the whole thing in some agile fashion, I just built the API as I build the Node.js app, which has a side effect on working on both Rails and Node (both backed up by different databases etc, ...). If I compare this to working on one small library or just some deep backend stuff, I find that my productivity basically non-existent, because I constantly switch around and find bugs in 50 different places, instead of just focusing on one. **Is there something that I'm fundamentaly doing wrong?**


Interpretation of DRY principle

Right now I'm struggling with this concept of DRY (Don't Repeat Yourself) in my coding. I'm creating this function in which I'm fearing it's becoming too complex but I'm trying to follow the DRY principle.               createTrajectoryFromPoint(A a,B b,C c,boolean doesSomething,boolean doesSomething2)      This function I have say takes 3 input parameters, and then the function will do something slightly different given the boolean combinations `doesSomething` and `doesSomething2`. However the problem I'm having is that this function is growing in complexity greatly with every new boolean parameter that's added. So my question is, is it better to have a bunch of different functions that share a lot of the same logic (therefore violating the DRY principle) or one function that behaves slightly differently given a number of parameters but making it much more complex (but preserving DRY)?


"continue" and "break" for static analysis

I know there have been a number of discussions of whether break and continue should be considered harmful generally (with the bottom line being - more or less - that it depends; in some cases they enhance clarity and readability, but in other cases they do not). Suppose a new project is starting development, with plans for nightly builds including a run through a static analyzer. Should it be part of the coding guidelines for the project to avoid (or strongly discourage) the use of `continue` and `break`, even if it can sacrifice a little readability and require excessive indentation? I'm most interested in how this applies to C code. Essentially, can the use of these control operators significantly complicate the static analysis of the code possibly resulting in additional false negatives, that would otherwise register a potential fault if break or continue were not used? (Of course a complete static analysis proving the correctness of an aribtrary program is an undecidable proposition, so please keep responses about any hands-on experience with this you have, and not on theoretical impossibilities) Thanks in advance!


What is the best procedure to setup real-time data transfers with Redis?

I have setup a RESTful API using Ruby on Rails for an iPhone application.There are some instances, however, that I would like to use Real-Time Pub/Sub data- transfers, I have drawn up 2 potentials:   * Connect the Rails API to a RealTime Node/Socket.io application using Redis. Where the iOS clients subscribe to the Node App through a socket connection.   * Interface Redis-rb (Ruby) and ObjCHiredis (iOS) directly - circumventing the Node application. (Is this even possible?) Would either of these be workable/recommended solutions? Disclaimer: I have never used Redis before.


Is open source development considered "commercial use" of software?

## The Software Setup: I am currently planning on creating a new software product. I have never commercially launched an application, nor am I doing this for a company. It's more for fun than anything, but it _may_ bring in some cash too. :P Anyway, there are going to be two "core parts" of the software:   * **Part Number One:** This one I am going to release open source. It's basically an installer/launcher/patcher that automatically checks for updates, it can handle error reporting, etc. Blah, blah, blah.    * **Part Number Two:** This is going to be the actual software. Closed source, but freeware. It's linked to an account, which can be either free or paid. * * * ## The Problem: So that's all fine above... until I realise my development computer has a lot of "freeware for non-businesses and paid for businesses" software. (Office, antivirus, and who knows what else?) I know I will _definitely_ have to do something about the software for the for-profit part, but **how about the open source part?** It is free, but the whole intention of developing it is for adding it to a bigger, paid software.


Larger Code is Still Faster

When compiling C code with `gcc`, there are compiler optimizations, some that limit code size and others create fast code. From the `-S` flag, I see that the `-O2/03` generates more assembly than the `-Os` code. How is more assembly still faster than less assembly?


Open office arrangement with non-programmers (sales, etc) talking all day?

Just curious about this, I'm about to leave this job for a variety of reasons but one thing is that the office I work in is a full open office with a few non-programmer employees in close proximity talking nearly all day on the phone, making sales calls etc. This is obviously terrible for concentration and in my opinion laughable that someone thinks this is a proper way to run a business where the core aspect of the business is software development. I'm just curious how common this would be, if anyone else has had a situation like this. It seems to me this is an obvious sign of a bad employer, I should have probably realized this earlier but I needed a job right away so I took it. I understand that programmers may have a shared room or space, but I would think that it would be the norm to keep things separated as far as people who talk on the phone for a living vs those who have to concentrate on a programming task.


How to bag online side projects related to Web development?

Basically, I want to know how people bag side projects related to Web Development online to make the extra buck. I'm looking for websites or portals that allow web developers to pick up new interesting projects that they can do in their free time.


Do you have to ban atomics to get good tool support for race detectors?

It seems that Helgrind treats atomics the same way as normal read/write operations. So, using atomics will result in lots of false positives. I don't know exactly how ThreadSanitizer deals with atomics, but I have found a method called tsan_atomic32_load. I assume that it can distinguish between atomics and normal read/write operations. In practice, however, the best way seems to be to avoid atomics in order to use tools to detect race conditions. Otherwise, you end up with to many false positives. There are specialized tools to verify concurrent data structures, e.g., Spin. Although it looks powerful, it seems to be out-of-scope for regular applications. **How do big projects deal with the problem of false-positives?** Do they disencourage the use of atomics, do they use suppression files, or do they simply not bother with race detectors?