What to do when allowing application to run in an invalid state?

We currently have a 'global catch all exceptions' section in our application. When an uncaught exception is thrown, the stack trace is displayed and the application continues running. More often than not, this leaves the state of the application invalid going forward. Especially with NullReferenceExceptions, and threading exceptions being the cause. I decided to have the application log the exception in the 'global' section and shutdown and restart. This was met with criticism from management - who asserted that the user should choose to select whether or not to restart under these conditions, since it never shut down before. ( _Though I tried my best to explain that the issue was allowing the app to continue running in the first place)_. I am looking for things to watch out for now, and specific approaches I can take to handle code that is now allowed to continue to run while in an invalid state.


Should I use a workflow engine?

I need to add some new features to a PHP application. It is to follow the steps of a order. A process create some orders, the order goes to confirmation, then if approved is sent to a provider, later the provider confirm that can deliver the order, a request is made to the provider and so on... I need to register when every step is made and send notifications. Also, some steps have a estimate time, and if that time is elapsed I need to send notifications so everybody know about the delay. When a process starts, it have a predefined set of steps, but in a middle the user should be able to create new sub-steps, and delete or skip future steps.. Should I use a workflow engine? Which one do you suggests (free-opensource only)?


Converting a bounded knapsack problem to 0/1 knapsack problem

I ran across a problem where goal was to use dynamic programming (instead of other approaches). There is a distance to be spanned, and a set of cables of different lengths. What is the minimum number of cables needed to span the distance exactly? To me this looked like a knapsack problem, but since there could be multiples of a particular length, it was a bounded knapsack problem, rather than a 0/1 knapsack problem. (Treat the value of each item to be its weight.) Taking the naive approach (and not caring about the expansion of the search space), the method I used to convert the bounded knapsack problem into a 0/1 knapsack problem, was simply break up the multiples into singles and apply the well- known dynamic programming algorithm. Unfortunately, this leads to sub-optimal results. For example, given cables:   1 x 10ft,   1 x 7ft,   1 x 6ft,   5 x 3ft,   6 x 2ft,   7 x 1ft If the target span is 13ft, the DP algorithm picks 7+6 to span the distance. A greedy algorithm would have picked 10+3, but it's a tie for minimum number of cables. The problem arises, when trying to span 15ft. The DP algorithm ended up picking 6+3+3+3 to get 4 cables, while the greedy algorithm correctly picks 10+3+2 for only 3 cables. Anyway, doing some light scanning of converting bounded to 0/1, it seems like the well-known approach to convert multiple items to { p, 2p, 4p ... }. My question is how does this conversion work if p+2p+4p does not add up to the number of multiple items. For example: I have 5 3ft cables. I can't very well add { 3, 2x3, 4x3 } because 3+2x3+4x3 > 5x3. Should I add { 3, 4x3 } instead? [I'm currently trying to grok the "Oregon Trail Knapsack Problem" paper, but it currently looks like the approach used there is not dynamic programming.]


Do speakers get paid for tech talks?

I'm curious if speakers (bloggers, google employees like Matt Cutts) get paid for speaking at conferences. If they do, how much? If they don't, or they get paid so little that it's as though they don't, why do it? What are the attractions beyond money that lead a developer into public speaking?


How to trim emails for just the body, when using email as input to an external system?

When an application allows emails to be sent to it to either reply to comments or add todos, trimming those emails for just the relevant text becomes a problem, since there are many different standards. Many times you'll end up seeing things like this: > Hey Joe, good to hear from you. Let me know when you'll be back in town.   >  **_Posted by Bob, 30 minutes ago_** > > * * * > > I'll be back on the 13th. > > \--   >  Sincerely,   >  Joseph R. Roberts   >  Senior Partner > > This communication is confidential and is property of Whatever Law Firm.   >  **_Posted by Joe, 10 seconds ago_** Signatures are probably the most difficult to get rid of, and quoted text the easiest. I imagine any comprehensive strategy for trimming will be multi- facted, and ideally, learning. I think a good system should:   1. Remove quoted body   2. Remove quote headers ("On 15 October, Joe wrote:")   3. Remove signatures   4. Preserve anything that was typed manually. What steps would a system need to take to accomplish this, and what pitfalls should it be aware of? * * * This answer is a good example of a useful answer to a similar question


Architectural patterns for interaction beyond MVC?

We all know the venerable Model-View-Controller pattern used to design interaction [mostly] with human users. It is the de-facto standard in OOP environment. What are some other architectural patterns of interaction worth mentioning? Non-OOP (functional, logical, etc) approaches welcome, too.


Is the separation of program logic and presentation layer going too far?

In a Drupal programming guide, I noticed this sentence: > The theme hook receives the total number of votes and the number of votes > for just that item, but the template wants to display a percentage. That > kind of work shouldn't be done in a template; instead, the math is performed > here. The math necessary to calculate a percentage from a total and a number is `(number/total)*100`. Is this application of two basic arithmetic operators within a presentation layer already too much? Is the maintenance of the entire system severely compromised by this amount of mathematics? The WPF (Windows Presentation Framework) and its UI mark-up language, XAML, seem to go to similar extremes. If you try to so much as add two numbers in the View (the presentation layer), you have committed a cardinal sin. Consequently, XAML has no operators for any arithmetic whatsoever. Is this ultra-strict separation really the holy grail of programming? What are the significant gains to be had from taking the separation to such extremes?


Do you have any tips to help with applying to an international job?

I've had some freelance jobs in my country (Brazil), working for different companies. I like to work to Brazillian companies, but I'm looking for some international experiences and I would like some advice. How do you hire foreign developers/professionals? How can I proceed to become more "visible" to the international employers? I don't want to leave Brazil for now, so I wonder if its possible to get good freelance jobs outside here. If you have worked like I'm willing to work, I'll be glad if you share your experiences ;)


Help in finding the total time taken by the entire production?

I have a line object and each line object has an array of tasks associated with it.Each task has a start time and an end time.Each task also has a list of tasks which are its predecessors. **So if all the tasks were independent (no predecessors) I would just calculate the end time of the last task on each line which would be the end time of this line.The time taken by the production would be the maximum of the end time of all lines.** The problem is a task could be dependent on a task (which could be on the same or a different line). So if a task's predecessor is on the different line and its start time is greater than this task's start time,then this task's start time should be updated accordingly. **How can I calculate the correct production time given these predecessor tasks on different lines?** **EDIT:** This is what I have come up with so far.               Cluster{     func* func[n]     };          func{     int executiontime;     int starttime;     int endtime;     func* pred[k]     };          int main{     /Cluster objects were initialized up somewhere.          Cluster cl[4];//An array of four clusters          for(int i=0;i<4;i++){          cl[i].func[0].starttime = 0;          cl[i].func[0].endtime = cl[i].func[0].starttime + cl[i].func[0].executiontime;          for(int j=1;j<n;j++){          cl[i].func[j].starttime = cl[i].func[j-1].endtime;          cl[i].func[j].endtime = cl[i].func[j].starttime + cl[i].func[j].executiontime;          }          }          int productiontime=Max(cl[0].func[n].endtime,cl[1].func[n].endtime,cl[2].func[n].endtime,cl[3].func[n].endtime);          return productiontime;     }      This is what I have done so far.I am stuck at how to modify the code to account for the task predecessors. **EDIT** :After the above loop,I would update the start and end times of each task whose predecessor task is on another line.If the predecessor task's start time is greater than this task's start time then this task's start and end time both would be updated.How should I do this when the problem is that predecessor task's start time might also need to be updated depending on its own predecessor tasks.


Being IDE dependent. How can it harm me?

I am highly IDE dependent developer (NetBeans and Eclipse as I am a JAVA dev). I can code properly if I have an IDE. I can rely a lot on that for development, debugging and deployment. But without IDE I can do nothing. Can code a simple hello world program or some simple UI arranging but I need an IDE to do complex things or long coding of simpler things. Do you think it harms me? Some programmers who have more than 6 years of development experience strongly believe that it can be harm, but I think that if I can do some complex things rapidly and properly why should I stick to notepad and command line tools to perform a time consuming task when IDEs have a button click to do this?


Does a developer really have to know build tools, classpath etc?

When IDEs like eclipse can handle all the maven, ant, classpath etc related tasks, does a developer really need to learn all these things ? If yes, then why ?


Benefit of C++ to System Administrators

What benefit could C++ bring to system administrators? I am working on Windows and Ubuntu. If I learn C++, where could I implement it in system administration, Please specify some of its benefits.


How do I add restrictions for users to sign up before they can access web site?

How do I get my webpage not to go back when they hit the back button and are logged out ? how can I add a web page to be blocked like FACEBOOK doesn't let you get into their site with out having a page or a account with them, and if you try to put something in the url and try to go to something on their site it gives you a web page that says "you have to be logged in first" ? I mean I don't want someone going to the url of the "index" page before they have signed up as a member they need to make an account first then they can have access to the "index" page. How do I do this gateway? Consider I have a website so far that has a database and the website has 5 pages so far and two of them which is the login and sign up page which are both used with php and mysql and they work fine. How do I restrict access to the main website by first having the users sign up with me for an account?


Are Extension methods (C#) and categories (Objective-C) the same as traits?

According to: Something similar to Objective-C categories in other languages? Static extension methods in C# are `basically the same thing` as Objective-C categories, so I'm going to lump these two features together in asking: Are these techniques the same as traits? Also, can these language features be used to solve problems that typically would be solved with Multiple Inheritance? And, if so, specifically how do they avoid the pitfalls of Multiple Inheritance?


Expanding on vendor software?

I am a SCADA consultant and I work with many software packages. Due to their robust nature they include the capability of executing internal/external activex and vbscript code. Over the years I have written 10's of thousands of lines of code which my clients have utilized happily. I've met a point in my career where I want to go independent with these libraries due to their complex nature. That being said, is it legal for me to advertise "SoftwareX Expansion libraries" or "SCADA expansion libraries for software X/Y/Z"? What exactly can I state on a website or software package which would not get me swarmed by lawsuits? SCADA is supervisory control and data acquisition. Writing advanced reporting/software for industrial hardware and software. I work with human machine interface(hmi) software which allows internal/external execution of vbscript. Think of it as adobe flash, and how it executes actionscript. In the case of adobe flash, I would want to sell my actionscript libraries. My question is - Is it legal?


How to choose which schema design for a tree structured domain model

I have the following classes that I want to store.               public class StorableObject     {         public string Id { get; set; }     }          public class User : StorableObject     {         public string Name { get; set; }     }          public class Project : StorableObject     {         public string Name { get; set; }         public User Owner { get; set; }         public ICollection<Task> Tasks { get; set; }     }          public class Task : StorableObject     {         public string Name { get; set; }         public User Owner { get; set; }         public ICollection<Timesheet> TimeSheets { get; set; }     }          public class Timesheet : StorableObject     {         public User Owner { get; set; }         public DateTime Timestamp { get; set; }         public TimeSpan Duration { get; set; }     }      Schema design has a lot to do with which queries you'll be needing, so let me try to explain a bit. I'll need to do fast queries to extract:   * all Tasks on a Project   * all Timesheets on a Task   * all Projects a user owns   * all Tasks a user owns   * all Timesheets a user owns. I also need some summations like get total time spent on a Project or Task in a given time period and total time spend per user in a given period. (MapReduse I suppose) I started out (after reading this blog) with 4 collections (Users, Projects, Tasks, Timesheets), each child would have a parent reference so I could construct my domain model in my business logic. However after watching this I've changed my mind and now going for a more embedded approach.               {        _id: 123456789,        owner_id: 123,        name: "My Project",        tasks: [                 {                    owner_id: 123,                    name: "My Task",                    timesheets: [                                  {                                     owner_id: 123,                                     ...                                  }                                ]                 }               ]     }      What's your take? Is that a fast schema design?


How to make Ninject inject an MVC view model?

How do I configure Ninject so it injects an instance in a view model? PS. It is an abstracted service to help with validation, so I am not trying to burden the model with too much responsibilities.


How often do you use Formal UML?

I used ad-hoc MUML (made-up modeling language) to design and explain system fairly frequently. It looks similar to UML and tends to be pretty well understood. However, I've had a professor or two that harped on the use of strict, formal UML, as close to the spec as possible. I always suspected that strict UML wasn't really as common as they claimed. So, how 'bout it- how often do you actually draw out complete diagrams that use all the proper line endings, multiplicity, member type symbols, etc?


What should I concentrate on?

Let me first give you a small background. I am a high school student in my last year of high school. When I get to college, I want to take up computer science, because I really love software engineering. At home, I do a lot of programming. I never really finish any projects, but I just create all kinds of different "experimental" stuff just to learn different programming languages, technologies, and programming methods. I am a big fan of C# and I also am getting more into other managed languages such as Java. I've worked with C++ many times, and I know how the language works. Still, I just can't seem to get anything useful done with it. In C#, I can create a useful app in just a few hours. In C++, I will still be trying to understand different 3rd party libraries to get things done. For instance, I was earlier trying to figure out Qt for C++ GUIs, but in C#, you have Windows Forms right there to help with GUI Development. **So I say all of that to ask** , what is the job market out there currently looking for? I want to get more into C++, but it gives me such a hard time. By the way, I am interested in business application programming. So would it be wise to concentrate on sharpening my C# and Java skills and leave C++ until later? Thanks


Is Software Testing Really Needed?

I'm a student working on my B.E(CS) and my question is the following:   1. Is testing in the software field needed?    2. If we create a software with great care, then why should we test?    3. After testing can we be **sure** that we have achieved this goal (the product/software works as intended) because we have done the **testing** for it? Is it possible? My question: **Is testing of software needed**?


For open-source licenses with an acknowledgement clause, how obvious does the notice need to be?

In licenses such as that of libjpeg and freetype, there are clauses like the following: > (2) If only executable code is distributed, then the accompanying > documentation must state that "this software is based in part on the work of > the Independent JPEG Group". or: > o Redistribution in binary form must provide a disclaimer that states that > the software is based in part of the work of the FreeType Team, in the > distribution documentation. Is putting a notice in a text file in the installation directory enough? Or is a more obvious notice typically needed? For a non-open-source end application, what's the usual way to display these mandatory acknowledgments?


arrays format (Javascript)

I have a list of users, with minions, something like this:               User52:            minion10            minion12     User32:           minion13           minion11      I've been keeping in an array where the "location" is the id, like this:               Users:            [52]User                    minions:                            [10]minion                            [12]minion            [32]User                    minions:                            [13]minion                            [11]minion      so I can access them easily like this: `user[UserID].minions[MinionID]` (ex: `user[32].minions[11]`). But when I print it or send it by json I get something like this:               {,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,minion,,,,,,,,,,,,,,minion}      But should I keep using like this or should I change to something like this:               User = function(){        this.minions = ...;        this.getMinion = function(value){          for(var m in this.minions){           if(this.minions[m].id == value){              return this.minions[m];              break;           }          }        }      }      and get it like this:               user.getMinion(MinionID);      Question: I get better performance using a "short" array but using loops every time I need a minion, or using "long" arrays, but no need for loop and getting values directly from the id "name"?


Resharper: Do You Use 'Symbol Completion' or 'Smart Completion'?

@Amir Rezeai says that 'Coding Assistance' is his favorite Resharper feature. I actually just found out about 'Coding Assistance' after watching James Kovacs' most excellent webcast, entitled 'Resharper Tips and Tricks' on Pluralsight.com. My Question is: > Do you use 'Symbol Completion' or 'Smart Completion'? And if so, did it take you a while to get used to [either feature]? * * * These features could potentially accelerate development. But it seems like they require a different mindset.   [I don't know - Maybe it's just me.]


Learn programming backwards, or "so I failed the FizzBuzz test. Now what?"

### A Little Background I'm 28 today, and I've never had any formal training in software development, but I do have two higher education degrees equivalent to a B.A in Public Relations and an Executive MBA focused on Project Management. I've worked on those fields for about 6 years total an then, 2,5 years ago I quit/lost my job and decided to shift directions. After a month thinking things through I decided to start freelancing developing small websites in WordPress. I self-learned my way into it and today I can say I run a humble but successful career developing themes and plugins from scratch for my clients - mostly agencies outsourcing some of their dev work for medium/large websites. But sometimes I just feel that not having studied enough math, or not having a formal understanding of things really holds me behind when I have to compete or work with more experienced developers. I'm constantly looking for ways to learn more but I seem to lack the basics. Unfortunately, spending 4 more years in Computer Science is not an option right now, so I'm trying to learn all I can from books and online resources. This method is never going to have NASA employ me but I really don't care right now. My goal is to first pass the bar and to be able to call myself a real programmer. I'm currently spending my spare time studying Java For Programmers (to get a hold on a language everyone says is difficult/demanding), reading excerpts of Code Complete (to get hold of best practices) and also Code: The Hidden Language of Computer Hardware and Software (to grasp the inner workings of computers). **TL;DR** So, my current situation is this: I'm basically capable of writing any complete system in PHP (with the help of Google and a few books), integrating Ajax, SQL and whatnot, and maybe a little slower than an experienced dev would expect due to all the research involved. But I was stranded yesterday trying to figure out (not Google) a solution for the FizzBuzz test because I didn't have the `if($n1 % $n2 == 0)` ~~method~~ **modulus operator** memorized. What would you suggest as a good way to solve this dilemma? What subjects/books should I study that would get me **solving problems faster** and maybe more "in a programmers way"? **EDIT** \- Seems that there was some confusion about what did I not know to solve FizzBuzz. Maybe I didn't express myself right: I knew the steps needed to solve the problem. What I didn't memorize was the modulus operator. The problem was in transposing basic math to the program, not in knowing basic math. I took the test for fun, after reading about it on Coding Horror. I just decided it was a good base-comparison line between me and formally-trained devs. I just used this as an example of how not having dealt with math in a computer environment before makes me lose time looking up basic things like modulus operators to be able to solve simple problems.


Why do we need the async keyword?

I just started playing around with async/await in .Net 4.5. One thing I'm initially curious about, why is the async keyword necessary? The explanation I read was that it is a marker so the compiler knows a method awaits something. But it seems like the compiler should be able to figure this out without a keyword. So what else does it do?


Can a small team enter .NET world while most of them are working on OpenSource languages?

We are a team of about 15 employees, in a non-IT enterprise. Today, we mainly develop websites, using PHP, MySQL, etc. We run a bit less than 100 linux servers on ourselves. But today, we are confronted with a too-big-for-us-to-code project. We selected a great provider (yes, outsourcing), and now they ask us to choose between C++/Qt and .NET/WPF. The app is highly graphical, and meant to be distributed on Windows systems. .NET is recommanded to us as easier to design and more lightweight. But what about our team ? Can we handle, with our small number, both universes at the same time ? responsibilites :   * during the dev : design the app, review the code   * after the dev : host servers, do maintenance and answer user calls   * in the case we need a v2, we intend to call back the same provider What do you think ? **EDIT** We finally chose C++/Qt. The reasons are :   * the dev time has been tested to be somewhat equal   * it suits us better from a management point of view   * and it increases cross-platform portability


Why do we need method level security?

In the real world , why do we need to implement method level security ? We either have a web application or a desktop application , where the user accesses the user interface (and therefore directly cannot access the method) . So where does accessing methods directly come into picture here ? edit : I ask this question because I am experimenting with spring security , and I see authorizing users for accessing methods . something like :                @ROLE_ADMIN     public void update() {           //update     }


Adding base-class (inherited) functionality to classes that you don't control

I have a set of classes from a 3rd party library. These classes use an inheritance structure to share logic. I would like to add a layer of abstraction in the middle of their inheritance tree to add functionality to all of the children (concrete) implementations. Here is a simplified example of the classes in the 3rd party lib:               public interface IAnimal     {         bool IsMammal { get; }     }          public abstract class Animal : IAnimal     {         public abstract bool IsMammal { get; }         public string Name { get; set; }     }          public class Cat : Animal     {         public override bool IsMammal { get { return true; } }         public void Pur() {}     }          public class Dog : Animal     {         public override bool IsMammal { get { return true; } }         public void Fetch() {}     }          public class Snake : Animal     {         public override bool IsMammal { get { return false; } }         public void ShedSkin() {}     }      I would like to add the concept of an `AnimalWithSuperPower`. These types of animals should have 1 additional Property; `SuperPower`. I would like to be able to have classes like `CatWithSuperPower` which derive from `Cat`, `AnimalWithSuperPower`, & `Animal` so that I can access all the functionality of those. Here is the definition of `SuperPower`:               public enum SuperPower { Invisibility, SuperStrength, XRayVision }      My first idea was to use multiple inheritance. But unfortunately, C# doesn't support multiple base classes.               private abstract class AnimalWithSuperPower : Animal     {         public SuperPower SuperPower { get; set; }     }          // doesn't compile because you can't extend 2 classes     private class DogWithSuperPower : AnimalWithSuperPower, Dog {}      My next attempt uses a combination of inheritance, composition, and generics to try to deliver the functionality of the base classes.               private abstract class AnimalWithSuperPower<TAnimalType> : Animal where TAnimalType : IAnimal     {         public SuperPower SuperPower { get; set; }              protected readonly TAnimalType Animal;              protected AnimalWithSuperPower()         {             Animal = (TAnimalType) Activator.CreateInstance(typeof(TAnimalType));         }     }          private class SuperCat : AnimalWithSuperPower<Cat>     {         public override bool IsMammal { get { return Animal.IsMammal; } }     }          private class SuperCatWithPur : AnimalWithSuperPower<Cat>     {         public override bool IsMammal { get { return Animal.IsMammal; } }              public void Pur() // needing duplicate pass-through methods/properties like this is painful :(         {             Animal.Pur();         }     }          private static void ExampleUsage()     {         var invisibleCat = new SuperCat { SuperPower = SuperPower.Invisibility };         invisibleCat.Pur(); // doesn't compile - can't access Pur() method because doesn't extend Cat              var xrayCat = new SuperCatWithPur { SuperPower = SuperPower.XRayVision };         xrayCat.Pur(); // only works because I exposed the method with the EXACT same signature     }      This solution is not very good (IMO) because of these reasons:   * `SuperCat` and `SuperCatWithPur` aren't actually instances of `Cat`   * any method you wish to use from `Cat` needs to be mirrored in the container class   * feels kind of messy: `AnimalWithSuperPower` is an `Animal` but it also takes an `Animal` type parameter I also tried doing it with an extension method but it wasn't any better than the above two attempts:               private abstract class AnimalWithSuperPower : Animal     {         public SuperPower SuperPower { get; set; }     }          private static AnimalWithSuperPower WithSuperPower(this Animal animal, SuperPower superPower)     {         var superAnimal = (AnimalWithSuperPower) animal;         superAnimal.SuperPower = superPower;         return superAnimal;     }          private static void ExampleUsage()     {         var dog = new Dog { Name = "Max" };         var superDog = dog.WithSuperPower(SuperPower.SuperStrength);         superDog.Fetch(); // doesn't compile - superDog isn't an instance of Dog     }      If I had control of the 3rd party classes, I could likely do this cleanly by introducing a new class in the middle of the inheritance tree, but I can't **My Question:** How can I model `AnimalWithSuperPower` so that:   * instances are considered of types `Cat` (or appropriate sub-class), `Animal`, & `AnimalWithSuperPower`   * all the methods and properties are available without extra pass-through calls


Why is nesting or piggybacking errors within errors bad in general? To me it seems bad intuitively, but I'm suspicious in that I cannot adequately articulate why it is bad. This may be because it is not in general bad and that it is only bad in specific instances. Why is it detrimental to design error/exception handling in such a way. The specific instance is that of a REST service. There is a desire by some to use http errors (specifically the 500 response) as a way to indicate any problem with specific instances of a resource. An example of an instance resource in this case would be:                 http://server/ticket/80 # instance       http://server/ticket # not an instance      So this is the behavior that is being proposed.   * If `ticket 80` does not exist return a http response code of `500`. Within the body of the error return the "real" error as an additional error code and description.   * If the `ticket` resource doesn't exist return a response code of 404.


Good example of gprof, for iOS project

The GNU profiler `gprof`, can be used to profile any application right on the device, allowing real world profiling. As Xcode 4.5 based on LLVM plus it has GNU Debugger, Profiler, and others. I need a better example, implementation example, for iOS projects.


How do I make web-application development less frustrating?

I am fairly new to web-application development. I just can't shake the feeling that it takes me forever to do anything of even remote complexity. In c++ and java I could write the same applications in a matter of hours. On the web debugging is painful (especially if complex json-ajax) is involved. IDEs suck. The languages let everything through without errors until it is doesn't work anymore and you are stuck looking for a bug without any error or warning to guide you (and no real good way to step through the program). Can someone guide me to reading material and/or technologies that would help me find a way to stay sane when developing complex web-applications? Perhaps the answer is to use a good framework (zend?). At work we are not really using a framework except for database models generators and basic add/update/delete page generators.


Tips on develop further on a legacy system?

I was assigned to extend (and eventually maintain) a legacy system (mostly procedural, semi-ball of mud) without MVC. Any tips or suggestions for me going forward? :S


Where does form processing belong in an MVC application?

I found  this question on stack overflow and I have a question about one of the answers: In Zend Framework, forms are typically objects with decorators, but usually (I thought) processing is done using a combination of controllers and models, with the main objective to keep the controller as lightweight as possible, and each object responsible for its own state. One of the answers said to use the form object itself as the place to encapsulate the form processing members. Is that a good practice? For some reason that seems awkward to me. But it also seems awkward to do most of the work in either the database abstraction layer (Zend_Db_Table/Row) or the controller. Where is the best place to encapsulate form processing? Should you create separate classes for the form itself and another class for processing the form (which then deals with the DBAL)? **Edit:** here is another SO post that asks a similar question, but the OP doesn't get a complete answer. We want to know: where does each part of the form processing logic belong?


Is there any method to estimate the cost for source code verification?

I am in need of an estimation technique to verify if the source code delivered is appropriate. for example, if the vendor has developed an application and is surrendering the source code, me as a consultant to the client, need to verify if the source code delivered is genuine and appropriate. Question is how to verify and how much to charge for this service?


Is there a canonical book on Monodroid?

So far I have been living of standard Android books and mainly blogs for Monodroid, but I'm trying to find a definitive resource about the topic and not having any luck. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on Monodroid? What makes that book special?


Middle tier language for interfacing C/C++ with db and web app

I have a web application requiring a middle-tier language to communicate between an oracle database and math routines on a Linux server and a flex- based application on a client. I'm not a software expert, and need recommendations for which language to use for the middle-tier. The math routines are currently in Matlab but will be ported to C (or C++) as shared libraries. Thus, by default there's some C or C++ communication necessary. These routines rely on FFTW (www.fftw.org), which is called directly from C or C++ (thus, I don't see re-writing these routines in another language). The middle tier must manage traffic between the client, the math routines, and the Oracle database. The client will trigger the math routines aynchronously, and the results saved in the db and transferred back to the client, etc. The middle-tier will also need to authenticate user accounts/passwords, and send out various administrative emails. Originally I thought PhP the obvious choice, but interfacing asychronously multiple clients with the C or C++ routines doesn't seem straightforward. Then I thought, why not just keep the whole middle tier in C or C++, but I'm not sure if this is done in the industry (C or C++ doesn't seem as web-friendly as other languages). There's always Jave + JNI, but maybe that introduces other complications (not sure). Any feedback appreciated.


Working with multiple clients

After applying to multiple contracting positions, I landed a few interviews which I then was accepted to do the work. I am also a full time college student, but I do have about 25-30 hours free a week, so that isn't a problem. My issue is how do I manage that **time efficiently**? One of the contracting position starts next week and I've already started one yesterday. How do you make your schedule to fit your clients to give them the most time a day and not get stuck in a narrow path of working for one until you "feel" done? My clients do know that I have other work, but I don't want them to think it'll affect their work nor do I want it to. Also, if you can give advice about similar experience of **things to look out** for or how having multiple clients affected your **quality of work**. I'm hoping this isn't too subjective or too specific, so comment regrading to that so I can fix it . Thanks!


how to separate the logic of different views when using android viewFlipper?

I use a ViewFlipper in a dialog. I want to fetch the data from the EditText in both of them and also add click listeners to both of them. I can write the whole code in one big file, but i want to separate the logic to different files. since i don't need UI and full life cycle I don't use Activities but plain managers. what should i pass these managers to use `findViewById()`? if i pass context how can i fetch its UI's root view?


What are some ways people handle DB change notifications?

Multiple clients can modify the DB and all need to be notified if a DB change occurs. Where I work, this is implemented with application threads that poll the DB every second or so. This doesn't strike me as a good way to do it, so I was wondering how do people usually handle this?


Is it OK to reformat another developers code while modifying/adding to a module?

While developing in a group atmosphere and adding or modifying features in some code base. Is it considered offensive or impolite to reformat the previous developers code to bring it up to current coding standards? I understand that standards have changed, and will probably continue to change, but would any of you get offended if someone came through and changed your code formatting? To be clear, I'm not talking about changing any logic, just messing with tabs and spaces and such. EDIT: I don't only do this for the sake of coding standards, it helps me read through their code and bring it up to date so I can fully understand the logic that has been implemented before I start modifying critical applications.


Differences betwen HTML templating systems

I'm looking at backbone.js and noticed that it supports various templating systems (they specifically refer to Mustache.js, Haml-js, and Eco, but I understand it can support even more)(like Pure and dust.js) My question is really why are there so many of these? What makes one better or different to the others? Can anyone shed light on what their individual strengths and weaknesses are.


Where ORMs blur the lines between code and data, how do you decide what logic should be a stored procedure, and what should be coded?

Take the following pseudocode:               CreateInvoiceAndCalculate(ItemsAndQuantities, DispatchAddress, User);      And say `CreateInvoice` does the following:   * Create a new entry in an Invoices table belonging to the specified User to be sent to the given DispatchAddress.   * Create a new entry in an InvoiceItems table for each of the items in ItemsAndQuantities, storing the Item, the Quantity, and the cost of the item as of now (by looking it up from an Items table)   * Calculate the total amount of the invoice (e.g., shipping and taxes) and store it in the new Invoice row. At a glance you wouldn't be able to tell if this was a method in my application's code, or a stored procedure in the database that is being exposed as a function by the ORM. And to some extent it doesn't really matter. Now technically none of this is business logic. You're not making any decisions - just performing a calculation and creating records. However some may argue that because you are performing a calculation that affects the business (the total amount to be invoiced) that this isn't something that should be done in a stored procedure and instead should be in code. So for this specific example - why would it be more appropriate to do one or the other? And where do you draw the line? Or does it even particularly matter as long as it's sufficiently well documented?


Requiring Programming Portfolios In Interviews/Recruiting

I've heard about a few mentioning of programming portfolios. A programming portfolio being a significant amount of code or code segments. Is a programming portfolio a good indicator of the quality of a developer? Also, another part of this question is how do you reject an potential employer's request for an portfolio?


Appropriate use of SQL CLR

We have some back end processes that runs* on our sql server (SQL Server), they involve processing claims. This requires both data manipulation (biz logic) and data read/write to tables. The biz logic contained should never be used by any of our end user (web/fat client) applications, just for this (runs once, nightly) process. * By "runs" I mean it runs, but it is slow, full or errors, and is a nightmare to maintain, we're looking to redo this to fix these issues. One thing I'm trying to avoid is writing a 3000+ line Stored Proc (we have a few) that does everything, it isn't maintainable. My initial thoughts/approach is to use:   * SQL CLR (Sql 2012 / C# .Net 4.0) for the biz logic (there will be some complexity to the logic)   * Entity Framework for any simple CRUD read/write   * Stored Procedures for any complex data read/writes. There will be a final step of writing our end results (data) to other companies databases, but that's someone else responsibility. I'd like some thoughts about this approach if it is a good one (is there a better approach?), any suggestions would be appreciated.


modify source of copyrighted software

There is a a program that I want to use that is released in two (fully copyrighted) ways:   1. Stable binary form   2. Beta release, mostly-stable binary form that is easy to derive the source (uses jars) (this version is free) Question:   1. Can I legally download the beta version, make the necessary changes to work properly on my machine, recompile and then use the software?   2. If yes to question 1, can I then explain to people I work with how to do the same thing so that they too can use the product?  In no way would I be giving them the modified software, but rather distributing instructions how to modify it. The original download would still come from the copyright owner. I believe I have done my due diligence searching these and google's forums, but as always, if you find a duplicate question, please let me know (and point to where it is found). It seems odd to me that this hasn't been covered yet.


How to handle unexpected schema changes to production database

Is it a common or normal practice to encounter schema changes, especially renamed or removed columns, in a production database, without having been notified of the change? If unexpected schema changes are anticipated in the production database, how are they guarded against, other than basic exception handling? I've worked mainly with credit union software, DoD software, high volume e-commerce web applications, real estate systems, robotics, and more recently CMMS, GIS, and SCADA systems. Although the '90s and early 2000s were more of the wild west, everything I have been involved with over the last 10 years or so has required change management. Modifications to a production database without change control is not allowed by policy and by security controls. Comments in the accepted answer to this question - Why is “Select * from table” considered bad practice make me wonder how much of this is academic and how much is reality.


How to network with other developers?

What suggestions would you give to find networking opportunities or to network at user groups and other developer venues? For instance, if you went to a code camp, would you try to network with other developers there? How would you go about doing it? Would you go up to someone you don't know at lunch and introduce yourself? I recently attended a user group meeting and found it somewhat boring. Only a few people really seemed to talk to others. Most attendees seemed to keep to themselves. Is this typical for developers? I've never been good at networking, probably somewhat introverted around people I don't know, so networking isn't my strong point. However, I would definitely like to branch out more and meet other developers.


scripting support in a C# application

what is the simplest and fastest way to support simple scripting in a .Net application? I search a lot but only find many things with practical no documentation or outdated since years. I only need to transfer a simple .Net Object to the script and get a bool result from it.


Does anyone have a specific example of using the Flyweight Pattern?

I have been studying design patterns and came accross the fly weight pattern. I have been trying to see opportunities to use the pattern in my applications but I am having trouble seeing how to use it. Also, what are some signs that a fly weight pattern is being used when I read other peoples code? According to the definition it says: > Use sharing to support large numbers of fine-grained objects efficiently. If I read it right Dictionaries and Hashtables could be instances of fly weights is this correct? Thanks in advance.


using parent child windows - is chrome phasing this out?

I use child pop ups extensively in my browser based web application. Examples include using child to search for information which is passed back down to parent form that is updated or I use child to update recordset information which then updates and refreshes parent. Current code has been working great in IE for years and until latest Chrome update (version 34.0.1847.116) it was working in Chrome too. Now it doesn't. From what I have read, it appears Chrome is specifically disallowing the ability to pass focus back to the parent from child. I cannot understand why this is the case. Its simple, intuitve and easy. Can someone shed light on this please? And what are the thoughts regarding using parent child in this way as a method? Hope I have made myself clear :) Thanks in advance.


What's the ideal length of the sprint review/retrospective based on the length of the iteration?

I've been in several projects using scrum now. The length of the sprint review and/or retrospective has varied from client to client, from project to project. Some of the reviews became too long (2 days). Sometimes, I've lost focus while being in this long meetings and just wanted to go back to my safe and happy place (my chair in front of my computer). What is the ideal length of these meetings? What's the best way to avoid long meetings?


Reading from a file and inserting into a database, a good practice

I am making an Android application which reads several JSON files and inserts the read information into tables in my database. For instance, there are three files:   1. countries.json { "countries": [ { "name": "United States", "org_ids": [ { "id": 1 }, { "id": 2 }, { "id": 3 } ] }, { "name": "China", "org_ids": [ { "id": 1 }, { "id": 2 } ] }, { "name": "Hong Kong", "org_ids": [ { "id": 3 }, { "id": 4 }, { "id": 5 } ] } ] }   2. orgs.json { "orgs": [ { "id": 1, "name": "UNO" }, { "id": 2, "name": "Organization of American States" }, { "id": 3, "name": "INTERPOL" }, { "id": 4, "name": "European Union" }, { "id": 5, "name": "The Commonwealth of Nations" } ] }   3. continents.json { "continents": [ { "id": 1, "name": "Africa" }, { "id": 2, "name": "North America" }, { "id": 3, "name": "South America" }, { "id": 4, "name": "Asia" }, { "id": 5, "name": "Europe" }, { "id": 6, "name": "Australia" } ] } Please don't pay attention to the contents of my JSONs, they don't contain real members of the listed international organizations. It's just an example. I see two ways. **THE FORMER WAY.** Store each country with its data to a class instance and define a `SparseArray` contains a country ID as a key and a `CountryInfo` object as a value.               /** Each item contains country's ID (key) and respective data (value) */         private SparseArray<CountryInfo> mCountriesInfo = new SparseArray<JsonParser.CountryInfo>();      After reading everything from the files, the data from the `SparseArray` will be inserted into the database.                   private class CountryInfo {              String mCountryName;         int continentId;         String mContinentName;         /** Contains IDs (keys) and names (values) of organizations */         SparseArray<String> mOrgNames = new SparseArray<String>();          }      **Drawbacks.**   * The more JSONS (or the more complex JSONs) the more complex the class for storing.    * Data duplication. **Benefits**   * Reading and inserting does not depend on each other. **THE LATTER WAY.** Read and insert without preliminary saving. **Drawbacks.**   * Database logic and reading logic are mixed. **Benefits.**   * No any additional classes.    * No data duplication. Which way is a better practice?


How do you deal with pain from typing too much?

This is probably not the right place for this question, but I figure it is a board visited by thousands of programmers, and I am a programmer, and it is related, so I would try anyway. This is not a technical question, but rather a physical one - targeting mostly programmers, who have, as we all know, an extremely keyboard intensive lifestyle. The constant back and forth of the mouse, the rapid typing, the near expert level fluency over the keys. I can't be the only one who has come down with long term chronic pain from all of this. So I pose the query to other coders, how do you slow down? How do you bring those enormous typing speeds down to levels that let you function in day to day workload? I am currently attempting unfamiliar keyboard layouts, arthritic gloves, restrictive pads, and even word delay tools and I am having a lot of trouble "training" myself to type more slowly and not burn my arms up. I apologize if this isn't appropriate content, I just figure a place with all programmers would hold some insight.


Persistence frameworks and common sense

I have studied some persistence frameworks mainly Hibernate, DORM, TMS Aurelius and I'm wondering. In a model of type:               TOrderFiscal < > ----- > Items < > -------- > TOrderItem ------- > TProduct          TOrderFiscal --------- > TSuplier --------- > TCidade -------- > State      Each class of this with countless attributes, all mapped correctly to their corresponding tables and fields. When carrying a note without using "Lazy Load" would always be done with several joins select all fields to come from each of these classes. But it would be a waste since the note need only the supplier code and name attributes, the attributes OrderItem need only code, qty name. stock. What solution should be taken to create a specific class supplier of note just with these attributes ? eg               TOrder <> ----- > Items <> -------- > TOrderItem ------- > TNotaItemProduct          TOrder -------- > TOrderSupplier      If this is the solution , what happens when a business rule in TProduct should also be TOrderItemProduct? I duplicate code in both classes? Do heritage, eg TORderItemProduct and TProduct both inheriting from TBaseProduct ? Or is this a concern that we programmers we should not have ?


Is Windows suitable for Ruby development?

I've read that Windows is not recommended for Ruby development and this is last thing that stops me from starting some projects in Ruby. Are there any changes to this? Or any suggestions to make development less painful? PS. I really like Win 7 as desktop OS, but for production I'm going to use Linux server.


C++ library API: new or getters?

I'm writing a C++ wrapper for my C library (my C++ skills are a bit rusty) and I'm wondering what's preferable: allowing user to construct objects themselves or give them objects via getters? What would be idiomatic C++ equivalent of that C function?               result* process_foo(library_handle*, foo*);      a constructor like this:               Result *res = new Result(library_handle, foo);      or a getter like this? (that basically wraps the above code):               Result *res = library->get_result(foo);      Does the answer change if creation of the result could fail? Getter could return `NULL`, but what should constructor version do on failure? AFAIK some people don't like exceptions. An extra method such as `init()` or `is_valid()` doesn't seem elegant. OTOH the `Result` object sticks to RAII, it's tiny with inline methods, so it might be good candidate for stack allocation.


Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity O(N)

Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity `O(N).` Another variant of the question goes like this: given a matrix with sorted rows, and sorted columns, find kth smallest. We can easily formulate an `O(klogk)` solution with minheap, but the challenge is doing the same in `O(N)` time ... The paper below formulates the solution but I could not understand it. Can somebody explain it or any alternative idea? hint: http://www.cse.yorku.ca/~andy/pubs/X%2BY.pdf


When to use MVC

I'm building a site with PHP and a MySQL backend. But, I am currently not using any type of framework. Should I be using Model View Controller?


How to remember the details (Core APIs) of one computer language?

I found my self often paused to check a certain usage of one core API when writing either `javascript` or `Ruby`. I am wondering how the other guys doing? Is it necessary to remember every Core API usages? It the answer is **yes** , how did you guy do it **efficiently**?


does quicksort provide less swapping step?

So far, most of the fastest and common sorting method is quicksort. Although it has its pro and cons. However, i'm thinking that although this sorting method is fast but does it provide shortest swapping step? Because quicksort divide a set of element into 2 and then sorting, will it double up the swapping step?


Managing large number of app.config files

We have many windows services and web apps which all rely on a lot of common settings. Currently we use just appSettings as needed and they are referenced by key. Some of the settings are app specific and only know by the app team while others are environment specific and only know by the deployment team. Also we have issues when we have to make a change to common setting necessitating the change 100s of files and restarting all corresponding services. With the great variety of settings there are duplicates ones that are no longer used and many that don't mean the same thing to different applications. To solve the problem I had a two fold idea one we would write a custom config sections group for the company with custom config sections for each app and one for common. The common section would be able to accessed by a wcf service and validate that all of its settings are the current settings. My question is am I reinventing the wheel are there any good frameworks/projects/products that are designed to manage many many configurations files in a distributed environment, and if not is the approach I have decided take a reasonable one.


Why would Qt be considered harmful?

A large list of "harmful stuff" related to software development is presented on cat -v. Is Qt harmful? What would be the rationale for considering to Qt harmful? Why would Tcl/Tk be presented as a superior alternative?


OS Development in C++ Questions

As a Master's project, I am designing a simple operating system. It is being designed to run in 16-bit Real Mode on an x86 architecture. Ideally, I would like to develop this OS in C++, and only using assembly where necessary. Thus far, I have a boot loader written in assembly, that loads a kernel that is a mix of C++ and asm. My question is in regards to using C++. As of now, it has compiled and can run, but I have not used any dynamic memory allocation. If I were using C, it would make sense to write malloc functions that would handle memory allocation, but in C++ the new keyword is used. So... **How does 'new' work behind the scenes to allocate memory, and how would I go about handling this?** And as a corollary... **Does it make sense to try to use C++ to take advantage of its higher level abstactions? Or would it be more of a headache to use it and should I stick with C?** Please provide rationale if you believe that C++ would not be a good choice.


Why is C++ backward compatibility important / necessary?

As far as I understand it is a wide-spread opinion within the C++ community that certain features of C++ (including some features inherited directly from C), while still usable in themselves, do not fit well with the most recent C++ _best practices_. For example, I read a comment on this site stating that new / delete should be avoided altogether in favor of smart pointers. In view of this, I often wonder why backward compatibility with C and earlier C++ features is still important: to my knowledge there is no 100% compatibility, but most of C and C++ are contained in C++11 as a subset. So, maybe it would be possible / make sense to drop earlier C++ features (e.g. the mentioned new / delete) from a future C++ standard so that it is impossible to use them in new code. Existing code could still be maintained using the appropriate compiler. Interoperability between legacy and new code would be supported through separate compilation. One could continue to use the earlier standard or adopt the more recent one, only mixing the two would not be possible: a developer /team would have to **clearly choose** which programming style they want to use. The most flexible solution would be to have compiler options to switch on and off certain features (e.g. no new / delete allowed). Would this be a viable strategy for encouraging the adoption of modern C++ practices? Are there technical problems (e.g. compiling existing templates, ABI compatibility) that make such a change too difficult or even impossible? **EDIT** Following the suggestions contained in comments and answers I have shortened and partially reformulated the question. This is **NOT** a C versus C++ question. It is a question regarding C++ best practices and how they can be promoted. **EDIT 2** The number of down-votes suggests to me that the point of the question has not be understood by some. I have changed the formulation to stress the important point even more.


How to maintain trade off between number of columns in table vs join operations?

I have learnt that if there are more columns in table, then get those results using join query. How to decide the max number of columns in table? How feasible is "Join Operation" if too many table involved? **And if join operation hurts performance** Can we define all columns in one table to get rid of join operation? I found many developer telling me that its better to have few extra columns if needed frequently in most database operation than to have multiple tables.


What decent web-frameworks exists for functional programming?

I would like to do some web programming using functional programming. What decent web-frameworks exists for functional programming languages?


Real life examples of P, NP, NP hard ,NP Complete problems

I need to know the real life or real time examples of above mentioned problems thanks!!


Tools for Operating on Large Amounts of Text Data

I need to handle and process ~5 million news articles, an amount small enough to fit on a commodity desktop but too large to process serially. Thus far, I have been using Python/`pickle` for serialization, but this is easily getting out of hand. However, I do not have a server much less a cluster immediately available for distributed storage. What tools can I use to store, query, and operate on this size of a dataset? The majority of operations I need to do can be formulated as Map operations; the only exception is that the Natural Language Processing portion which is handled by calling Stanford's CoreNLP software suite (it needs a few seconds to load some large parameter files).


At least one database view per database table-Is this good or bad design and why?

We are building a Windows Mobile based application to interface with a customer's existing web application. We are reading and writing data to the customer's SQL server 2008 database. The customer wants all reads to happen through SQL views, and all writes to happen through stored procedures. But taking a look at their database schema, they have a view of each and every table. And they have a view of each and every query that would be used to read data, instead of using the existing views on their tables. They have 348 tables and 655 views so far. They want us to model our mobile application in a similar fashion i.e. create additional views for all queries that we use to retrieve data. I know this is poor design, but I am unable to list out to the customer why their view based strategy is a poor design. What is the consensus in the community on when to use views? How does having so many views affect performance of the SQL server?


Good resources for learning Rails?

> **Possible Duplicate:**   >  Is there a canonical book on Ruby on Rails? I just finished working through Peter Cooper's "Beginning Ruby". So now I've got a reasonable grounding in the Ruby language and would like to move onto learning Rails. This question's answers give some good pointers, but I'd like to hear some specific reviews of books and online materials. I generally learn best by working through books with good practical/technical examples AND some passive reading content that breaks up the study between practical and reading sessions (this is what made "Beginning Ruby" great for me), but I'm worried that RoR is evolving fast and that any printed book I order might be obsolete by the time I get it and work through it. Is this a fair worry? Or can anyone recommend a good Rails 3 book that should be up to date at least for the next year or so? Also, I had a brief look at some of the online resources from the other questions, and Rails for Zombies seems to get a lot of praise. Has anyone here actually used it as their introductory guide to Rails? Basically I'd like to hear first-hand accounts of people who went through this "Ruby-to-Rails" learning phase recently and which materials were useful to you.


How should I go about learning Ruby and Rails?

> **Possible Duplicate:**   >  Is there a canonical book on Ruby on Rails? I really want to change my PHP specialization to Ruby. I have some Ruby/Rails experience, and I've already created a few Ruby apps and a few Rails apps, but I want to dig deeper. I have limited time everyday for studying, so I'm looking for an effective way to improve my skills. I want to learn and understand a lot of Ruby-specific topics, e.g.:   * Ruby coding style   * understanding Ruby/Rails internals   * OOP and functional realization   * OO patterns in Ruby Also any other technologies related to Ruby and Rails that intermediate/senior developers should know. I don't want to confuse myself by reading/watching everything without a plan, so I need a good roadmap; I could create this plan by myself, but I would like to hear some advice from more professional developers. **Update: here is what I have so far** :   1. Learn the obscure parts of Ruby syntax; the parts that aren't explained in books that simply cover syntax.   2. Learn TestUnit.   3. Learn TDD and use it every time I write code.   4. Learn Ruby patterns. Ruby's OO architecture is different than PHP/Java/C++, so patterns look different.   5. Learn metaprogramming techniques.   6. Write my own web server that has common features, e.g. process-based, thread-based. Publish it on GitHub and get help from others at stackoverflow etc.   7. Dig into rack.   8. Dig into useful gems and tools such as: rake, haml, sass, rspec, nokogiri, capistrano, cucumber etc.   9. Write my own simple MVC framework that uses several ORMs. Publish it on GitHub and get help from others at stackoverflow etc.   10. Learn Rails by learning every topic from different sources: books, articles, screencasts. For example: learn generators from books, from railscasts, searching at stackoverflow, google groups etc.   11. Read Rails-specific topics in Crafting Rails Applications, paid screencasts from RailsCasts, PeepCode, TekPub, Rails for Zombies v2.


Is there a good reference manual for ruby/rails?

> **Possible Duplicate:**   >  Is there a canonical book on Ruby on Rails? I've found switching from Java to Ruby/Rails to be very difficult. I feel like the rails books and websites that I've seen are program by example, and I have yet to see anything like a complete reference. In the java/spring world there is plenty of examples but also very thorough reference manuals. So even though I can get toy application xyz up and running in an afternoon with rails I'm apprehensive about doing anything of significance. I'm willing to admit that maybe this is because I've done java/spring for a few years and have near zero experience with ruby/rails. Just wondering if anyone else has run into this or if I'm missing something.


Rails Book Suggestions

> **Possible Duplicate:**   >  Is there a canonical book on Ruby on Rails? I'm looking to learn Ruby on Rails. I already have a small background in Ruby and don't really need a book that covers both, as I ordered the Pickaxe Book a couple days ago. I recently read some of Beginning Ruby on Rails-Steven Holzner, but abandoned that after seeing multiple statements on SO about how terrible the code in it was, and also the fact that it used Rails 1...Just wondering, what is the best book for an ABSOLUTE BEGINNER in Rails?


Legal issues of creating a version of a classic game (Snake)

I recently created a version of Snake, the classic game popularized by Nokia, and I am planning on using it as an example of my game development skills. I just want to know if there are any copyright issues that could come up if I do this?


Java SE and Java EE?

I was now talking with some people and they told me that if i was intrested in a job in the future for Java programming i should not spend too much time only learning Java SE i should spend time learning Java EE instead.. Now that brought me to some questions.. Java Enterprise Edition why use this ? What can i make with this that i can't make in Java SE?, And what kind of applications is this good for? Is there any good books out there that i can read to learn the Java EE? If i know Java SE well is it easier to learn Java EE ? Thanks! I will keep browsing the web for some anwears for theese questions.. And if i find anything i wil update this question.


What is the difference between Enterprise Java vs Core Java?

I have some experience in programming in Java but wondering if someone could explain what is the difference between Enterprise Java vs Core Java? Someone asked me a question on whether I use core-Java or Enterprise Java. Now I have to ask is there such thing as core-java?


Distributing Libraries

How are libraries typically distributed? Because they have to be compiled with the **same compiler** under the **same settings** as the project using it, distributing the `.dll`, `.lib`, etc. seems impractical. Is the source code just made available for download?


What's the difference between computer science and programming?

I'm new at computer science and programming, and I was wondering, is there a difference between computer science and programming? and do you get to choose to study only one of them at the university, or both of them?


What are the things you put on an impact analysis document?

So you're fixing bugs, then you encountered one that could affect other modules of the software product. Your data is not enough to support your claim about the effects of the fix and you were asked to create an impact analysis document.   1. Is there a defined process on how to do this?   2. What are the key information needed?   3. Are there any known formats / templates for this document?


Find material for improvement of my SQL ability

I need lots of training in SQL coding in MS SQL server The following part that is needed to be improved is:   * script    * T SQL    * Procedure    * Function Problem:   Where can I get material to improve my ability in SQL coding? Is there any website for downloading a database with different task/assignment and solution? Where should I go to review lots of SQL code?


Designing status management for a file processing module

**The background** One of the functionality of a product that I am currently working on is to process a set of compressed files ( containing XML files ) that will be made available at a fixed location periodically (local or remote location - doesn't really matter for now) and dump the contents of each XML file in a database. I have taken care of the design for a generic parsing module that should be able to accommodate the parsing of any file type as I have explained in my question linked below. There is no need to take a look at the following link to answer my question but it would definitely provide a better context to the problem Generic file parser design in Java using the Strategy pattern **The Goal** I want to be able to keep a track of the status of each XML file and the status of each compressed file containing the XML files. I can probably have different statuses defined for the XML files such as NEW, PROCESSING, LOADING, COMPLETE or FAILED. I can derive the status of a compressed file based on the status of the XML files within the compressed file. e.g status of the compressed file is COMPLETE if no XML file inside the compressed file is in a FAILED state or status of the compressed file is FAILED if the status of at- least one XML file inside the compressed file is FAILED. **A possible solution** _The Model_ I need to maintain the status of each XML file and the compressed file. I will have to define some POJOs for holding the information about an XML file as shown below. Note that there is no need to store the status of a compressed file as the status of a compressed file can be derived from the status of its XML files.               public class FileInformation {              private String compressedFileName;         private String xmlFileName;         private long lastModifiedDate;         private int status;              public FileInformation(final String compressedFileName,                 final String xmlFileName, final long lastModified, final int status) {             this.compressedFileName = compressedFileName;             this.xmlFileName = xmlFileName;             this.lastModifiedDate = lastModified;             this.status = status;         }     }      I can then have a class called StatusManager that aggregates a Map of FileInformation instances and provides me the status of a given file at any given time in the lifetime of the appliciation as shown below :               public class StatusManager {             private Map<String,FileInformation> processingMap = new HashMap<String,FileInformation>();                public void add(FileInformation fileInformation) {             fileInformation.setStatus(0); // 0 will indicates that the file is in NEW state. 1 will indicate that the file is in process and so on..             processingMap.put(fileInformation.getXmlFileName(),fileInformation);         }              public void update(String filename,int status) {                     FileInformation fileInformation = processingMap.get(filename);             fileInformation.setStatus(status);         }             }      That takes care of the model for the sake of explanation. _**So whats my question?_** Edited after comments from Loki and answer from Eric : - I would like to know if there are any existing design patterns that I can refer to while coming up with a design. I would also like to know how I should go about designing the status management classes. I am more interested in understanding how I can model the status management classes. I am not interested in how other components are going to be updated about a change in status at the moment as suggested by Eric.


Do programmers think differently from non-programmers?

From reading various comments on this site, surfing the net, and talking to other programmers/non-programmers I find that a recurring theme is that programmers think differently from non-programmers. Do you really think this is the case? Aren't programmers just people who have a skill that can be difficult to explain in detail to non-programmers? Isn't this the same problem that any skilled person has when explaining it to someone unskilled in that same area? Edit 2: Hackers and Painters - This is a link from Michael's answer. Definitely worth reading if you've got a spare 15 mins Edit: Here's a link to clarify my question Programmers think differently than non-programmers The author of this blog holds the stance that programmers don't think differently from others. Does anyone disagree with this? If yes, why?


Unit testing for a scientific computing library

I've had a bit of experience with unit testing before, in what I call (not pejoratively) the classic software engineering project: an MVC, with a user GUI, a database, business logic in the middle layer, etc. Now I'm writing a scientific computing library in C# (yeah, I know the C# is too slow, use C, don't reinvent the wheel, and all of that, but we have a lot of people doing scientific computation in my faculty in C#, and we sort of need it). It's a small project, in terms of the software development industry, because I'm writing it mostly by myself, and from time to time with help of a few colleagues. Also, I don't get paid for it, and most important, is an academic project. I mean, I expect it to have professional quality some day, because I'm planning on going open source, and hopefully with enough time it will grow a community of developers. Anyway, the project is getting big (around 18,000 lines of code, which I think is big for a one man's project), and its getting out of my hands. I'm using git for source control, and I think I got pretty all right, but I'm testing like old school, I mean, writing full console applications that test a big part of the system, mainly because I have no idea how to do unit testing in this scenario, although I feel that is what I should be doing. The problem is that the library contains mostly algorithms, for instance, graph algorithms, classifiers, numerical solvers, random distributions, etc. I just don't know how to specify tiny test cases for each of these algorithms, and since many of them are stochastic I don't know how to validate correctness. For classification, for instance, are some metrics like precision and recall, but these metrics are better for comparing two algorithms than for judging a single algorithm. So, how can I define correctness here? Finally there is also the problem of performance. I know its a whole different set of tests, but performance is one of the important features of a scientific tools, rather than user satisfaction, or other software engineering metrics. One of my biggest problems is with data structures. The only test I can come up for a kd-tree is a stress test: insert a lot of random vectors and then perform a lot of random queries, and compare against a naive linear search. The same for performance. And with numerical optimizers, I have benchmark functions which I can test, but then again, this is a stress test. I don't think these tests can be classified as unit tests, and most important, run continuously, since most of them are rather heavy. But I also think that these tests need to be done, I can't just insert two elements, pop the root, and yes, it works for the 0-1-n case. So, what, if any, is the (unit) testing approach for this kind of software? And how do I organize the unit tests and the heavy ones around the code-build- commit-integrate cycle?


Couple of questions about sprint in scrum methodology

Its a general title for the question but I have a couple of questions for the Sprint in a SCRUM methodology.   1. What happens if a HOTFIX comes in the middle of a sprint. e.g - The website crashes or some part of the site that hasnt been worked on for quite some time crashes (like creditcard authorize or webservices etc). How do you incorporate that in the current Sprint(s)?   2. How to tackle bugs at the end of a Sprint. I know we can have Defect tracking sprint but should I plan for that at beginning? Or do I put that sprint back in the product backlog and start planning that from the next sprint planning.   3. How to decide how many sprints are required?  thank you for your help


Drag and drop feature for a website

I have to design a website which will have drag and drop features for creating an e-card. So you select items from a tool box and drag and drop this item on the card area. Once you have completed the design you can publish the e-card on the web by clicking "Save and publish" button. What are the possible technologies for implementing this feature? The requirement is that the application should not degrade the performance of the website, and should not take much time in publishing once the user click "Save and publish" button.


Is there a factory pattern to prevent multiple instances for same object (instance that is Equal) good design?

I have a number of objects storing state. There are essentially two types of fields. The ones that uniquely define what the object is (what node, what edge etc), and the others that store state describing how these things are connected (this node is connected to _these_ edges, this edge is part of _these_ paths) etc. My model is updating the state variables using package methods, so all these objects act as immutable to anyone not in Model scope. All Objects extend one base type. I've toyed with the idea of a Factory approach which accepts a Builder object and constructs the applicable object. However, if an instance of the object already exists (ie would return true if I created the object defined by the builder and passed it to the equal method for the existing instance) the factory returns the current object instead of creating a new instance. Because the Equal method would only compare what uniquely defines the type of object (this is node A to node B) but won't check the dynamic state stuff (node A is currently connected to nodes C and E) this would be a way of ensuring anyone that wants my Node A automatically knows its state connections. More importantly it would prevent aliasing nightmares of someone trying to pass an instance of node A with different state then the node A in my model has. I've never heard of this pattern before, and it's a bit odd. I would have to do some overriding of serialization methods to make it work (ensure that when I read in a serilized object I add it to my facotry list of known instances, and/or return an existing factory in its place), as well as using a weakHashMap as if it was a weakHashSet to know whether an instance exists without worrying about a quasi-memory leak occuring. I don't know if this is too confusing or prone to its own obscure bugs. One thing I know is that plugins interface with lowest level hardware. The plugins have to be able to return state that is different than my memory; to tell my memory when its own state is inconsistent. I believe this is possible despite their fetching objects that exist in my memory; we allow building of objects without checking their consistency with the model until the addToModel is called anyways; and the existing plugins design was written before all this extra state existed and worked fine without ever being aware of it. Should I just be using some other design to avoid this crazyness? (I have another question to that affect that I'm posting).


What does it mean when code "runs on" the .NET CLR?

The .NET CLR is not an interpreter, since code gets compiled to native code by the JIT compiler. So I find the usual description of code "running on" the CLR confusing. How does the native code interact with the CLR? Does the compiler insert calls into CLR methods at the beginning and end of your methods, for example? I have no idea.


Is having my objects so aware of each interconnection a bad thing?

I'm looking to refactor an existing design; to move a bunch of stuff out of a database and into memory where it should be (There are many reasons the DB approch is dangerous as it is now). My first act was to take all the existing objects and expand more state to them. The previous objects new only their parents, and that was it. From the youngest child you could walk up to find parents, but you couldn't ask "what edges are on this node" at all. I changed things to make state more accessible from every object. Now each object effectively knows of it's parent and all of it's children. I thought this was an obvious simplification that would make storing things in memory much easier. The problem is that I need to be able to construct objects without modifying my model, untill addToModel is called, which means I need to be able to construct objects in one state, and then update some of their state to be consistent with the Model's state and properly represent all the interconnectivity (node has to be informed when an edge is added, edge needs to know it's paths etc etc). This proved surprisingly complicated to keep consistent. I end up with either encapsulation issues (like assuming each object knows not to call the package scope methods that change memory from public methods that shouldn't be able to change state), as well as a concern about aliasing (what if someone creates a new Node A with no connections, when my Model says node A should be connected to B, C, and E?). I thought of many approches that work, but none feel 'clean'. Is the issue that I"m trying to make my objects too aware of state, and thus putting too much effort on my model to maintain this state?


Where to put details about the acceptance criteria of a user story?

In this blog post about acceptance criteria the author explains that good acceptance criteria should:   * State an intent not a solution (e.g. “The user can choose an account” rather than “The user can select the account from a drop-down”)   * Are independent of implementation (ideally the phrasing would be the same regardless whether this feature/story would be implemented on e.g. web, mobile or a voice activated system)   * Are relatively high level (not every detail needs to be in writing) And further details such as:   * The column heading is “Balance”   * The rolling balance format is 99,999,999,999.9 D/CR   * We should use a dropdown rather than checkboxes should be moved to either a _Team internal documentation_ or _Automated acceptance tests_ **However** , I often hear people frowning about using Cucumber or similar frameworks for doing GUI tests. Moreover, using an internal documentation could generate lots of problems due to failure to update the documentation regularly. I'm still struggling to find an effective way to capture such details during the conversation with the customer.


How to manage tailored/branded web tools?

We produce a number of analysis tools which we re-brand and customise for other businesses to include in their websites. The tools are typically product comparison, data/trend analysis and report production (in a very particular sector). At present these tools run as a single instance in house, our clients redirect there traffic to us with a URL param specifying the client for branding and customisation. Up until now we've been using an MVC approach with XSLT views. If a customer wants customisation we add switches in the MVC and/or imports&override in the XSLT. This was manageable for a while but now we have so many versions and customisations for sooo many clients, getting stable builds out the door is becoming a nightmare We are looking to move to MS asp.mvc3 with using Razor for our views but before this I am wondering are there any standard practices or patterns for developing and managing the kind of mess we are sliding towards? Cheers, T


Hot swap/plug components in clojure?

I'm using OSGi for some time and I **really** like the ability to swap/replace components while my application is running. I simply have to build my module and push it to the OSGi container. Is there a similar concept/framework for clojure? I know about leiningen's dependency management which really helps modularity but I know of no built-in way to hot swap code.


REST object with resources

I am designing a HTTP-based REST API. Let's say I have an entity called `Entity` that has a bunch of properties. Some of its properties are files. Let's say `Entity` has following properties:               name: string     description: string     photos: array of photos     videos: array of videos      API is designed to be used from mobile devices and should work well under conditions of slow or unstable connection. The thing is the object should be not considered as complete until I upload all the resources the client have. What it the best way to construct a new object? * * * For now I come up with the following solution. Add readiness flag `isReady`, first post basic object data within single json:               POST /entities/ {name: "somename", description: "description", isReady: false}     obtain id of newly created `entityId`      Then upload resources one by one:               POST /entities/{entityId}/photos/ <photo data>     POST /entities/{entityId}/videos/ <video data>      And then update object's readiness flag               PUT /entities/{entityId}/ {isReady: true}      * * * The second solution that comes to mind is to create separate endpoints for photos, videos. Then I'll be able to first post photos and videos and then create `Entity` with references to resources.               POST /photos <photo data>     obtain ids     POST /videos <video data>     obtain ids          POST /entities/ {name: "somename", description: "description", photos: ids[], videos:ids[]}      The question with the second solution: is it okay for resource to be referenced by multiple `URIs`?               /entities/photos/{photoId}     /photos/{photoId}      * * * Is the first solution correct? Wouldn't the second one be overcomplicated? Thanks in advance


What defines an encapsulation properly?

I find the encapsulation concept a bit confusing. So far I have read that the members of the class should be private and any access to private members must be through getter and setter methods, which are public. Are these the only properties which define a properly encapsulated class? If yes, what about protected class members? We can access protected members in the same package through an object reference -- are classes containing protected members improperly encapsulated? Please give clarification.


Managing one-off scripts using DVCS

As a research scientist, I divide my code broadly into (1) Cohesive projects and (2) one-off scripts that perform an isolated task. I manage code from category (1) using a DVCS like git or hg in tandem with github and bitbucket and this works quite well for me. I would like to use a DVCS for category (2) and I am looking for suggestions on a good strategy to do so. The problem is that all of these scripts are scattered throughout my file system, usually living in a directory related to the data that they work on. It doesn't make sense to have a repo for each script as this would totally clutter my github/bitbucket accounts. On the other hand having one massive repo with random scripts seems like a mess keeping track of where each script contained in the repo is suppose to operate, and giving them descriptive names might be difficult given their specificity. Does anyone have experience managing random scripts in a sensible way that works well for them using a version control system? Suggestions would be most appreciated.


Is realtime validation of username good or bad?

I have a simple form for the user to sign up to my site; with email, username and password fields. We are now trying to implement an ajax validation so the user doesn't have to post the form to find out if the username is already taken. I can do this either on **keyup** event or on text **blur** event. My question is, _which of these is really the best way to do?_ ## Keyup From the user POV, it would be good if the validation is done as and when they are typing, _(on key up event)_ \- of course, I am waiting for half a second to see if the user stops typing before firing off the request, and user can make any adjustments immediately. But this means I am sending way more requests than if I validated the username on _Blur_ event. ## Blur The number of requests will be much lower when the validation is done on blur event, But this means the user has to actually go away from the textbox, look at the validation result, and if necessary go back to it to make any changes and repeat the whole process until he gets it right. * * * I had a quick look at google, tumblr, twitter and no one actually does username validations on keyup events, (heck, tubmlr waits for the form to be posted) but I can swear I have seen keyup validations in a lot of places too. So, coming back to the question, **will keyup validations be too many for server, is it an unnecessary overhead? or is it worth taking these hits to give user a better experience?** ps: all my regex validations etc are already done on javascript and only when it passes all these other criteria does it send a request to server to check if a username already exists. (And the server is doing a `select count(1) from user where username = ''` \- nothing substantial, but still enough to occupy some resource) pps: I'm on asp.net, MS SQL stack., if that matters.


Tension between the dependency inversion principle and avoiding "new" in C++?

I have seen a lot of advice that it is better to do `Type object;` than               Type* object = new Type();      in C++ whenever possible—i.e., _minimize your use of`new`_. I understand the rational behind this and appreciate it. But according to my understanding, to practice dependency inversion requires pointers, e.g.:               Type* object = new Implementation();      where `Type` is abstract (i.e. contains at least one pure virtual method) and `Implementation` is concrete. It is not possible to do               Type object = Implementation();      because what that means is               Type object;     object = Implementation();      which requires constructing `object` as a `Type` initially—but that cannot be done, since `Type` is abstract. Is there an inherent tension between the dependency inversion principle and avoiding `new` when using C++? If so, what patterns/principles/practices can be used to mitigate this tension?


Render Ruby object to interactive html

I am developing a tool that discovers network services enabled on host and writes short summary on them like this:               init,1     └── login,1560 --         └── bash,1629             └── nc,12137 -lup 50505     {         :net => [             [0] "*:50505 IPv4 UDP "         ],         :fds => [             [0] "/root (cwd)",             [1] "/",             [2] "/bin/nc.traditional",             [3] "/xochikit/ld_poison.so (stat: No such file or directory)",             [4] "/dev/tty2",             [5] "*:50505"         ]     }      It proved to be very nice formatted and useful for quick discovery thanks to colors provided by the `awesome_print` gem. However, its output is just a text. One issue is that if I want to share it, I lose colors. I'd also like to fold and unfold parts of objects, quickly jump to specific processes and what not? Adding comments, for example. Thus I want something web-based. What is the best approach to implement features like these? I haven't worked with web interfaces before and I don't have much experience with Ruby. **Update** : Maybe I didn't write my willings clear enough. I think I want something that behaves like Chromium's chrome://chrome/settings/ (or better, of course). Is there maybe an erb template or manual showing how to implement that? I thought this is a thing needed often enough.


Who owns this work?

I worked for a small company as a long term contractor making websites and other such things. A client comes along, pays what he said was "A lot of money" for me to spend a week doing his website. He paid it to the company. I didn't see any of his money, I've since left that job because they owe me months of back pay and it looks like I'm not going to end up getting much of it. (Bad situation) I want to consider the possibility now of exploring who owns any work I did that was unpaid, because if I need to, I can use it as leverage to help get my owed money. The company is still using some work in-house that's unpaid which I'm a lot clearer about contesting rights to. What's I'm struggling with is working out what to do about the clients website. From his POV he paid for it, it's his. From my POV I did it and didn't get paid for it so it's mine. Who owns it? If I do, I wouldn't want to strip it away from him, it seems really unfair, but I would like to use it as leverage if it comes to that.


Using machine learning to aim mirrors in a solar array?

I've been thinking about solar collectors where several independent mirrors to focus the light on a solar collector, similar to the following design from Energy Innovations. ![Solar Array](http://i.stack.imgur.com/zFSwl.jpg) Because there will be flaws in the assembly of this solar array, I am proceeding with the following assumptions (or lack thereof):   * The software knows the "position" of each mirror, but doesn't know how this position relates to the real world or to other mirrors. This will account for poor mirror calibration or other environmental factors which may effect one mirror but not the others.   * If a mirror moves 10 units in one direction, and then 10 units in the opposite direction, it will end up where it originally started. I would like to use machine learning to position the mirrors correctly and focus the light on the collector. I expect I would approach this as an optimization problem, optimizing the mirror positions to maximize the heat inside the collector and the power output. The problem is finding a small target in a noisy high-dimensional space (considering each mirror has 2 axis of rotation). Some of the problems I anticipate are:   * cloudy days, even if you stumble upon the perfect mirror alignment, it might be cloudy at the time   * noisy sensor data   * the sun is a moving target, it moves along a path, and follows a different path every day - although you could calculate the exact position of the sun at any time, you wouldn't know how that position relates to your mirrors My question isn't about the solar array, but possible machine learning techniques that would help in this "small target in a noisy high dimensional- space" problem. I mentioned the solar array because it was the catalyst for this question and a good example. What machine learning techniques can find such a small target in a noisy high- dimensional space? EDIT: A few additional thoughts:   * Yes, you can calculate the suns position in the real world, but you don't know how the mirrors position is related to the real world (unless you've learned it somehow). You might know the suns azimuth is 220 degrees, and the suns elevation is 60 degrees, and you might know a mirror is at position (-20, 42); now tell me, is that mirror correctly aligned with the sun? You don't know.   * Lets assume you have some very sophisticated heat measurements, and you know "with this heat level, there must be 2 mirrors correctly aligned". Now the question is, which two mirrors (out of 25 or more) are correctly aligned?   * One solution I considered was to approximate the correct "alignment function" using a neural network which would take the suns azimuth and elevation as input and output a large array with 2 values for each mirror which correspond to the 2 axis of each mirror. I'm not sure what the best training method is though. More thoughts:   * The mirrors do have a coordinate system which the software has access to, but the software doesn't know how this coordinate system relates the the real world. Let's say a mirror is at position (4, 42); what does that mean? I don't know and neither does the software. But I do know that if I move the mirror around and then move it back to (4, 42) the mirror will be in the same position it was previously. Additionally, two mirrors may be at position (4, 42) but be pointing in opposite directions in the real world.   * Yes, with a lot of quality sensors the problem is easy to solve. Energy Innovations is out of business as best I can tell, probably because they used a bunch of really awesome sensors and people said "I'll just buy solar panels, they're cheaper."   * The only sensors in the system are in the collector head.


Implementing Glicko Rating in Python

Recently, I've been trying to implement some working version of the Glicko Rating System for fun. However, I fail to understand how to programmatically isolate `R` in Step 2. As you can see `R` appears on both sides of the equation and for a variable number of instances. How would I programatically solve for `R` using python? Thanks for any help :) EDIT: Actually shouldn't the `R` in step 2 be `R_0` on the right hand side of the equation? Is this a typo? Note in "The Glicko system" by Professor Mark E. Glickman, the equations are identical except for all `R`s being on one side and `R'` being on the other.


Y combinator and tail call optimizations

The definition of a Y combinator in F# is               let rec y f x = f (y f) x      f expects to have as a first argument some continuation for the recursive subproblems. Using the y f as a continuation, we see that f will be applied to successive calls as we can develop               let y f x = f (y f) x = f (f (y f)) x = f (f (f (y f))) x etc...      The problem is that, a priori, this scheme precludes using any tail call optimization : indeed, there might be some operation pending in the f's, in which case we can't just mutate the local stack frame associated with f. So :   * on the one end, using the Y combinator require an explicit _different_ continuation than the function itself.   * on the othe to apply TCO, we would like to have no operation pending in f and only call f itself. Do you know of any way in which those two could be reconciled ? Like a Y with accumulator trick, or a Y with CPS trick ? Or an argument proving that there is no way it can be done ?