Why are weakly-typed languages still being actively developed?

I wonder why are weakly-typed languages still being actively developed. For example, what benefit can one draw from being able to write               $someVar = 1;     (...)  // Some piece of code     $someVar = 'SomeText';      instead of using the much different, stongly-typed version               int someInt = 1;     (...)     string SomeString = 'SomeText';      It is true that you need to declare an aditional variable in the second example, but does that really hurt? Shouldn't all languages strive to be strongly-typed since it enforces type-safety at compile time, thus avoiding some pitfalls in type-casting?


Why don't we use a class and its static members to do what a singleton does?

In Java,C++,Objective C, C#, and all other similar OOP languages, Why don't we use a class with static methods and vars instead of going through a singleton syntax having to deal with various scenarios ?


Which user-story estimation technique is better?

I found two techniques for estimating user stories:   1. by the size of the story, which is unit-less   2. by the time estimate, which is measured by days The first uses relative comparison between stories to infer time, and it should be independent on developer experience, while the second depends on developer experience. I tried the first which is good, but I believe the second is more developer- friendly, and I want to see the pros and cons of each of them from practical experience. Any idea?


How can a developer evaluate the effectiveness of his workflow?

This question has been on my mind for probably 10 years. Ever since I've started programming for a living. And I've seen multiple discussions about good fit, distractions, being in the zone, etc. But I haven't seen links to some information/research that could give an objective self evaluation measure/tool to understand how you're really doing. What constantly bugs me, is that I think I'm not spending enough time on coding, and the effective work hours are not 8 out of 8, but less, with some days being even super ineffective, exactly like in this article. There are some metrics expressed as lines of code per day, with some sources quoting 1.5 being good and some sources indicating 500 per day being normal, but this again, is completely invalid metric as far as I can see. So at the end of the day, you have an assignment, you do it, but part of the time evaporates in sort of like "wth I was doing" kind of way. Emails, just staring at the code, thinking, painting a mental picture of the code in your head, floating somewhere, rethinking how things could have done more effectively, etc. And because of that, I'm never sure if I need to do something ASAP, to keep the raises coming, or am I paranoid, or is it just normal. The only half-good measure I've found so far, is seeing the amount of code other developers produce-vs-code I produce. And that usually floats around same number. But when I look at my code, or others code I still always get a feeling it could be done 10x faster. Then again, code crunching doesn't seem to work, or does seem to cause a burnout if not handled properly. So do you know of a good self evaluation approach to see if you're ineffective/effective? How do you weight the work you've done?


How to deal with variables when extracting methods in to smaller methods?

This is an abstract question to clarify a refactoring concept in the ruby language. Assume in the real world that there would be many more variables and method in the Furniture Class and Refinish method. I have a Class called Furniture. It has a method called '`refurnish(VarnishToUse, TimeToTake)`'. This method has               varnish_cost = Varnish(VarnishToUse).price * TimeToTake      I want to extract out the cost calculation into               def VarnishCost       price * TimeToTake     end      then the Furniture class can just have:               def Refurnish(VarnishToUse)       varnish_cost = VarnishCost(VarnishToUse)     end      How do I pass in the VarnishToUse into VarnishCost? Should the method be               def VarnishCost(Varnish)     ...     end      or should I be setting an instance variable `@varnish = VarnishToUse` in the Refinish class and then just expect that instance variable to be available in the VarnishCost method as I showed above? Does it make a difference if the other method is private? protected? I am looking to minimize the use of variables and multiple responsibilities for a class (SRP).


Suitable vocabulary when helping novice programmers

I find myself aiding novice programmers relatively often; explaining why their code won't work when they ask, suggesting solutions and the like. The people I'm helping do have a formal education in programming from a first-year degree-level module, in Java, but I feel like I can't communicate with them very well. For example: one might write a function but not understand why it isn't executed, not realising they forgot to call it. If I use phrases like `"(make a) call (to) the function/it"` and `"pass it the.."` I get blank looks. My normal process then would be to find some place in their code where they call a function from the language, and tell them they can call their own functions in the same way as they called this other function. Sometimes even that gets blank looks. **Are there other pieces of vocabulary that are more suited to (better for?) helping novice programmers? Or is this not an issue of communication?**


Why would a language let programmer to handle divison by zero

This happens in Javascript, for example, that division by zero is not handled by the language itself. Is there's a valid reason for this? I see this as a very basic exception that a language should be able to handle (they even handle 0/0 as NaN NaN). > or take the square root of a negative number or use arithmetic operators > with non-numeric operands that cannot be converted to numbers.


Best way of Javascript web development in Netbeans (Hot deployment)

I'm beginning Javascript development and as a beginner in JavaScript I make a lot of mistakes. The way I'm developing is very counter-productive because every mistake I fix I have to shutdown Glassfish, re-build the app and re- deploy it. My app is a Java back-end with REST services and the Html, JavaScript, CSS for the frontend. Everything is packed in a .ear file. As of right now, I'm just working with the frontend but I do have to make this whole process to update the files. My question is ... is there a better way of doing this? Can somebody tell how do you guys work in a similar setup to do the everyday development?


Is it possible to efficiently store all possible phone numbers in memory?

Given the standard North American phone number format: (Area Code) Exchange - Subscriber, the set of possible numbers is about 6 billion. However, efficiently breaking down the nodes into the sections listed above would yield less than 12000 distinct nodes that can be arranged in groupings to get all the possible numbers. This seems like a problem already solved. Would it done via a graph or tree?


What would Business Intelligence (BI) developers look for in code reviews?

Let me preface this with saying I am **_not_** a Business Intelligence (BI) developer. I'm a .NET developer, and I have only a vague notion of what BI is, and encompasses. I've been an evangelist for a secure development lifecycle in our company, and recently convinced the rest of the development team that we should be doing peer reviews including...   * Requirements Reviews   * Code Reviews   * Architecture/design reviews   * Documentation Reviews The .NET team does code reviews and we look for various things - general overview:   * Maintainability (clear design, adequately documented, etc.)   * Code clarity (standard .NET coding/naming guidelines)   * Security (scanning for failures to sanitize input, prevent SQL injection, etc)   * Functionality (does it do what it's supposed to)   * Usability   * Performance At any rate, our Business Intelligence developers don't really do the same type of coding/development that we do for websites, windows apps, etc. Our templates/checklists don't really apply to them. Since I've been the one trying to evangelize and get everyone do start doing peer reviews, they asked me for advice on what types of things they should be looking for. I could probably guide them and help them to develop their own checklists by asking questions about what can go wrong, what is important to them, etc., but I thought I'd ask and see if anyone is aware of established guidelines for doing "code reviews" for BI developers. I'll also take, from BI people "What would you look for in evaluating another BI developer's work?".


Coding a web browser on Windows using a layout engine?

I've never attempted anything like this before but what I want to do is code a browser for Windows. I know that I can use the web-browser control that Microsoft has released, but I'm interested in seeing how the problem is solved from a lower level. So I want to know what layout engine I should be looking at? Or is a layout engine the best way to go? I've been looking at WebKit, but it seems rather Mac-centric, so I'm wondering if there are any more practical one's for windows? Has Microsoft released the source code for their webbrowser winforms control in the .Net framework? That would be dependent on the CLR anyway, I suppose? Any suggestions?


Git: Pushing to a remote repo from a remote repo?

I have a destination repo that is remote and I have a source repo that is also remote. I would like my local machine to act as a proxy to allow me to push to the destination from the source without ever download the repo to my machine. Is this possible?


Why are threads called threads?

I understand that a process a unit of resource ownership and executable instructions. Threads allow a process to share its resources with multiple executions, and it's easier for an OS to schedule threads because of all the overhead associated with whole processes. But why the name _thread_? Does it have some reference to _string_ or the interleaving of execution? Even so, this isn't an intuitive term in my opinion.


Is database based chat room bad idea?

Most of simple "group chat" systems are based on local file storage logs (e.g. _log.txt_ ). I'm developing a simple group chat (under 20 users simultaneity ) with jQuery/AJAX. So basically, client-side code loads log from server **every second**. It needs to be fast. In database system (PHP/MySQL) that would mean MySQL query every second. Is that overload for server (shared hosting)?


Managing child worker thread list

After so much research, I thought I should ask the experts. I am working on a project for my corporate employer, we have android and iPhone mobile apps that make request to a web service, the request is logged in pending state for processing. A windows service retrieves the pending requests and spins a new thread for every request. This is because the request could be directed to different providers who process request in different manners. One could immediately process the request and return feedback, others could receive the request and take up to 30 seconds to return a feedback which you have to poll for the status. The mobile app will also be polling for the status of the request. Now my challenge is: I am thinking of creating a list of threads say 100 and assign each thread to execute a request, once finished the thread will be recreated and assigned a new request. It is a high response based platform so I am thinking of not using ThreadPool. Is it advisable to spin new threads in a fire and forget sequence or manage these list of threads and if it is to managed, then what is the best approach to manage these list of threads and ensure high performance in C# as the mobile apps will be polling for a response.


How to handle editing a large file for a non-technical user

I have a client who is given a tab delimited .txt file containing hundreds of thousands of rows. I have a user story as follows: > As a user I want to take the text file and add a new value at the end of > each line which contains the concatenated value of two of the columns. for example if the file read               text_one    text_two      I need to output the following (preferably to a .txt file)               text_one    text_two    text_onetext_two      My first approach was to ask the vendor supplying the file to do the concatenation before providing the file, the easiest way to solve a problem is to eliminate it right? however they are very uncooperative and have point blank refused. I've looked at building a simple javascript application that does this client side so a non-technical user could select the file using a file selector. This approach has a few problems   * The file could be over a GB in size and so can't be loaded straight into memory, I've tried and the browser crashes   * There is no means to write a file in javascript so I'd need to output the content to the screen and have the user save it (somehow) I was thinking if I could get around the filesize limitations I could just output the edited content to the page and have the user save the page as a .txt file, however I think there is a better way than using javascript that will still accommodate the users lack of technical know-how. Please consider this question to be stack agnostic, but bear in mind that a nice little shell script or python script would be deemed unsuitable for a non technical user unless there is a way of "packaging" it nicely for a non- technical user. ## Updates The file is too large to open in excel. The process needs to be run weekly, but it doesn't require scheduling or automation...(yet)


Is Java's ElementCollection Considered a Bad Practice?

From my understanding, an ElementCollection has no primary key, is embedded with the class, and cannot be queried. This sounds pretty hefty, but it allows me the comfort of writing an enum class which also helps with internationalization (using the enum key for lookup in my ResourceBundle). **Example:** We have a user on a media site and he can choose in which format he downloads the files ![](http://s9.postimg.org/9y69wyfin/Database.png)               @Entity     @Table(name = "user")     public class User {             /* snip other fields */              @Enumerated         @ElementCollection(                 targetClass = DownloadFilePreference.class,                 fetch = FetchType.EAGER         )         @CollectionTable(name = "download_file_preference",             joinColumns = @JoinColumn(name = "user_id")         )         @Column(name = "name")         private Set<DownloadFilePreference> downloadFilePreferences = new HashSet<>();     }          public enum DownloadFilePreference {         MP3, WAV, AIF, OGG;     }      This seems pretty great to me, and I suppose it comes down to "it depends on your use case", but I also know that I'm quite frankly only an initiate when it comes to Database design. Some best practices suggest to never have a class without a primary key- even in this case? It also doesn't seem very extensible- should I use this and gamble on the chance I will never need to query on the FilePreferences?


What functionality should a (basic) mock framework have?

If i would start on writing a simple Mock framework, then what are the things that a basic mock framework MUST have? Obviously mocking any object, but what about assertions and perhaps other things? When I think of how I would write my own mock framework then I realise how much I really know (or don't know) and what I would trip up on. So this is more for educational purposes. Of course I did research and this is what i've come up with that a minimal mocking framework should be able to do. Now my question in this whole thing is, am I missing some important details in my ideas? * * * # Mocking   * **Mocking a class:** Should be able to mock any class. The Mock should preserve the properties and their original values as they were set in the original class. All method implementations are empty.   * **Calls to methods of Mock:** The Mock framework must be able to define what a mocked method must return. IE: `$MockObj->CallTo('SomeMethod')->Returns('some value');` # Assertions To my understanding mocking frameworks also have a set of assertions. These are the ones I think are most important (taken from SimpleTest).               expect($method, $args)             Arguments must match if called     expectAt($timing, $method, $args)    Arguments must match when called on the $timing'th time     expectCallCount($method, $count)       The method must be called exactly this many times     expectMaximumCallCount($method, $count)     Call this method no more than $count times     expectMinimumCallCount($method, $count)     Must be called at least $count times     expectNever($method)           Must never be called     expectOnce($method, $args)  Must be called once and with the expected arguments if supplied     expectAtLeastOnce($method, $args)  Must be called at least once, and always with any expected arguments      * * * And that's basically, as far as I understand, what a mock framework should be able to do. But is this really everything? Because it currently doesn't seem like a big deal to build something like this. But that's also the reason why I have the feeling that i'm missing some important details about such a framework. So is my understanding right about a mock framework? Or am i missing alot of details?


Design pattern for client/server sessions?

Are there any common patterns or general guidance I can learn from for how to design a client/server system where the both the client and server must maintain some kind per-client session state? I've found any number of libraries that can help with some of the plumbing, but it's the overall design I'm wondering about. Open issues in my mind:   * How to structure the client/server communication so that bidirectional synchronous and asynchronous requests are possible?   * The server side needs to spawn a couple of per-connected-client session-long helper process. How to manage that?   * How to manage the mapping from a given client (and any of it's requests) to server state and helper process instances in the face of multiple clients and intermittent network connectivity.   * Most communication can be simple blocking request/reply, but some will be long running processing tasks that the client will want to keep tabs on. To the extent that it matters, the platform is Linux/C/C++. Not web based. Just an existing thick-client software app being modified to talk to backend servers for some tasks.


Licensing a collaborative research project

I am involved with an international research project which involves many different universities, national labs, and companies. The project is developed by national grants and in-kind support. One task in the project is to develop code to streamline workflow in our domain (energy simulation) by scripting common pre- and post-processing tasks for different tools. We want this code to be freely distributable to the simulation community. How can we ensure that this effort is digestible by the legal departments of these different parties such that the people involved can freely code?


Unit testing time-bound code

I'm currently working on an application that does a lot of time-bound operations. That is, based on `long now = System.currentTimeMillis();`, and combined with an scheduler, it will calculate periods of time that parametrize the execution of some operations. e.g.:               public void execute(...) { // executed by an scheduler each x minutes         final int now = (int) TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());         final int alignedTime = now - now % getFrequency() ;         final int startTime = alignedTime - 2 * getFrequency();          final int endTimeSecs = alignedTime - getFrequency();          uploadData(target, startTime, endTimeSecs);     }      Most parts of the application are unit-tested independently of time (in this case, `uploadData` has a natural unit test), but I was wondering about best practices for testing time-bound parts that rely on `System.currentTimeMillis()` ?


Is 'Protection' an acceptable Java class name

This comes from a closed thread at stack overflow, where there are already some useful answers, though a commenter suggested I post here. I hope this is ok! I'm trying my best to write good readable, code, but often have doubts in my work! I'm creating some code to check the status of some protected software, and have created a class which has methods to check whether the software in use is licensed (there is a separate Licensing class). I've named the class 'Protection', which is currently accessed, via the creation of an appProtect object. The methods in the class allow to check a number of things about the application, in order to confirm that it is in fact licensed for use. Is 'Protection' an acceptable name for such a class? I read somewhere that if you have to think to long in names of methods, classes, objects etc, then perhaps you may not be coding in an Object Oriented way. I've spent a lot of time thinking about this before making this post, which has lead me to doubt the suitability of the name! In creating (and proof reading) this post, I'm starting to seriously doubt my work so far. I'm also thinking I should probably rename the object to applicationProtection rather than appProtect (though am open to any comments on this too?). I'm posting non the less, in the hope that I'll learn something from others views/opinions, even if they're simply confirming I've "done it wrong"! EDIT: Thanks for all the responses, which have been all been helpful. I think 'Protector' fits the bill perfectly, as the class checks the license, and acts accordingly.


Automated tests for differencing algorithm

We are designing a differencing algorithm (based on Longest Common Subsequence) that compares a source text and a modified copy to extract the new content (i.e. content that is only in the modified copy). I'm currently compiling a library of test case data. We need to be able to run automated tests that verify the test cases, but we don't want to verify strict accuracy. Given the heuristic nature of our algorithm, we need our test pass/failures to be fuzzy. We want to specify a threshold of overlap between the desired result and the actual result (i.e. the content that is extracted). I have a few sketches in my mind as to how to solve this, but has anyone done this before? Does anyone have guidance or ideas about how to do this effectively?


Simulating a projector in openGL

I wish to simulate a projector screen in OpenGL, where an image is truly being projected onto the wall in real time. By this I mean if an object were to get in between the projector and the wall, that portion of the image will appear on the obstructing object. Is this functionality possible in OpenGL? And what technolgies/libraries can I implement to facilitate this development?


COM INTEROP Support - which is better? C# or VB

I keep hearing that c# is "better" than vb... but as far as I can see, aside from syntactical differences, both compile down to the same IL. I've found some good articles by googling that explain what the differences are between the two and so I feel comfortable in "diffusing" conversations between developers arguing over vb / c#. =) But I did read an article that said vb.net 2005 had better support for com interop stuff. But i'm wondering if this is still the case? This is of interest to me because we are in the middle of redesigning an old vb6 app that communicates with some older COM components. Does anyone have recent experience with .NET and COM interop? Thanks.


definition of Acme Developers for iPhone

I have heard the term acme developer of iPhone. I was just wondering, what it stands for? I think I know the meaning, it is when a developer goes to a client and present's his/her ideas for the app. Thanks for your help.


One Login amongst multiple ASP.NET MVC applications Questions

I have been working on an ASP.NET MVC 4 application that uses forms based authentication. Users are validated against a membership provider based on a provider selection on the login form. For example, at this moment there are two providers: active directory and a custom provider that calls an external web service. If the user is valid then we update information in our local users table, like last logon date, etc. If the user is valid and doesn’t exist in the local users table, we add them. Once all of this is done we set a cookie and move on to the main content. All of the controllers check **User.Identity.IsAuthenticated** and return to the login page if the test fails. Now I am told that this application is going from a single web application to a multiple application solution. Each application should exist independently from the others, share the same look and feel, and use the same login functionality. Each application can require a new membership provider to be added. We will also add data for limiting access to the applications. One user may only have access to one of the applications while another user has access to all of them. Setting up the data storage is not a problem. Sharing the layout from one application to be used in the others is not a problem either. What I am having trouble with is deciding how to “refactor” the login functionality such that adding a new membership provider and application “down the road” will not require us to republish existing applications. Right now they would also not want a single sign-on launch page for the applications. They would like for the users to go straight to an application, login, and do what they came there to do. Thus, I may go to http://site1.mysites.com, login and do my work while the guy next to me goes to http://site2.mysites.com, logs in and does his work. I am having trouble wrapping my head around the best way to do this. My first thought was a WCF web service for the login. I would have a controller action call the webservice passing the login credentials. If the login was successful, then I could get a list of applications for the user from the local storage. Adding more applications would not require us to republish existing apps due to no changes in the web service for those apps. I also keep hearing about this ASP.NET Web API stuff. Should I go that route instead? I may want to build a site around administering the local user database so having a site that hosted the web api could be an option. Is the Web API stuff wrong for this situation? If not, does it hold advantages over the WCF web service? Are there alternative methods of achieving my end result?


Design of input files reading when it comes to defaults/transformations

Suppose you have an application that reads an input file, on a language that does not support the concept of None. The input is read, parsed, and the contents are stored on a structure for later use. Now, in general you want to keep into account transformation of the data from the input, such as adding default values when not specified, or adding full path information to relative path specified in the input. There are two different strategies to achieve this. The first strategy is to perform these transformations at input file reading time. In practice, you put all the intelligence into the input parser, and your application has no logic to deal with unexpected circumstances, such as an unspecified value. You lose the information of what was specified and what wasn't, but you gain in black-boxing the details. Your "running code" needs that information in any case and in a proper form, and is not concerned if it's the default or a user-specified information. The second strategy is to have the file reader a real one-to-one mapper from the file to a memory-stored object, with no intelligent behavior. unspecified values are not filled (which may however be a problem in languages not supporting None) and data is stored verbatim from the file. The intelligence for recovery must now go into the "running code", which must check what was specified in the file, eventually fall back to a default, or modify the input properly before using it. I would like to know your opinion on these two approaches, and in particular which one you found the most frequently implemented.


User selection and object creation

I'm writing a GUI application. The user selects item from a comboBox (non editable). The suitable input data control is then enabled and user enters data. Then the appropriate object according to the comboBox selected item is created.   1. I've thought of using String[] array to display the list of choices and then using conditional statements to create the object.   2. Or create all the objects before user selects and set each object's properties accordingly after user data input. I can't think of any better way to do this so I'd like to ask if there is one. If no, the first or the second way listed above is better? Thank you.


Should a developer have fast-typing skill?

> **Possible Duplicate:**   >  How important is the ability to touch-type? We're going to hire new programmers and we just wondered should we include typing skill in our employment filters? Someone has already applied for the the vacant position, and is qualified for it. The only thing that is under doubt, is his poor typing skill (using 2 fingers and slowly). Should we consider this as a highly negative point? Or in general, should developers know how to type fast? Also I want to know how fast a touch-typist can type? Mine is 69 wpm with 95% accuracy (690 lpm)


Programming as fast as you can touch-type... How to get to that stage?

I took a test recently and found that I could touch type comfortably at around 100 wpm... and if given some sort of autocorrect/intellisense then that would be even faster (who knows maybe 150 wpm?)... I definitely do not program anywhere near that speed... This led me to wonder how exactly does one become faster at programming? Once I look at a problem and design the algorithm to solve it (the problem is solved... I know what i'm going after give or take some debug runs) why does it take so much longer for me to actually type up the program? What I found was that in general when I'm coding, until I am done typing a word... even if it is just the letter a or number 1, I cannot simultaneously think and type. What that means is that I can come up with stuff as I'm typing but I don't have the ability to look ahead. Its either one or the other... For example in writing this, I might have a feel for where this goes, but until my fingers hit the keyboard, I don't really know what I'm going to say next. How do I change this? How do I get the ability to think ahead while typing so that I can take advantage of my typing speed? Also just in general how does one become a faster problem solver? I know the usual list of practice (which I have no problem with) but is there any particular excercise one should emphasize to train their mind? For example is playing various logic games (sudoku etc...) carry much help in improving your sense of logic in other areas of programming? Sorry its a bunch of questions at once but they are all sort of related... P.S. Is it possible to use a stenograph to program? I've heard that users of stenographs can achieve blistering speeds like 200 - 300 wpm. Assuming I can somehow think faster... that would be pretty cool. Obviously fast programming != good programming. But if your always training to become a better programmer, it doesn't hurt to be able to do it fast.


Allowing client to select data to return via REST interface

I have a rest service that is essentially a proxy to a variety of other services. So if I call `GET /users/{id}` It will get their user profile, as well as order history, and contact info, etc... all from various services, and aggregates them into one nice object. My problem is that each call to a different service has the potential to add time to the original request, so we would rather not get ALL the data ALL of the time if a particular client does not care about all of the pieces. A solution I have arrived at is to do something like this: `GET /users/{id}?includeOrders=true&includeX=true&includeY=true...` That works, and it allow me to do only what I need to, but it is cumbersome. We have added enough different data sources that there are too many parameters for that style to be useful. I could do something similar with a single integer and a bitmask or something, but that only makes it harder to read, and it does not feel very Restful. I could break it down into multiple calls so they would need to call `/users/{id}/orders` and `/users/{id}/profile` separately, but that sort of defeats the purpose of an aggregating proxy, who's purpose is to make clients jobs easier. Are there any good patterns that can help me return just enough data for each client, without making it too difficult for them to filter and select what they want?


Can HTML injection be a security issue?

I recently came across a website that generates a random adjective, surrounded by a prefix and suffix entered by the user. For example, if the user enters "123" for prefix, and "789" for suffix, it might generate "123Productive789". I've been screwing around with it, and I thought I might try something out. I entered this into the prefix field:               Click
      And, sure enough, I was given the link, then an `<hr>`, then a random adjective. What I'm wondering is, could this be dangerous? There must be many more websites out there that have this issue, are all of them vulnerable to some sort of php injection?


What is the best way to comment a deprecated class in Java?

I would like to know the best way to add a comment to identify a deprecated class in Java. Should I remove the previous comment added to the top of the class that helps another programmer to know what was that class for, or should I add it below the comment?


Sets Data Structure in Golang

I really like google golang but could some one explain what the rationale is for the implementors having left out a basic data structure such as sets from the standard library?


What's the purpose of 'so that' clause in user story definition?

A user story can be defined in a sentence like:               As a <type of user> I want <some goal> so that <some reason>      Just Google for 'user story formula' and first links all propose this formula. My question is, what is the purpose of **so that** clause? Is it there for managers? Is it there so that project managers and stakeholders can understand the priority of the item better? Why is it there? Note: I've worked with `as a <type of user> I want <some goal>` formula, and it works just well. I haven't noticed any problem in my work by implementing this format which is more brief.


Is it beneficial to have a long-term experience in a specific technology rather than short-term multiple ones?

I am currently working in asp.net and having almost 1 year of experience. Now my company wants to change my technology and wants to put me in mobile development (might be other than .net mobile development). Would this be harmful for my career? As I have heard that it is beneficial to have a long experience in a specific technology than multiple ones.


When did the standard for packaging Linux source code become .tar.gz?

When browsing open-source projects that are primarily developed for Linux systems and downloading the latest packages, the source code is always stored in a .tar.gz or .tar.bz2 file. Is there any reason for using .tar.gz or .tar.bz2 rather than something like .zip or .rar or some other compression algorithm (or even leaving it uncompressed if the project is small enough)?


What happened to Alan Cooper's Unified File Model?

For a long time Alan Cooper (in the 3 versions of his book "About Face") has been promoting a "unified file model" to, among other things, dispense with what he calls the most idiotic message box ever invented - the one the pops up when hit the close button on an app or form saying "Do you want to discard your changes?" I like the idea and his arguments, but also have the knee-jerk reaction against it that most seasoned programmers and users have. While Cooper's book seems quite popular and respected, there is remarkably little discussion of this particular issue on the Web that I can find. Petter Hesselberg, the author of "Programming Industrial Strength Windows" mentions it but that seems about it. I have an opportunity to implement this in the (desktop) project I am working on, but face resistance by customers and co-workers, who are of course familiar with the MS Word and Excel way of doing things. I'm in a position to override their objections, but am not sure if I should. My questions are: Are there any good discussions of this that I have failed to find? Is anyone doing this in their apps? Is it a good idea that it is unfortunately not practical to implement until, say, Microsoft does it?


Quality Assurance (Testing) in Scrum

I just had a Release Retrospective for my scrum team. We talked a lot about our release process. I pointed out that because our company is not able to tolerate bugs in our production environment we are not be able to adhere to the traditional scrum mantra of releasing often. In short, we are a medical company. Bugs in production can cause issues with patient care. (A rapid fix release does not help the patient that was negatively impacted by the bug.) I pointed out that scrum does not have a formal quality assurance process. (It is assumed that testing will be done during development.) I then stated that scrum has an implied expectation of bugs in production. (Based on the process of releasing early and often.) The Scrum Process people in the room said that scrum is not that way. They said that properly done scrum can be bug free in production. So here is my question: **How does testing and quality assurance work for scrum? (So that there is very low occurrence of bugs in production.)** OR **Is there documentation that bugs are expected to a small degree in Scrum (along with quick follow up releases)?** NOTE: This is for full enterprise level development. We have 6+ WCF services, several Service Buses, 4 databases, a WPF front end application and a Web Interface all written by two separate scrum teams of about 6-8 people each. _This means answers that include just coding it right the first time are not realistic._ NOTE II: I know that no software product is going to be bug free. But our release process (non-agile) catches the few that get past our development process and brings our software fairly close to the "No Bugs" level.


Is INT_MIN-1 an underflow or overflow?

I seem to remember that I was reading that   * `underflow` means you have a too small _magnitude_ that cannot be presented anymore in a type   * `overflow` means you have a too large _magnitude_ that cannot be presented anymore in a type However, in practice I perceive that the terms are used such that   * `underflow` means you have a too small _value_ that cannot be presented anymore in a type   * `overflow` means you have a too large _value_ that cannot be presented anymore in a type What is the correct meaning to use here? Are the terms defined differently for integer and floating point types?


Methods to encourage good behaviour when using shared servers?

This question was prompted by a comment left on another question pointing to this article. What Is Clean Code? I was thinking about how that sentiment can be applied to shared resources (servers, etc). What are some of the ways you've found that work to ensure that when others use a shared server they clean up after themselves?   * Delete files / folders after one time use (after a fix or upgrade)   * Leave the desktop clean of crap   * Dont install software that they can use on their desktop    * Dont create filesystem shares not needed for the solution Oh Yes, the applies mostly to a windows server environment, in a team of developers + support staff of about 25. I know there are a few ways to tackle the problem, so what have you guys found that works?


Distributing Contestant Entries Between Multiple Bins, Is this Knapsack?

I am an algorithm novice and am faced with a rather difficult problem. I am working with contests. There are   * **contestant** - individual player   * **entry** - contestants can have multiple entries into a tournament   * **contests** - abstract - has a max number of entries property   * **contests instances** - contains entries My requirements are:   1. all contestant's entries must only be grouped into one instance (they cannot span instances)   2. minimize the number of instances created.   3. If multiple instances are required, distribute the contestants among them to get as close to equal entry distributions as possible (if there are 120 entries and 2 instances selected should be distributed as close to 60 / 60 as possible while keeping each contestant's entries in only 1 instance, whoa)   4. If all entries cannot be fit into the number of instances allotted alert user.   5. There is a hard limit on the number of instances. An example end user scenario is:   * client selects a contest that has 100 max entries   * the client then selects they will pay for up to 200 entries (2 instances)   * the client registers contestants and grants entries   * suppose the client has 22 registered contestants and grants them each 9 entries (198 total entries)   * then the client registers another contestant and grants them 2 entries.   * In the above scenario the contestant/entry combination will not fit into exactly 2 instances, so we must detect that. The difficulty is fitting these blocks of contest entries into only 1 instance while respecting the hard limit on the number of instances. My current solution is extremely lackluster, right now (from what I've read I'm solving it as more of a bin packing style) I am putting the blocks of entries into the a first instance and spilling over into the remaining available instances. If there is no available space in either instance I remove single entries and merge the instances. This was working because we would only need to generate 1 instance maybe 2 every now and then and there were quite a few single entries, But now that we need to generate many instances, this completely fails. Is this an example of a multiple knapsack problem? It certainly seems like it, but I want to make absolutely sure before I start diving into solutions like http://www.or.deis.unibo.it/kp/Chapter6.pdf , because papers like that are a struggle for me and it is going to take a very large time investment to work through something like that.


How do you call the discipline which consist of making the right choice of language/paradigm/class diagrams?

As a physicist, I've learnt programming on my own. But I would like to know the name of the discipline (like algorithmics is the discipline of designing algorithms) which consists of :   * making the right choice of language/paradigm   * designing a class diagram   * organizing the different parts of a code and how they will interact between each other


Python - assert vs if & return

I am writing a script that does something to a text file (what it does is irrelevant for my question though). So before I do something to the file I want to check if the file exists. I can do this no problem, the issue is more that of aesthetics. Here is my code, I have two ways of doing the same thing.               def modify_file(filename):         assert os.path.isfile(filename), 'file does NOT exist.'               Traceback (most recent call last):       File "clean_files.py", line 15, in <module>         print(clean_file('tes3t.txt'))       File "clean_files.py", line 8, in clean_file         assert os.path.isfile(filename), 'file does NOT exist.'     AssertionError: file does NOT exist.      or:               def modify_file(filename):         if not os.path.isfile(filename):             return 'file does NOT exist.'               file does NOT exist.      The first method produces an output that is mostly trivial, the only thing I care about is that the file does not exist. The second method return a string, it is simple. My questions is: which method is better for letting the user know that the file does not exist? Using the `assert` method seems somehow more pythonic.


FPGA device + networking + software kit

Sorry for the very abstract and uncertain question, but I guess if I could ask it better I would have answered it myself. Here is the thing. I am getting more and more interested in FPGA. However, it is hard to tell where I should start off. What I want to do is to write a simple application that listens to UDP packets and sends TCP/IP packets. So I think something like Xinix Virtex®-7 FPGA will work for me as FPGA. How does that sound? I will also need a PCI card that will host it with Ethernet card on it. Obviously I am not that good in hardware on that level and won't make it myself. Are there any out of the box solutions? Also, I guess there must be a core for working with Ethernet adapter already. Am I right on that? Where should I look? Is there anything with interface close to POSIX sockets? What is the best software kit I will need to achieve that? Thank you!


In Visual Studio 2010, which is better to use: VS Installer or the InstallShield LE?

I built a VS Installer project in Visual Studio 2008. I see in VS 2010 they have InstallShield LE available as an alternative. I used InstallShield long ago as part of Borland Delphi, but haven't really looked at the latest version. I am time constrained and don't want to spend a lot of time digging into it if it's not worth it. Can anyone provide the pros and cons of using it vs. the VS Installer tool? I don't want want to have re-make my installer unless there's a really compelling reason to do so. Thanks, Michael


How do you design programs in Haskell or other functional programming languages?

I have some experience in object oriented programming languages like c# or ruby. I know how to design a program in object oriented style, how to create classes and objects, and how to define relations between them. I also know some design patterns. How do people write functional programs? How do they start? Are there design patterns for functional languages? Are methodologies like extreme programming or agile development applicable for functional languages?


Can Agile software development be used in projects defined by a contract?

I recently had a conversation with a fellow developer about Agile Software Development. While I understand the principle, it seems that continuously changing requirements creates the potential for the project to go on forever. But, at least where I work, projects need to reach completion because it's a contract. That is, the first iteration could take months, because for some projects the customer cannot use an incomplete application. For some projects, I think you need to define finished first, then you can break it into iterations and refine your definition after each iteration. But you _must always_ have this definition. If Agile Software Development embraces changing requirements how do you know where it ends? How can you budget for a project when the end result is always changing? Is Agile Software Development more about an agile process, than an agile product?


Relationship between "Task Parallel Library" and "Task-based Asynchronous Pattern"?

In the context of C#, .NET 4/4.5 used for an application running on a web- server, what is the relationship between "Task Parallel Library" and "Task- based Asynchronous Pattern"? I understand one is a library and the other is a pattern. But to dig deeper, is it like "The library is used by the pattern to enforce good practices". I'm also not clear if both are supported in .NET 4.0 (with `await` and `async` keywords) Edit: Seems that `await` and `async` are only in .NET 4.5 ...


Help me understand a part of Java Language Specification

I'm reading part 17.2.1 of Java language specification: http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.2.1 I won't copy a text, it's too long, but I would like to know, why for third step of sequence they're saying that `If thread t was removed from m's wait set in step 2 due to an interrupt` Thread couldn't get to step 2 it wasn't removed from wait set, because it written for the step 1: `Thread t does not execute any further instructions until it has been removed from m's wait set` Thus thread can't be removed from wait set in step 2 whatever it's due to, because it was already removed. Please help me understand this.


What is a Ruby on Rails way to save images?

I develop on iOS, and I'm switching from a PHP backend to Ruby on Rails. The interchange format is JSON. A quick Google search for 'save images in Rails' has nearly every result talking about saving image data as blobs to the database. I might be mistaken, but I'm under the impression that saving image data in a database is a huge waste of time and space (as opposed to saving a link to the file location ('/img/subcat/4656.png'). In PHP, it's pretty standard to receive the data, generate a filename, save that file to disk, and update the database with the image's location on disk. Is this the same for Ruby on Rails, or is there some built-in ActiveRecord image functionality I'm not aware of?


Counting product releases if you work on the backend/online services?

I am trying to update my resume, and I would like to count the number of "product releases" that I was directly involved in with a company. It would seem to serve as a performance metric. The problem is that I was working on the backend of a very large distributed system, like along the lines of Hadoop or other huge database. We had regular 6-month major releases and other minor releases. My manager kept saying that we "shipped" these releases, but "shipping" a product to me sounds like releasing single pieces of software, like Microsoft would ship Office 11 or something. Any ideas on "product releases" for backend service engineers, or any other type of performance metric?


Programmer VS Commercial Systems (ERP)

My question here is relative to jobs for programmers. Why does employer still contract programmers if today we have a lot of good commercial system avaliable on the market? I want to be very clear at this point, this question is relative only to a system, more specially to ERP systems. Maybe this question looks a little bit useless, but right now I'm working and this doubt arose to me and my boss. I have a few answers to my own question, but I really would like to speculate this subject a bit more. Also I know, every good company needs a customized system, but ... the question is here. :-) Any answer will make me feel better. Thanks.


Best Practices: Database app programming patterns

I have written many database (MySQL) web apps so far but I always think my structure is kinda clumsy. I want to improve the programming/design pattern I use, hoping for some advice here. Particularly, I cannot find a structure that complements an OOP approach that encapsulates the implementation of the database (schema). I Think my question can be best explained by example. There are 2 approaches I use now say I have an Invoice object/class: first is to use static member functions               class Invoice     {        int id;        string ref;        int customer_id;        date created;        date due;             static id create();        static bool update(id, field1, field2, ...);        static bool delete(id);        static bool get(id);     };      The second approach is to put every thing in a database object:               class Database extends ProprietaryDBConnecter, Singleton     {        id createInvoice();        bool updateInvoice(id, field1, field2, ...);        bool deleteInvoice(id);        bool getInvoice(id);             id createCustomer();        bool updateCustomer(id, field1, field2, ...);        bool deleteCustomer(id);        bool getCustomer(id);             // etc...     }      I find that both ways the (SQL) member functions are very much unseparable from the "view", in that the "view" determines what the classes needs to have and hence seems to break the document/view architecture. Also, it seems kind of inefficient for example a SELECT statement should only select what is needed, but the presence of member variables in Invoice seems to imply "guaranteed data". Don't know if I explained the question clearly, What are some other best approaches to this architecture/design pattern/what-it-is-known-as? Thanks for advices


How to quantify benefits from a programming training?

I'm conducting a programming training for 3 months. Details in this link - Programming Training Details. My question is "How do we quantify benefits from such training?". I think the two important factors to focus on are   - Quality of Code   - Productivity  My current thinking is on the lines of having the group solve a problem on day 1 of the training and compare it with how the group solves a similar problem on the last day of the training. **Edit 1 :** Thanks for the feedback. This is a program which I have plans to extend to other teams if it is successful. And there by the thoughts on how to quantify benefits. I agree that all the replies saying "Its difficult to quantify!" and I had further discussions outside which helped me understand that measuring might even be counter productive.


Why OOP is enforced in Java and C#?

In many other languages like C++ and Javascript, OOP is optional. Procedural code is ok. But in languages like Java and C#, OOP is somewhat enforced. Everything is to be a part of a class or an object. What are the benefits?


Types in Lisp and Scheme

I see now that Racket has types. At first glance it seems to be almost identical to Haskell typing. But is Lisp's CLOS covering some of the space Haskell types cover? Creating a very strict Haskell type and an object in any OO language seems vaguely similar. It's just that I've drunk some of the Haskell kool-aid and I'm totally paranoid that if I go down the Lisp road, I'll be screwed due to dynamic typing.


Is currying too complex a tool to actually use?

Today I feel like I finally grokked currying (in Javascript), and of course, like any programmer who has learned a new trick, my mind immediately began racing over how to improve my current codebase using it. And again, like any programmer, the little voice shouting "[new trick] all the things!" was silenced by another saying, "[new trick] is really complex. maybe you shouldn't use it." Curry is sugar, essentially, after all. I understand that there's nothing wrong with using a feature in moderation, especially one as mind-bending as currying, but for the sake of simplicity should I avoid using it if something equally as efficient is sufficient?


Conways Game of Life C#

Not sure if this is the correct place for this question or SO - mods please move if necessary. I am going to have a go at creating GoL over the weekend as a little test project : http://en.wikipedia.org/wiki/Conway's_Game_of_Life I understand the algorithm, however I just wanted to check regarding the implementation, from maybe somebody that has tried it. Essentially, my first (basic) implementation, will be a static grid at a set speed. If I understand correctly, these are the steps I will need:   1. Initial seed   2. Create 2d array with initial set up   3. Foreach iteration, create temporary array, calculating each cells new state based on the Game of Life algorithm   4. Assign temp array to proper array.   5. Redraw grid from proper array. My concerns are over speed. When I am populating the grid from the array, would it simply be a case of looping through the array, assigning on or off to each grid cell and then redraw the grid? Am I on the correct path?


Is there a downside to using Access as a database?

I have inherited an application that stores data in multiple tables in Microsoft Access; the Access DB is only used for storage, all data processing is handled by the app (VB.net). Is this good practice? I need to build a similar app from scratch and am unsure of what is 'normal' practice. I have tried Googling the question in various formats and checked through numerous results (including many on this forum) but all questions seem to relate to where you are programming within Access rather than simply using it for data storage. I guess I could be more specific and say would SQL Server Express or similar be a better option and if so why? If you are reading this post due to having a similar question then check out this link provided by @DanielB below - http://stackoverflow.com/questions/694921/ms-access-mdb-concurrency


Reporting and handling asynchronous process errors to a client

I have a product with two separate applications. The core of the product lives in the database (oracle) and runs according to a schedule. The other is a client application (currently ASP.NET MVC3) used to manage the database application. There are three levels of validation going on; client, server- side, and database before the client data is saved to the database. However, there are cases where pieces of the data set are currently valid but could become invalid at some point in the future. In these cases rather than abort the entire (lengthy) data input process, we just place the process for the data set on hold until the data either becomes valid, or is updated to a valid value. The error might be something like, "Hey, you scheduled the copy process of data Foo to location X, and then grant access to user Bob. The Bob user account you originally selected is no longer valid, what would you like to do? 'Cancel the Copy Request' 'Change the User' or 'Wait'". Is there a best practice for storing and reporting error conditions (fixable by the user) and exceptions (not fatal and not fixable by the user) back to the client from the database? For example:   - Database starts process A   - Database selects data set Foo   - During process an error or exception is encountered   - Database stores the error or exception   - Database handles the abort for process A with data set Foo   - Database continues process A with next data set until all data sets are processed   - Database completes process A  Then some time later:   - User logs in to client application at a later time (after the weekend?)   - User receives notification that an error or exception occurred  My first thought is some sort of db table storing various fields (event_ time_stamp, process, event, object_type, object_pk, event_code, additional_details, status, last_updated). Then setting up client-side templates (i.e. hard coded with parameters) for each error code and presenting those to the user...but there has to be a better way? Ideally I am looking for a solution that will allow the client to provide helpful UI options that will aid the user in possibly resolving the errors. What solutions have you found to this problem? Would something like NServiceBus or MassTransit work? EDIT: There are two different requirements here. The first to store the exceptions, and the second to report (and possibly take action on) them.


Is using xml + xsl to create a weekly html email a good or bad idea?

The guy who is in charge of our html emails is leaving and I have been asked to take over. We are an online retailer and send out an email once a week. An email will consist of a main image, a bit of an opening paragraph and then rows of product offers. As everyone knows html emails are painful to work with due to the archaic html and css you need to deal with. When something needs changing last minute it's a real pain to wade through the spaghetti of td's to get to the link that needs it's url and tracking code changing and the opportunities to make a mistake are plentiful. So I've decided to create an `xml` file consisting of all the data that needs to go in the email. For example, the products would be recorded like this:               <products>         <product id="1">             <title>My Product</title>             <image width="160px" height="160px">                 <alt>My Product</alt>                 <url>http://somedomain.com/emails/image1.jpg</url>             </image>             <link>                 <term>my_term_for_google_analytics</term>                 <url>http://somedomain.com/products/1</url>             </link>         </product>         <product id="2">             <title>My Second Product</title>                  ... etc ...         </product>     </products>      I could then use an `xslt` template to create the email. The advantage of this is that when a product goes out of stock the morning the email is due to go out I can just change a bit of text in the `xml` file, generate the html and we're good to go again. I can also use the same `xml` to create a microsite for the email. The trouble is I've had a good ol' Google about this and I can't find anyone else who has really tried this. So I'm either a visionary genius or an idiot. It usually turns out I'm an idiot so has anyone else had any experience of creating html emails from `xml` using `xslt` or can anyone see any major pitfalls with this approach. Is it a good idea? Disclaimer - I don't really think I'm a potential visionary genius.


How would you practice concurrency and multi-threading?

I've been reading about concurrency, multi-threading, and how "the free lunch is over". But I've not yet had the possibility to use MT in my job. I'm thus looking for suggestions about what I could do to get some practice of CPU heavy MT through exercises or participation in some open-source projects. Thanks. Edit: I'm more interested in open-source projects that use MT for CPU-bound tasks, or simply algorithms that are interesting to implement using MT, rather than books or papers that only describe the tools like threads, mutexes and locks, or how MT can be used to have responsive GUIs...


Is a single object to be preferred over multiple variables?

It was quite hard to put what I meant into a title, but it's easy to put into code. **C++** Is this               int offset_x = 10;     int offset_y = 40;     ...     element.move(offset_x, offset_y);      To be preferred over this?               Vector<int> offset(10, 40);     ...     element.move(offset.x, offset.y);      (Note that Vector is not like `std::vector`, it's a 2D vector. This class has lots of methods I don't need here, like `normalize()` and `scale()`. Should I have a more basic `Point` class for this?) **JavaScript** Is this               var offsetX = 10;     var offsetY = 40;     ...     element.move(offsetX, offsetY);      To be preferred over this?               var offset = {x: 10, y: 40};     ...     element.move(offset.x, offset.y);


What's the benefit of avoiding the use of a debugger?

Over the course of my career, I've noticed that some developers don't use debugging tools, but do spot checking on erroneous code to figure out what the problem is. While many times being able to quickly find errors in code without a debugger is a good skill to have, it seems it's less productive to spend a lot of time looking for issues when a debugger would easily find little mistakes like typos. Is it possible to manage a complex without a debugger? Is it advisable? What benefits are there to be had by using "psychic debugging?"


How do you use Roundup issue tracker?

Roundup issue tracker is pretty minimalistic by default, and it does not bring any specific workflow with itself. It was once called ‘so configurable that it’s probably better described as a lightweight tracker-oriented framework.’ Have you ever used Roundup extensively or seen some interesting use cases? If so, please share an example. (If you don’t consider your workflow special enough, at least tell how do you understand & utilize `superseder` field in the default ‘classic’ template, which alone could be interpreted differently—see _old.nabble.com/Superseder- td13792131.html_ )


What's the proper way of dealing with a global file path?

I don't have compilable code, because the code in question depends on a large function that's irrelevant to the question, but say I have the following scenario:               savePath = "C:\\..."          changePath1, changePath2 :: String -> String          changePath1 passedPath =         'Do something with passedPath'          changePath2 =         'Do something with savePath'          let newPath1 = changePath1 savePath in ...     let newPath2 = changePath2 in ...      Is it more proper to set up functions like changePath1 (where the global path is passed in), or changePath2 (where it just internally uses the global path) If the functions had a chance of processing more then 1 path, obviously I'd use changePath1, but in my current program, there is only 1 path to deal with, so it seems simpler to just have all the functions internally know the global path instead of constantly passing it in. Thank you


Is it worth cross-browser testing in GWT applications?

as **GWT** is supposed to abstract all the browsers implementations (for widgets, etc) is it worth doing cross-browser testing? I was just thinking to test only the styling related stuff (CSS related) in different browsers. Any opinion on that?


How much of original code is left in modern software products?

Many of you out there work for large companies that ship well-known software. I was wondering, how much of original code (basically, code that was "v1.0" release) is left in modern massive applications, such as, say, Firefox, Photoshop, Windows, Linux, etc? I'd really prefer first-hand experience and real-world war stories. Thanks for satisfying my curiosity. **EDIT** Turns out there's a degree of misunderstanding. What I'm after is basically as follows: when you blame/annotate source code, are there any parts or even whole files untouched since the initial 1.0 release.


Advice and resources on collaborative environments

I need some advice on collaborative software environments. More specifically, I am looking for books and reference materials that can aid me in understanding team and code structures and the interactions thereof. In other words books, blogs or white papers explaining:   * Different strategies for structuring teams that share common code between each other but have distinct individual functions?  To summarise my question I would like to know what would be a good source of knowledge if I were to set up teams in an organisation that shared code but each unit still remained autonomous. I have done some research on this subject and explored:   * code review tools,   * distributed VCS,   * continuous integration tools,   * Unit testing automation. The tough part about implementing these tools are to determine where a good place would be to start, which tools are low hanging fruit, which tools or methods provide higher success rates. If someone asks me about code quality reference I point them to Code Complete. I am looking for an equivalent guide on software team structures and tools to make this equation work better. I realise that this question is quite vague but it arose as "we need to share code between teams without breaking each others stuff and causing management headaches and reams of red tape" The answer is definitely not simple and requires changes on many levels, hence the question. If the question is too vague please vote to close or delete. I would accept any good starting point as an answer.


Find the peak of each islands in sparse matrix

I have a sparse matrix that contains several islands of unknown size. I would like to find the highest peak of each islands. Consider this matrix as an example:               0 0 1 0 0 0 0     0 0 1 2 1 0 0     0 0 0 3 2 1 0     0 1 0 0 0 0 0     0 2 3 4 0 1 0     0 0 1 1 0 1 0     0 0 0 0 0 1 0      In this case I would like to get the position of 3 at (3, 2), the position of 4 at (3, 4) and the position of 1 at (5, 4), (5, 5) or (5, 6). Note: I consider 4-connected neighbours. Until now I came up with the solution that scans each pixel and if it is not zero it starts a flood fill from that pixel. The flood fill paints the pixels to zero keeping track the maximum value visited. This algorithm works well but I was wondering if there are any faster solution? In my target platform (iOS) I have access to different vector processing frameworks like BLAS, LAPACK, vDSP that provide some functions for fast finding the maximum value in a vector (or matrix). Maybe one could implement a faster solution with the help of these functions?


Why are the version / build numbers different for Mylyn?

At projects.eclipse.org Mylyn Build 1.1.0 is slated for June 2013. At www.eclipse.org/mylyn The "news" says Mylyn 3.8.3 was released on March 1st. Why is there little or no correlation between the two?


What aspects of "maintainability" can influence choice of IS implementation technology?

**Background** : I'm an apprentice and am handling the project of developing a particular IS-System. Currently I'm only managing the requirements analysis and the information-processes design, but as a Software Developer, I would also like to implement the concept as an actual Web-Portal. When it comes to choice of technology, I personally would like to build my front-end based on JavaScript Frameworks(jQuery, Bootstrap, DataTables.Net, ...) which offer high front-end implementation flexibility and nice out-of-box modern design, and wire these to .NET MVC in the code-behind. The people around me, who haven't written a line of code in what seems like decades, all fret about difficulty to maintain such a system, in comparison to using .NET Controls and sticking to the MS Web-Site development Package. So whenever I try to bring up, that I could build a nice-looking, user-friendly, modern portal, once we're done with the first concept-phase, I just get concerned looks and a mumble about "maintainability" and "we'd prefer trying to use Sharepoint Analysis Services connected to our DB". **Question** : what aspects of " _maintainability_ " can influence choice of System implementation technology? **Goal** : I would like to sit down and "prove" that my approach is just as maintainable as what they are suggesting, and if it isn't I would like to identify ways to improve it. * * * Questions I found interesting:   * JavaScript codes complexity and maintainability   * How does one meaningfully measure maintainability?   * How to have a maintainable and manageable Javascript code base   * What characteristics or features make code maintainable? (!)    * What hurts maintainability? (!) Some abstract aspects of maintainability:   * readability   * coupling   * consistency   * the reasoning behind code is documented


Does anyone have any idea how Java decides the names of the converters?

Making reference to this link In particular, what made them decide to pick 'tl' as the converter symbol for hour... It seems so random. I understand why they've decided on 'te' (it's because 'e' comes after 'd' in 'td' and d is the first letter of 'day'). Edit: Oh come on, why the downvote? I'm asking something that might not be important but it does nag on me


Problems with Facades and then evolution in software

I initially started a project with Facades and Polymorphism as a way to create simple extensible design following SOLID Principles. Here is a sample code:               public interface IInterface     {         void FillList(List<InputPocoObject> listOfInputObjects, out List<OutputPocoObject> ListOfOutputObjects);     }          public class SampleClass : IInterface     {              public void FillList(List<InputPocoObject> listOfInputObjects, out List<OutputPocoObject> ListOfOutputObjects)         {             //some data layer code              //and a for loop to fill OutputPocoObject object and add it to list         }     }      I have number of classes such as above which are created in runtime with the help of factory( not shown here for the sake of simplicity) Recently after couple of months I see that there are different requirements emerging in my project, which I attempted to solve by the help of Polymorphism and I see that I am stuck with violating DRY principles. Here is a sample code of this situation:               public class SampleClass2 : IInterface     {              public void FillList(List<InputPocoObject> listOfInputObjects, out List<OutputPocoObject> ListOfOutputObjects)         {             //some data layer code              //and a for loop to fill OutputPocoObject object and add it to list             // there is a property in OutputPocoObject which is set to 1         }     }               public class SampleClass3 : IInterface     {              public void FillList(List<InputPocoObject> listOfInputObjects, out List<OutputPocoObject> ListOfOutputObjects)         {             //same code as above              //with only one difference that  property in OutputPocoObject is set to 5 here         }     }      One Simple solution will be to add a control parameter to interface such as:               public interface IInterface     {         void FillList(List<InputPocoObject> listOfInputObjects, out List<OutputPocoObject> ListOfOutputObjects, int controlParameter);     }      but I don't know whether this is such a better idea? Or whether it might introduce some complexity in my design?


Creating a System Sequence Diagram from an [extended] use case

As I have been taught - one controller = one use case. But I have:   * OutsiderController   * SupplierController (which extends OutsiderController)   * SubContractorController (which also extentds OutsiderController) And I want to do the SSD for `SupplierController` and `SubContractorController`. What do I do? Do I write in both SSDs the methods from `OutsiderController`?


How to categorise information in end-user documentation?

One of the greatest piece of documentation I ever read is _the TeXbook_ by Donald Knuth—the manual of the _TeX_ typesetting system, and I used it in my first analysis. As far as I can tell, the type of information conveyed by documentation falls in three categories: _recipe,_ _reference_ and _expert knowledge_ that I describe hereafter. Which categories am I missing? ## Recipe A recipe answers a question like “how do I solve that problem with this software?” and binds the _problem world_ with _software features._ Chapters 3, 7 and 8 in the _TeXbook_ answer questions like “How do I run TeX?” or “How do I type text?” and provide the user with recipes. Other software packages often contain installation or backup procedures that fall in this category. ## Reference A _reference_ documents all the needed details on some piece of software. It is useful for the user knowing that “this feature is useful to solve that problem” and wanting to know if it can parametrise “this feature” to solve a close problem. It is also useful for troubleshooting the software when it gives unexpected results. Chapter 14 “How TeX Breaks Paragraphs into Lines” in the _TeXbook_ is an example of a reference text. UNIX manual pages almost always belong to this category. ## Expert knowledge Expert knowledge pertaining to the problem solved by the software also belong to the software documentation. Reasons for this are at least:   1. Users are not experts in the area where the software is useful.   2. Experts use varying terminology and methodologies to describe or solve problems. For 1. mathematicians reading the _TeXbook_ also learn the _basics_ of design and layout: they get aware that there is a structured knowledge in this area and learn the names of the basic concepts involved, so that they can phrase out problems and get help. For 2. it is useful to “fix the notation” in the software documentation and this is best done by providing some high-level or background information. Hence expert knowledge contained in the user documentation binds the conceptual organisation of the problem as it is known to the software designers to the conceptual organisation of the problem as it is known to the software users.


what do programmers dealing with data driven/machine learning related programming need?

Given the increasing amount of data generated through different web services ( social network, etc), there are must be more and more programmers who are familiar with machine learning and/or statistics needed to write programs to deal with those data. I wonder if any one working in related jobs could briefly describe what are the possible daily activities. Is it more like a traditional software engineering or is it more like working as a statistician? I am personally interested in machine learning and programming. If I want to work in jobs like this, should I spend more time learning statistics or more time in the traditional software engineering side?


Saving mobile application data when no service?

Say I have a mobile application that allows users to enter information which is then uploaded to a central location. I had planned on building this using only HTML5 and javascript (non-native app), but I'm assuming if someone is in an area where there is no service they simply will not be able to use the app. As a work around would it be possible to write a native app that saves the information on the device and then uploads it whenever service returns? If so, is it possible to write a native app entirely in HTML5 and Javascript that does this?


What should I look for in a school when trying to obtain a Software Engineering degree?

My goal is to be as employable as possible and to have enough knowledge not to look foolish when interviewed. However, that's probably everyone's goal and it's not achieved simply by taking classes in the University -- you have to put in some of your own time as well (which I do). I'm in process of obtaining my Associates degree in Computer Programming through a local community college. There are several options for me to choose from in the area, such as Cal Poly Pomona, CSU San Bernardino, UC Riverside, and a few other schools in that general area (one of them is CalTech Pasadena, but I hear it's very hard to get in...even with my 4.0 GPA). Of course, there is plenty of information ranking schools, but nothing really explains on what to look for in a school when choosing a particular area of study. I'm interested in Software Engineering. I might branch of into AI, but that's up in the air as of right now. I think for Bachelor's I'd just go with general Software Engineering, unless I find a specific area I want to commit to. I'm definitely aware that student-to-teacher ratio is a huge point to consider when choosing a school. But what other things should I take into account? Should I choose a school that's more focused on theory, such as UCR, or a school that takes a hands-on approach such as CalPoly Pomona? What have you seen in the industry that would point as one being superior over the other? What is your own experience? Education is not cheap and I have a family to support (I work full time and go to school), so, I want to make sure that my investment is justified. That being said, I make a decent salary, so I can afford to invest into education, as long as it's not wasteful. I'm reaching out to those of you who have first- hand experience in these matters to assist me with some tips and answers to the above questions. I hope I am being clear with my goals and what I'm trying to find out; if clarification is needed, please let me know (I just got done with a 12-hour shift, so I'm a bit drowsy, heh).


Is the architecture of my project a common one? What's its name?

I am responsible for a software project for a few years now (a Java desktop application, which is mostly event-driven). I started it from scratch, and at the beginning of this project I made some strong choices on the architecture of the software. ## My architecture I introduced the `Module` class, which represents a functionnal part of the application, with a well-defined responsability. The only thing a `Module` exposes to the world is a set of "communication handles". There are 4 types of communication handles :   * an `Emitter<T>` can emit a message of type `T`.   * a `Handler<T>` can receive a message of type `T`   * a `Puller<R, Q>` can make a query represented by a message of type `Q`, and will receive a response message of type `R`   * a `PullServer<R, Q>` can receive a query represented by a message of type `Q` and will send back a response message of type `R`. Then, at the beginning of the execution of the application, I instanciate all the modules that compose the application, and I set up all the connections between them. An `Emitter` can be linked to one or many `Handlers`, and a `PullServer` can serve one or many `Pullers` (the types of these two endpoints must be compatible, of course). All the classes used to represent a message are immutable, and are defined in one subproject. Every `Module` depends on that subproject, and nothing more. This makes the `Modules` very decoupled (a `Module` knows nothing about the other `Modules`, and their input/output to the outside world very clear). Also, the dynamic aspect of the application (the dataflow) is defined in a unique place, in the `main` function. Also, it is super easy to test a `Module`, we just have to provide fake `Emitters` and `PullServers`, and plug it to the `Module`'s `Handlers` and `Pullers`. ## My thoughts on this architecture So, this is the first "big" software project I work on, and I made up this design because it felt like the right thing to do. Now, the project is working just fine, with a total of 57 `Modules` working together. One of my co-worker, who joined the project recently, asked me if this was a common architecture, if there was a name for such a design. I don't have an answer, since I am not really familiar with other real-world software architectures. It seems to me that this design is close the the concept of Actors, that we can find in languages such as Scala (and maybe Erlang). However, Actors do not provide the decoupling provided by my design. And Actors have an additional capability : each Actor has its own message queue, and its own thread of execution (kind of). Also, I think my design is somewhat related to the Dependency Injection pattern, in the sense that dependencies between the `Modules` are defined in a central place. However, this pattern deals with interfaces, not with messages. It does not define how the modules communicate (notification, request/response). ## The question (finally !) Do you know of a software project that's architecture is similar to mine? Is there a name for that? ### Edit @Doc Brown suggests that this design is similar to the Flow Design. I cannot agree more. Here is a one to one comparision between those two designs :   * My _Module_ is the same thing as a _Functionnal Unit_.   * My _Emitter/Handler_ are the same as the _Output-pin/Input-pin_ , except mine don't have a name. In my design, the "communication handles" are only identified by their types.   * The connections between my Modules is the equivalent of their _wires_.   * My _Puller/PullServer_ is similar to their _Dependency relations_. However, they say there is an explicit dependency from the caller to the callee. In my design they are decoupled.   * They define the concept of _Boards_. That's interesting, I think I'll borrow this idea !   * They define the concept of _Configuration_. I do have the need for configuring a Module in my program, and for that I define a configuration Handler on some of my Modules.   * Both solutions are synchronous.   * I don't have the concept of _map_ and _join_. But I don't feel the need for it. Well found, Doc !


Sprint planning and accommodating slack

After reading Tom DeMarco's Slack, I'm wondering how to factor slack into sprints. For those who haven't read the book, TDM describes 'slack' as providing time for innovation and other good things. Scrum leans towards eliminating slack and resisting change within the sprint. Allowing stories to be re-prioritised between sprints. I appreciate the purpose of a sprint, and am not trying to ask how to respond to change within them. My initial thought about adding slack to sprints would be to plan a sprint with 8/9 days of work for a two week sprint. If you're conscious of this decision, can still calculate your velocity accurately? Based on story points completed in your 8/9 day window (vs 10). Conversely, these are two competing ideas and don't belong together... ? gnat's focus factor link is interesting.


terms for the html/css/javascript model?

Are there any words for the design model implemented by HTML + CSS + JavaScript, either for that specific set of technologies or any abstract pattern that they follow?


Scalability: How does splitting a database table work on different replicated SQL Servers?

I would like to know more about the general concepts behind dividing data of a database into different servers. For example, suppose I have a SQL Server database which has a massive table. Assume one single server cannot handle the amount of data in this table. I would like to break that table down and split its contents among different servers with an identical database (replicated). Now, suppose I have a single SQL (ADO) connection to any one of these servers, and choose to select records from this particular table. Since the data is in separate databases on separate servers, I need to gather the records from all the various servers and combine them into one. I'm sure there's standard ways of accommodating for this, and I'm willing to go another route than a direct SQL Server connection (I plan to wrap it in my own HTTP Server API anyway) but I'm still going to use SQL Server as the actual engine. What is the most standard practice and where can I learn more about it?


Using ref instead of out. Would that be considered a bug?

Given that out and ref parameters have slight different connotations would writing code like below be considered a bug (even though it doesn't cause an issue at present), or just a lack of understanding on ref and out parameters?               public void MyMethod()      {         int myInt = 0;         MyMethodWithRef(ref myInt);     }          public void MyMethodWithRef(ref myInt)     {         // not used before being assigned a value.  Does an out parameter make more sense then           myInt = 5;     }      I understand that this is the incorrect usage of ref but if you saw that in code constantly or even once would you consider it a bug and hence fix it as well as inform the original coder or just do it as part of general refactoring practices?


Domain-Driven-Design - external dependencies in the Entity problem

I'd like to start Domain-Driven-Design, but there are several problems I'd like to solve before starting :) Let's imagine I have a Groups and Users and when user wants to join a group, I'm calling `groupsService.AddUserToGroup(group, user)` method. In DDD I should do `group.JoinUser(user)`, which looks pretty good. The problem appears if I there are some validation rules for adding a user, or some external tasks need to be started when user is added to the group. Having these tasks will lead to the entity having external dependencies. An example could be - a restriction that user can only participate in 3 groups max. This will require DB-calls from inside group.JoinUser method to validate this. But the fact that an Entity depends on some external services/classes doesn't seem so good and "natural" to me. What's the proper way to deal with this in DDD?


A good schema to represent integer numbers from 0 to infinity, assuming you have infinite linear binary storage?

I would like a schema to represent integer numbers starting with 0, without any limit (assuming access to infinite linear storage). Here's a schema that can represent numbers from 0 to 255: Use the first byte of the storage (address 0) to store the integer. Now, suppose I want to represent numbers larger than 255. Of course, I could use more than 1 byte to represent the integer, but as long as it's a fixed number, there will be eventually an integer so large that it cannot be represented by the original schema. Here's another schema that should be able to do the task, but it's probably far from efficient. Just use some sort of unique "end of number" byte, and use all the previous bytes to represent the number. Obviously, this "end of number" byte cannot be used anywhere in the number representation, but this can be achieved by using a base-255 (instead of base-256) numbering system. However, that's slow and probably inefficient. I want to have a better one that performs better with low values and scales well. Essentially, it's a UUID system. I want to see if it's possible to create a fast-performing UUID system that can theoretically scale to use for years, thousands of years, millions of years, without having to be redesigned.


Why does a Java source file bear the name of the public class it contains?

I am a newbie learning Java. In Java every source file must contain a public class and that source file should have the same name as that public class. Moreover, no source file can contain two public classes. Why is this restriction?


Advantages and disadvantages of PHP/Ruby

I've been a front-end developer for about two years now, and I'm attempting to break into the server side of things. Ideally I'd like to work for a startup social network on the back-end side so I want to try and be as marketable as possible. In my quest to learn a new scripting language I've dug myself into the PHP vs Ruby hole. What are the main advantages and disadvantages of the two? I would really appreciate words from experience with the two, but will settle for any experience. Cheers.


Reasoning behind indexedDB versioning

So, the last 2 weeks I have been fighting with `indexedDB` and one of two recurring questions that keep popping up is why `indexedDB` has to use/present it's entire versioning system? I do understand that in certain very specific cases it's a nice thing to have, but in those cases an `if(localstorage.dbversion <= ...)` would do, so is there some reason in respect to browser implementations/optimalizations that require this roundabout1 system? Or does it make indexedDB far more efficient or something? 1 Roundabout because **for example** in `onupgradeneeded` you get the transaction from `event.target.transaction` whereas in `onsuccess` you get it from the `result.transaction()`. And there are countless of other more complex examples. (Such as cases where `createStore` is called in response to various huge (too big to keep it all in memory) ajax calls)) * * * If this does not belong on Programmers, but after all on SO then my sincere apologies and I will re-ask it there. (Will remove this note in a bit if it turns out that this is the right place).


Dedupe while or after write

I have a summary tool written in python that reads input files, and writes them into a summary file. I have the following stipulations:   1. No duplicates.    2. If it exists, add a count to it.  Is it better / faster to write one GIANT output file THEN de-duplicate the entries or to dedupe as you go (ie, each write command checks before writing)? The small files are about 100-300k each, there can be hundreds of thousands of these, and the final output file is usually 1-4 MB. A sample line in the file would be like this: `String,number` I would be checking the string for dupes. If it were a dupe, I would output: `string,COUNT,number(additive)` as in, I would keep add the numbers every time I'd get a duplicate, and keep a count of how many times it was duplicated. I would say there are mostly duplicates.


What 's the minimal requirement for a code be considered an AI implementation?

I'd like to know at what point can be considerated an AI implementation? I means, what is the minimal requeriment for that? Can you give a simple code example?


What UML diagram should be used for modelling permissions/users/files in Linux?

If I am planning a structure for support testing in Linux, a structure that will contain packages, such files as shell and build scripts, app configurations, DBs, sources, tests and jars for to be managed, applications for be managers, users, permissions, etc., what diagram could be used for it? Just now I am using the Component Diagram with some stereotyping, but it is not at all convenient in the part of permissions/users stuff. There are such diagrams as RBAC, but they are not UML, and it remains unclear how to combine them. An example picture and/or a real experience description would be highly appreciated. But any fresh thought will be useful, too.


What's the best/most efficent way to create a semi-intelligent AI for a tic tac toe game?

basically I am attempting to make a a efficient/smallish C game of Tic-Tac- Toe. I have implemented everything other then the AI for the computer so far. my squares are basically structs in an array with an assigned value based on the square. For example               s[1].value = 1;      therefore it's a _x_ , and then a value of 3 would be a _o_. My question is whats the best way to create a semi-decent game playing AI for my tic-tac-toe game? I don't really want to use minimax, since It's not what I need. So how do I avoid a a lot of _if statments_ and make it more efficient. Here is the rest of my code:               #include <stdio.h>     #include <stdlib.h>     #include <string.h>     #include <time.h>          struct state{ // defined         int state; // 0 is tie, 1 is user loss, 2 is user win, 3 is ongoing game         int moves;     };          struct square{ // one square of the board         int value; // 1 is x, 3 is o         char sign; // no space used     };          struct square s[9]; //set up the struct     struct state gamestate = {0,0}; //nothing          void setUpGame(){ // setup the game         int i = 0;         for(i = 0; i < 9; i++){             s[i].value = 0;             s[i].sign = ' ';         }         gamestate.moves=0;         printf("\nHi user! You're \"x\"! I'm \"o\"! Good Luck :)\n");     }          void displayBoard(){// displays the game board         printf("\n %c | %c | %c\n", s[6].sign, s[7].sign, s[8].sign);         printf("-----------\n");         printf(" %c | %c | %c\n", s[3].sign, s[4].sign, s[5].sign);         printf("-----------\n");         printf(" %c | %c | %c\n\n", s[0].sign, s[1].sign, s[2].sign);     }          void getHumanMove(){ // get move from human         int i;         while(1){             printf(">>:");             char line[255]; // input the move to play             fgets(line, sizeof(line), stdin);                 while(sscanf(line, "%d", &i) != 1) { //1 match of defined specifier on input line                 printf("Sorry, that's not a valid move!\n");                 fgets(line, sizeof(line), stdin);             }             if(s[i-1].value != 0){printf("Sorry, That moves already been taken!\n\n");continue;}             break;         }         s[i-1].value = 1;         s[i-1].sign = 'x';         gamestate.moves++;     }          int sum(int x, int y, int z){return(x*y*z);}          void getCompMove(){ // get the move from the computer          }          void checkWinner(){ // check the winner         int i;         for(i = 6; i < 9; i++){ // check cols             if((sum(s[i].value,s[i-3].value,s[i-6].value)) == 8){printf("The Winner is o!\n");gamestate.state=1;}             if((sum(s[i].value,s[i-3].value,s[i-6].value)) == 1){printf("The Winner is x!\n");gamestate.state=2;}            }         for(i = 0; i < 7; i+=3){ // check rows             if((sum(s[i].value,s[i+1].value,s[i+2].value)) == 8){printf("The Winner is o!\n");gamestate.state=1;}             if((sum(s[i].value,s[i+1].value,s[i+2].value)) == 1){printf("The Winner is x!\n");gamestate.state=2;}         }         if((sum(s[0].value,s[4].value,s[8].value)) == 8){printf("The Winner is o!\n");gamestate.state=1;}         if((sum(s[0].value,s[4].value,s[8].value)) == 1){printf("The Winner is x!\n");gamestate.state=2;}         if((sum(s[2].value,s[4].value,s[6].value)) == 8){printf("The Winner is o!\n");gamestate.state=1;}         if((sum(s[2].value,s[4].value,s[6].value)) == 1){printf("The Winner is x!\n");gamestate.state=2;}     }          void playGame(){ // start playing the game         gamestate.state = 3; //set-up the gamestate         srand(time(NULL));         int temp = (rand()%2) + 1;         if(temp == 2){ // if two comp goes first             temp = (rand()%2) + 1;             if(temp == 2){                 s[4].value = 2; s[4].sign = 'o';                 gamestate.moves++;             }else{                 s[2].value = 2; s[2].sign = 'o';                 gamestate.moves++;             }         }          displayBoard();         while(gamestate.state == 3){             if(gamestate.moves<10);                 getHumanMove();             if(gamestate.moves<10);                 getCompMove();             checkWinner();             if(gamestate.state == 3 && gamestate.moves==9){                 printf("The game is a tie :p\n");                 break;             }             displayBoard();         }     }          int main(int argc, const char *argv[]){         printf("Welcome to Tic Tac Toe\nby The Elite Noob\nEnter 1-9 To play a move, standard numpad\n1 is bottom-left, 9 is top-right\n");         while(1){ // while game is being played             printf("\nPress 1 to play a new game, or any other number to exit;\n>>:");             char line[255]; // input whether or not to play the game             fgets(line, sizeof(line), stdin);             int choice; // user's choice about playing or not                while(sscanf(line, "%d", &choice) != 1) { //1 match of defined specifier on input line                 printf("Sorry, that's not a valid option!\n");                 fgets(line, sizeof(line), stdin);             }             if(choice == 1){                 setUpGame(); // set's up the game                 playGame(); // Play a Game             }else {break;} // exit the application         }         printf("\nThank's For playing!\nHave a good Day!\n");         return 0;     }


is there any language that supports automatic evaluation of input expressions?

I'm wondering if anyone knows of a language that supports automatic- evaluation. (not sure this is the right term. so let me describe what I mean below) For example, a program asks for an `int` as its input, one can give it `2 + 2`, which evaluates to an `int` with value `4`. Of course, one can certainly make a program that accepts this using any language, but I'm wondering if there is any language that natively supports this. What are the plus and down sides of this? P.S: My "ultimate" goal is to decide whether to do this in a language that I'm designing. So I'd appreciate any input especially with regard to design.