Canonical representation of a class object containing a list element in XML

I see that most implementations of JAX-RS represent a class object containing a list of elements as follows (assume a class House containing a list of People)               <houses>       <house>         <person>           <name>Adam</name>         </person>         <person>           <name>Blake</name>         </person>       </house>       <house>       </house>     </houses>      The result above is obtained for instance from Jersey 2 JAX-RS implementation, notice Jersey creates a wrapper class "houses" around each house, however strangely it doesn't create a wrapper class around each person! I don't feel this is a correct mapping of a list, in other words I'd feel more confortable with something like this:               <houses>       <house>         <persons>         <person>           <name>Adam</name>         </person>         <person>           <name>Blake</name>         </person>         </persons>       </house>       <house>       </house>     </houses>      Is there any document explaining how an object should be correctly mapped apart from any opninion?


What is the proper amount of time required to interview a .NET developer?

I had two interviews during the last two weeks, one of them was about 30 minutes, and they had me fill out a job application before it, and the other one was less than 10 minutes! In your own point of view, how much time do you need to interview a .NET developer with almost 2 years experience?


Should I avoid SharePoint Development in Visual Studio?

Not long ago I started an internship at a company that supplies SharePoint consultancy, hosting and development. While their consultancy seems to be pretty good and solid, I feel their development department lacks direction. The reason for this, most likely, is that they stopped outsourcing not too long ago. One thing that I've frequently bumped my head into is the following: My supervisor strongly insists that everything that can be done natively in SharePoint (somehow this includes editing xslt files in Designer) should be done in SharePoint. Even if this results in longer development time (at least when they make me write XSLT) and reduced usability. Her main arguments for this are:   * Better maintainability   * Editing the functionality doesn't require programming knowledge I feel the company is a little biassed and I am unable to get a decent discussion going. This is why I am looking for other places to get some responses on the subject (and not only on the arguments of my supervisor, but more on the subject in general). Kind regards


Interfaces: profit of using

First of all, my ubiquitous language is PHP, and I'm thinking about learning Java. So let me split my question on two closely related parts. Here goes the first part. Say I have a domain-model class. It has some getters, setters, some query methods etc. And one day I want to have a possibility to compare them. So it looks like:               class MyEntity extends AbstractEntity     {         public function getId()         {             // get id property         }              public function setId($id)         {             // set id property         }              // plenty of other methods that set or retrieve data              public function compareTo(MyEntity $anotherEntity)         {             // some compare logic         }     }      If it would have been Java, I should have implemented a `Comparable` interface. But why? Polymorphism? Readbility? Or something else? And if it was PHP -- should I create `Comparable` interface for myself? So here goes the second part. My colleague told me that it is a rule of thumb in Java to create an interface for every behavioral aspect of the class. For example, if I wanted to present this object as a string, I should state this behaviour by something like `implements Stringable`, where in case of PHP `Stringable` would look like:               interface Stringable     {         public function __toString();     }      Is that really a rule of thumb? What benefits are gained with this approach? And does it worth it in PHP? And in Java?


Who actually performs the task of log rotation?

I know _log rotation_ is a feature seen in application servers like Oracle's Weblogic. I would like to understand:   1. What is actually meant by log rotation?   2. What is it useful?   3. Who performs the task? Is this duty performed by the logging frameworks that the developers use or is it handled by the servers themselves? Would log rotation be available in a server like Weblogic if the application doesn't use any logging framework(not `java.util.logging`) and simply rely on `System.out.println()` and `System.err.println()` etc?


What is the proper copyright information?

I want to know what should I write in copyright part? I mean the copyright part when you right click on the executable, click properties, and click the details tab. I was developing a little tool that parses some information from output files. It's been a year now and somehow it became something more than a simple, personal tool. We are using it for academic purposes and it's going to cited in several academic papers. BTW, I do not want to make it freeware. Also, I am the only developer of the software. I have used Visual Studio 2010 Ultimate that I obtained for free with the academic license provided my university.


Real-time chat in Ruby on Rails without owning a server

I'd want to implement a Real-time chat for my Rails app but I can't really host the server which handles the sockets. I've tried Faye but it needs a server. I've also heard of pusher but it's limited to 20 users at a time on the chat and I can't really be sure they won't be more. I've thought of IRC but I think I can't really embed it into a rails app, maybe it needs sockets... How can I implement a real-time chat without owning a server?


How far should we rename code and data when end users nomenclatures change?

A long time ago we added a feature where our users could "Accept" an image after it was added to a workflow queue. Turns out, we used the wrong term, and users actually "Approve" the image. Changing Accept to Approve on our interface is easy, just replace one word. But we programmed all layers with the word "accept", from the CSS class name to the database values.   * The CSS class that turns the button green: ".accepted";   * The model method that verifies and binds the class attribute on the DOM node: "isAccepted";   * JavaScript status attribute: Array with "unreviewed", "accepted" and "published";   * Mysql status column: ENUM with "unreviewed", "accepted" and "published";   * Test names; It's trivial (specially when you have tests) to replace most occurrences of accept to approve. A little bit harder is to migrate the data, specially since it needs to be synchronized with deployment. This specific case is simple, but I've faced similar, yet more complex cases, during my career. When a file is also renamed and deployment happens on dozens of servers, or when proxy caching, memcached and mysql are involved. Leaving "accepted" on every other layer except the interface is a bad idea, since new programmers joining the team might not learn the historical reasons it led to this decision, and while accept -> approve are close words in terms of meaning, if it was renamed to "queued for managerial next status meeting", it certainly wouldn't make any sense. And it feels if we compromise here and there, in a few iterations the user interface concepts will have no bearings to the system internals, and I certainly do not want to work on a system where half of the output has no connection to its innards. So, do you always rename everything when needed? If this happened to you, and you decided that the trade-off was not worth, did it come back to bite you? Is code comment or developer documentation enough to avoid this issue?


Just wondering about "Do-It Yourself Apps" on the internet versus apps written by us developers

I have been doing Objective-C programming over the past few weeks, and I have learnt a lot. However, I see that there are other Web-companies offering services to consumers directly from their website that allow consumers to create their apps through a point and click and drag features without any code. Clearly they are more cost effective and fast than having a developer write an app. I was wondering if there are any advantages then of having a developer build an app for someone, other than the obvious advantage that its got a custom look and feel. Could someone please clarify, since Im new and would like to evaluate whether it is worthwhile spending time towards learning a whole new development environment when someone could just use a webservice to make an app for multiple platforms Thanks


What happens at control invoke function?

A question about form controls invoke function.   Control1 is created on thread1. If you want to update something in Control1 from thread2 you must do something like:               delegate void SetTextCallback(string txt);            void setText(string txt)       {         if (this.textBox1.InvokeRequired)         {            SetTextCallback d = new SetTextCallback(setText);            this.Invoke(d, new object[] { txt });         }         else         {             // this will run on thread1 even when called from thread2          this.textBox1.AppendText(msg);         }       }`        What happens behind the scenes here? This invoke behaves different from a normal object invoke. When you want to call a function in an object on a specific thread, then that thread must be waiting on some queue of delegates, and execute the incoming delegates. Is it correct that the windows forms control invoke function is completely different from the standard object invoke function?


Why do we need to use sealed on a class? Do we really need sealed?

Reading this article (by Eric Lippert), it has four arguments as to why you should use `sealed`, however, I don't understand why we actually **need** it. Philosophical/aesthetic reasons aside, why do we need to use sealed? I can see how things like `readonly` from C# or `const` from C++ actually catch genuine errors. Is there any type of error that `sealed` can catch? An often cited reason for sealing a class is because, it hasn't been to designed to be extended. What does that mean? Why is it important? Are there any real examples of this? The point on compatibility isn't a reason why we need to seal classes but why it should be default. The final point again is strange, because sealing your class doesn't prevent someone providing an alternative implementation in a heirachy. **Edit:** If I didn't put enough emphasis, on it already I'm looking for reasons we actually **need** it. Not the usual, "someone else might write bad code". I understand that plenty of people _like_ using `sealed` for design intent, but I'm looking for a practical purpose beyond that.


How to provide data to a web server using a data warehouse?

We have data stored in a data warehouse as follows: Price Date Product Name (varchar(25)) We currently only have seven products. Once every business day, seven new data points are added representing the day's price for each product. On the website, a user sees this information on a page load. Analytics shows that the amount of page loads is about 100 per day. The website server is an external server to our data center. The data warehouse server is internal to our data center and has other critical data (in different tables) not related and should not be accessible to the website. The following approaches have been considered: 1) The data warehouse could daily push (SFTP) a CSV file containing the daily data to the web server. The web server would have a process running on a crontab every 15 minutes. It would check if the file had changed. If so, it would update its database with the data. Then, on page loads, the web server would query its database to get the data to display on the web page. Usually, the push would only be once a day, but more than one push could be possible to communicate (infrequent) price corrections. Even in the price correction scenario, all data would be delivered in the file. The polling process would pick up the change and overwrite the data in the database. 2) The web server could request data from the data warehouse using JDBC or similar SQL connection technology. However, a security concerns have been voiced. The concern is that by allowing the web server access to our data warehouse, SQL injection attack or some other external attack through the website could compromise the data warehouse. Measures could be put in place to reduce the risk, but the easiest and safest approach has been suggested to simply not allow any public facing system to directly access the data warehouse. In other words, the data warehouse can establish a communication with other servers (say to SFTP the file), but no server can initiate a connection with the data warehouse. Do these concerns seem reasonable and hard to mitigate? 3) A web service could be built, and the web server could call the web service that is hosted in our internal data center. 4) A process hosted in our internal data center could call the web server when it knows the data warehouse has data available. If so, how should this be done? HTTPS with some way to prevent other unauthorized clients from making the same call? Which of the above approaches is best or is there a better approach than listed above? What are the pros and cons to an approach?


Is it fine to reuse a class instance?

I ask in terms of high cost classes, with a particle engine as an example. I read somewhere that an instance of a class with a high cost to initialize, like a particle manager, should have its state variables altered at run time rather than reinitialize the particle manager with new data every time it is used in a different way. The particle manager would create perhaps thousands of instances of particles on initialization and then manage them from then on. For example, let's say this particle manager is used to manage shrapnel in an explosion; and you're creating a ground zero simulation for an artillery attack; thus there are many explosions. Instead of multiple managers for each explosion, which is extremely expensive, you alter the variables for each explosion and have a scattered sequential set of explosions using the same manager and the same particles. So I ask: is it fine to reuse a class instance at run time? Or is the above really just a super optimization case?


How did you find the slow performance in your application?

What makes the web application perform and scale better is always a big topic. And finding the performance problems and tuning them is another... Here is some my thoughts of how to "finding" performance problems: For a "new" api/application or other   * Analzying the detail api and then preparing the Jmeter/Grinder testing scripts for it.   * Using different load to identify the threshold for the api   * Adding profiling codes find the slownes   * Restart from point one again.. For a "old" api/application or other   * Analyzing the user pattern from the access detail log    * Simulate the real user load to find the slowness   * Adding profiling codes find the slownes   * Restart from point one again..  So,how can you identify the performance problems?


iOS build machine setup: problem with certificates

some background:   * work with multiple team mates   * each work on our own MBP   * I'm setting a build machine that we can `git push` to in order to generate a build (aim to allow anyone to push to the build machine and then generate an archive, upload to testflight and send on its way)  problem:   * getting my apple developer certificates on the build machine.  I installed Lion, XCode, etc and I signed into my developer account through Xcode organizer, provisioning profiles download,etc. but beside each one it says: `valid signing identity not found` I also download my certificate from the developer.apple.com page, imported it into keychain, etc but no luck. Anyone else have a similar issue? Or maybe hints to fix? Thanks


Importing an existing project into Git

# Background During the course of developing our site (ASP.NET), we discovered that our existing source control (SourceGear Vault) wasn't working for us. So, we decided to migrate to Git. The translation has been less than smooth though. Our site is broken up into three environments DEV, QA, and PROD. For tho most part, DEV and the source control repo have been in sync with each other. There is one branch in the repo, if a page was going to be moved up to QA then the file was moved manually, same thing with stuff that was ready for PROD. So, our current QA and PROD environments do not correspond to any particular commit in the master branch. Clarification: The QA and PROD branches are not currently, nor have they ever been in source control. # The Question How do I move QA and PROD into Git? Should I forget about the history we've maintained up to this point and start over with a new repo? I could start with everything on PROD, then make a branch and pull in everything from QA, and then make another branch off of that with DEV. That way not only will the branches reflect the differences in the environments, they'll be in the right order chronologically with the newest commits in the DEV branch. # What I've tried so far I thought about creating a QA branch off of the current master and using robocopy to make the working folder look like the current QA environment. This doesn't work because the new commit from QA will remove new files from DEV and that will remove them when we merge up, I suspect there will be similar problems if I started QA at an earlier (though not exact) commit from DEV.


Is it normal to get your software development products critiqued?

I am currently a software developer on coop that was in an interesting situation today. I cannot say too much, as the things I do are under NDA, but I make Grasshopper 3D (which is a Rhino plugin) components. Our firm has under three software developers including me. We all specialize in different languages. This project I was working on, I was in charge of creating a piece of software that has a very broad general use. It's an extension from typical Grasshopper behavior. With this said, the other developer I worked with has been in this industry for a good... decade or two. He is very knowledgeable towards the use of Grasshopper. His prior education involved great use of it, and his daily work involves the use of Grasshopper (though not explicitly what I am doing, which is creating C# components for it). With that said, my final component went through a number of iterations. It seemed each iteration was better than the previous. An interesting point is, the other developer I worked with (I was essentially under his wing) manages to break my component every single time. I don't mean this in a malicious way. By breaking, I meant, he was able to overflow particular lists. He was able to, after almost every iteration, find ways that my component could be improved on. Honestly, I really feel grateful for his suggestions and critique, because these were honestly things that either I overlooked, or did not know could happen. My question is are three-fold:   1. Is it normal in software development practices/companies to have someone critique and improve your code? There was no code review. It was simply ways improving the tool through either UX improves or back-end improvements. And honestly, even though there was no code review, I learned so much from his suggestions which I always found success in implementing.    2. Are there any suggestions for a more "formal" testing procedure? I am relatively new to the software development world, and thus am interested in software dev testing procedures.   3. How can I improve on my way to "predict" issues? At one side, I feel like there are issues that I cannot normally find out myself because everyone uses a piece of software differently. On another side, I feel it may be my oversight or incompetence that's causing this. I'm reading up on this thread, and it seems in a way, we have a loose testing procedure, though it's all dependent on me to ask for critique.


How to suggest using an ORM instead of stored procedures?

I work at a company that only uses stored procedures for all data access, which makes it very annoying to keep our local databases in sync as every commit we have to run new procs. I have used some basic ORMs in the past and I find the experience much better and cleaner. I'd like to suggest to the development manager and rest of the team that we look into using an ORM Of some kind for future development (the rest of the team are only familiar with stored procedures and have never used anything else). The current architecture is .NET 3.5 written like .NET 1.1, with "god classes" that use a strange implementation of ActiveRecord and return untyped DataSets which are looped over in code-behind files - the classes work something like this:               class Foo {          public bool LoadFoo() {              bool blnResult = false;             if (this.FooID == 0) {                  throw new Exception("FooID must be set before calling this method.");             }                  DataSet ds = // ... call to Sproc             if (ds.Tables[0].Rows.Count > 0) {                  foo.FooName = ds.Tables[0].Rows[0]["FooName"].ToString();                 // other properties set                 blnResult = true;             }             return blnResult;         }     }          // Consumer     Foo foo = new Foo();     foo.FooID = 1234;     foo.LoadFoo();     // do stuff with foo...      There is pretty much no application of any design patterns. There are no tests whatsoever (nobody else knows how to write unit tests, and testing is done through manually loading up the website and poking around). Looking through our database we have: 199 tables, 13 views, a whopping **926** stored procedures and 93 functions. About 30 or so tables are used for batch jobs or external things, the remainder are used in our core application. Is it even worth pursuing a different approach in this scenario? I'm talking about moving forward only since we aren't allowed to refactor the existing code since "it works" so we cannot change the existing classes to use an ORM, but I don't know how often we add brand new modules instead of adding to/fixing current modules so I'm not sure if an ORM is the right approach (too much invested in stored procedures and DataSets). If it is the right choice, how should I present the case for using one? Off the top of my head the only benefits I can think of is having cleaner code (although it might not be, since the current architecture isn't built with ORMs in mind so we would basically be jury-rigging ORMs on to future modules but the old ones would still be using the DataSets) and less hassle to have to remember what procedure scripts have been run and which need to be run, etc. but that's it, and I don't know how compelling an argument that would be. Maintainability is another concern but one that nobody except me seems to be concerned about.


Why aren't young programmers interested in mainframes?

A key issue with mainframes is that the cohort of supporting programmers is dwindling. While normally this wouldn't be a problem in that a falling supply of programmers would be offset by an increasing amount of salary those causing a rising supply of programmers via the law of supply and demand, I'm not sure this is really happening for mainframes. While they still form critical infrastructure for many businesses, the simple fact is there isn't an adequate number of young programmers coming up along to keep the support population populated. Why is this? What makes mainframes unattractive to young programmers?


Is it more valuable to double major in Computer Science/Software Engineering or get an undergraduate CS degree with a Masters in SE?

A friend and I (both in college) are currently in a debate over which is better, in terms of employment opportunities, experience, and education: a Bachelors degree in both Computer Science and Software Engineering, or a Bachelors in Computer Science with a Masters in Software Engineering. My point of view is that I would rather go to school for 4-4.5 years to learn both sides of the field, and be out working on real projects gaining real experience, by going the double major route. His point of view is that it would look better to potential employers if he had a Bachelors in CS and Masters in SE. That way, when he's finally done after 4 years of CS and 2-4 of SE (depending on where he goes), he can pretty much have his choosing of what he wants to do. We are both in agreement on the distinction between the two degrees: CS is "traditional" and about the theory of algorithms, data structures, and programming, where SE is the study of the design of software and the implementation of CS theory. So, what's your stance on this debate? Have you gone one route or another? And most importantly, why?


What are your decision critera in C++ to make something a data member or virtual method?

(Figured this was too subjective for SO, so posting here...) I have some behavior that I can implement in various ways. At least two methods are shows in the code snippet below. Presume that the m_well data member is correctly set somehow at object construction time.               struct Behavior     {         virtual bool behavesWell() { return true; }          private:         bool m_well;     public:         bool behavesMemberWell() { return m_well; }     };          struct OtherBehavior : public Behavior     {         virtual bool behavesWell() { return false; }     };      Obviously the one relies upon virtual dispatch, and the other merely the return of a data member. A third, non-shown method would likely have the non-virtual public member function not return a fixed data member, but instead call a virtual - lets leave that aside for the purpose of this please. What would lead you to one or other other of these two methods of implementing functionality, such that a user of this class can interrogate an object's behavior?


"every statement and declaration an expression that yields a value" why?

At the end of the answer to "Can I do ++x and x++ in Python?" on this page: http://norvig.com/python-iaq.html, you can read: > [...] I'm with my fellow Dane, Bjarne Stroustrup, on this one. He said in > The Design and Evolution of C++ ``If I were to design a language from > scratch, I would follow the Algol68 path and make every statement and > declaration an expression that yields a value''. Why?


Data integrity in NoSQL situations

**Background** To start off, at work I work with a legacy system that, in its day, was quite spectacular, but now is ...interesting... to work with. It uses IBM (now Rocket) UniVerse as its backing database. One particular part of it that has caused some issues is its lack of data-integrity checks. By data integrity, I don't mean file corruption, but rather things like orphaned records or invalid keys. The particular version they use doesn't support things like triggers and such and so unless the programmer remembered to update their computed indexes, it becomes "broken" and filled with bad data. Now, the other programs have been built to live with this bad data, but it is most annoying when putting it into another database, such as MySQL (using InnoDB as the engine) which actually has constraints on the data. **The question** I'm experimenting with MongoDB and NodeJS just to see what all the hype is about. I really like Mongoose as well and its schema system. I've been reading a lot about what to store on each record vs in a separate collection. Perhaps its just my own RDBMS bias, but I decided to store each "type" of thing in a separate collection and utilize Mongoose's "populate" functionality to essentially relate the records together. Now, I am sure someone is going to say that that is going against the whole NoSQL thing, but I haven't really read anywhere that says that just because something stores documents instead of records and has no set schema on the db level that it can't be made relational. In my experiment, I have "Posts" and "Comments". I see four ways to store the relation between these two:   * The full data for each comment is put directly onto the post as a subdocument. There are two main cons that I have seen with this: If I decide to put comments on something else (let say a "Page") as well, I have to essentially repeat myself and it isn't quite as simple to find out how many comments a user has posted if the comments are actually stored in several collections   * Comments are a separate collection and they store their parent's key and a Schema name for mongoose to use when populating (the schema name switching wouldn't be automatic). This isn't too bad, but its biased towards loading comments first and posts later. Finding out the comments on a post isn't hard, but requires a manual query.   * Comments are a separate collection and posts have a list of comment ids that relate to them. This is biased towards loading posts first and finding out what a comment is attached to becomes difficult. However, mongoose would let me load the comments without having to write anything additional.   * Comments are a separate collection and have a parent id. Posts also have a list of comment ids. This combines the above two methods and neutralizes their cons and makes for relatively few "manual" queries, but introduces the possibility of data becoming dirty and out of sync like the legacy system that I described above (e.g. a comment says it belongs to one post and another post (or multiple posts) claims that they own that comment). I was going down the latter path listed above and I realized that I was starting to enter the realm of this legacy system that had caused so many headaches with its manually updated indexes and possibility for bad data. Now, I don't expect to do a ton with this little experiment of mine, but its the principal of the thing that has me thinking. What would you all recommend to go with on this? I want to be able to keep query counts low, but I also don't want to have to remember to update all these indexes. There has to be a happy medium somewhere. Another option, of course, is to just use MySQL with some nice schema constraints, but that isn't the point of this particular exercise for me since I've done that tons of times already.


When I test out the difference in time between shifting and multiplying in C, there is no difference. Why?

I have been taught that shifting in binary is much more efficient than multiplying by 2^k. So I wanted to experiment, and I used the following code to test this out:               #include <time.h>     #include <stdio.h>          int main() {         clock_t launch = clock();         int test = 0x01;         int runs;              //simple loop that oscillates between int 1 and int 2         for (runs = 0; runs < 100000000; runs++) {                   // I first compiled + ran it a few times with this:         test *= 2;              // then I recompiled + ran it a few times with:         test <<= 1;              // set back to 1 each time         test >>= 1;         }              clock_t done = clock();         double diff = (done - launch);         printf("%f\n",diff);     }      For both versions, the print out was approximately 440000, give or take 10000. There was no (visually, at least) significant difference between the two versions' outputs. So my question is, is there something wrong with my methodology? Should there even be a visual difference? Does this have something to do with the architecture of my computer, the compiler, or something else?


When would using a scripting language within a larger program be useful?

I have heard of several situations of people using say, JavaScript or Python (or something), inside a program written in C#. When would using a language like JavaScript to do something in a C# program be better then just doing it in C#?


Will the Apache License or the GPL License protect my trademarks?

I'm trying to see if these two open source licenses give protection of trademarks to the originator. I have read both licenses but they only seem to talk about their own trademark i.e. 'Apache'.


Joomla or development from scratch?

As someone who has very little experience in it, I would like to know what makes you think that Joomla can fulfill all you requirements?. What makes you choose it over development from scratch (or using a framework like Yii or Kohana). What are the most common or crucial problem that you are facing when using Joomla? Since I don't have much experience in it, I would pressume that one of the biggest problem is flexibility. You can't scale or customize the behaviour of your app, and even if you could, you need to break some rule in Joomla, or wait for the next release. Is this true?. Currently I am building a long term project, there might be a lot of specific functions and behaviours in it. I would like to build it from scratch or with help from some PHP frameworks. But I've seen so many websites (and some of them are great in terms of complexity) are using Joomla. This gave me some doubts about choosing the right tech. I would like to know is there any, one or two ultimate reasons to choose Joomla/other.


Design of an evaluator object for propagation and IO of results

We are having a discussion about design. Keep into account this is fortran, so we can't be too smart. We have the following classes: Application, System, Calculator, CalculatorSimple, CalculatorPeriodic, Result. Application is an application object which handles System objects. In order to compute information on the System object, the Application passes System to a Calculator, which returns a Result. Inside Calculator there are two specialized classes CalculatorSimple, and CalculatorComplex, which act on System depending on information available on the system itself. Some Systems require CalculatorSimple. Others require CalculatorComplex. The decision happens inside Calculator, and the Result object may contain additional information if the CalculatorComplex was run. These additional info can be queried with methods on the Result object, to test if the information is present or not. This info is of small size. To keep separation of roles, I want to keep this part unaware of input output. The Result object is received by the Application, and then the Application has the role of writing the data onto the file, according to what it finds on the Result object. A colleague instead proposes to pass the file to the Calculator object, and have it percolate through the chain so that stuff is written directly on the file. The additional point is that we must have only one output file, so when the program runs in parallel, only the master node must write on the output file, which is identified via an absolute path and due to a limitation of our raw IO lib cannot be accessed by MPI slave processes. We need an independent opinion. What would you do ? **Edit** : thanks. I spread votes and awards as much as I could, as there's clearly not a correct answer, just a set of feedbacks.


Best overview to modern C++ paradigms?

I used to write C++ extensively between 8 and 10 years ago. I have since moved on to C# for professional reasons. However, from time to time I see statements like > "If you're still manually tracking pointer references, you're doing it > wrong" or > "C++ is perfectly safe as long as you're using modern concepts like RAII and > not manually allocating memory like a recovering C developer." Both of those were standard procedure a decade ago. I have seen that C++ has been improved considerably in recent times; C++ 0x in particular seems like it has some new capabilities. What's the best resource for a "C/old C++" programmer to get caught up on "modern" C++ patterns and practices?


Telecommuting with a foreign employer as a permanent job

Does anyone have any experience in telecommuting (working at home) for a company based in some foreign country? By this I don't mean working on some contracted job, but more or less permanent job. Is this even possible, what are options for payment, and can you expect to be paid by usual rates for that country or significantly less? Is there any working hours control, or as long as you deliver on time it's all good.


How much detail about a user story can a developer expect?

The biggest drawback of agile development I have experienced is that people not involved in development focus on the mantra that a user story (3-10 ideal person days) should not contain more than 1-3 sentences like: > As a customer, I can use free-text search so that I can find the products > I'm looking for. Giving this sentence, project managers expect me as a developer to commit to an estimate and develop the story. They assume that agile development means that sentences like this are all they have to provide to developers. I won't blame them because the well-known literature about agile development creates the impression that this would actually work. I've read something like 2 pages in natural language per story in "Planning XP", but that's it. Because "working software" is favored over "comprehensive documentation", this topic seems to be generally avoided. The reality is, of course, that if the developer is given the chance to do so, an interview with the customer brings up a long list of requirements that the customer has about the story: >   * We need boolean operators like AND and OR. >   * We need fuzzy search an all terms. >   * We need to search by single words as well as by phrase. >   * We don't want to find products that meet criteria X, Y, and Z. >   * We want to sort the result. Oh, and by the way, the user can select the > sort criteria in a combo box with options a, b, and c. > So you see that I'm not talking about technical details or software design or even implementation details. It's pure requirements. The longer we talk the more the customer realizes that there's actually quite a lot to say about what they want. But often enough I find myself in the situation that such information is not provided or in very shoddy fashion. Neither is it possible that I do the interview, nor does the person that would be in the position to do the interview provide me with a result of it. Sometimes, managers even come up with technical details like "we want Lucene search" but they don't want to think about if they want find only product names or also product descriptions. Sometimes I think they are just lazy ;) For me, this is the top issue in projects I work in (e-business web application, 500-2000 person days per project). I've addressed this problem often enough, and managers are aware that most developers have a problem with the situation. But they believe that developers are just too much "perfectionists". They seem annoyed that developers "always want to have everything specified". Due to the lack of generally acknowledged numbers it's hard to argue. Everybody knows how long an iteration should be. But nobody can tell how much requirements are needed to estimate and develop a story. Do you have some reference?


How is the price of a website evaluated?

I cannot find a good way to to ask this question: Every day I read the news about the sale of "Twitter" or "Friendster" or "hi5". What I would like to know is how the price of such websites are evaluated?


I want to publish my slides for students

I want to make a website for uploading my slides for students but i don't want to use public sites that every one can see my slides, I want only my students to see and download them. what is the best things can I do? Is it to use WordPress for example (I am not sure if I can upload my slides in WordPress or not)? Or is there any easy to install and use script for this purpose?


Why is C++ "this" poorly designed?

1) For every `a` and `b` which are non-const pointers of the same type, you can do `a = b;`, right? 2) Inside non-const member functions the `this` keyword exists, which is a non-const pointer. So logicaly if `b` is same type as `this` you can also do `this = b;` right? Wrong. You cannot do `this = b;`, because `this` uses pointer syntax but logically `this` is a reference! But why on earth is `this` syntactically a pointer but logically reference? Can this weird behavior be corrected in next C++ standard, by introducing a new keyword, for example `me` which will be reference not only logically but also syntactically? (See also my attempt to solve this here: Is it a good idea to “#define me (*this)” ?)


As an API-user, would you tolerate BestPractice Exceptions?

I'm in the process of designing an API, part of which involves writing POCOs to a database. In C#, we have the `DateTime` structure. The "default" value for this (`DateTime.MinValue`) is 01/01/0001. Part of the API serializes POCOs to the database. If a date field is optional, it should _really_ be nullable (in C# syntax, this would be defined as `DateTime?`). What I'd like to avoid, is programmers falling in to the trap of writing `DateTime.MinValue` to the database _at all_. It's a valid date, for sure - but smells of something. So I am debating implementing a `BestPracticeException` class that would be thrown in circumstances such as this. If the user of the API really needs to deal with that date, they probably also need to deal with dates prior to that and need an entirely different structure (e.g comparing how many months have occurred between 500 BC and today). Do you think preventing writing 01/01/0001 to the database, on the whole, is a good thing to do? One might argue that you need to differentiate between being no date entered, and the user entering nothing. My answer to _that_ would be it is the function of a more broader auditing process that would pick that up, rather than attempting to ascertain intent from a field being null, or not null.


How do I know that the freelancer (Developer) gave me my money's worth?

I am hiring a PHP developer to build me a website. Their rate is 70$ an hour. He seems to have a good portfolio and experience. How do I know that I get a good website that is scalable and easy to maintain? Do I ask them to give me code samples so I can review it (I am a programmer but I did not do much PHP)? What are good credentials for a PHP developer? experience with Drupal? LAMP?


Problem in Understanding Algorithm from TAOCP "Multiply Permutations in Cycle Form"

I am not able to understand one algorithm discussed in TAOCP Volume 1; Section 1.3.3 named as "Algorithm A" stated as "Multiply permutations in cycle form" while compared with the stated example in next page. The step that is not clear is mentioned in 8th and 9th rows;i.e. how can be the "CURRENT" value becomes "g" after the previous iteration where the CURRENT value was "d"? Please refer to "The Art of Computer Programming Volume 1" by Knuth for more details (section 1.3.3). It contains the detailed description of this algorithm. Detailed Algorithm: **Algorithm A (Multiply permutations in cycle form).** This algorithm takes a product of cycles, such as (6), and computes the resulting permutation in the form of a product of disjoint cycles. For simplicity, the removal of singleton cycles is not described here; that would be a fairly simple extension of the algorithm. As this algorithm is performed, we successively "tag" the elements of the input formula; that is, we mark somehow those symbols of the input formula that have been processed.   * A1. [First pass.] Tag all left parentheses, and replace each right parenthesis by a tagged copy of the element that follows its matching left parenthesis. (See the example in Table 1.)    * A2. [Open.] Searching from left to right, find the first untagged element of the input. (If all elements are tagged, the algorithm terminates.) Set START equal to it; output a left parenthesis; output the element; and tag it.   * A3. [See CURRENT.] Set CURRENT equal to the next element of the formula.   * A4. [Scan formula.] Proceed to the right until either reaching the end of the formula, or finding an element equal to CURRENT; in the latter case, tag it and go back to step A3.   * A5. [CURRENT = START?] If CURRENT i- START, output CURRENT and go back to step A4 starting again at the left of the formula (thereby continuing the development of a cycle in the output).   * A6. [Close.] (A complete cycle in the output has been found.) Output a right parenthesis, and go back to step A2.


Where should I put methods that make an Http Request to get data from a web service in iOS development?

I have a Model Car in my iOS application where it's parameters like name, year, value etc are fetched from a web service in order to fill a list with cars data. **Where should I put the method that asynchronously goes to the server and returns an array of cars (this method already converts the JSON to a Car array)?** My current approach is a static method in my Car class that receives an HttpClient (so I'm able to unit test it mocking the client) and returns an NSArray of cars, is this good? What have you guys done in this situation? I'm concerned because I recently started reading clean code which says that a Class should do only one thing, and the way I have it now appears to do 2 things (hold information about a Car and get a list of cars).


Static objects and concurrency in a web application

I'm developing small Java Web Applications on Tomcat server and I'm using MySQL as my database. Up until now I was using a connection singleton for accessing the database but I found out that this will ensure just on connection per Application and there will be problems if multiple users want to access the database in the same time. (They all have to make us of that single Connection object). I created a `Connection Pool` and I hope that this is the correct way of doing things. Furthermore it seems that I developed the bad habit of creating a lot of static object and static methods (mainly because I was under the wrong impression that every static object will be duplicated for every client which accesses my application). Because of this all the Service Classes ( classes used to handle database data) are static and distributed through a `ServiceFactory`:               public class ServiceFactory {          private static final String JDBC = "JDBC";     private static String impl;          private static AccountService accountService;     private static BoardService boardService;          public static AccountService getAccountService(){         initConfig();              if (accountService == null){             if (impl.equalsIgnoreCase(JDBC)){                 accountService = new JDBCAccountService();             }         }              return accountService;     }          public static BoardService getBoardService(){          initConfig();              if (boardService == null){             if (impl.equalsIgnoreCase(JDBC)){                 boardService = new JDBCBoardService();             }         }              return boardService;     }     private static void initConfig(){         if (StringUtil.isEmpty(impl)){             impl = ConfigUtil.getProperty("service.implementation");                  // If the config failed initialize with standard             if (StringUtil.isEmpty(impl)){                 impl = JDBC;             }         }     }      This was the factory class which, as you can see, allows just one Service to exist at any time. Now, is this a bad practice? What happens if let's say 1k users access `AccountService` simultaneously? I know that all this questions and bad practices come from a bad understanding of the static attribute in a web application and the way the server handles this attributes. Any help on this topic would be more than welcomed. Thank you for your time!


Data persistence for transactional customer emails

I'm developing a system to handle sending transactional emails to our customers. This is how it works:   1. An event occurs during the order's life cycle, for example 'shipped'    2. This event will trigger the creation of an email in the database (email queue)    3. A separate windows service is polling the db table for new emails to send. When it finds one it calls a Web service with all the required data. It's the Web service's responsibility to handle the actual sending of the email.  My question relates to step 2. When an email triggering event occurs, should I take a snapshot of all the data required by the service (thereby duplicating data and introducing new tables) or should I get the required data from the transactional db tables only at the point where I'm ready to call the Web service. [Note: I'm not at all concerned with the body of the email, all I'm doing is passing the data to a Web service. The email templates etc are handled by another system. My concern is purely to queue the email notification and pass the required data to the Web service.]


Decompilers - Myth or Fact?

Lately I have been thinking of application security and binaries and decompilers. (FYI- Decompilers is just an anti-complier, the purpose is to get the source back from the binary)   * Is there such thing as "Perfect Decompiler"? or are binaries safe from reverse engineering? (For clarity sake, by "Perfect" I mean the original source files with all the variable names/macros/functions/classes/if possible comments in the respective headers and source files used to get the binary)   * What are some of the best practices used to prevent reverse engineering of software? Is it a major concern?   * Also is obfuscation/file permissions the only way to prevent unauthorized hacks on scripts? (call me a script-junky if you should)


What is idiomatic use of arbitrary blocks in C?

A block is a list of statements to be executed. Examples of where blocks come up in C are after a while statement and in if statements               while( boolean expression)         statement OR block          if (boolean expression)         statement OR block      C also allows a block to be nested in a block. I can use this to reuse variable names, suppose I really like 'x'               int x = 0;     while (x < 10)     {         {             int x = 5;             printf("%d",x)         }         x = x+1;     }      will print the number 5 ten times. I guess I could see situations where keeping the number of variable names low is desirable. Perhaps in macro expansion. However, I cannot see any hard reason to need this feature. Can anyone help me understand uses of this feature by supplying some idioms where it is used.


What is a scalable and practical way to search existence of a group of strings in a huge file

**Context** : I built an app which generates around **1000 domain names** based on user input. I need to check if they are **available or not** by matching against a huge zone file of parsed domain names which is around **2 GB**. I have an amazon micro instance and cannot store the text file in there due to space constraints. I am expecting around **100k - 200k** and more in **search queries** per month. **Naive approach** (Potentially): 1\. Store the text file in dropbox. Then get the contents of the file and search for the strings and spit out the available domain names on the EC2 instance. I only need to check if domains exist or not. **Should I have to store it in a database?** Some Info: There are currently 100 million dot com names registered according to Verisign. And my parsed domain names are one on each line. Like:   * GOOGLE    * APPLE    * FACEBOOK    * STACKOVERFLOW etc What is the best and practical way to deal with the problem? Ideally the checking should take only a few seconds. But I am fine with anything that works at this point.


Readers Writers algorithm help - starvation and no starvation

I found this link, as an explanation of r/w problem - http://pages.cs.wisc.edu/~bart/537/lecturenotes/s7.html But, I'm having problems realizing is there any starvation present here and why? Also, if there is, what should be changed? I would also appreciate help with confirming the answers on the questions that are provided below the lecture: >   * Is the first writer to execute Lock.P() guaranteed to be the first > writer to access the data? > No? >   * Can OKToRead ever get greater than 1? What about OKToWrite? > Yes and No?


why no native compiler of C# or other “productive” language?

I've been reading about D and Go and how they aim at being compiled to machine code yet be convenient (like garbage collection, no need to manipulate pointers unless needed) and I agree that there is a need for such a language. However designers of both Go and D for some reason decided to invent a new language. Why? Why not take existing language which is popular, proven to be productive but is not compiled to native code like C#? What are technological reasons for that? Would it be hard to implement garbage collection (D does), linq or something entirely else?


Can applications override the OS keyboard layout?

We have in-house .NET application, which can be used across multiple languages. Lately we received a strange bug that is when our application is being used, user was unable to enter accent characters (Spanish, Win 7) in other applications (ex: MS Word or Notepad). Strange, huh! Did anyone come across similar bug? If yes how did you solve that?


Test-driven development and improving white box testing skills

I am an entry level Java Programmer straight out of school. I have good knowledge and experience with J2SE. Can anyone advise me on how to improve or tune my skills towards being a Java white box tester? Wide range of inputs are welcome. And what is Test Driven Development?


How can I use Scrum with a freelance team?

I'm working in a start-up. I have a background with teamwork and management, but I'm currently the only developer. We have a project that will involve a few developers in the form of 2 freelancers. I will function as a developer as well as the ScrumMaster. The project is scheduled to last three to four months. The 3 developers (myself and the two freelancers) have never worked together before. Would it be possible or advisable to use Scrum to manage this type of project? Would there be any problems organizing or running the team using Scrum?


Is It OK to Develop Against a 3rd Party Library You Discover?

If you find out a way to interact with a web service API that is not publicly documented as available, and can emulate it within an application you develop, is it illegal to do so? Furthermore is it illegal to charge for a product that you build to interact with these services (maybe all that's needed is a reference to the 3rd party)? An example would be, lets say, Google didn't advertise how to do a search in your program, but you found out how and made it so people could do the search differently than how Google presents it, can you build against the service you discovered and sell a version of it?


What's the standard practice to prevent users from having unreasonable expectations?

There's some subscription-based data processing web service - users pay via PayPal for the right to use the service. The "terms of service" document prepared by lawyers explicitly says that there're no guarantees so customers can't possibly file a lawsuit. Now the service doesn't always work trouble-free. Sometimes there're network problems and so it's unreachable to some clients. Sometimes there's a problem with third-party services the service depends upon. So something like twelve hours per year total it doesn't work. This is not perfect, but IMO very good. Yet clients feel that since they've paid for it - it must just work, period, at all times and they even write claims for compensation to the service support. I'd guess they just don't read the "terms of service" but I can't be sure. What's the standard practice (besides having "terms of service") to prevent users from having unreasonable expectations?


How to optimize calls to multiple APIs at once and return as one set?

I have a web app that searches across 2 APIs right now. I have my own Restful web service that I call, and it does all the work on the backend to asynchronously call the 2 APIs and concatenate them into one result set for my web app to use. I want to scale this out and add as many other APIs as I can (currently looking at about 10 more). But as I add APIs, the call to my service gets (potentially) slower and more complex. How do I handle one API not responding ... and other issues that arise? What would be the best way to approach this? Should I create a service call for each API, that way each one is independent and not coupled to all the other calls? Is there a way on the backend to handle the multiple API calls without all the extra complexity it adds? If I go the route of a service call per API, now my client code gets more complex (and I have a lot of clients)? And it's more work for the client, and since I have mobile apps, it will cost the client more data usage. If I go one service call, is there a way to set up some sort of connection so I can return data as I get it, in case one service call hangs?


Matching my skills with Java and Web Programming

here is my main question:   **What is the most common way that Java is used in web development?** The reason I ask:   I am currently in the process of finding my _first_ internship. Every employer has a separate set of languages, technologies and acronyms they want their candidates to know.   * In school I did well with Java.    * As a hobby and interest I have developed a handful of web pages widgets, scripts, etc. My university emphasized _Java_ , C and theory. My hobbies emphasize HTML, PHP, JavaScript, CSS, and a little jQuery, etc. I can't learn a dozen different technologies to satisfy most prospective employers (in what is left of the summer). I think my best bet is combine my skills with Java and my interests in web development. That brings me back to my original question: _What is the most common way that Java is used in web development?_


Pointless Code In Your Source

I've heard stories of this from senior coders and I've seen some of it myself. It seems that there are more than a few instances of programmers writing pointless code. I will see things like: >   * Method or function calls that do nothing of value. >   * Redundant checks done in a separate class file, object or method. >   * `if` statements that always evaluate to true. >   * Threads that spin off and do nothing of note. > Just to name a few. I've been told that this is because programmers want to intentionally make the code confusing to raise their own worth to the organization or make sure of repeat business in the case of contractual or outsourced work. My question is. Has anyone else seen code like this? What was your conclusion was to why that code was there? If anyone has written code like this, can you share why?


What is "Open Core" software?

What does the term "Open Core" software mean?


Is there a "SMACCS" for jQuery?

I find my usage of jQuery scaling in proportion with user expectations and RIA app. development. Problem is, I'm no jQuery Guru. I am looking for some nice practices that also do not require a deep knowledge of js/jquery. An article I ran across today inspired me to ask this question. Is there such a simple set of general guidelines for jQuery? I have not read "javascript the good parts" as of yet, so looking for some basic stuff.


How much does/should your style imply about your skill in a language?

Two things I've noticed in the past week that make me wonder:   * An interview where my Perl skills were reviewed. I always use C-style for loops and use map about once in every 10,000 lines of code, so I almost always have to reference it before using it. While I can interpret others code using that, it's not my style and that is for reasons involving readability and ease of changing between languages. I at least perceived that I was dinged for that.   * This answer to my question in which the answerer proceeded to refactor and bullet-proof my tiny script. I admit I was a little bit offended and kind of annoyed at that, though I can understand how that as a habit may be helpful. I understand that in a team, my style will need to adapt what the team has decided is correct -- this is necessary in every project and everybody has their own ideas. Yet I feel like I'm judged for what is syntactically fine and readable code. How much does the style of your smaller snippet code weigh in? Does code like that imply to others that I don't have control of the language because I didn't use all the features? Does my code imply that I'm not familiar with unit testing and proper testing because I didn't fully error-protect a tiny script?


How to create a WinForms project that is "WPF-ready"

I'm a C# developer who hasn't had the privilege of learning WPF yet. However, I recently initiated the architecture phase of a new project which I expect will eventually employ WPF (probably; although ASP.Net is still an option) -- but the GUI development won't begin for _several_ months. (We need to get buy- in on a WinForm-based proof-of-concept before we proceed with full production- grade development.) When we are ready to begin implementing the GUI, I will either learn WPF myself or hire someone with experience (preferably both). So my question is, what are some key fundamentals (design patterns, language essentials, etc) that I could employ right away which would facilitate a smoother migration down the road? For example, my code is a simulation model which will contain a very large number of entities that will eventually need to be "visualized", with interactive user-controls. Are there certain techniques that, if implemented from the ground up, would make wiring up these objects with WPF less painful later on? (Like dependency properties, or what- not.) Similarly, if I stick with the MVC approach that I am familiar with for right now, will it be straight-forward to morph that into an MVVM strategy later? Are there some simple concepts that I could apply now that would make the migration easier, but which won't take two weeks out of my current dev- cycle to master? Basically, I am trying to follow Uncle Bob's advice to postpone architectural decisions (in this case, the GUI layer) until I absolutely have to make them. But I want to know if there are any unnecessary migration costs that I could avoid if I anticipate them in advance.


Appending local MySQL data to same MySQL data in web server

my IT boss wanted this scenario to be undertaken: First, we develop an Alumni program using PHP and deploy this in the web server which can be accessed by that school alumni in the web to update their personal data anytime. Then, using exactly that SAME program we must also deploy this locally, thru the LAN in its satellite campus which is far and have a very erratic and unreliable internet connection. The purpose is that that the latter system (in LAN) can still be used to add new alumni data even during "offline" periods, and then, once the internet signal is OK, or now being "online" to just upload these offline-generated data in MySQL to the web server hosting THE SAME software program. How do we do a seamless data transfer then of this MySQL database - from the LAN to the web server - once the online signal is now steady? Thanks for any advice...


Should a developer be forced to memorize details?

Many times I forget things about my application. I don't memorize the table names or what a query did and I search to get what I want. My team leader told me I'm supposed to memorize the table names that I use. Is the developer required to `memorize` the table names in the database, the classes names...etc? And if the answer is "Yes, all the time," what should I do to remember those things?


Why is it good not to rely on changing state?

This question arises out of the question Is Haskell worth learning? Generally a few often repeated statements are made, about how Haskell improves your coding skills in other languages, and furthermore, this is because Haskell is stateless, and that's a good thing. Why? I've seen someone compare this to only typing with the left hand, or perhaps closing your eyes for a day and just relying on touch. Surely there is more to it than that? Does it relate to hardware memory access, or something else which is a big performance gain?


Should we be looking out for lying code?

This is referring to a discussion in an answer and the comments of this question: What's with the aversion to documentation in the industry?. The answer claimed that "code can't lie" and thus should be the go-to location instead of documentation. Several comments pointed out that "code can lie". There is truth on both sides, at least partly because of how poorly and inappropriately documentation is handled. Should we be on the lookout for lying code, comparing it against any existing documentation? Or is it usually the best source for what it needs to be doing? If it is agile code, is it less likely to lie, or can that code not lie at all?


Is Node.js future-safe?

I've been getting great results with Node.js since a year+. Everything is perfect and I couldn't be happier. Yet I have a feeling that this model won't last long and will be forgotten as soon as something replaces JavaScript on the browser, so I'm considering migrating to Haskell or similar as soon as I can. Is Node.js a future-safe technology, or is it a middle-term solution?


When using Git, is using the master branch for active development advisable?

First, some background, we are in the process of moving all of our project teams over to using git and are in the process of laying down the guidelines for how the repositories should be organized so that certain branches can also be monitored for continuous integration and automatic deployment to the testing servers. Currently there are two models that are developing:   1. Heavily influenced by the nvie.com article on successful branching with the master branch representing the most stable code, a development branch for the bleeding edge code, and an integration branch for code that is ready for QA testing.    2. An alternate model in which the master branch represents the bleeding edge development code, an integration branch for code that is ready for QA testing, and a production branch for the stable code that is ready for deployment. At this point, it is partly a matter of semantics in regards to what the master branch represents, but is doing active development on the master branch actually a good practice or is it not really that relevant?


Entity-Component-System architecture: interaction between systems

I am studying the Entity-Component-System architecture philosophy. As I have read about it, a typical entity system has: 1) **Entities** \- which are merely ID tags which have a number of components 2) **Components** \- which contain _data_ on various aspects of an enity that the component is responsible for 3) **Systems** \- which update relevant components of every entity. Say, a rendering system updates the rendering component, or simply saying, draws a picture that is stored in the data of that component. A positional and movement system handles position and movement of each entity who has a corresponding component. These statements follow from this article which in my opition tries to be the most clear and pure in it's statements - But the author did not explain how the interaction between systems should be realized. For example, the rendering system must know the data from the positional component of an entity in order to draw it in a correct position. And so on. So the question is - how should I implement the interaction between the various systems?


How should you approach supporting rapidly-updating web browsers?

Today, Firefox 5 was released. If all goes according to plan, Firefox 7 will be out by the end of the year. Firefox has adopted the Google Chrome development model wherein version numbers are largely unimportant and so just supporting "the latest (publicly available) one" is probably the best strategy. But how do you best test that? As my QA guys have pointed out, if you tell the client that you support "the latest version" but a version comes out that breaks your site, then you have a problem because now you've stated you support a web browser you don't. And since both Firefox and Chrome now update themselves automatically, the average person probably has no clue or care what version they're running. And having them either not upgrade or roll back is nontrivial. I'm finding there are a number of organizations that mandate their employees use IE (the head of IT subscribes to the Microsoft school of thought), or mandate their employees use Firefox (the head of IT subscribes to the IE-is- insecure school of thought), so Chrome updating constantly was a non-issue. But now that Firefox is a member of that club, I can see this becoming a bigger issue soon. My guess, in the case of Firefox, would be that the Aurora channel is the key, but what is the best way to approach testing it? Should we fix anything that comes up as an issue in Aurora, or should we wait until closer to the scheduled release? Do people automate this sort of thing?


Learning Erlang vs learning node.js

I see a lot of crap online about how Erlang kicks node.js' ass in just about every conceivable category. So I'd like to learn Erlang, and give it a shot, but here's the problem. I'm finding that I have a much harder time picking up Erlang than I did picking up node.js. With node.js, I could pick a relatively complex project, and in a day I had something working. With Erlang, I'm running into barriers, and not going nearly as quickly. So.. for those with more experience, is Erlang complicated to learn, or am I just missing something? Node.js might not be perfect, but I seem to be able to get things done with it.


Why does there seem to be a lot of fear in choosing the "wrong" language to learn?

Perhaps its just me, but as a current CS student I have already come across many questions on this site and elsewhere about not just "Which language should I use for x?" but also "Does anyone still use language Y?" My first CS class was taught in Scheme, which, if I'm not mistaken, isn't used widely (at least in comparison to languages like Java, PHP, Python, etc). Many of my classmates balked at the idea of having to learn a language they would never have to use again, but I don't quite understand where so much of this fear of learning less popular languages comes from. No, I may not use Scheme in any job I get, but I certainly don't regret having learned to use it (albeit in a very beginner, not very in-depth manner in that one semester). I am taking a search engines class this semester, which is done in Perl and again I am seeing classmates complaining about the language choice. I can understand having a favorite language and disliking others but why do some get worked up over learning it in the first place? Can you really learn the "wrong" language? Isn't learning something like Scheme or Haskell good mental exercise if nothing else, and useful at least to exposure to different ways of solving problems?


Can I use Ruby to automate everything?

I face various types of applications (web-based, GUI-based, command-line, etc.) on various platforms (Windows, Linux, etc.) to operate everyday. There is a great opportunity for me to automate tasks by scripting. But almost every type of application and platform has its **native** scripting language or tools (such as VBScript and PowerShell for Windows, Bash scripts for Linux, Selenium for web applications, and AutoIt for GUI applications, etc.). It kills me to learn and maintain so many scripting languages. I have a feeling that Ruby can interoperate with various platforms easily, and it is very expressive. So my question is:   1. It is possible to use Ruby to script everything?   2. If it is, what are the main disadvantages compared to the **native** scripting language of each platform?


When checking for transposed day and month values between two Dates - should comparing 11/11/2000 and 11/11/2000 return true or false?

Assuming a function with a signature of               boolean isTransposed(Date date1, Date date2);      Example outcomes:               date1   date2           Outcome     06/02/2000  02/06/2000  true     02/06/2000  06/02/2000  true     02/06/2000        null  false     06/02/2000  02/06/1987  false     11/11/2000  11/11/2000  true     04/04/2001  04/04/2000  false      Granted the behavior can be documented but what are your thoughts on `isTransposed('11/11/2000', '11/11/2000')` returning `true` verse `false`?


Should I be able to design good interfaces and produce quality content?

I'm just coming into my final year of university so I'm going to start looking for jobs as a software developer and I just wanted to know just how important it is to be able to design good looking interfaces and produce good quality content in a software development job? I'm only asking because I struggle to be creative due to my dyslexia but If given a design to do (i.e. a picture or description of some sort) I am able to do it to a high standard, Will this affect my career options?


Controller and Model Interaction

I'm fairly new to MVC and I'm trying to get a better understanding of it. There is endless information about the theory and general responsibilities of each part of an MVC app, which I've read a good deal of, but I find myself constantly second guessing my implementation. I currently have my application setup where my "Model" provides a number of methods that effectively do CRUD work on the application data. Methods like `add_document(name, path)` and `update_account(id, code, name, status)` At this point it works, but it feels clunky, as I effectively have to decide whether I want to write a method to update every property of a model object, or whether I want one method that can handle updating any property for a given object. These methods all interact with model objects in SQLAlchemy (A Python db toolkit and ORM). Lately I've considered the possibility of passing ORM objects back and forth between the Model and Controller. The controller would change a property, then pass the object back to the Model which would handle sessions, commits, and error conditions. While this seems so much easier than writing tons of CRUD methods, it also seems to break the division of responsibility by allowing the Controller to touch ORM objects at all... I was hoping to get some guidance here. Are a whole ton of CRUD operations normal in MVC apps? Is it acceptable to pass ORM objects between the Model and Controller - where the Controller only ever updates properties while the model handles session and database work? I'm also open to alternative ideas about how to separate responsibilities in an elegant way.


Is often using int constants as parameters in communication between objects considered bad design?

An app I'm working on is designed with MVC. The components often interacts with each other by passing int constants, which then have to be interpreted with `if` statements. I'm wondering if this is considered bad OO design. (Not specifically with MVC, but in general). For example: When the user clicks a specific button, the controller is told by the view `controller.somethingHappened(Controller.SOME_INT_VALUE);` The view uses a constant int value in the controller as a message to tell what happened. The controller then has to have a lot of `if` statements to interpret the message from the view. E.g.:               public void somethingHappened(int message){         if(message == AN_INT_VALUE) doSomething();         if(message == ANOTHER_INT_VALUE) doSomeThingElse();         if(message == A_DIFFERENT_INT_VALUE) doAnotherThing();     }      As a result the controller passes another int value into the model, as a message to do something. I.e. `model.doSomething(Model.SOME_INT_VALUE);`. Which forces to model to also have a bunch of `if` statements:               public void doSomething(int message){         if(message == AN_INT_VALUE) doSomething();         if(message == ANOTHER_INT_VALUE) doSomeThingElse();         if(message == A_DIFFERENT_INT_VALUE) doAnotherThing();     }      This results in both the controller and model having a lot of `if`s to interpret the messages the receive. **Is this considered ugly and/or bad design?** Should I try to pass actual objects into methods, or make more specific method calls - instead of passing constants that have to be interpreted with a bunch of `if`s? **Or is this practice of using a lot of constants as messages considered reasonable?** If it is considered bad design, how can I avoid this? _(Please note: For the purpose of this question I'm also referring to enums)_.


how to make the move from C++ to java

I have a few years worth of C++ professional experience under my belt. Recently, I decided to look for a new job, and found out that find a C++ job is not as easy as it used to be. Nearly all jobs posting and head hunters are in the market for Java/C# developers.   Event though I have a some experience with Java, it's not enough to make me interesting to any of the companies I applied for. I've decided that after I get a new job (C++ as it appears) I must get my hands dirty with Java or C# . Currently, my only possible plan is to either join or start my own open source project. But will it be enough? Can such a project replace 2-3 years of working in a commercial company? Is there another way to make the transition?


Describe business logic with diagrams

I am currently developing a web application for my thesis.I was asked by my professor to make diagrams to describe the business logic. Since I don't have a prior experience, I am pretty confused with all the terminology. I managed to clarify,I think, what business rules and business logic are, but I can't find out how you describe the business logic. Is it something particular or is it something more general? Do I need to learn UML? Does the fact that I use MVC affects the way I'll describe it?


Replacing string comparisons with dictionary lookups

Given 2 strings s1 and s2, if I do a simple equality check , it is considered to be O(n) when calculating algorithm efficiency. So, if I am using a brute force approach for the rotated substring question the efficiency is O(n^2) (take the 2nd substring, rotate by 1 and check. Repeat till rotations = strlen or matched) However, a Dictionary lookup is considered O(1). If I instead used a dictionary with the sole element having a dummy value and a key = s1. Then , instead of doing a string compare I checked for the existence of s2 in the dictionary, wouldnt my complexity go down to O(n)? Intuitively it doesnt make sense to me, so I'm guessing one of my assumptions is incorrect...


What do you do when you can't seem to understand a certain part of programming?

I'm learning new languages as I go along, I write code for very basic programs in multiple languages, and I go to classes. I've read books, articles, lessons, videos, you name it, however I can't seem to get the hang of certain things. For example I never understood pointers - what they are good at. (NOT PART OF THE QUESTION - retagging with "Pointers" is not required...) * * * My question however, is not what pointers do, but instead how can I understand things like that? If, after reading a book or an article about a certain part of programming, and I don't understand, what do I do? Writing code in a certain feature of programming surely helps, however it doesn't actually help with understand that much. The theoretical part is important in understanding.


Gerrit code review, or Github's fork and pull model?

I am starting a software project that will be team AND community developed. I was previously sold on gerrit, but now Github's fork and pull request model seem to almost provide more tools, ways to visualize commits, and ease of use. For someone who has at least a little experience with both, what are the pros/cons of each, and which would be better for a team based project which wants to leave open the possibility for community development?


Microsoft Dev Centre accounts

Looks like Microsoft is offering a special offer of 95% of the yearly subscription for the Phone Dev Centre (I didn't say anything about desperate). What I was wondering is do you need a seperate account to publish to the Windows Phone app centre and the Windows App Centre? Also I heard some horror stories about the time it takes to get application published on the Windows phone marketplace, does anyone have any experience with this? Windows Phone Dev Centre Windows App Dev Centre


When would you use multiple languages in one project?

When would you consider incorporating another language into your project? Some domains are inherently multi-language ( Database interaction, interactive web client side development), but others could be done with 1 language and the idea of introducing another language could hinder understanding more than help it. Currently I have high performance code in C++ that also needs to do a fair amount of routine file and i\o manipulation which would be easier and faster to write correctly in a higher order language like Python. To be honest I don't know C++ extremely well when it comes to 3rd party libraries including Boost.


How to Avoid Fragile Unit Tests?

We have written close to 3,000 tests -- data has been hard coded, very little reuse of code. This methodology has began to bite us in the ass. As the system changes we find ourselves spending more time fixing broken tests. We have unit, integration and functional tests. What I'm looking for is a definitive way to write manageable and maintainable tests. **Frameworks**   * FakeItEasy   * nUnit   * AutoFixture


Complexity vs maintainability in modern hardware

Today with the modern hardware and memory coming cheap, how much sense does it make to spend effort to analyze algoriths or data structure complexity?   Wouldn't it be better instead, to focus on clean, maintainable code, readable code than on optimizations for complexity?   Note:I not talking about embedded systems or systems with similar kinds of constraints.


UDP distributing/sharding methods

Currently I'm sending UDP messages to a server which handles and processes the message. To make the processing more scalable, I'd like to have some sort of autoscaling mechanism for the receiving servers. I have two ideas: 1.) Use a UDP load balancing technology   2.) Distribute the messages on the client side. For the second option, I would update the receiving server list on the client side using a background thread on the client and would hit some sort of internal API and retrieve an updated list periodically. My question is, does this sound like a reasonable method? Also, would something like zookeeper be good for this? It would store the server list and be retrieved by the clients.


I will be delivering a lecture on Android development tomorrow. Any topics I should cover?

I have been asked by my local Association for Computing Machinery chapter to give a lecture on Android development, and while I already have some topics to cover, I was curious if the community of SO had any suggestions of things that would be interesting to hear about. Thus selected:   * OpenGL   * Using hardware features (camera, audio, accelerometer, multitouch)   * Good UI practices   * Social media integration


An algorithm for finding converse duplicates of ordered pairs

Given an array of ordered pairs of values, is there a well-known algorithm to find converse duplicates? [Converse meaning the same values, but in the opposite order.] That is, given [ab,ac,ad,bc,bd,ca,db] is there an efficient way to find ca and db, being the converse duplicates for ac and bd? The application is simple enough: the ordered pairs are edges in a directed graph and if there is a converse edge then a single double-ended edge is to be drawn rather than one edge in each direction. The values are strings, being node names. It can be viewed as a lookup in a sparse array. Given coordinates (a,b), check whether (b,a) exists. However, common programming languages do not (appear to) provide sparse 2d arrays. I have written a solution in ruby using hash-of-hash, but it's about 20 lines of awkward code and an unsatisfying outcome. Writing the same code in a language like C# or Java would be longer. A better solution is sought, in any convenient language (or pseudocode). * * * I haven't attempted to define 'efficient' or 'better', and performance is not an overriding consideration for a drawing of a few hundred nodes. The nodes are not sorted, so the default algorithm would be, for each pair, to form the converse and brute-force search the preceding half. A binary search would require a prior sort. A solution based on hash indexing should be much faster.


What's the best language to use for a simple windows 7 dynamic gui desktop app

[Note: I hope I am not breaking etiquette, but I originally posted a variant on this question here, but am re-asking here because I am making this now solely a question about programming.] I would like to program of the following simple form:   1. The user can produce X number of resizable frames (analogous to HTML frames).   2. Each frame serves as a simple text editor, which you can type into and save the whole configuration including resized windows and text.   3. The user should be able alternately "freeze" and present the information, and "unfreeze" and edit frames. Thus it will be a cross between a calendar and a text editor. I don't particularly care if it is a web application or not. What languages are ideal for such a setup? I know some C and Python and Html, and am willing to learn others if need be. It seems to me this should be a relatively easy program to make, but I need a little direction before starting. EDIT: My OS is Windows 7.


Fluid VS Responsive Website Development Questions

As I understand these form the basis for targeting a wide array of devices based on the browser size, given it would be a time consuming to generate different layouts targeting different/specific devices and their resolutions. * * * ## Questions: * * *   * Firstly right to the jargon, is there any actual difference between the two or do they mean the same?   * Is it safe to classify the current development mainly a html5/css3 based one?   * What popular frameworks are available to easily implement this?   * What testing methods used in this regard?   * What are the most common compatibility issues in terms of different browser types?   * I understand there are methods like this http://css-tricks.com/resolution-specific-stylesheets/ **which does this come under?**.   * Are there any external browser detection methods besides the API calls specific to the browser that are employed in this regard? * * * **Points of interest [Prior Research before asking these questions]**   1. Why shouldn't "responsive" web design be a consideration?   2. Responsive Web Design Tips, Best Practices and Dynamic Image Scaling Techniques   3. A recent list of tutorials 30 Responsive Web Design and Development Tutorials by Eric Shafer on May 14, 2012 * * * ## Update Ive been reading that the basic point of designing content for different layouts to facilitate a responsive web design is to present the most relevant information. now obviously between the smallest screen width and the highest we are missing out on design elements. I gather from here http://flashsolver.com/2012/03/24/5-top-commercial- responsive-web-designs/ The top of the line design layouts (widths) are   * desktop layout (980px)   * tablet layout (768px)   * smartphone layout – landscape (480px)   * smartphone layout – portrait (320px) Also we have a popular responsive website testing site http://resizemybrowser.com/ which lists different screen resolutions. I've also come across this while trying to find out the optimal highest layout size to account for http://stackoverflow.com/questions/10538599/default-web- page-width-1024px-or-980px which brings to light seemingly that 1366x768 is a popular web resolution.   * Is it safe to assume that just accounting for proper scaling from width 980px onwards to the maximum size would be sufficient to accommodate this? given we aren't presenting any new information for the new size.   * Does it make sense to have additional information ( which conflicts with purpose of responsive web design) to utilize the top size and beyond?


How to handle people who lie on their resume

> **Moderator comment** > > Please note that this is a **two year old** question that has just been > migrated from Stack Overflow. Please take your time to read **all** the > answers and ask yourself "would my answer add anything to this?". I'm conducting technical interviews to fill a few .NET positions. Many of the people I interview really _do_ know .NET pretty well, but I find at least 90% embellish their skillset anywhere between "a little" to "quite drastically". Sometimes they fabricate skills relevant to the position they're applying for, sometimes they don't. Most of the people I interview, even the most egregious liars, are not scam artists. They just want to stand out among the crowd, so they drop a few buzzwords on their resume like "JBoss", "LINQ", "web services", "Django" or whatever just to pad their skillset and stay competitive. (You might wonder if a person that lies about those skills is just bluffing their way through a technical interview. My interviews involve a lot of hands- on coding and problem-solving - people who attempt to bluff will bomb the hands-on coding portion in the first 3 minutes.) These are two open-ended questions, but it would really help me out when I make my recommendations to the hiring managers:   1. **Regarding interviewing etiquette, should I attempt to determine whether a person really possesses all of the skills they claim to have? Can I do this without making the candidate feel uncomfortable?**   2. **Regarding the final decision, should I recommend candidates who are genuinely qualified for the positions they're applying for, even if they've fabricated portions of their skillset?**


Logging in a latency sensitive system

Requirements:   1. My application is latency sensitive. Millisecond level responsiveness matters. Not all the time, but when it acts, it needs to be fast.   2. My application needs to log information about what it's done in those times.   3. The actual writing of the logs does not need to be that fast, just the actions.      * However, the log files need to be written at human speed, in other words, I cannot set `immediateFlush` to false. So, obviously, certain kinds of logging are getting offloaded to another thread. I am using logback as a framework, but for certain sorts of log messages I still want to offload the work to another thread. Here is how the system currently works:   * Each part of the latency sensitive system gets a particular logger interface injected. Each of these log methods has a signature specific to the sorts of things I know the logger will need to log.   * A `SimpleLogger` implementation is written for each case. This writes to the log on the same thread.   * I have also written a `ThreadedLogger` which implements ALL the logging interfaces, and gets a "backing" logger implementation injected for each sort of logger.   * Whenever a log method is called in `ThreadedLogger`, it wraps the request in an `SomeLogObject implements LogCommand`, throws the objected into a `LinkedBlockingQueue`, and returns. This is similar to the Go4 Command pattern     * There is a consumption thread that blocks on `BlockingQueue.take()` waiting for log objects to come in. When they do, it calls `LogCommand.execute()`, which calls the appropriate method in the backing `Logger` in `ThreadedLogger`.   * Currently the `LogCommand` implementations are very stupid. They just call the appropriate method in the proper injected logger. I am trying to decide if I should refactor this system. Currently, if I need to create a new place to do these offloaded logs, I have to create:   * A new interface   * A new implementation of this interface   * Two new DI bindings (one for the simple logger, one for the `ThreadedLogger` backer)   * A new `LogCommand` implementation   * A new method for creating this `LogCommand` object   * Code for injecting and storing as a field the appropriate logger in `ThreadedLoggger` It seems to me that it would be a lot simpler to offload the creation of the `LogObject` to the calling threads, but I am concerned that I'm exposing too much of the internal workings of the log system if I do that. Not that this is necessarily a problem, but it seems unclean. Another possibility would be to combine the functionality of the simple logger implementations with their respective log objects, so the objects change from being "I am an object that does logging when given log data" to "I am a log event that knows how to log myself", and these objects can be created by a log factory.


Is it bad software design to mix JDBC SQL calls and use an ORM in an application?

Is it bad software design to have JDBC/raw SQL and also use an ORM? I don't mind using an ORM for boilerplate CRUD, but some queries are better in SQL (for me). I'm not arguing for or against ORMs. I've read about them until I'm blue in the face. I used JDBC in my question, but it could have been DBI, or some other database interface. ORM can be any of them. How about maintainability? Would mixing the strategies complicate it? To me the maintainability of an application efficiently becomes even more blurrier, if it is a compiled language vs. a scripting language. I have to recompile Java. I don't have to recompile Python or PHP. If my SQL is in a model layer, does that change anything? EDIT: If I use find a point where I need to use SQL in my ORM, in my model, what kind of data is sent back? I won't be able to use something like person.save('somevalue'), for example, will I?


Solutions for Project management

* The team consists of **3** people.    * The method of development is **Scrum**.    * The language of the project is **C++**.    * The project will be under the control of the **git** system.    * The start up budget is **0**. **The following things have to be chosen:**   1. Build and Version Numbering   2. Project documentation ( file with the most common info for current stage of the project, which will be changed every time the new version or subversion of the project emerges )   3. Project management tool ( like Trac or Redmine, I cannot use them, because there is no hosting )   4. Code documentation ( I consider Doxygen ) **The following questions have arisen:**   1. What can you add to the above list of the main solutions for project management in the described project?   2. One of three project participants has linux os (No MS Office), one has Windows and MS Office (does not want to use Libre or Open Office), one has Windows, but does not have MS Office. What formats, tools can u suggest using for project documentation? The variant of using online wiki does not fit, it must be files.   3. OneNote mb is a good tool for project management, but because of the reason mentioned above it is not possible. What can you advise?   4. Offer a system for Build and Version Numbering.


Open source library, can the project owner change the license to be more restrictive?

A company releases a library with an open source MIT license. If they wanted to, could they change the license to be very restrictive so competitors cannot use it? What impact would this have on previous versions? Meaning if on Nov. 1st they make it very restrictive to some other license, would all versions prior to Nov 1st be still on MIT?


How would I implement this application idea?

I am a D&D gamer and a developer that has mostly worked with ASP.NET applications professionally. I have written some chat bots in Node.js and I have only played a little with PHP but wrote nothing serious. I have had inspiration to create a site that allows a person to keep track of characters (aka the character sheet). I am thinking of using this as a learning opportunity to learn noSQL and to write a full javascript front-end. I want this application to save the value as I change it. So if I edit the armor class, it is saved immediately instead of waiting until I hit the submit button. I think that will make it easier to use while gaming and not losing anything because I forgot to save the change. I have never done anything like this. How do you implement this style of application? Is there a tutorial or howto to get me on the right path? While I would really like to use ASP.NET but I don't have a Windows server to publish on (and I really can't afford to pay for a service). What language that runs on Linux would work well for this type of application? Note: I feel noSQL would work in this case because of the sheer number of tables required to create something like this in SQL.


Is there a way to add unique items to an array without doing a ton of comparisons?

Please bare with me, I want this to be as language agnostic as possible becuase of the languages I am working with (One of which is a language called PowerOn). However, **most languanges support for loops and arrays.** Say I have the following list in an aray:               0x  0  Foo     1x  1  Bar     2x  0  Widget     3x  1  Whatsit     4x  0  Foo     5x  1  Bar      Anything with a 1 should be uniqely added to another array with the following result:               0x  1  Bar     1x  1  Whatsit      Keep in mind this is a very elementry example. In reality, I am dealing with 10's of thousands of elements on the old list. Here is what I have so far. Pseudo Code:               For each element in oldlist      For each element in newlist       Compare       If values oldlist.element equals newlist.element, break new list loop       If reached end of newlist with with nothing equal from oldlist, add value from old list to new list      End     End      **Is there a better way of doing this? Algorithmicly, is there any room for improvement?** And as a bonus qeustion, what is the O notation for this type of algorithm (if there is one)?