How can I look at a GitHub repository and know what version of the code to download?

I am new to GitHub and new to the open source world (coming from .NET). I have a media wiki site and want to install a Google analytics extension: http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration The extension's documentation says to download the code from GitHub. In the GitHub repo, there are some "reviews" that say master and some that that say branches. I assume that I want a master and not a branch. But how do I pick which master to download? Also, the documentation says that some of the commits will be tagged but this does not seem to be the case. Without tags/documentation is there any easy way to know what commits are stable and what commits are not? I'd love some general wisdom about how to approach a repo for a project like this.


Is Windows Workflow Foundation appropriate for a CPU-heavy async application?

At one of the DevDays conferences a presenter said that Workflow Foundation isn't just for applications that require persistence, but they can make it easier to write and maintain Async WCF code and the corresponding error handling. (try.. catch)   * Assuming that is true, is Workflow Foundation able to use all the CPUs in a system? (Async IO)   * What WF-specific guidance is needed before writing a CPU-heavy Async WCF application within the WF framework? (only tips that are specific to Workflow Foundation)


Azure website that talks to third party services

I have website that crawls data from many third party services when user browse to webpage. This can be really slow because I hit third party server and process returned data before showing it to user. I am hosting website on Azure (shared mode). I am thinking to improve my implementation. Here is what I am thinking... Run a service that crawls data from third party services, process it and then store it in database. when user browse to my site, my site pulls data from database and display them to user. But above solution is not clear to me. Should I have normal service or wcf service? If wcf service then should website talk to database or wcf service (that can access data from database)? If normal service then how can I deploy on Azure?


Does anyone else feel Scrum isn't agile?

I am a big fan of agile development and used XP on a very successful project a few years ago. I loved everything about it, the iterative development approach, writing code around a test, pair programming, having a customer on site to run things by. It was a highly productive work environment and I never felt like I was under pressure. However the last few places I have worked use/used Scrum. I know it's the poster child for agile development these days but I'm not 100% convinced it is agile. Below are the two main reasons why it just doesn't feel agile to me. **Project Managers Love It** Project managers, who by their very nature are obsessed with timelines, all seem to love Scrum. In my experience they seem to use the Sprint Backlog as a means to track time requirements and keep a record of how much time was spent on a given task. Instead of using a whiteboard they all use an excel sheet, which each developer is required to fill out, religiously. In my opinion this is way too much documentation/time tracking for an agile process. Why would I waste time estimating how long a task is going to take me when I can just get on with the task itself. Or similarly why would I waste time documenting how long a task took when I can move onto the next task at hand. **Standup Meetings** The standup meetings in the previous place I worked were a nightmare. Everyday we had to explain what we had done yesterday and what what we were going to do that day. If we went over on our time "estimate" for a task the project manager would kick up a stink, and reference the Sprint Backlog as a means of showing of incompetent you are for not adhering to the timeline. Now I understand the need for communication but surely the tone of daily meetings should be lighthearted and focus on knowledge sharing. I don't think it should turn into a where's your homework style charade. Also surely the hole point of agile is that timelines change, they shouldn't be set in stone. **Conclusion** The idea of agile is to make the software better by making the developers life easier. Therefore in my opinion any agile process used by a team should be developer led. I don't think having a project manager use a process they have labeled "agile" to track a project has anything to do with agile development. Thoughts anyone?


Is there a licence that let people see my code but not use it?

I'm building free games in javascript, with my code is easily accessible by looking into the html of the webpage. I really don't mind people looking at my code (for curiosity, or to learn something). But I don't want anyone to use my code to make their own games, or steal the art I've done. With this goal in mind, what software licence should I use? Thanks!


How to handle monetary values in PHP and MySql?

I've inherited a huge pile of legacy code written in PHP on top of a MySQL database. The thing I noticed is that the application uses `doubles` for storage and manipulation of data. Now I came across of numerous posts mentioning how `double` are not suited for monetary operations because of the rounding errors. However, I have yet to come across a complete solution to how monetary values should be handled in PHP code and stored in a MySQL database. Is there a best practice when it comes to handling money specifically in PHP? Things I'm looking for are:   1. How should the data be stored in the database? column type? size?   2. How should the data be handling in normal addition, subtraction. multiplication or division?   3. When should I round the values? How much rounding is acceptable if any?   4. Is there a difference between handling large monetary values and low ones? **Note:** A **VERY** simplified sample code of how I might encounter money values in everyday life (various security concerns were ignored for simplification. Of course in real life I would never use my code like this):               $a= $_POST['price_in_dollars']; //-->(ex: 25.06) will be read as a string should it be cast to double?     $b= $_POST['discount_rate'];//-->(ex: 0.35) value will always be less than 1     $valueToBeStored= $a * $b; //--> any hint here is welcomed           $valueFromDatabase= $row['price']; //--> price column in database could be double, decimal,...etc.          $priceToPrint=$valueFromDatabase * 0.25; //again cast needed or not?      I hope you use this sample code as a means to bring out more use cases and not to take it literally of course. **Bonus Question** If I'm to use an ORM such as Doctrine or PROPEL, how different will it be to use money in my code.


Microsoft Visual C++ Redistributables, Software Requirement?

When compiling with Visual Studio C++, I noticed that you need a specific MSV C++ Redist, depending on the version of Visual Studio you compile with. The required redistributable is necessary on machines without it. Otherwise without the redists missing MSVCPxxx.dll errors are prompt. Is there a way to by-pass needing the necessity of the redistributable? Or is there a way to package that inside of the program you're creating, be it DLL, executable, etc.?


Is it bad code smell if private method calls public one?

Is it bad code smell to call public method in private method of same object instance?


Whats the best way to parallel my problem using Java API

I´m with trouble, because I want to make faster my code using `threads`, `fork in join` or any kind of `parallel`. I did a code using `fork in join` but I saw my `arraylist` isn´t getting the correct values. I don´t know if is my implementation. But I want to take off all messages without attachments, later separate by sender. One example of my class using `fork in join`, but I´m looking for any suggestions.               package service.forkinjoin;          import java.io.IOException;     import java.util.ArrayList;     import java.util.List;     import java.util.concurrent.RecursiveAction;          import javax.mail.Message;     import javax.mail.MessagingException;          import service.EmailUtil;          public class ForkSortMessagesBySender extends RecursiveAction {              private static final long serialVersionUID = -1092415796824205832L;         private List<Message> listMessagesWithAttachment;         private List<Message> listMessages;         private String sender;              public ForkSortMessagesBySender(List<Message> listMessagesWithAttachment, List<Message> listMessages, String sender) {             this.listMessagesWithAttachment = listMessagesWithAttachment;             this.listMessages = listMessages;             this.sender = sender;         }              @Override         protected void compute() {                  List<RecursiveAction> actions = new ArrayList<>();                  if (this.listMessagesWithAttachment.size() <= Runtime.getRuntime().availableProcessors()) {                 try {                     this.separateMessages();                 } catch (MessagingException | IOException e) {                     e.printStackTrace();                 }             } else {                      int end = this.listMessagesWithAttachment.size() / 2;                 actions.add(new ForkSortMessagesBySender(this.listMessagesWithAttachment.subList(0, end), this.listMessages, this.sender));                 end += this.listMessages.size() % 2 == 0 ? 0 : 1;                 actions.add(new ForkSortMessagesBySender(this.listMessagesWithAttachment.subList(end, this.listMessagesWithAttachment.size()), this.listMessages, this.sender));                 invokeAll(actions);             }         }              private void separateMessages() throws MessagingException, IOException {                  for (Message message : this.listMessagesWithAttachment) {                 if (EmailUtil.getSender(message).equals(this.sender)) {                     this.listMessages.add(message);                 }             }         }     }


Are nested classes under-rated?

I'm not trying to say I know something everyone else doesn't but I've been solving more and more designs with the use of nested classes, so I'm curious to get a feeling for the acceptablilty of using this seemingly rarely used design mechanism. This leads me to the question: am I going down an inherintly bad path for reasons I'll discover when they come back to bite me, or are nested classes maybe something that are underrated? Here are two examples I just used them for: https://gist.github.com/3975581 \- the first helped me keep tightly releated heirarchical things together, the second let me give access to protected members to workers...


DataSet Validation vs. ASP.NET MVC Validation

I have a general question on where to put validation. I have an asp.net mvc that gets/sets data from/to a DataSet. Currently, the fields in the form are validated by the form itself (e.g. for invalid length, range, etc.). Is it a good or better idea to transfer these validation checks into the DataSet? The downside is I need to trigger update calls to the DataSet in order to get the column with errors. In using forms, I can catch the error earlier. Or should I use validation for both of them? For additional consideration - it's possible I will be re-using this Dataset assembly with another project (a WCF service?). And I'd like to re-use the same validation code when possible.


Resources on Writing Efficient C Code for Micro-controllers?

Serious help needed here. I love programming. I've been reading bunch of books(such as K&R) and articles/forums online for C language lately. Even tried looking into Linux code(although, i was lost where to start but peeking into small libraries helped?). I started as a Java programmer and in Java it's pretty cut and dry; If programs gets too big, slice it in classes then further into functions. Guidelines like, keep the code readable and add comments. Use information hiding and OOP techniques. Some of which still applies for C. I've been coding in C now and so far i get programs to work one way or the other. A lot of people talk about performance/efficiency, algorithm/design, optimization, and maintainability. Some people stress one more then the other but for non-professional software engineers you often hear something like e.g: Linux kernel dev won't just take any code. My question is this: I plan on writing a code for 8-bit microcontroller **without wasting any resources**. Know that i'm coming from java background so things are not the same anymore... resources/books/links/tips will be much appreciated. Performance and size now matters. Resources/Tricks on efficient(within best practices) C code for 8-bit micro-controllers? Also, `inline assembly` plays a vital role as well sticking close to micro- controllers standard. But are there general rule of thumb to efficiency that applies to all? For example: `register unsigned int variable_name;` is preferred over `char` anytime. Or using ` uint8_t ` if you don't need big numbers. EDIT: Thank you so much for all the answers and suggestions. I appreciate everyone's effort for sharing knowledge.


Why use other number bases when programming

My coworkers and I have been bending our minds to figuring out why anyone would go out of their way to program numbers in a base other than base 10. I suggested that perhaps you could optimize longer equations by putting the variables in the correct base you are working with (for instance, if you have only sets of 5 of something with no remainders you could use base 5), but I'm not sure if that's true. Any thoughts?


Client-Server connection response timeout issues

User creates a folder in client and in the client-side code I hit an API to the server to make this persistent for that user. But in some cases, my server is so busy that the request timesout. The server has executed my request but timedout before sending a response back to client. The timeout set is 10 seconds in client. At this point the client thinks that server has not executed its request (of creating a folder) and ends up sending it again. Now I have 2 folders on the server but the user has created only 1 folder in the client. How to prevent this? One of the ways to solve this is to use a unique ID with each new request. So the ID acts as a distinguisher between old and new requests from client. But this leads to storing these IDs on my server and do a lookup for each API call which I want to avoid. Other way is to increase the timeout duration. But I dont want to change this from 10 seconds. Something tells me that there are better solutions. I have posted this question in stackoverflow but I think its better suited here. **UPDATE:** I will make my problem even more explicit. The client is a webbrowser and the server is running nginx+django+mysql (standard stack). The user creates a folder in webbrowser. As a result I need to hit a server API. The API call responds back, thereby client knows API call was success. This is normal scenario. Sometimes though, server successfully completes the API request but the client-side (webbrowser) connection timesout before server can respond back. The client has no clue at this point. The user thinks the request was a fail & clicks again. This time it was a success but when the UI refreshes he sees 2 folders. I want to remedy this situation.


Learning PHP for an ASP.NET Developer

I am mostly developing on ASP.NET MVC and sometimes on ASP.NET WebForms. But when I hit a PHP web site, I always think that; > Should I learn PHP? Assuming answer here is yes, where would be the first place to start and where should I go from there?


USB software protection dongle for Java with an SDK which is cross-platform “for real”. Does it exist?

What I'd like to ask is if anybody knows about an hardware USB-dongle for software protection which offers a very complete out-of-the-box API support for cross-platform Java deployments. Its SDK should provide a jar (only one, not one different library per OS & bitness) ready to be added to one's project as a library.   * The jar should contain all the native stuff for the various OSes and bitnesses   * From the application's point of view, one should continue to write (api calls) once and run everywhere, without having to care where the end-user will run the software   * The provided jar should itself deal with loading the appropriate native library **Does such a thing exist?** With what I've tried so far, you have different APIs and compiled libraries for win32, linux32, win64, linux64, etc (or you even have to compile stuff yourself on the target machine), but hey, we're doing Java here, we don't know (and don't care) where the program will run! And we can't expect the end-user to be a software engineer, tweak (and break!) its linux server, link libraries, mess with gcc, litter the filesystem, etc... In general, Java support (in a transparent cross-platform fashion) is quite bad with the dongle SDKs I've evaluated so far (e.g. KeyLok and SecuTech's UniKey). I even purchased (no free evaluation kit available) SecureMetric SDKs&dongles (they should've been "soooo" straighforward to integrate -- according to marketing material :\ ) and they were the worst ever: SecureDongle X has no 64bit support and SecureDongle SD is not cross-platform at all. So, **has anyone out there been through this and found the ultimate Java security usb dongle for cross-platform deployments?** Note: software is low-volume, high-value; application is off-line (intranet with no internet access), so no online-activation alternatives and the like. \-- EDIT Tried out HASP dongles (used to be called "Aladdin"), and added them to the no-no list: here, too, there is no out-of-the-box (out-of-the-jar) support: e.g. end-linux-user has to manually put the .so library (the specific file for the appropriate bitness) in the right place on his filesystem, and export an env. variable accordingly. \-- EDIT 2 I really don't understand all the negativity and all the downvoting: is this a **taboo** topic? Is it so hard to understand that a freelance developer has to put food on the table everyday to feed its family and pay the bills at the end of the month? Please don't talk about "adding value" as a supplier, because that'd be off- topic. Furthermore I'm not in direct contact with end-customers, but there's an intermediate reselling entity: it's this entity I want to prevent selling copies of the software without sharing the revenue. \-- EDIT 3 I'd like to emphasize the fact that the question is looking for a **technical** answer, not one about opinions concerning business models, philosophical lucubrations on the concept of value, resellers' reliability, etc. I cannot change resellers, because this isn't a "general purpose" kind of sw, but a very vertical one and (for some reasons it's not worth explaining here) I _must_ go through them. I just need to prevent the _"we sold 2 copies, here's your share [bwahaha we sold 10]"_ scenario.


Loose Coupling Presenter to View in MVP

We work in a Java shop here and our web application uses an implementation of the MVP architectural pattern. Our manager comes from a .NET world, where he has been exposed to the MVVM design pattern. Our manager is advocating changes in our MVP implementation, including that the Presenters should be decoupled from (or loosely coupled to, depending on your interpretation) its Views via the Observer design pattern, in tradition with MVVM. I am more of the opinion that the Presenter and the View work together to achieve a common goal, and as such should be coupled. Among the arguments brought up in support of the change is the ability to unit test Presenters. If the Presenters only see the views as Observers, the argument goes, then they can be more easily unit tested. But presenters strongly coupled to their views are not necessarily difficult to test. If the View uses the Humble View paradigm, then it can be mocked. And finally, testability should be a symptom of good design, not a driver for the design. Another argument used by my manager in support of layering the Views and the Presenters is the supposed maturity of MVVM. As such, we should follow MVVM's teachings and adapt to its implementation of MVP. Correct me if I'm wrong, but MVVM imposes the (artificial) layering of views and presenters in order to facilitate its data bindings in controls. Can you please help us see the light here? Why should we use a decoupled model and pay the price for it? I'm not seeing the benefit. Occam's razor says I need arguments to use decoupling, and testing doesn't seem to be one of them. * * * **Clarification** : What I'm really looking for with this question are the arguments that can tip the balance in favor of a presenter that doesn't know about its view and shoots events in the aether or in favor of a presenter that knows about its view(s) through more direct coupling, like a humble view interface or directly to the class. Note that presenters can easily serve multiple views with both loose and tight coupling. The difference is in the interface that the presenter talks to: with loose coupling, the presenter talks to listener classes (or an event bus representative), whereas with tight coupling, the presenter talks to the view interface.


What's the best way to estimate story points in scrum?

I like the way planning poker works at the beginning of any project, letting you compare and discuss details of each story with one another. One of the issues I've noticed with this is that through time and as you gain more experience with the problem domain, you tend to vote less points for each story, i. e., a story that was worth a 5 or an 8 at the beginning of the project might now be worth a 3. How do you avoid or tackle this problem in the best possible way? Is there a better way to estimate? Should the stories always remain the same, or is this story points decrease ok?


How do programming language translators work?

I'm a programmer and I'm looking to play around with translating one language to another. Say C# to Lua. I'm curious as to how translating languages like that works? I would think there is some kind of standard methodology that I could perhaps look into for this or is it pretty raw?


Will it be a wrong idea to have <style> in <body>?

In below code i placed internal style sheet with in body tag, instead of having in head. For Single-Page-Application I am considering to do this for styles that is only applicable to that page alone, rather than having separate pagespecific.css file. Is there a scenario where this has downside as i am not putting the same in head section?
                   Hello


In what meaningful ways does Erlang prevent race conditions in concurrent programming?

Reading about concurrency in Erlang, reminds me of the Akka concurrency toolkit. Both give you tools to prevent or limit race conditions. But you can send links to mutable data to other processes using the Akka toolkit, which is still unsafe. I see Akka as a useful tool, but it does not provide _protection_ against out-of-order access to objects and data leading to race- conditions, deadlock, and/or starvation. It doesn't prevent you from writing unsafe code the way Java or C# protects you from writing most of the kinds of memory leaks you can write in C++ (you can still create memory leaks in Java by tricking the garbage collector, but it is less of a problem than having to remember to free every byte you allocate). Does Erlang guarantee a degree of correctness, performance, and robustness in concurrent programming? I think operating systems provide protection when accessing system resources (assuming the driver writers did their jobs well). ACID databases provide protection for reads and updates. So it seems this is a solvable problem. Or would a generic safe solution would erase the performance gains that concurrency provides? Do other languages or toolkits provide the kind of concurrent safety that Erlang does (or doesn't)? This is a follow-up question to @Malfist's comment on @user1249's answer to What programming language generates fewest hard-to-find bugs?.


Separating entities in the business logic layer

I am going to start a project, which in the `BLL` would have something like:   * Jumper    * Map   * Record I need to keep track of all those, so I will make probably classes which hold them, e.g.:   * JumperList   * MapList   * RecordList First of all, is that a good practice to hold all the objects and is it good if I separate them like: `BLL.Entity` for the `Jumper`, `Map`, `Record` and `BLL.List` for `JumperList`, `MapList`, `RecordList` * * * Okay, I may have written it in a confusing way. What I meant was, is it good to make it like that:               BLL.Entity      - Jumper      - Map      - Record     BLL.List      - JumperList      - MapList      - RecordList


How to write a good mock for testing

I code in Python and I'm starting to use the Mock library. Although I've read through all of the documentation, something that I'm finding hard to understand is 'What makes a good mock'. For example, say I've got a function that makes a HTTP request:               def fetch_url(url, method=urlfetch.GET, data=''):         """Send a HTTP request"""              result = urlfetch.fetch(url=url, method=method, payload=data,                                 headers={'Access-Control-Allow-Origin': '*'})              return result.content      What would a good mock for this function look like? Furthermore, what would then be tested? From my understanding, the characteristics of a good test are that the test checks:   1. That the code isn't broken   2. That the code acts as expected   3. That the code returns the expected output if it returns something That said, what would be the characteristics of a good mock?


Does decoupling trump DRY in REST?

I am building a REST API to expose most of functionality of an existing Java API. Both APIs are for internal use within my organization; I do not have to design for external use. I have influence over both APIs but am implementing the REST one. The Java API will continue to be used for local applications (it's not being "retired"), but the REST API will be used for significant new development. Some of the Java API classes are simply data (beans with properties, getters, setters). And at least some of these make sense to transmit (in some form) over the REST API as data (which will be marshalled to XML or JSON). For example, a class that stores info about a server machine. I am faced with the following choice for these data classes: Do I...   1. expose the original Java class (or a subclass) directly in the REST API, or   2. make a new data transfer class (DTO pattern) specifically for the REST API? Either way I'll have REST data transfer classes; the question is whether to annotate the originals or create new ones (which may be near copies of the originals). There may be other choices, but I'll focus mainly on those two. Arguments for #1:   * DRY (don't repeat yourself)   * Faster to implement   * Easier to upgrade REST API Arguments for #2:   * What if REST API needs to be versioned separately from Java API? (This is somewhat likely.)   * What if there are significant changes to the Java data classes such as removal of properties, adding of behavior, or changes to class hierarchy? (This is also somewhat likely.) Bottom line is that it seems like a tradeoff between DRY (#1) and decoupling (#2). I'm leaning toward starting with #1 and then if problems arise moving to #2 later, following the agile guideline of not building what you can't prove you need. Is this a bad idea; should I start with #2 if I think I may end up there anyway? Are there major arguments/consequences missing from my lists?


Why don't modern libraries use OOP

I'm a beginner-level C++ programmer, but I understand the concepts of the language fairly well. When I began to learn external C++ libraries, like SDL, OpenGL (maybe something else too), to my great surprise I found out that they don't use C++ concepts at all. For example, neither SDL, nor OpenGL use classes or exceptions, preferring functions and error codes. In OpenGL I've seen functions like glVertex2f, which takes 2 float variables as an input and probably would be better as a template. Moreover, these libraries sometimes use marcos, while it seems to be a common agreement that using macroses is bad. All in all, they seem to be written more in C style, than in C++ style. But they are completely different incompaitable languages, aren't they? The question is: why modern libraries do not use the advantages of the language they are written in?


Should I Make my ASP.NET MVC N-tier?

I'm currently building a very small website, around 20 to 30 views, 10 controllers. I know MVC is only a design pattern and should only be the top presentation layer. I'm currently at a stage in development when you start question yourself and what you're doing. It feels like this small website don't 'need' the N-tier architecture because it's too small for that. But in the long run maybe it's worth it. Is it worth the time to migrate to N-Tier? IS there some level of abstraction when you **should** migrate to n-tier? Is there some magic point when the project grows too large? Or should it be done directly in the beginning of the development?


How did Strassen come up with his matrix multiplication method?

The famous Strassen's matrix multiplication algorithm is a real treat for us, as it reduces the time complexity from the traditional O(n^3) to O(n^2.8). But of all the resources I have gone through, even Cormen and Steven Skienna's book, they clearly do not state of how Strassen thought about it. What is the rationale of Strassen's matrix multiplication algorithm? Is this a lucky accident or is there something deeper in it?


Is is OK to use a non-primary key as the id in a rails resource?

I am getting ready to set up a resource for some new api calls to my rails application. I am planning on calling the resource devices ie               resources :devices      This is going to represent android mobile devices I know this will get me routes such as GET devices/:id In most cases :id would be an integer representing the primary key, and in the controller we would use :id as such:               GET devices/1     @device = Device.find(params[:id])      In this case I would like to use :id as the google_cloud_messaging_reg_id So I would like to have requests like this:               GET devices/some_long_gcm_id      and then in the controller , just us `params[:id]` to look up the device by the gcm registration id. This seem more natural, since the device will know it's gcm id rather than it's rails integer id. Are there any reasons I should avoid doing this? **\---------------------------------------------------------------------** **UPDATE:** **_My initial concern was that seeing a route (via rake routes) of /devices/:id or looking at the controller and seeing params[:id] would be confusing since most would assume :id was the integer primary key._** **After thinking about it some more, and reading Idan Arye's answer below, my current thinking is to create routes like shown below. This will get me routes (via rake routes) that look like this:**               GET    /api/v1/android_devices/:gcm_reg_key(.:format)       **which I think makes it somewhat clear that :gcm_reg_key may not be a primary key integer**. **And in the controller the parameter would be**               params[:gcm_reg_key]      **Again, I think this makes it somewhat clear that the param may not be an integer primary key (convention would be params[:id])** **Any other thoughts or suggestions are welcome.**               match '/android_devices/:gcm_reg_key', to: 'android_devices#show' , via: :get, as: 'android_device'     match '/android_devices/:gcm_reg_key', to: 'android_devices#update', via: :post, as: 'android_device_create'     match '/android_devices/:gcm_reg_key', to: 'android_devices#update', via: :patch, as: 'android_device_modify'     match '/android_devices/:gcm_reg_key', to: 'android_devices#destroy', via: :delete, as: 'android_device_destroy'     resources :android_devices , only: [:create, :index]


"Default approach" when creating a class from scratch: getters for everything, or limited access?

Until recently I always had getters (and sometimes setters but not always) for all the fields in my class. It was my 'default': very automatic and I never doubted it. However recently some discussions on this site made me realize maybe it's not the best approach. When you create a class, you often don't know exactly how it's going to be used in the future by other classes. So in that sense, it's good to have getters and setter for all of the fields in the class. So other classes could use it in the future any way they want. Allowing this flexibility doesn't require you to over engineer anything, only to provide getters. However some would say it's better to limit the access to a class, and only allow access to certain fields, while other fields stay completely private. **What is your 'default' approach when building a class from scratch?** Do you make getters for all the fields? Or do you always choose selectively which fields to expose through a getter and which to keep completely private?


Differentiating Standalone and Client-Server architectures

I was wondering what is the exact difference between a client-server and a standalone application, particularly in following scenario. For example lets say there is a win forms application running on a PC. So that the DBMS, SQL Server also installed on the same PC as it hosts the database too. Now this is clearly a standalone setup. Now if we introduce another PC and connect it to the first PC through a local area network and we want to run the application on this new PC too but it will use the same database which is in the first PC. Now is this application considered to be a standalone app or a thick client - server? EDIT: The application communicates with SQL server to access data and processing will happen locally. SQL server hosts the data and there are few stored procedures and views too.


Is it recommendable to program .net apps with C++

From what I can understand, C# is the defacto language when coding .NET apps. Is it recommendable to program .NET apps [let that be ASP.NET, WinPhone 7, GUI, etc] in C++? What are the pitfalls and the drawbacks if we choose to go down this path? Thanks for sharing.


How can I group commits in a version control system such as git

Instead of a one long flat commit history, why isn't there a hierarchy, so at the top level you might have pull requests, then you could go down a level and look at the commits in that PR. I realise that PR's are specific to github, but you get the idea. I just mean grouping a number of commits as a feature or bug-fix, for example. Surely it would make the commit history a lot easier to navigate. I'm sure there is an obvious answer this question, but I can't seem to find it.


What is better to return from the DataService: Status or Exceptions?

I have a MVVM app with DataServices (using mvvmlight). Right now, i'm using it like               var answer = await myDataService.PullList(categoryId);     if (answer.Status == Ok)         ObservableListOfItems.ReplaceWith(answer.Collection); // Show results     if (answer.Status == ConnectionLost)         // Handle connection lost state, show msg window or something     if (answer.Status == ParsingError)         // Handle parsing problem      where               async Task<MyAnswer> PullList(int id)     {         // Just a wrapper around HttpWebRequest, returns String.Empty if something happened         var resultString = await NetworkManager.GetAsync(UrlGenerator.GenerateCategoryRequest(id));                if (String.IsNullOrEmpty(resultString))             return new MyAnswer {Status = ConnectionLost);              try         {             var parsedResult = JsonConvert.DeserializeObject<PocoProducts>();                  return new MyAnswer {Status = Ok, Collection = parsedResult.List);         }         catch (Exception)         {              return new MyAnswer {Status = ParsingError; }         }       and               public class MyAnswer()     {         public List<Items> {get; set;}         public EnumStatuses Statuc {get; set;}     }          public enum EnumStatuses     {         Ok = 0,         ConnectionLost,         ParsingError     }      So I'm curious, did i just re-invented an exceptions, didn't i? PS: wrote a code just here, typos are possible, but general idea should be clear


Design for migrating to Multitenant architecture

We are in a process of redesigning our product code in such a way so as to support multitenancy. Currently the implementation is such that one product deployment caters to only one customer. Thus the application data corresponds to only one customer. This data (which is global wrt the application) is in the form of hashtables, lists and DB. Multiple threads make use of this data. The complete code is written in C. Now, since we want to migrate to multitenant architecture, the application code would need to store data for multiple customers. Since data stored in the application should be segregated wrt customers, I want to figure out what kind of architecture would best suit this requirement. I am thinking of adopting some OOP concepts here since I can use C++ also. But not sure how good this idea would be. Modularity is a prime advantage that OOP offers over C and hence thinking on those lines. But at the same time it is going to have a humongous on the current implementation requiring lots of changes. Hence, minimizing this is also important. What would be the best approach to attain all the objectives mentioned above? Is there any other way to do this?


Sync SQLite using only HTTP

I currently have a SQLite DB on my server that is needed by an android app I am currently developing. I download the DB to the android device using HTTP each time the contents are changed. Does anyone have any suggestions as to how to do this more efficient. ie. when the database gets large I don't want the android user to have to download the whole database again just because one record was added.


C++ is easy once you know PHP

I was at work last week and one of our "lead developers" (who said he has programmed C++ before, but I don't believe him) was talking about C++ and how our team of developers who only know PHP would not have a hard time at all learning C++. My first reaction was pure shock and then I laughed at his comment. He gave me a bad look and i asked if he was serious. Me personally I program a lot of C and C++ for mostly school projects and coding competitions. I don't think it's at all like PHP. I asked him why they were the same and he could not give me an answer (he doesn't know C++ at all I was thinking). Then I said "OK, yeah they both use curly braces and have conditional statements. But C++ you have to worry about memory management and all the easy to use built in functions in PHP, for example the array functions, are non-existent in C++. You actually have to know the algorithms behind them.". There are some great C++ libraries (STL, Boost) that will make your life easier but C++ is like PHP, come on! If you already know one language it will make it a little easier to learn another because you will already be good at boolean login (if this then that) or looping but there is just so much more to C++ than PHP. Like you have to compile the language and actually have to define what type of variable you are using and returning from functions. What do you think? EDIT: Actually what he said was "C++ is not much different than PHP"


Should sanity be a property of a programmer or a program?

I design and implement languages, that can range from object notations to markup languages. In many cases I have considered restrictions in favor of sanity (common knowledge), like in the case of control characters in identifiers. There are two consequences to consider before doing this:   * It takes extra computation   * It narrows liberty I'm interested to learn how developers think of decisions like this. As you may know Microsoft C# is very open on the contrary. If you really want to prefix your integer as Long with 'l' instead of 'L' and so risk other developers of confusing '1' and 'l', no problem. If you want to name your variables in non-latin script so they will contrast with C#'s latin keywords, no problem. Or if you want to distribute a string over multiple lines and so break a series of indentation, no problem. It is cheap to ensure consistency with restrictions and this makes it tempting to implement. But in the case of disallowing non-latin characters (concerning the second example), it means a discredit to Unicode, because one would not take full advantage of its capacity.


Not-for-profit universities that offer computer science undergraduate degree online?

There are many masters degree programs in computer science online offered by reputable organizations. However, I've found very few bachelors only degree programs offered by non for-profit institutions. I am looking for a degree in computer science and also any programs for entrepreneurship/management or algorithmic trading. I've found only 2 programs so far that fit: http://www.regis.edu/regis.asp?sctn=cpcis&p1=ap&p2=cs&p3=ol http://depaul.edu Requirements: 100% online undergraduate non-profit Options: Bachelor of Science Bachelor of Arts Bonuses: accelerated recognized ABET cost effective Update: I've answered my question with a list. If anyone knows an online program that combines skills in entrepreneurship (getting capital, starting a business) or algorithmic trading with a computer program that would be ideal.. maybe too much to ask though


How does an agile process deal with ORM?

This question was prompted by this answer, where I quote,"agile + ORM on a large constantly changing database is brutal". So, how can an agile process deal with a constantly changing database? I am interested in both cases:   1. Where the database design will stablelize, after using it a while to see how it works   2. Where constantly changing data schemas require that the database changes often A couple ideas I had were:   * Use a NoSQL database   * Creating key/value tables for different classes of data. This could create bigger tables, but might work well for data that is not inherently relational.


Dependency properties outside the realm of WPF?

Is there a more general concept or name for what WPF calls "dependency properties"? I imagine this is not a WPF-ism and in fact other libraries or frameworks have employed a similar approach? If so, what are these other instances and what are the similarities and differences compared to Microsoft's dependency properties? I am at a junction where I'm considering adding "dependency properties" to my own type system and object model (unrelated to WPF), as the construction seems appropriate for my design requirements; however, I want to consider what others have created as well, not just WPF's particular implementation.


Using a relational database vs JSON objects for event/activity data

I am working on a project where I am trying to decide between using a standard SQL relational database or JSON objects to store data about an event or activity. The project will store data on multiple event types so I have decided to just describe one event type for this question. The live music event (described in full using the JSON schema at the bottom of this question) is an object that stores data such as where the event will take place, the time/date of the event and the cost of the event. The live music event object has both one-to-one (event--> name, event --> description) and one-to-many (event--> venues, event--> dates, event--> ticket types) relationships. Furthermore, the event object can contain one or more performer IDs, which link to the performer object. The performer object stores data on musicians who are performing at the live music event. The data will be queried by users using both simple ("Find me events with 'x' name") and complex ("Find me events with 'x' music genre and 'y' cost within a radius of 'z' from my current location") queries. The data will be submitted by users using a web form. As you can probably tell from the defined JSON schema, I was originally going to use JSON objects to store this data but I've heard from some people who say that because my data is purely relational, I should stick to the older methods. I would appreciate any thoughts on the pros and cons of each approach given my needs. If you need anything clarified, please feel free to ask.               {         "event": {             "eventID":{                 "type":"string"             },               "eventType":{                 "type":"array",                 "eventTypeItem":{                     "type":"string"                 }             },             "eventName":{                 "type":"string"             },                   "eventDescription":{                 "type":"string"             },             "eventVenueList":{                 "type":"array",                 "eventVenueListID":{                     "type":"integer"                 }             },             "eventURL":{                 "type":"string"             },             "eventTwitter":{                 "type":"string"             },             "eventFB":{                 "type":"string"             },             "eventInstagram":{                 "type":"string"             },             "eventEmail":{                 "type":"string",                 "format":"email"             },             "eventContactPerson":{                 "type":"string"             },             "eventDoorTime": {                 "type":"string",                 "format":"date-time"             },               "eventPerformerIDList":{                 "type":"array",                 "liveMusicPerformerID":{                     "type":"integer"                 }             },               "eventSetList":{                 "type":"array",                 "eventPerformerID":{                     "type":"integer"                 },                 "eventPerformerStartTime":{                     "type":"string",                     "format":"date-time"                 },                 "eventPerformerEndTime":{                     "type":"string",                     "format":"date-time"                 }                                                },             "eventDateList": {                 "type":"array",                 "eventDateItem": {                     "type":"string",                     "format":"date-time"                 }                },             "eventDateStartTime": {                 "type":"string",                 "format":"date-time"             },             "eventDateEndTime": {                 "type":"string",                 "format":"date-time"             },             "eventTicket":{                  "type":"array",                 "eventTicketType":{                     "type":"string"                  },                 "eventTicketLowPrice":{                     "type":"number"                 },                 "eventTicketHighPrice":{                     "type":"number"                  },                 "eventDatesAdvancePrice": {                     "type":"number"                 }                }         },           "performer": {             "performerID": {                 "type":"integer"             },             "performerType": {                 "type":"string"             },             "performerName": {                 "type":"string"             },             "performerAlternateName": {                 "type":"array",                 "performerAlterateNameItem":{                     "type":"string"                 }             },             "performerGenreList": {                 "type":"array",                 "performerGenreItem":{                     "type":"string"                 }             },             "performerURL": {                 "type":"string"             }                                                }     }


Are (C) object files created with different compilers binary-compatible?

I understand that C++ compilers are not compatible with each other. However, I was unable to find anything on this topic for C in particular. I know that the C standard leaves a lot of room for compilers to implement things however they see fit: for example, the size and alignment of most (all?) data types is implementation-defined save for some minimal guarantees. Therefore, two compilers (or two versions of the same compiler) can disagree on numerous details. Am I correct in thinking that there's no guarantee that two object files compiled with different compilers will actually link properly? For example, the size of pointers could be 32 bits in one object file and 64 bits in the other. But if that's so, why are C libraries sometimes distributed in precompiled form? Is there an expectation that I'll use the same compiler they did (e.g. gcc), or some _de facto_ standard being used to ensure binary compatibility? And how do other languages with a Foreign Language Interface ensure things will line up properly when linking with C object files?


Work released under creative common

I have some questions regarding creative common.I'm reading the documentation at http://creativecommons.org/licenses/by/3.0/, yet I'm still confused about these licenses. Suppose there is a company which released a database or ontology about cars on creative common, say based on this license. Suppose I use this database to create a REST API and a mobile application which uses this database or ontology. My questions are:   1. Should I release all my source codes, i.e. the REST API source codes and the mobile application source codes   2. Can I limit API calls to the web service From what I've read, I've only understand that I should publish all mods I made to the current work I took on the license


How to not take risks with new collaborators?

My team is going to add new team members and my manager doesn't want to take any risks. I don't think it's a large problem but my manager is concerned that a new programmer would sabotage and accidentally destroy parts of the code or the data e.g. cause data disaster. I say that probability is not very high but still I've been told that it's important to limit the rights of what new collaborators can do. But this is not practical and we can't eat the cake and have it - adding a collaborator to source control gives the new collaborator access to all the source code and even if there was a way to only let a new member in to parts of the source code (we're using bitbucket for source control) it still wouldn't work since technically the whole project is usually needed to build it so one can't just take a part of the code and expect it to work and able to build on independently. We're using Google App Engine and nor is it a working idea to create a clone of the app that my collaborator can build on. I said that we are not the first ones with this problem and that a solution that works for someone else should work for us but my manager seemed not satisfied with that answer. Can you comment on my situation or give concrete advice what could be done about the "problem" / scenario since it's just a scenario that a newly added developer accidentally deletes the whole datastore, but we don't want it to be possible.


How can I Tap into EF code creation in Visual Studio 2013

I'm use the Repository pattern along with EF at work. I'm wondering if there is a way for me to make an addon or somehow tap into the EF code generation of the table classes when the model is saved. So that I can automatically generate the repository stub as well. I'd also like to check if it already exists and if so not to regenerate (as the stub might have custom code for that EF type).


How to learn an API

When I find some interesting project (e.g. on GitHub) I often would like to use it and try it out to see how it works, but if there isn't a good documentation or some kind of tutorial it's hard to figure out how to use it. So my question is: how do you approach such a situation? How do you figure out which classes are important and how to chain them to put them to use? What would you look at first? An advice I found is to look at the tests (if there are any). But if there are unit tests for every class, how do you know which ones to look at first?


Creating nested functions for purely aesthetic reasons?

I've always wondered what other programmers think about the idea of creating pure aesthetic functions. Say I have a function that processes a chunk of data: `Function ProcessBigData`. Say I need several process steps, only valid for that data: `Step1`, `Step2`, `Step3`. The normal aproach I see the most in source code is to write comments like so:               Function ProcessBigData:         # Does Step1         Step1..         Step1..              #Does Step2         Step2..         Step2..      What I usually do, but always felt wrong due to the lack of such coding style by fellow peers is:               Function ProcessBigData:         Function Step1:             Step1..             Step1..              Function Step2:             Step2..             Step2..              Step1() -> Step2()      I am mainly concerned if there any drawbacks for such style in **Javascript** and **Python** Are there any alternatives that I'm not seeing?


Storing hierarchical template into a database

If this title is ambiguous, feel free to change it, I don't know how to put this in a one-liner. **Example:**   Let's assume you have a html template which contains some custom tags, like `<text_field />`. We now create a page based on a template containing more of those custom tags. When a user wants to edit the page, he sees a text field. he can input things and save it. This looks fairly easy to set up. You either have something like a template_positions table which stores the content of those fields. **Case:**   I now have a bit of a blockade keeping things as simple as possible. Assume you have the same tag given in your example, and additionally, `<layout>` and `<repeat>` tags. Here's an example how they should be used:               <repeat>       <layout name="image-left">         <image /> <text_field />       </layout>            <layout name="image-right">         <text_field /> <image />       </layout>     </repeat>      We now have a block which can be repeated, obviously. This means: when creting/editing a page containing such a template block, I can choose between a layout `image-left` and `image-right` which then gets inserted as content element (where content for `<image />` and `<text_field />` gets stored). And because this is inside a `<repeat>`, content elements from the given layouts can be inserted multiple times. How do you store this? Simply said, this could be stored with the same setup I've wrote in the example above, I just need to add a parent_id or something similiar to maintain a hierarchy. but I think I am missing something. At least the relation between an inserted content element and the origin/insertion point is missing. And what happens when I update the template file? Do I have to give every custom tag that acts as editable part of a template an identifier that matches an identifier in the template to substitue them correctly? Or can you think of a clean solution that might be better?


Why is FRACTRAN turing complete?

I've tried to google for explanation but most links only say things like "FRACTRAN is turing complete. As an example, let's look at multiplication." I remember seeing an xkcd forum post say that FRACTRAN helped the poster understand Turing Completeness. I am looking for an intuitive explanation as to why this esolang is Turing complete, as it's not very obvious looking at the language mechanics.


Algorithm to create permutations for a given alphabet based on a sequence number

I would like to have a function that will create a word (always the same word) for a given sequence number based on a given alphabet.               word(0, [a,b,c]) = a     word(1, [a,b,c]) = b     word(2, [a,b,c]) = c     word(3, [a,b,c]) = aa     word(4, [a,b,c]) = ab     word(5, [a,b,c]) = ac     word(6, [a,b,c]) = ba     word(7, [a,b,c]) = bb     word(8, [a,b,c]) = bc     word(9, [a,b,c]) = ca     ...      I was able to recursively create all permutations of a given length but starting with length 5 it already gets quite big in memory.


Should I use SignalR to synchronize & cache CRUD data to a mobile app?

I'm considering using SignalR to send data to a mobile app, but need to have a way to synchronize data while it's closed or pending updates. Is it a good idea to use Backbone.js <\--> SignalR to manage queued CRUD updates to the server? If not, what is?


Lexing: One token per operator, or one universal operator token?

When lexing, what would be the best way to tokenize operators? Would one just create a `BinaryOperator` token, or a separate token for every single binary operator? Examples: `PlusOperator`, `MinusOperator`, `DivisionOperator` ... I am tended towards having a universal one, but going from the documentations and project sources I've read the vast majority of lexers are using one token per operator. Is there a particular reason for this? Does it even matter? Does it give you any advantages?


Logging events for reporting purposes

Are there any design patterns or best practices around logging events for use in reporting and BI systems. For example in a system which manages orders from a website, it would be beneficial if a customer support worker could type in an order number and see that it the order was placed on a certain day, dispatched on a certain day and delivered on another. I can see 2 ways around this. I have an order object which has the fields:               OrderDate     DespatchDate     DeliveryDate      and populate them if they have happend otherwise they will be null OR log some sort of events like which are messages like:               Order Number - "12312312" - Ordered on '2014/01/01'     Order Number - "12312312" - Despatched on '2014/01/01'      and add store the events in a database. Are there any guidelines for this? For example how does the work item history in TFS work? ![TFS History](http://i.stack.imgur.com/TlnCP.png)


How should semi-agile team operate during management-imposed waterfall-like "testing phase"

I'm not looking for advice how agile process should work. I know that part. I'm curious what the best way to adapt the process to a typical large, well- established corporation who loves its "processes" and gate/passport reviews. For those lucky enough not to know what they are, gates/passport things are essentially waterfall milestones presented by development teams to executives: Gate 0 - kick off, identifying positive npv projects; Gate 1 - planning work for the release, coding begins, Gate 2 - code complete/testing phase, Gate 3.... While within our team we've tried to embrace agile as much as we could (peer reviews, iterations, constant communication, doing what makes sense, continuous improvement...), these gates come from way up and there's nothing we can do about them. Of many things that bug me, one of them is that the corporate environment we are in, imposes some constraints which seem to have adverse effects on how we work. One example is that during development we only focus on new features and ignore existing bugs and even introduce new bugs. This is unfortunate and goes against agile, but we have no choice since code complete could be in 2 months, but "testing/bug fixing" phase can last 6 months after that. We are under constant pressure to "finish work" but emphasis is on completing features, not getting a stable product. This part we sorta learned to live with. My question is what strategy (successful mode of operation) other teams/companies have found for the "testing" phase that follows a "code complete" milestone? During "new development" we have iterations and each one gets filled in with stories and tasks. However, currently once development is "done", there's no more iterations and no more planning. Instead, we solely use bug tracking database to monitor how many new bugs are being found and how fast the bugs are being resolved. Personally, I don't see the difference between adding new UI feature and making existing UI feature work. To me work is work. I proposed that we continue having iterations as normal and continue to schedule work as before, but neither management nor other team members seemed to be on board with that. So 1) am I way off and is bug track database the best we can do? and 2) if there's a better approach, I'd like to explore it and maybe acquire enough ammunition to take back to my boss. At the same time I somewhat agree that a lot of times when reacting to bugs we don't have the luxury of waiting till next iteration. **\--- Slight clarification based on first few responses ---** We just entered the testing phase. At the moment, there's no more stories, no more iterations. Only bug tracking database. That doesn't sit right with me, that's why I'm curious what other teams would do in this situation. Also some bugs are definitely the size of a medium size story, while other bugs would take 5 min to fix. Should 5-min bugs also become stories if we were to continue with iterations? The other argument we've been having is that during "new development" we only interact with Agile tracking tool (Rally) but in "testing" if we continue with iterations, we'd have to maintain paper trail in Rally as well as in bug tracking software.


What do ptLineDist and relativeCCW do?

I saw these methods in the Line2D Java Docs but did not understand what they do? Javadoc for `ptLineDist` says: > Returns the distance from a point to this line. The distance measured is the > distance between the specified point and the closest point on the > infinitely-extended line defined by this `Line2D`. If the specified point > intersects the line, this method returns 0.0 Doc for `relativeCCW` says: > Returns an indicator of where the specified point (PX, PY) lies with respect > to the line segment from (X1, Y1) to (X2, Y2). The return value can be > either 1, -1, or 0 and indicates in which direction the specified line must > pivot around its first endpoint, (X1, Y1), in order to point at the > specified point (PX, PY). > > A return value of 1 indicates that the line segment must turn in the > direction that takes the positive X axis towards the negative Y axis. In the > default coordinate system used by Java 2D, this direction is > counterclockwise. > > A return value of -1 indicates that the line segment must turn in the > direction that takes the positive X axis towards the positive Y axis. In the > default coordinate system, this direction is clockwise. > > A return value of 0 indicates that the point lies exactly on the line > segment. Note that an indicator value of 0 is rare and not useful for > determining colinearity because of floating point rounding issues. > > If the point is colinear with the line segment, but not between the > endpoints, then the value will be -1 if the point lies "beyond (X1, Y1)" or > 1 if the point lies "beyond (X2, Y2)".


What design pattern can I use to represent processing data from any stream?

I'm reading data from a stream in buffered series of bytes (say 1024 bytes at a time) and do some comparison, checking, or processing, before writing it back to the same type of stream. Currently data comes from file. But in the future it may come from other sources (memorymapped file, TCP etc) Is there a design pattern I can implement? Or is that not necessary?


Do I need to get permission to access a site's data or functionality programmatically?

I'm creating an application which will programmatically sent HTTP GET and POST requests to a site and processing the data received. If I want to release that application, do I have to get permission from the site's owners?


Synchronized access to network industrial equipment

I have an industrial equipment which is controlled by a software. The software connects to it using sockets, and keeps the connection all the time alive, while from time to time sending commands to the equipment. Now, this equipment is represented by a class which encapsulates the sending and receiving of data. Next, I need to make a UI, that will show the state of the equipment, independent from the controlling software (controlling is on a different thread same solution). Refresh to the UI must be done lets say every second, but it can happen that UI wants to read data, and the controlling software wants to write. The problem is that the equipment might respond from 50 ms to 1 second, we don't know, and during the response no one must interfere! How can I best synchronize calls to the equipment communication class? There might be at least 2 solutions:   1. Using simple `lock(obj) {}` statement in C#, for each method in the common. class   2. Using events and a message queue with a subscriber concept While the first one might be simple, I assume for my case is the worst solution because it can block everything. The second one seems more OK, but the problem is that there will be for sure some delay on receiving the results if many subscribers are, or dunno, I'm not really sure.


Working with Multiple Versions of Websites (Git)

I have a main template like website I have made that will allow me to quickly roll out and make new websites on demand when I need them, for my personal use. I'm wondering what is the best practice when using a Git repo is for this practice. My goal is that if for example down the road I'd like to make a change to all the sites at once, I can simply change the master (Repo) and have this change applied to all other versions of the template. Currently I have my template hosted privately on BitBucket. I'm assuming it is best to git clone the repo, and then makes changes on the clone. Then when I make changes to the template I do a git pull on the sites. Is this is the ideal approach, or are there better methods to do this?


Differences between messages and methods?

In Objective C you have the concept of sending messages to other objects, and, well this is very similar to method calling in languages like C# and Java. But what **exactly** are the subtle differences? How should I think of messaging when thinking about my code? Note: Just a bit of background here, I'm a C#/Java developer trying to understand some concepts about Objective C.


How to test a code online?

I am preparing for technical interview and would like to brush my coding skills. I have written a C++ program and would like to test it online. I don't have access to any linux compiler on my machine. Where can I do it? I have perception that I can do it in code.google.com -> Google Code Playground but I don't see where I can choose my compiler. I have written a simple C hello world program in "edit code" panel and have clicked on "Run code" but it has been a while and nothing appears in bottom output window. Please help. Thanks,


My client wants me to add background music to a site. How do I tell them this is a terrible idea?

I'm having a rather Oatmealesque experience with a particular client's website. The latest 'feature' they have requested is that background music play automatically when the site loads. What should I say to gently convince them that this is a bad idea?


Do Universal iOS Apps have more "issues" when new versions of iOS come out?

I was discussing developing an iOS App with a client and I mentioned that we should ideally have a Universal App that would perform as an iPhone App on an iPhone and as an iPad App on an iPad. The client likes the idea of an iPad-specific version of the App but prefers the idea of a separate App entirely for the iPad version. And not for some "Angry Birds/Angry Birds HD" type of reason (the App in question will be free, so there's nothing to be gained financially) but rather because "other [organizations in his industry] have told him" that "Universal Apps have more compatibility issues with older devices when new versions of the operating system [iOS] are released" and having discrete apps for this alleviates this issue. I believe he may have been referring to the concept of an App requiring a version of iOS that is more recent than the last one available on the phone. Or maybe the concept of releasing an App or an update that requires a version of iOS beyond the last one available on a device (original iPhone is stuck at 3.1.3 forever, iPhone 3G is stuck at 4.2.1 forever). But I presume you can still make a Universal App for 3.1.3 since the original iPad shipped with iOS 3.2 and Universal Apps existed before 4.0. And while I'm having a difficult time finding out what the minimum iOS version is for Apps submitted to the App Store, I presume that the original iPhone can still download and buy Apps or else the one guy in the office here who still has his OG iPhone would probably have complained more by now. But I really don't know. Do Universal Apps have more issues with compatibility on devices (and more specifically older devices) than individually developed separate (but otherwise pretty equivalent) Apps? Has anyone ever run into this?


Are 'edited by' inline comments the norm in shops which use revision control?

The senior dev in our shop insists that whenever code is modified, the programmer responsible should add an inline comment stating what he did. These comments usually look like `// YYYY-MM-DD <User ID> Added this IF block per bug 1234.` We use TFS for revision control, and it seems to me that comments of this sort are much more appropriate as check-in notes rather than inline noise. TFS even allows you to associate a check-in with one or more bugs. Some of our older, often-modified class files look like they have a comment-to-LOC ratio approaching 1:1. To my eyes, these comments make the code harder to read and add zero value. Is this a standard (or at least common) practice in other shops?


What are the different meanings of 'fixture'?

I have some difficulty understanding the concept of "fixture". I know what a test suite is, a test case, a test run, but what exactly is a "fixture"? A parameterized test case? It seems to me that the meaning or semantics of the term "fixture" can vary slightly by programming language or by testing framework? I think a _phpunit fixture_ > " _the code to set the world up in a known state and then return it to its > original state when the test is complete. This known state is called the > fixture of the test._ " is slightly different from a "fitnesse fixture", where > " _Fixtures are a bridge between the Wiki pages and the System Under Test > (SUT), which is the actual system to test_ ". Is there an expert in software testing around here who can answer this question? References to other programming languages are welcome. **Updates:** I'll add more definitions of _fixture_ here as when I encounter new ones. That'll be fun. Alternative definitions   * (anything that implements the ITestFixture interface) Source: sqa


Functional metrics in Agile methodologies

I'm preparing a presentation about Agile methodology for managers (not programmers) and I'm looking that, from a side, the Agile talks about **functional perspective*^ (in Scrum we have _planning game_ ) but, from other side, it lacks any (standard) definition of **functional measure**. In my opinion it's strange: how I can give a magnitude of effort by functional needs of user if Agile methodology doesn't use a formal/univocal definition of **functional needs** and doesn't adopt any formal functional measurement (Function Point, COSMIC). If you have played to _planning game_ or _User Story_ , what was your measure unit? Have you used the FP or COSMIC?


Essential roles for web application team

Some friends of mine came up with an idea for a web application which we (so far) think could be great. I made the analysis and all the early stages of the development process and I'm about to start the coding. I'm talking about something that is barely a mid-level project, so I consider one developer (myself) should be enough. The thing is that we are trying to assign roles to each one of us so we can be focused on our duties and have clear our responsibilities within the team. We are a crew of four people, three of us (my friends) are business people who would do the marketing, customer relationship, management and accounting stuff and I'm basically the developer. I have in mind to get them involved into the development process by giving them documentation to write and use them as testers, all of that besides the management duties they have. Perhaps someone out there have been in the same situation, so I would appreciate if the experience is shared so we can effectively give ourselves positions in the project based on what I explained above. Which are the essential roles or the optimal team layout so the idea can be developed successfully? The question is not strictly about programming, but it's related to build a software entrepreneurship beyond the code, that is something that I'm sure plenty of us are looking. Any help is really appreciated! Regards.


Guidelines About Using Code Repository

I'd like to have some suggestions about using code repository. I don't need to know how to check out or how to check in or how to create a branch. What I need to know is, how to maintain the repository tree or how to structure it for optimal usage. For example, for a given project, when to create a branch? Where to create a branch with respect to the project's location? What should be done when one or more than one developer are working on same project but different features? When to merge? Where goes the bug fix? How the QA team should checkout a specific version? Etc.


I'm working on a PaaS similar to Heroku or Google App Engine, and was curious which pricing structure users prefer. Ideas?

My current project is a cloud deployment platform similar to GAE or Heroku. I'm trying to figure out what pricing method works best for us and the users. Assuming that I cannot _currently_ provide a free plan, here are the options: 1) Have fully unlimited scaling (GAE-like), and charge for usage ($5 per project + x cents per CPU hour the project uses on our system, also charge a certain amount for bandwidth in/out, database storage + I/O, r/w data store, memcached, etc.) This ends up being cheaper (around $20 for a moderately loaded website) and more "fair" for the user (pay **only** for what you use), but much more complicated with the many different factors that affect final price. This type of architecture is more resilient to what you throw at it, so if you get a traffic spike, it will work perfectly fine, you'll just get charged more. 2) Pay for "application readiness"/specific scalability (have a specific amount of processes per user available to accept requests, maybe $20 a month (3 cents per hour) per process), and for a specific tier of a database. No bandwidth/IO charges (within fair use, of course). Add-ons like email and memcached are extra. (Heroku-like) This option is a lot more simple, and much easier to project costs on. However, the pricing curve is rather steep. You do end up likely paying more (probably $40-$60 a month for a moderately-loaded website), but all of those miscellaneous costs are completely abstracted. Which would you more likely pay for? Also, is there another option I may be overlooking?


The nature of callbacks in Node.js

In the plain javaScript world I've learned that nested functions can be problematic because the inner function is "re-created" every time the outer function is called:               function outer(a) {         function inner(arg1,arg2){             return arg1 + arg2;         }         return inner(a, 6);     }     myVar = outer(4);      Apparently the inner function is garbage collected and the constant re- creation of it has a cost on performance. This could be re-factored as:               function inner(arg1, arg2) {         return arg1 + arg2;     }          function outer(a) {         return inner(a, 6);     }          myVar = outer(4);      If I am correct it seems that the tradeoff lies in the changing scope of inner; the fact that function inner no longer has access to outer's own variables. If I am correct so far, lets move to Node.JS. Node is heavy on callbacks, and my question is, are asynchronous callback functions typical in Node also "re-created" every time they are fired? Take the following common Node construct:               http.createServer(function (req, res) {         res.writeHead(200, {'Content-Type': 'text/plain'});         res.end('Hello World\n');     }).listen(1337, '127.0.0.1');      In reality the function can get pretty large; it can encompass a lot of functionality. Is the above callback "re-created" every time a client GETs or POSTs the server? If so, would it be better to always de-couple the callbacks as in the plain javaScript example:               function handleGET(req, res) {        res.writeHead(200, {'Content-Type': 'text/plain'});        res.end('Hello World\n');     }          http.createServer(handleGET).listen(1337, '127.0.0.1');      as a related bonus question, are event functions re-created too? Would they benefit from prior declaration?               myObj.on('someEvent', function someFunction() {...});      vs.               function someFunction() {...}     myObj.on('someEvent', someFunction);


The number of years experience needed to be a contract developer

Suppose you are a programmer in your mid-20's who has had several years industrial experience working for both big tech and a few internet startups but now you'd like to try contracting in the hope you'll be able to choose more interesting and varied work and be able to have a few months off between jobs to focus on things like open source, travelling and developing your own startup ideas. Now this is possibly one of those 'grass is greener' daydreams.. Even if in the workplace you manage to have the enthusiasm and skill to work equally alongside much more experienced co-workers, how realistic do you think it would be for someone with too few years of experience to appear 'specialist' or 'experienced' to compete for contracts and afford to live this lifestyle?


C/C++: Which conversion warnings make sense in practice?

C/C++ implicit conversions can cause bugs. Here's one example:               int foo, bar;     scanf("%d", &foo);     scanf("%d", &bar);     float foobar = foo / bar;      If I input `7` and `2`, it's not `3.5` as expected - it's `3` -> bug (let's ignore the buffer overflow). gcc's `-Wconversion` warns about this kind of stuff, so I turned it on. But it just seems to me like it's going over the top with the warnings. For instance, this:               int foo;     float bar;     scanf("%d", &foo);     scanf("%f", &bar);     float foobar = foo / bar;      Causes a warning:               warning: conversion to 'float' from 'int' may alter its value [-Wconversion]      Even though it works as intended, returning `3.5` when I input `7` and `2`. I know that float cannot represent all possible int values precisely, but I'm questioning if adding a cast here does anything to help - other than adding more code. In the example above, casting one of the int values in the expression to float actually changed the result, replacing an implicit cast by an explicit one in this example doesn't. So much for float to int conversion warnings, but that's not all. There's also sign conversion warnings. Traditional example:               std::vector<char> chars = get_chars();     for (int i = 0; i < chars.size(); i++)         std::cout << chars[i] << std::endl;      Causes this warning:               warning: comparison between signed and unsigned integer expressions [-Wsign-compare]      I could use the more cumbersome `unsigned int` for the index variable instead - which will require further casting when I do calculations with it. All for the unusual situation that I have between `2^31 + 1` and `2^32` elements in my vector and don't do any calculations with the index variable that cast it to int. So, my question is: Which conversion warnings make sense in practice? Does adding explicit casts to fix them really improve anything?


How to figure out how to write a program

I have a program that i need to do. I know what the program should do, but i dont know how to approach making it What is the best way to arrange my ideas and thoughts, layout the what the program should do, aproach doing it correctly and transform my thoughts and ideas into code?


Switching to a career in Machine Learning

My day job is plain old software development. I am also doing my Masters in CS (part time, course based). I took a course on AI and found machine learning quite fascinating but like most courses it only offered a basic intro. I intend to learn more about Machine Learning and if possible get a job in that field. When I look at job postings in this field it is clear that a Phd in Machine learning (or prior experience in the field with considerable expertise) is required for most of them. I'm looking for advice on self learning to gain experience that'll useful in industry. At least, enough experience to get my foot in. I will do the obvious ones like reading text books, papers etc. Perhaps any open source efforts that I can participate in or something I could do on my own? Apologies if I'm being vague here but I hope there are at least a few of you who done a similar switch and can advise. Thanks !


Best design for a "Command Executer" class

Sorry for the vague title, I couldn't think of a way to condense the question. I am building an application that will run as a background service and intermittently collect data about the system its running on. A second Android controller application will query the system over tcp/ip for statistics about the system. Currently, the background service has a tcp listener class that reads/writes bytes from a socket. When data is received, it raises an event to notify the service. The service takes the bytes, feeds them into a command parser to figure out what is being requested, and then passes the parsed command to a command executer class. When the service receives a "query statistics" command, it should return statistics over the tcp/ip connection. Currently, all of these classes are fully decoupled from each other. But in order for the command executer to return statistics, it will obviously need access to the socket somehow. For reasons I can't completely articulate, it feels wrong for the command executer to have a direct reference to the socket. I'm looking for strategies and/or design patterns I can use to return data over the socket while keeping the classes decoupled, if this is possible. Hopefully this makes sense, please let me know if I can include any info that would make the question easier to understand.


What is the best strategy for licensing a desktop application using a web service, when all I need to know is when people use the product?

Our company's main application is a desktop program that is used at warehouses and written in C# and Windows Presentation Forms. The next thing we want to be able to do is track when customers open up the application and when it is being used. The reason for this is so we can charge them per month, based on if they are/arn't using the application. My boss is having me research different ways to "license" the product under these requirements. Not having any experience doing this, a few things come to mind. I could create a web application that runs on a server, and every time the desktop application is opened and the user logs in, the application connects to the server and marks a database with the DateTime. Or is there licensing software that I can use to accomplish this? Just looking for tips/advice from people who have experience with this type of stuff.


How to discriminate from two nodes with identical frequencies in a Huffman's tree?

Still on my quest to compress/decompress files with a Java implementation of Huffman's coding (http://en.wikipedia.org/wiki/Huffman_coding) for a school assignment. From the Wikipedia page, I quote: >   * Create a leaf node for each symbol and add it to the priority queue. >   * While there is more than one node in the queue: >     * Remove the two nodes of highest priority (lowest probability) from the > queue >     * Create a new internal node with these two nodes as children and with > probability equal to the sum of the two nodes' probabilities. >     * Add the new node to the queue. >   * The remaining node is the root node and the tree is complete. > Now, emphasis: >   * **Remove the two nodes of highest priority (lowest probability) from the > queue** >   * **Create a new internal node with these two nodes as children and with > probability equal to the sum of the two nodes' probabilities.** > So I have to take two nodes with the lowest frequency. What if there are **multiple nodes with the _same_ low frequency**? How do I discriminate which one to use? The reason I ask this is because Wikipedia has this image: ![enter image description here](http://i.stack.imgur.com/2yhN2.png) And I wanted to see if my Huffman's tree was the same. I created a file with the following content:               aaaaeeee       nnttmmiihhssfffouxprl      And this was the result: ![enter image description here](http://i.stack.imgur.com/DNOwz.png) Doesn't look so bad. But there clearly are some differences when multiple nodes have the same frequency. My questions are the following:   * What is Wikipedia's image doing to discriminate the nodes with the same frequency?   * Is my tree wrong? (Is Wikipedia's image method the one and only answer?) I guess there is one specific and strict way to do this, because for our school assignment, files that have been compressed by my program **should be able to be decompressed by other classmate's programs** \- so there must be a "standard" or "unique" way to do it. But I'm a bit lost with that. My code is rather straightforward. It literally just follows Wikipedia's listed steps. The way my code extracts the two nodes with the lowest frequency from the queue is to iterate all nodes and if the current node has a lower frequency than any of the two "smallest" known nodes so far, then it replaces the highest one. Just like that.


What is the most performant CSS property for transitioning an element?

I'm wondering whether there is a performance difference between using different CSS properties to translate an element. Some properties fit different situations differently. You can translate an element with following properties: `transform`, `top/left/right/bottom` and `margin-top/left/right/bottom` In the case where you do not utilize the `transition` CSS property for the translation but use some form of a timer (`setTimeout`, `requestAnimationFrame` or `setImmediate`) or raw events, which is the most performant–which is going to make for higher FPS rates?


Programming and Ubiquitous Language (DDD) in a non-English domain

I know there are some questions already here that are closely related to this subject but none of them take Ubiquitous Language as the starting point so I think that justifies this question. For those who don't know: Ubiquitous Language is the concept of defining a (both spoken and written) language that is equally used across developers and domain experts to avoid inconsistencies and miscommunication due to translation problems and misunderstanding. You will see the same terminology show up in code, conversations between any team member, functional specs and whatnot. So, what I was wondering about is how to deal with Ubiquitous Language in non- English domains. Personally, I strongly favor writing programming code in English completely, including comments but ofcourse excluding constants and resources. However, in a non-English domain, I'm forced to make a decision either to:   1. Write code reflecting the Ubiquitous Language in the natural language of the domain.   2. Translate the Ubiquitous Language to English and stop communicating in the natural language of the domain.   3. Define a table that defines how the Ubiquitous Language translates to English. Here are some of my thoughts based on these options: 1) I have a strong aversion against mixed-language code, that is coding using type/member/variable names etc. that are non-English. Most programming languages 'breathe' English to a large extent and most of the technical literature, design pattern names etc. are in English as well. Therefore, in most cases there's just no way of writing code entirely in a non-English language so you end up with mixed languages anyway. 2) This will force the domain experts to start thinking and talking in the English equivalent of the UL, something that will probably not come naturally to them and therefore hinders communication significantly. 3) In this case, the developers communicate with the domain experts in their native language while the developers communicate with each other in English and most importantly, they write code using the English translation of the UL. I'm sure I don't want to go for the first option and I think option 3 is much better than option 2. What do you think? Am I missing other options? **UPDATE** Today, about year later, having dealt with this issue on a daily basis, I have to say that option 3 has worked out pretty well for me. It wasn't as tedious as I initially feared and translating in real time while talking to the client wasn't a problem either. I also found the following advantages to be true, based on my experience.   * Translating the UL makes you pay more attention to defining the UL and even the domain itself, especially when you don't know how to translate a term and you have to start looking through dictionaries etc. This has even caused me to reconsider domain modeling decisions a few times.   * It helps you make your knowledge of the English language more profound.   * Obviously, your code is much more pleasant to look at instead of being a mind boggling obscenity.


How to make a license apply to a whole library?

I'm creating a standard library for a programming language, and I'd like to license each and every single class or function in there under the MIT license, so they're completely FOSS. All of the files reside in a single directory. Would it be enough to put a LICENSE.txt file in the same directory, containing the MIT license? Do I need to say that the following license applies to all features of the library, or is the library itself considered to be a program?


How fundamental to good development is BDD?

I am learning to be a web developer and am using rails. I have read lots of advice and books on the subject and am trying to build my own app, so learning by doing. My question is about that learning journey and the path to take. I have been convinced that BDD is a very sensible and helpful way to develop so I am studying this technique. I am using Cucumber and RSpec and am working through the RSpec book and the Cucumber book. I have now reached a point of total frustration though as I try to write features and steps because I don't know how to use rails or write code. I am new to it but wanted to make sure I built in the good habits as I learn. If I make BDD the way I code from the beginning it will be second nature to me once I am an experienced developer, but because of how slowly I am progressing and how lost I am I am thinking I should scrap BDD for now and just learn the framework. But them I am in the habit of not writing tests as I go and getting lazy. What are your experienced feelings on this matter? Should I keep plugging away at the BDD tests to build good habits? Or am I putting to much importance on it? Thank you for advice,


Pseudocode for an echo using recursion

Using pseudocode, what would the code for an echo using recursion be? UPDATE: Appears I should have been more clear. By echo I mean the pattern sound exhibits when it echos, not echo as in repeatly add one to self where self equals zero. Any thought on what the code would look like for a "real" echo? For example, I'd thought about "echo(reduce-volume();exit-if- silent;echo())" but was sure if the logic made sense. UPDATE-2: Working through my own logic above an noticed it lacks a way to account for "positive feedback", which I'm guessing is required. http://en.wikipedia.org/wiki/Positive_feedback


SQL RDBMS : one query or multiple calls

After looking around the internet, I decided to create DAOs that returned objects (POJOs) to the calling business logic function/method. For example: a Customer object with a Address reference would be split in the RDBMS into two tables; Customer and ADDRESS. The CustomerDAO would be in charge of joining the data from the two tables and create both an Address POJO and Customer POJO adding the address to the customer object. Finally return the fulll Customer POJO. Simple, however, now i am at a point where i need to join three or four tables and each representing an attribute or list of attributes for the resulting POJO. The sql will include a group by but i will still result with multiple rows for the same pojo, because some of the tables are joining a one to many relationship. My app code will now have to loop through all the rows trying to figure out if the rows are the same with different attributes or if the record should be a new POJO. Should I continue to create my daos using this technique or break up my Pojo creation into multiple db calls to make the code easier to understand and maintain?


Is there a perf hit using mule as a container vs. standard JEE container like Weblogic?

Our team is considering using Mule in a large scale medium volume internal facing transactional banking application. At first Mule would just be used as an application server although it is possible some of its esb/orchestration features would be used in the future. I have no experience with mule, being new on the team. But my gut says Mule would not be as performant as Weblogic or Glassfish as a deployment container. Does anyone have any comparison stories to share that might shed light?


Can one always design for scale out?

When designing an application where scalability is going to be important, it would be useful if the application could be designed to "scale out" on cheap commodity servers. However, there are many scale up applications (see my previous question). Is it always _possible_ to design an application to scale out, or do some requirements make scale out impossible, even if all software can be designed from scratch and no legacy software is involved? I am looking for cases where scale out is an inferior solution to scale up, and where good application design could not mitigate this. In other words, the application _cannot_ be designed to scale out effectively, no matter how hard one tries. I am _not_ looking for cases where legacy software or data structures -- or even entire architectures (as in the answer to the previous question) -- were not designed to scale out and could not be changed. Alternatively, if there is reason to believe that one can _always_ scale out, if the application is well designed, I would love to know that as well. Edit: I am looking for an explicit example of such a system, if there is one.


Distinguishing between UI command & domain commands

I am building a WPF client application using the MVVM pattern that provides an interface on top of an existing set of business logic residing in a library which is shared with other applications. The business library followed a domain-driven architecture using CQRS to separate the read and write models (no event sourcing). The combination of technologies and patterns has brought up an interesting conundrum:   * The MVVM pattern uses the command pattern for handling user-interaction with the view models. .NET provides an ICommand interface which is implemented by most MVVM frameworks, like MVVM Light's RelayCommand and Prism's DelegateCommand. For example, the view model would expose a number of command objects as properties that are bound to the UI and respond when the user performs actions like clicking buttons.   * Many implementations of the CQRS use the command pattern to isolate and encapsulate individual behaviors. In my business library, we have implemented the write model as command / command-handler pairs. As such, when we want to do some work, such as create a new order, we 'issue' a command (CreateOrderCommand) which is routed to the command-handler responsible for executing the command. This is great, clearly explained in many sources and I am good with it. However, take this scenario: > I have a ToolbarViewModel which exposes a CreateNewOrderCommand property. > This ICommand object is bound to a button in the UI. When clicked, the UI > command creates and issues a new CreateOrderCommand object to the domain > which is handled by the CreateOrderCommandHandler. This is difficult to explain to other developers and I am finding myself getting tongue-tied because everything is a command. I'm sure I'm not the first developer to have patterns overlap like this where the naming/terminology also overlap. **How have you approached distinguishing your commands used in the UI from those used in the domain?** (Edit: I should mention that the business library is UI-agnostic, i.e. no UI technology-specific code exists, or will exists, in this library.)


What is minimalistic setup for Agile Development for a small team?

I have 10 developers and 3 Testes team and I want to setup CruiseControle as CI for automated builds, tests and deployment to production server and some repository for SCM ( Source Code Management). I need something that would enable the team lead to create tickets (tasks) for each sprint in SCRUM and issue/bug tracking and task time tracking. I want to use simplest possible solution that just gets the job done with the minimum requirements specified in this SO question. I do not want to use heavy weight or feature rich software ( either free or costly), just the simplest possible setup. Each developer is using Eclipse STS IDE. So it must be something that is integrated into STS (like available as STS plugin, again to keep things as simple as possible). This is for development of Java web application.


What's so special about x64 and programming x86?

I know this is a little funny question, but I didn't have the chance to realize what makes any difference when programming x64 or x86 at high level languages (.NET for instance). Any explanations would be appreciated.