How to recover after embarrassing yourself and your company?

I work in an outsourcing company in Russia, and one of our clients is a financial company located in USA.   For the last six months I have been working on several projects for this particular company, and as I was being assigned a larger project, **I was invited to work onsite in USA in order to understand and learn the new system**. Things didn't work out as well as I hoped because the environment was messy after original developers, and I had to spent quite some time to understand the quirks. However we managed to do the release several days ago, and it looks like everything's going pretty smooth. From technical perspective, my client seems to be happy with me. My solutions seem to work, and I always try to add some spark of creativity to what I do. However I'm very disorganized in a certain sense, as I believe many of you fellas are. Let me note that my current job is my first job ever, and I was lucky enough to get a job with flexible schedule, meaning I can come in and out of the office whenever I want as long as I have 40 hours a week filled. Sometimes I want to hang out with friends in the evening, and days after that I like to have a good sleep in the morning—this is why flexible schedule (or lack of one) is ideal fit for me. [I just realized this paragraph looks too serious, I should've decorated it with some UNICORNS!] Of course, after coming to the USA, things changed. This is not some software company with special treatment for the nerdy ones. Here you have to get up at 7:30 AM to get to the office by 9 AM and then sit through till 5 PM. Personally, I _hate_ waking up in the morning, not to say my productivity begins to climb no sooner than at 5 o'clock, i.e. **I'm very slow until I have to go** , which is ironic. Sometimes I even stay for more than 8 hours just to finish my current stuff without interruptions. Anyway, I could deal with that. After all, **_they are paying for my trip, who am I to complain?** They need me to be in their working hours to be able to discuss stuff._ It makes perfect sense that fixed schedule doesn't make any sense for me. But it _does_ makes sense that it does make sense for my client. And _I_ am here _for client_ , therefore sense is transferred. Awww, you got it. I was asked several times to come exactly at 9 AM but out of laziness and arrogance I didn't take these requests seriously enough. This paid off in the end— **on my last day I woke up 10 minutes before final status meeting with business owner, having overslept previous day as well**. Of course this made several people mad, including my client, as I ignored his direct request to come in time for two days in the row, including my final day. Of course, I didn't do it deliberately but certainly I could've ensured that I have at least two alarms to wake me up, et cetera...I didn't do that. He also emailed my boss, calling my behavior **ridiculous and embarrassing for my company and saying “he's not happy with my professionalism at all”**. My boss told me that “the system must work both in and out” and suggested me to stay till late night this day working in a berserker mode, fixing as many issues as possible, and sending a status email to my client. So I did, but I didn't receive the response yet. These are my questions to the great `programmers` community: > Did you have situations where your **ignorance and personal non-technical > faults created problems for your company**? > > Were you able to **make up for your fault** and **stay in a good > relationship** with your client or boss? How? > > How would you act **if you were in my situation**? * * *


Adding a callback to a function?

Is there a way to add a callback to any given javascript function without changing its definition? Can this be done without using a library like deferred?


Representing floating-point numbers in bytecode

How do interpreted languages typically go about representing floating-point numbers in their bytecode? For example, suppose I've got a Java program with the line `double a = 3.0;` What does `3.0` look like in the program's bytecode? I see two possibilities: 1) Writing the bit-level representation of the in-memory number into the bytecode, and then just reading it back into memory when we need it. There are probably problems with portability here (the size of `double` on different machines can vary, so how do we store a number in bytecode in a portable way?). 2) Write a canonical representation of the number into the bytecode which can be decoded when program execution time comes. The literal string `3.0` might serve that purpose here, but then we're wasting execution time parsing a floating-point number during runtime. So my question is, which strategy is most common/efficient/best? You can feel free to cite examples from different interpreted languages that compile down to bytecode (Python, Lua, etc.), or merely point me in the direction of some resources of some relevant articles if that's necessary (I've been Googling quite a bit, but few virtual machines are well-documented).


When should I prefix names with the project name?

If you work with SharePoint, you'll see classes like `SPList`, `SPSite` etc. I've seen variations of this on other projects, in other technologies, e.g. for a CRM project, classes named `CRMLoggingFactory`, `CRMEntity` etc. This stands out when you look at the code and you know what the prefix corresponds to, but when do you draw the line? What are the conditions for a class to be prefixed by the project name, company name, etc. (i.e. the "domain name" of the project)?


Providing users with program revision history information?

One limitation of a program that I maintain is that the end-users often don't know what changes have been made. To remedy this I would like to show my users a simplified list of changes made to their program. Is there a good methodology/approach to follow that would create a easy to update list that could then be fed into the user interface? For example: Should I store everything in a XML file that is read into a form? Should the change history go into a database? Note: The program is Winforms (C# 4.0). **UPDATE** Based on the excellent feedback I have decided to use SQLite as my information storage and will provide the users with a chronological list of changes in a TreeView control.


Ruby on Rails application interfacing with a Datamax barcode printer

I am trying to find a standalone way to interface with a Datamax M-Class Mark2 label printer through a Ruby on Rails application. I currently have a solution that is working, which i use javascript to interface with an ActiveX object on the users machine. If at all possible i would like to accomplish this without the need for the ActiveX object.


How to solve installation errors reported by users, on Android?

I've some application on the Google Play, free to download, but I have some people reporting things like: "There has been problem installing on my htc x." How do I help these people? I could reply and ask things like their android version and what not, but this won't really help me debug it, since the error occurs on installation! Any general ideas on how to handle this? Maybe some tips about general android installation issues, or on how to help the people?


Fixing data duplication in two similar tables in different databases

I'm currently doing maintenance on an old order system that has grown into the poster child for bad coding practice. One of the tings I'm dealing with is a lot of data duplication, which I want to fix. The problem, is that one central table "users" exists in two different databases (A and B), in A ties into the ordering system, B ties into the logistics system. New users are added to both tables, and they contain identical information, except for that in B there are three aditional fields. My instinct is to remove this data duplication. Now, a lot of queries are made against A and B by their respective toolchains.   1. My first thought is to change the queries for A.users to B.users, and delete the A.users table. Though this seems bad there would be JOINS going from A to B whenever any order tools needs to check against the user table (which is a lot).    2. My second idea is to move the users table into a seperate database that contains only user specific data and move the fields pertinent to logistics into a seperate table on B. Any ideas on how to untangle this?


Mobile Web Security Articles

I'm starting to introduce mobile web apps to my company but my not-so-techie boss is worried about web security issues on mobile devices. I'm new in the mobile world but as a web developer I know the basics about web security (like the best practices listed in OWASP) but I don't know if there's anything else that could make my mobile web app vulnerable specifically for mobile web browsers. Also, I need an internet article readable from not-so-techie bosses that could help me convince him how secure our mobile web app could be if I apply the common web security best practices. Can you help me with this? PS. I'm using Java as my backend and jQuery Mobile as my frontend.


How to use mock objects [C++] without passing them as arguments to functions

I'm in the process of integrating a Unit Testing Framework for an existing code base in C++. I've zeroed down on CxxTest, but as it turns out we can use other Mocking Frameworks (like googlemock) in conjunction with CxxTest too. After reading tutorials on CxxTest (Mocking) and googlemock (the infamous turtle example), I have the general idea that you have to define a mock class (using macros etc), declare an object of the mock class and then pass it to the function you are unit testing. Now, there are many occurences in the existing code base where it isn't possible to do that. Here's an pseudo example to clarify:               class CCandidateForTest     {         public:         bool foo(int a)         {             CAnotherClass obj;             int b = obj.bar(a+2);             if (a == b) {                 return true;             } else {                 return false;             }         }     }      (This is over-simplified, there are also exceptions and the primitive types may also be other objects etc.; but you get the general idea) (also, creation of objects is not always direct and may sometimes use a factory) I want to write a test for the function `CCandidateForTest::foo`. This method internally creates an object of `CAnotherClass`, which I need to mock so that `CAnotherClass::bar` returns different values so that different code paths in `foo` are traversed in unit testing. In a nutshell, the problem is that the function being tested internally creates an object of the class that needs to be mocked - hence passing an instance of the mocked object to the function is not possible. How do I use mocking in such a case? Is there a specific mocking framework that makes this possible?


What to do (or not do) when a developer doesn't deliver the goods?

I've recently had the misfortune of hiring a developer who failed to deliver a **working** product by the arranged date. I have the software, but it produces errors on installation. The developer said the product works. I had wanted to give the developer the benefit of the doubt, but they have ignored all requests to show me a working demo. I set up a website specifically so that they could install the software, but they have done nothing (it should be a matter of uploading the zip and changing a few things in the configuration). They have also ignored all requests for information on their configuration. Actually it is really difficult to get any reply from them at all. It is almost 1.5 months after the deadline. **Possible ideas**   * Have a third party check the software.    * Put in a claim with Paypal (although I think it is too late and isn't covered anyway).   * Make it public (I'm assuming it isn't defamation because it is true). **QUESTION:** What should I do (or not do) about this? **EXTRA**   * I've noticed that even if the software was to work there are a number of features that I requested (prior to their acceptance of the job) that they have ignored.   * I've found comments on the web about the company saying that this situation is normal for them. They seem to use errors in their software as an excuse to extort more money from their clients. Actually this was a relief as it backed up my belief that I'd been scammed.   * They don't have a phone number on their website.    * The developer is based in the US. **EDIT:** The arrangement was that I paid 25% of the cost of the development. The developer would keep all rights for the product. The product was integrating an already existing open source component with a CMS. I produced icons and did the styling for part of the component (completed). The developer would have the component done with the features I requested by mid December. **EDIT2:** The developer said that they would be able to provide all the features I requested. **EDIT3:** There is no documentation with the software.


What's the best practice for rendering a different GSP template based on the type of object in a collection?

Let's say I have a collection that is setup in my controller, named "things." In this collection is a heterogeneous assortment of objects. Let's say some are of type "Thing" and some others are of type "OtherThing". In the GSP page that renders this list, I want to render each different object type differently. I know that the following code works, but I can't escape the feeling that there should be a more elegant way to do this. Does anybody have a better way?                       <div id="eventStream">                  <ul>                 <g:each in="${things}" var="thing">                          <g:if test="${thing.type.equals( 'Thing' )}">                         <g:render template="/renderThing" bean="thing" />                     </g:if>                          <g:if test="${thing.type.equals( 'OtherThing')}">                         <g:render template="/renderOtherThing" bean="thing" />                     </g:if>                      </g:each>                    </ul>              </div>      (Note: there is a "type" field defined on 'Thing' and 'OtherThing' that contains those string literals. That's just a shortcut). EDIT: Just realized that there's another way to do this, that depends on the notion of "convention over configuration." I could just go with a convention that the templates are always named something like: _renderXXXXTemplate.gsp where XXX is "Thing" or "OtherThing" or whatever. Then I just render with something like:               <g:render template="/render${thing.class.name}Template" bean="thing" />      Anybody care to share their thoughts on the merit of that approach?


Alternatives to using  cookies?

Whate are alternatives to using cookies/client-side storage for a PHP/MySQL based site on Apache. Scenario/Requirements:   * I want to try using some anti-bot code to prevent specific scrapers etc. from accessing the site.       * I would like to run this code before launching the rest of the site (before DB access etc.).      * I don't want to constantly run the same code on every page-load after a visitor has passed the initial check.    * I'd like to avoid the use of Cookies/Client side storage if at all possible. The only solution I can currently think of is to write files to the server based on the visitors IP/UA, or to write a list of them to a single file. Yet this has the limitation of multiple users through a proxy/same connection, etc ... So, any ideas/suggestions? Or am I simply over working the issue?


Constant database calls or store in objects?

I'm creating a pretty simple database driven application. Whenever I create a db app, I create classes that mimic the data in the db. Is this good practice? Am I better off making one big call to the database and populating my objects and working with these objects, or should I retrieve data from the db only when needed?


MIT License: Why isn't it considered viral?

The first part of the license implies you can do basically whatever you want with it (copy, modify, sell etc). But the second part says that these freedoms must propagate into all copies of the software. My interpretation of that is, you can incorporate the software into your proprietary project, but that portion must remain open....so any modifications to the software must keep that license attached, forcing my changes to be open sourced. Isn't this the reason people consider the GPL to be restrictive/viral? Because it forces modifications to be open sourced? Here is a copy of the license: > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to > deal in the Software without restriction, including without limitation the > rights to use, copy, modify, merge, publish, distribute, sublicense, and/or > sell copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in > all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS > IN THE SOFTWARE.


What's the standard for entity design/database connectivity for a mySQL database?

I'm hosting a solution that serves as a web tier on a Ubuntu machine running Apache and Mono. I'm currently developing the project on OSX, using Mono. I understand there is no native support for Linq to SQL in Mono, so I've been going old school and developing stored procedures for my database interaction. I use ADO.NET for connectivity. Development is painstakingly slow. Whenever I make a change to a stored procedure, I must update fields all across my architecture. I've gotten very lazy in terms of being able to easily delete an entity in Linq to SQL and have my objects updated with new fields. It feels like development is taking 10x as long as it would natively in .NET in Windows. Is there a better architecture I could be using for my database connectivity? While the methodology I'm adhering to is straightforward and works fine, it's simply a slow approach.


what is a good way to show mysql experience?

As always, if this is a duplicate question that I have yet to uncover, please feel free to close or delete it. I'm attempting to get into the programming industry. I've focused mainly on PHP due to how widely it's used, but I have some experience in other languages as well. The thing is, I know SQL syntax quite well, and PHP-wise I don't have much if any problem using either the mysqli interface (if I have to) or PDO. However, I'm a bit stumped as to what to create as a portfolio piece that would be a good showcase of what I can do with SQL. The reason for this is that most frameworks worth their salt include some form of ORM. Most of the grunt work in terms of setting up database queries and so forth is usually both done for you and hidden from you, so that you can focus on your domain logic. I have a _bit_ of experience with CakePHP, which uses its own form of ORM, and am interested in developing this experience further due to it being a fairly popular (and thus likely to show up as a job requirement) framework. Symfony is equally unhelpful AFAIK in that you have the choice of using Propel or Doctrine; I'd love experience with either but I'm not seeing a whole lot of demand for them, at least not for the entry-level jobs I've been looking at. However, I am aware that CodeIgniter will allow you to override its ORM / ActiveRecord capabilities and allow you to write your own SQL queries. I have a relatively simple web app I want to create as a portfolio piece. If I use CakePHP to create it, I wind up with a piece that shows off my CakePHP skills, but not my SQL skills, at least not directly. If I use CI, I can show off my SQL skills directly, but then gain experience in a framework that doesn't appear to be used as often, at least not in industry. The real question comes down to this: if you were (or are) in charge of hiring a new programmer for your team, and your requirements include, for example, MySQL, how would you prefer that the incumbent programmer show his or her expertise in this skill? Would you accept a programmer who only had ORM-based solutions to show you directly but could, if requested, easily whip up a fairly complex SQL query? If not, what would you recommend as a means of demonstrating skill in SQL? I suppose an alternate title for this question could be "What do interviewers expect from entry-level candidates in terms of SQL?"


Silverlight 5 In or Out of Browser?

I'm deciding which I need for my new LOB application. I will list PRO's of each and if I'm wrong - correct me please as this is how I see it. In Browser   1. Users can navigate using URL's. I see it as a BIG thing. Users can share links like app.com/orders/12345   2. With elevated permissions I can do all the same stuff. Use COM, file system, etc.   3. I can open other browser windows with other functionality if multi-window needed. The only difference - I won't have such control over those windows as with out of browser. Out of browser   1. Runs out of browser. Not sure why I care?   2. More problematic to handle updates   3. Yes, there is windows I can open but not modal. So, in-browser separate IE window almost identical Do I miss anything? I tend to keep it in browser but I want to see where I'm limiting myself.


If a story is de-scoped during the iteration then what to do with its estimate/size?

Sometimes we change user story scope to complete it during the iteration. For example, Original story (8 points): As a user i want to save my data as PDF. De-Scoped story: As a user i want to save my **text** data as PDF. Now do i need to decrease the size of the de-scoped story as well? **EDIT** What do you do in such cases and why?


Rails conventions vs. "enterprise" architecture

(The title for this probably isn't as good as it should be, I cannot think of a better one) I am about to revisit a startup idea and my platform of choice is Ruby on Rails. I've also recently started re-reading the book "Enterprise Rails" which suggests that you do **not** follow the Rails default conventions but instead separate out your layers into "physical" and "logical" components. This is the only book I have yet to see where this opinion is expressed; every other Rails book seems to just follow the "convention over configuration" mantra. In short the book suggestions you divide your app/ folder into the following:   * app/models/physical (used for the actual .rb model files)   * app/models/logical (used for web service APIs I believe) and do the same with your controllers and other areas of the app. The book also advises not to use database migrations at all but use raw SQL scripts (and later on makes use of using SQL views and functions) under a separate folder that doesn't adhere to the Rails norm. My question is whether or not I should worry about these things if I am just beginning to develop my application. Obviously the book advises that I do to avoid _possible_ problems down the road, and the .NET developer in me wants to agree, but the Rails developer in me (still an infant) is telling me to just follow the "Rails Way" 100% since I'm still learning the framework and the Ruby language. I wonder how many successful Rails apps actually just follow the norm with all the models in app/models, all the controllers in app/controllers without any further segregation, and how many do some kind of "enterprise-y" architecture?


Off-shore bug fixing

If a prospective employer told you they "outsourced bug fixing because developers hate fixing bugs", What would you think? What might be your concerns?


Most secure method of asynchronous exchange of randomized loot in a strictly offline ARPG

I'm interested in the conceptual (programming language agnostic problem) process of sending a game object to another player of the game in exchange for another game object without a face-to-face online presence of both parties. This should be done so that in theory in game exploitation of inherent bugs of the trading system would not be possible to dupe items or steal items from another player. In this case I am not considering cheaters, (I strictly define cheating as manipulating of in game RAM/saves and NOT exploitation of programming/inherent bugs/flaws) only the ability of users to dupe or steal items from strictly within the game itself. Possible method idea to solve this:   1. Player 1 (P1) and (P2) meet out of game to arrange a trade of in game loot and come to an agreement amongst themselves.   2. Both players go in game to set up the trade by giving their item "to the game" to hold and remain inaccessible for the duration of the trade. In exchange they are given a procedurally generated alphanumeric encryption code (such as pokemon mystery dungeon or similar) specific to themselves and the other player's name and ID number (similar to the mainstream pokemon games)   3. Both players share their codes with each other and enter the opposite code into their game.   4. a confirmation screen appears for both players showing the other player's offer. if a player accepts the offer they are given another code to give to the other person.   5. Both players enter in the other's confirmation code to their game and both players receive their item in game.   6. not sure but may additionally need both players enter in a thank you code to truly confirm both players got their items, but I think that is covered by the confirmation code because if P1 confirms and gets P2's confirm then that means P2 confirmed also. And likewise if P2 confirmed and received P1's confirm then P1 confirmed.  But as I think of it, if P1 accepts and P2 accepts and P1 gives the code but then P2 does not, then P2 is able to get his desired item at the cost of his item and P2 is now a scammer to P1 because P1 was denied his new item, (it vanished) It would cause players to incrementally trade items of lesser worth because they wouldn't stand for losing that great loot they couldn't use but would still be valuable; wasting people's time and discouraging trade. Also a thank you code would add time to the process and not cause any added security. I actually think this is a real world problem of agreements, trading goods, and trust that requires synchronous trade. I think this cannot be solved in a game any more so than in real life. Correct me if I am wrong.


User Stories - How should it be defined for complex changes involving multiple applications

This is one of the definitions that I asw for user stories - _When the time has come for creating user stories, one of the developers (or the product owner in Scrum) gets together with a customer representative. The customer is responsible for formulating the user stories. The developer may use a series of questions to get the customer going, such as asking if some particular functionality is desired, but must be careful not to dominate the idea creation process._ In a large organization there could be multiple lines of business. For a particular line of business , there could be multiple applications (more than 10) that may be involved in fulfilling a business requirement. The requirement to each of these application teams could be provided by a business analyst and the high level solution could be formulated by a solution designer. In scenarios such as these , would a single user story be defined for a specific change request that impacts multiple applications or would different user stories be created for each application? If it is a single user story then would a separate SRS be defined for each impacted application would it need to be associated with the user story defined?


Does a "QA Programmer" style job exist?

Basically a programmer that comes in during the testing phase of a project and once a tester finds a bug, tracks down the cause. I enjoy this investigative process and am generally able to track down the cause of obscure bugs even in code that I have never worked on. I've done something like this internally in companies I've worked for, but I wonder if this is something people do on an independent contractor basis?


How to do TDD for something with many permutations?

When creating a system like an AI, which can take many different paths very quickly, or really any algorithm that has several different inputs, the possible result set can contain a large number of permutations. What approach should one take to use TDD when creating a system that outputs many, many different permutations of results?


Could you describe "GNU General Public License (GPLv2)" in "for Dummies" terms?

I just want to make sure I'm using the right license for my open source API wrapper project for some social networks and also make sure I understand it. Could you just describe the basics of that license? What I can and can't do, etc? Does these things suit the GPLv2 license:   * Open Source'ness   * Ability to use it in your own project   * But also give credit for it on ones website and keep copyright notices at the top of source files   * Have control over it as in if you don't like how someone is using your code, you can report it somewhere after contacting the developer.   * I would also like to make commercial versions and add ads to my project - so exceptions in the license would be noted. * * * Thank you all for your answers and comments. I've gone with the shorter and easier to understand New BSD License (BSD). Thanks anyway.


Is it bad practice for a decorator to break the decoration chain?

I'm currently using decorators to apply various modifications to a template prior to rendering it. I'm unsure about my cache decorator, though, because it is currently able to break the chain of decorators and return a cached object as opposed to the original decorated object.               class Cache : Decorator     {         public String Render()         {             if(templateCache.IsCached('some_template_identifier'))             {                 return templateCache.Get('some_template_identifier');             }             String renderedTemplate = Template.Render();             templateCache.Cache(renderedTemplate);             return renderedTemplate;         }     }      Is this bad practice? Should I _always_ be returning the original decorated object or is it ok to break the flow like this and return a different object?


Implementing RSA into an Android Messaging App

I am implementing RSA encryption on a Android App so that I can send SMS message securely, each phone will have its own public and private key generated by the App. But am stuck deciding the best way to store the keys, my options are:   1. Create a keystore and hold the public and private key in the keystore.   2. Save the public and private key to separate files.   3. Use sharedpreferences to store keys. I was also thinking of encrypting the private key with blowfish if just stored in a file. Can anyone help explain to me which is the most secure option?


Is a small demo a good idea for an interview?

Unfortunately most of my work is internal -- I was toying with the idea of a small web demo to give the company better insight. What do you think?


How should I test my TEST code?

> One of the few things that most software developers agree on is that you > shouldn't rely on code to work correctly unless you test it. If you don't > test it, it may have hidden bugs that are only going to cause you more work > down the road. I understand how to test my normal code, but **how should I test my test code to make sure it can effectively find and report errors when they are present?** I personally have been stupid enough to write erroneous test cases that would pass when they should not have, thus defeating the purpose of my writing tests in the first place. Fortunately, I found and fixed the errors in time, but according to testing mantra it seems like no test suite would be complete without having its own set of tests to make sure it worked. It seems to me that the best way to do this would be to make sure the test fails for buggy code.* If I spend 2 minutes alternately adding bugs to the code and making sure it fails, I should have an acceptable degree of confidence that the tests 'work'. This brings me to my second question: **What are good ways to introduce bugs to make sure that they are caught by the test cases?** Should I just randomly comment out statements, make sure the wrong branch of an `if-else` gets run by negating its condition, and change the execution order of code with side-effects, etc., until I'm satisfied my tests will catch _most_ common bugs? How do professional developers validate that their tests actually do what they're supposed to do? Do they just assume the tests work, or do they take the time to test them as well? If so how do they test the tests? I'm not suggesting the people should spend so much time testing their tests and then testing the tests for their tests that they never actually write the real code, but I've done stupid enough things that I feel like I could benefit from a bit of 'meta-testing', and was curious about the best way to go about it. :D * I could check to see if the test passes when testing 'bug-free' code, but using the code as a spec for the test seem quite backwards...


Is the link between C# programming language and music obvious for English native speaker?

French is my native language and I just realized that the `#` in `C#` is the same character as for the _diese_ music character that raises a note by a half tone. Also, As I made my music elementary class in french, I did not realized that the C was also a musical note, as in french we use _do_. With a little searching, I noticed that this link was made on purpose. So, here is my question: Is that link obvious for English native speaker? Does that link automatically activate some bell as the for the BASIC acronym and a fundamental piece of knowledge, or the SOAP acronym and the cleaning compound.


Is this a good test to check programmers' ability? Any other suggestions?

For hiring new engineers at our company, we strongly believe in testing whether someone can actually write meaningful, usable, reasonable-quality code. Have been trying to devise a test for this for some time. The qualities i am looking for in this test are:   1. It should not take less than 3-4 hours of work which is the allotted time for the test.   2. It should be language and technology independent.   3. It should not be a trick question, if you can code well in your language of choice, you should be able to do it easily with a bit of googling.   4. The exact answer code should not be available from google itself.   5. It should consistently be of the same difficulty level so that we are always comparing apples to apples. At the same time, one candidate walking out of the door after attempting the test should not be able to give any hint or answers to the next candidate. Given all these considerations, the one test we are considering is to have a very large number of URLs pointing to news stories on the web and the idea is to give each candidate a random URL from this large set and ask her to scrape the news story, given a language of her choice, and save it in a structured way (json, xml) such that we have all required fields properly extracted. For example story title, date, author, text etc. Candidates are free to use internet and use whatever help they would otherwise have available when attempting a real programming problem in a job-setting. What does the community think of this way of testing? What biases do you think exist in this test? Also Id love to hear other people testing programmers with similar testing methods. Would also like to hear suggestions for similar/better test questions. EDIT: I realize that the question we devised is not ideal, in fact far from it. So while, your critique is welcome, you should also suggest some questions which are language-neutral, domain-neutral, require non-trivial coding and dont have answers already available on the internet. EDIT: Clearly people think its actually offensive for programmers to call their friends if they are stuck with a problem so i am taking that out from the process. (But, ironically asking someone on stackoverflow is ok)


BitBucket working with multiple developers on same project

I am new to BitBucket. I have my repository. And 2 people working on it me, Admin and another developer with **Read** only access. So in order for him to do changes he forked repository and made changes, uploaded to his repository and created pull request. Now I merged this pull request with my repository. And made few small changes afterwards and also committed them and uploaded to my repository. What would be the next step for him to continue working? Does he have to fork it each time I make changes to my repo? Is there some way for him to sync his with my repository without creating new fork each time?


Is it legal to reuse code in other customers' projects?

I'm working as a independent software developer for mobile applications. A customer asks me to develop a mobile app. So at the moment I'm calculating the time and effort to write an offer for this project. The app itself will only be used for a certain time as it is related to a certain event after that if will be useless. But the base functionality of the app will be reusable for other customers who want to have a similar app for their event. At the moment I'm wondering if it is OK to develop the app for the customer let him pay the development and reuse part of the source code for another customer's app? So what would be the best way for me to deal with this scenario?   * To whom belongs the source code of the app?   * Do I have to give the source code to the customer as they paid for the development?    * If I have to, can I still keep a copy of it and reuse it later?   * Do I have to ask the customer to reuse the code?    * Do I have to work with some kind of licensing model here. And let the first customer only pay a certain part of the development so I can reuse the code without any concerns?  I hope I made my situation clear. I'm looking forward to you answers.


What is the most productive way to handle development-related failures?

We've all been there:   * Your project failed or got cancelled.    * The code you spent days working on got rejected by your team.    * The design pattern you introduced to the team created chaos.    * Everyone ignores your ideas. My question is, what is the most productive way for a programmer to handle development-related failures such as these?


Command handlers and DDD

I have an ASP.NET MVC application, that uses a query service to get data and a command service to send commands. My question is about the command part. If a request comes in, the command service uses a command dispatcher that will route the command to its designated command handler. This command handler validates the comand first and if everything is acceptable, it executes the command. Concrete example: the AddCommentToArticleCommandHandler receives an AddCommentToArticleCommand, which has an ArticleId, CommentText and EmailAddress. First; validation has to occur, like: \- check if article exists \- check if article is not closed \- check if comment text is filled in and between 20 and 500 characters \- check if email address is filled in and has a valid format. I'm wondering where to put this validation? 1/ in the command handler itself. But then, it cannot be reused in other command handlers. 2/ in the domain entity. But as a domain entity doesn't know about repositories or services, it cannot do the needed validation (cannot check whether an article exists). But on the other hand, if the entity doesn't contain logic, than it becomes a simple data container, which is not following DDD principles. 3/ the command handler uses validators, so that validation can be reused in other command handlers. 4/ Other mechanisms? I'm looking for the chain of responsibilities for this particular example and what objects (entities, repositories, ...) play a role in it. Do you have ideas on how you would implement this, starting from the command handler up to the repositories?


Can an 81 digit number generator lead to copyright infringement?

I'm looking to write a program that will generate valid sudoku puzzles. Essentially, a sudoku puzzle is just an 81 digit number. (The blanks are zeroes.) I would then like to use these puzzles in an Android app. Is there any risk to using randomly generated puzzles in an app? If another app has the same puzzle, am I infringing somehow? All computer data is numbers, so theoretically a random number generator could stumble upon a copyrighted work at some point.


Do I need to license my code as GPLv2 if I only read/write to a database and pipe?

I'm writing an API for an open source network monitoring system which is licensed under the GPLv2. I also intend to open source this API but would like to license it under the BSD License.   * I don't re-use or link to any of the code in this system and I don't use any header files.    * I will not be re-distributing any part of the network monitoring code.    * Part of my application will install into the network monitoring installation folders, but not replace, remove or modify any of its files My hook into the system is via:   * existing MySQL databases belonging to the service, my API reads and writes to these databases directly. My concern here would be that whilst I am not copying their SQL statements, there are some complex operations. I've found that in a couple of cases I've arrived at SQL statements or sequences of work that aren't too dissimilar to theirs, it's hard not to.   * I talk to a pipe to issue various commands and submit data directly into the checking engine. This pipe is documented by the author as an official mechanism to communicate with the checking engine. The command pipe uses single line strings to issue commands, the pipe does not return any data, it's "fire and forget".   * There are a number of HTTP CGI scripts in the system from which I can scrape status information. I may use these in a future release. Is this considered "arms length" enough for me to license my code under a different license? i.e. > http://www.gnu.org/licenses/gpl-faq.html#MereAggregation > > However, in many cases you can distribute the GPL-covered software alongside > your proprietary system. To do this validly, you must make sure that the > free and non-free programs communicate at arms length, that they are not > combined in a way that would make them effectively a single program. Would reading and writing rows to a database be considered "exchanging complex internal data structures"? > http://www.gnu.org/licenses/gpl-faq.html#MereAggregation > > By contrast, pipes, sockets and command-line arguments are communication > mechanisms normally used between two separate programs. So when they are > used for communication, the modules normally are separate programs. But if > the semantics of the communication are intimate enough, **exchanging complex > internal data structures** , that too could be a basis to consider the two > parts as combined into a larger program.


How many strings are created in memory when concatenating strings in Java?

I was asked about immutable strings in Java. I was tasked with writing a function that concatenated a number of "a"s to a string. What I wrote:               public String foo(int n) {         String s = "";         for (int i = 0; i < n; i++) {             s = s + "a"         }         return s;     }      I was then asked how many strings this program would generate, assuming garbage collection does not happen. My thoughts for n=3 was   1. ""   2. "a"   3. "a"   4. "aa"   5. "a"   6. "aaa"   7. "a" Essentially 2 strings are created in each iteration of the loop. However, the answer was n2. What strings will be created in memory by this function and why is that way?


How to contact an open-source organisation (e.g. Apache) about a new project?

I've developed some software within my company and we have agreed that the future of the work is to open source it into the public domain. Is there an official contact procedure to contact the Apache Software Foundation, apache.org, to propose a new project? Looking at apache.org I've not been able to find a contact email or enquiry form, so I've resorted to searching lists of people involved in Apache projects and by chance some of them have blogs which may have a contact facility. Seems a bit haphazard way to make an important proposal about a new project, to me. I'm considering Apache as an Open Source Software (OSS) organisation first because   * the project is based on existing Apache libraries and is therefore a practical business problem demonstration applying those libraries, existing on the same open source platform is mutually beneficial - for example library updates may be easier, the project may be easier to find as a related project   * Apache Software License appears to be the most suitable license to use, given that the libraries that the project uses use the same and that ASL seems to be more flexible and pragmatic than GPL and possibly attracts more developers including those with commercial motivation   * Java-based: the project is Java based and Apache is a large, possibly even the largest, independent non-profit open source supporter of Java. I would consider other platforms too and if so would want to know how to contact them. **Background Reading** I've been researching how to Open Source, some notable references so far: (but so far not seen how to contact an OSS organisation once you are nearly ready to publish)   * http://oreilly.com/catalog/9780596517960/toc.html?CMP=ILC-search_spot1&ATT=intel-property-book \- book describes all the major OSS licenses and industry stories   * http://producingoss.com/ \- general advice   * http://stackoverflow.com/questions/3813613/looking-for-case-studies-of-managing-open-sourcing-code-from-a-company \- my post about how others did it   * http://stackoverflow.com/questions/1914104/how-to-license-code-source-but-keep-control-of-it/1914145#1914145 \- I got the accepted answer here


Programming by dictation?

ie. you speak out the code, and someone else across the room types it in Anyone tried this? Obviously the person taking the dictation would need to be a coder too, so you didn't have to explain everything and go into tedious detail (not 'open bracket, new line...' but more like 'create a new class called myParser that takes three arguments, first one is...'). I thought of it because sometimes I'm too easily distracted at my computer. Surrounded by buttons, instant gratification a click away, the world at my fingertips. To get stuff done, I want to get away, write my code on paper. But that would mean losing access to necessary resources, and necessitate tedious typing-up later on. The solution? Dictate. Pros:   * no chance to check reddit, stackexchange, gmail, etc.   * code while you pace the room, lie down, play billiards, whatever   * train your brain to think more abstractedly (have to visualize things if you can't just see the screen)   * skip the tedious details (closing brackets etc.)   * the typist gets to shadow a more experienced programmer and learn how they work   * the typist can provide assistance/suggestions   * external pressure of typist expecting instructions, urging you to stay focussed Cons   * might be too hard   * might not work any better   * rather inefficient use of assisting programmer   * need to find/pay someone to do this


Simple explanation of the Unix sockets

I can search and I've already looked at the wikipedia entry and in some other places, but even though I have some programming experience, I don't really grasp the concept. Can you treat me like a 10 year old and give me a clear explanation on socket communication?


Percentage or Pixel for layouts?

* What will you use for a webpage layout? Percentage or pixels?    * When should one use one over the other?


heuristic for searching through non-perfectly sorted data

Given sorted data, the search solution is obvious. Given unsorted data, sensible options are sort then search or just linear search. This question is about what to do if the data is _somewhat_ sorted, **but cannot be re-organized** (write operations require sector erase, and sectors won't fit in ram). the details: Data records are logged **sequentially with a timestamp**. The timestamp clock however, from time to **time resets to Epoch** for a while before it's synced or it's simply adjusted back due to daylight savings etc. The search result should be the log record with timestamp closest to the time specified. While performing a binary search for record at a particular timestamp, it is possible to land on a patch of discontiguous log data, and pivot the wrong direction. Besides a brute linear method, is there a heuristic we can take advantage of here? e.g. a Simplex Search immune to local minima? **update:** We can assume about 95% of the records are in sorted sequence. about 5% (scattered through the log) are the dirty hiccups. The the beginning of the hiccups _can_ be identified when the timestamp goes backwards in time and **and have an earlier stamp than the beginning of the log**


Unit testing method name standard for overloaded methods

I have read several posts which discuss coding standard for naming the unit test methods for improving readability. I follow this `NameOfMethod_ExpectedBehavior_WhenSomeScenario`, but now I am confused as to how should I continue with this in the face of overloaded methods. There can be several methods with same name but different signatures. Can someone please suggest me how to incorporate overloading in method names? For example: Java Code               class ClassUnderTest{         public int method1(){         }              public int method1(int arg){         }     }      Now I need to test both the methods individually from my test case. I am thinking of some standard that is applicable for this scenario.


Passing parameters to a stored procedure for use in a data reader object

using (SqlConnection con = db.con(user.Authority))     {         string command = "[Dashboard_GetUserPTOAndIncidentTotals] ";         using (SqlCommand cmd = new SqlCommand(command, con))         {             cmd.Parameters.AddWithValue("@UserName", cboIncidentsActiveDirectory.Text.Trim());             // Display the selected users information             con.Open();                  using (SqlDataReader dr = cmd.ExecuteReader())             {                 if (dr.HasRows)                 {                     while (dr.Read())                     {                         nudPTO.Value = Convert.ToDecimal(dr["PTO_REMAINING"]);                         nudIncidents.Value = Convert.ToDecimal(dr["TOTAL_INCIDENTS"]);                     }                 }                 else                 {                     nudPTO.Value = 0;                     nudIncidents.Value = 0;                 }                 dr.Close();             }         }     }      I am writing a business application to help track the remaining PTO time and incidents for our employees, however, I am running into an issue with the parameters of my code. I initially started out with an embedded SQL statement in place of [Dashboard_GetUserPTOAndIncidentTotals], which worked perfectly, however, after finishing the base code I was asked to migrate all application statements to stored procedures on the server side. After this transition I have ran into multiple issues and this is the only one I can't seem to work out. Every time I run this code, it throws this error message "Procedure or function 'Dashboard_GetUserPTOAndIncidentTotals' expects parameter '@UserName', which was not supplied". This error occurs on this line :                using (SqlDataReader dr = cmd.ExecuteReader())      I'm confused because to the best of my knowledge, I am supplying the requested parameter here :               cmd.Parameters.AddWithValue("@UserName", cboIncidentsActiveDirectory.Text.Trim());      Am I just setting this up incorrectly, or does something additional just have to be done to correctly instantiate the datareader object with my stored procedure?


Changing my Sun SCJP certification to an Oracle one?

I hold a Sun SCJP from ten years ago or so. At first it was supposed to be a temporary certification (valid for a few years, I don't remember exactly: all I remember is that I had an expiration date on my certification card) then Sun changed their mind and decided the SCJP was lifetime valid. Another SCJP programmer told me I could change my cert so I contacted Sun (there was a procedure for that that I don't remember either) and received my new SCJP (without any expiration date). Now that Oracle bought Sun I was wondering: can I get somehow a Oracle/Sun SCJP paper/card/badge whatever knowing that I do own a SCJP? If anyone here holding an old SCJP changed it to an Oracle/Sun one (if such a thing exist), I'd be interested to hear what can be done. (btw I'm new here so I cannot create a new tag: maybe someone with more rep could create a Sun tag?)


Ashamed to admit using jQuery?

Something I've noticed over the past few weeks is how many big commercial websites use jQuery combined with lots of plugins - but don't admit it. They will rename the main library to something obscure, as well as the plugins. Quite a few will even remove the comments that contain the MIT/GPL license information. (just noticed today that odeon.co.uk have done exactly this) Why are they doing this? are they abashed by the face that they are using a free and open source library?


Question: **Why might RMI be a sensible option for communication between client and server in a web application?** _So why would RMI be used for communication between client and server in web apps?_


Do we need even more web frameworks in C# now that async await is here

Developing endless frameworks for web application, websites and web services is always great fun. It's one of the richest areas where you have 100 different ways of achieving pretty much the same thing. Even with all this abundance, I've recently managed to find myself missing a web framework in C#. I feel that the new async-await API of C# 5.0 is really going to change the way server-side code is written. Reaching the zen state of full asynchronicity has always been the holy grail of server-side developers. But it always was too complicated and took too much code. Shamefully, 90% of the web frameworks in the world are still blocking. That's why I think node.js became so popular - it offers cheap asynchronicity. But now, with async-await, C# is going to steal the show and become the new "asynchronous wonder child". Goodbye JS (in server-side, don't get pissed off). At least that's the case for me, C# just became sexy. Does this new era call for a new generation of web frameworks? I'm missing a web framework, or more of a web ecosystem in C# that's reminiscent of `node.js` Something like node.cs. It's fundamental principals:   * Promise of full asynchronicity. Every package in the ecosystem **must** offer async-await API. I can't even imagine anymore accessing a DB and blocking when doing it. In addition, the core itself should be built around async interfaces - with flows looking like this.   * Package-based and modular. C# is notorious for having bloated monolithic web frameworks. I want to mix and match. I want a choice between 10 view engines (written by 10 different people), and a choice between 10 routing engines. These things should not be part of the core.   * Lean and concise code. I'm sorry but frameworks in C# never seem agile. Everything is always so overfeatured. Layers and layers of abstractions until you have no idea what's really going on. Don't get me wrong, those huge frameworks are good for many things, just not everything.   * Reduce vendor-lock. I'll be nice to offer hosting alternatives to IIS. Maybe come with its own optional async web server like node. Although IIS should be supported as well. Mono support on Linux is important, with async integrations to nginx and friends. I haven't been able to find an ecosystem with these characteristics. If it existed, it would draw developers towards the great benefits hidden inside the async-await pattern.. that is unique to C# (in production at least). **Edit:** Sorry my question wasn't clear. I'm asking:   1. Are you familiar with an existing solution that fits my requirements?   2. If not, do you think it's something worth writing? Do you find it useful? Would you use it as an alternative to the currently available web frameworks in C#?   3. What critiques and praises do you have for the proposals listed above if I were to create a framework that addresses said proposals.


LIcense Issues Of Publishing A WordPress Theme, Built With Roots Theme, At Themeforest

I want to develop a WordPress theme using Roots theme framework and then sell it on themeforest.net. Roots theme license allows me to sell the theme as per its founder's discussion with some guy on this google group post. It says that the product should have an MIT compatible license. The question is:- If I sell it on themeforest then will it be under compliance with the MIT license? I believe that themeforest has its own 'regular license'. Will the purchaser of the theme have the right to modify my theme's source code and sell it again on themeforest? Note: I don't have much knowledge of the licenses, that's why I'm here. Please don't ask me to read the license because I'm unable to understand their complex English. "INCLUDING BUT NOT LIMITED", "AS IS", "TORT OR OTHERWISE" etc. Can't understand it clearly.


Django development best practices

I have spent some time studying Django and I've done some applications. But I really don't know what is the best approach while developing an application, I mean, there are several options: Make all the models, then all the urls, the views and then make all the templates. Other people recommend using an agile approach, take a use case and go all the way until it's totally functional, and of course there might be other possible recommendations. Personally I feel really attracted by the agile approach, but I don't really know because for example every single model I append to my database would imply to create a new one. To sum up, what is the best approach one should take when developing and application in Django, taking into account all the consequences that it carries?


Is there a database programming language with encapsulation to prevent the injections?

One of things that annoys me about SQL is that it can't think in terms of objects and it's lack of encapsulation makes me constantly have to escape commands to prevent injections. I want a database language that can be polymorphic and secure. I have searched online for non-procedural database programming languages and so far my google search has been unsuccessful. I know in languages like php there are ways to prevent the injections by making the PHP encapsulated well, but not all database programming situations involve embedding the database language in another language. In situations where it's database programming only, is there a database programming language that is object oriented in itself? If not, are they working on one?


Apache License 2.0 - Beginner

I'm building close-source application with some libraries that's using Apache License 2.0. Number 4 point a) of the license stated that:               (a) You must give any other recipients of the Work or Derivative Works a copy of this License;      Does this mean that my application is now under Apache License 2.0 because I included that license to my app? Where should I include this license? In my source code or on the GUI? Thanks.


How to get involved in open-source project? (Android/java programmer)

My question might sound stupid and not suitable for this site, but i dont have any better place to ask then here, so please bear with me. Im a college student that love playing with android. Around last year, i changed my main OS to Ubuntu, and i found its amazing. So, i decided that i want to help developing open-source project. However, ubuntu uses C++ & QML, not java so i cant code for them. Do you know where i can find a good or widely use android open-source project? I know i can find some projects in code.google, but theres too many project. I dont know which one is suitable/good for me. Any help/suggestion is appreciated (im still a college student after all). And if you wondering "why dont i learn c++?", well i think i dont have enough time to learn now because i also have a part-time job as a android developer. Thats why i prever android, or at least java. Thanks for your time


How to teach Delegates

How do you go about teaching Delegates to new programmers? Any examples outside the programming concept that you would use to teach them? For instance, with inheritance, you teach it as follows. Cat is an Animal. Dog is an Animal too. So, we can put the common features that all Animals have in the Animal group (read as class) and then put the specific features that Cats have in the Cat group (read as class). In a similar way (or a different way), how would you teach Delegates?


What efforts you make to stay on the edge of perfect productivity?

May be it is only me, but sometimes I think I spend to refactoring and working with abstractions too much time. My project usually begins with studying some new technology, like MVP, .NET, MVC, WPF and so on.. It's very rarely I stand on something that I've already knew. New things always win the competition in my mind. Then I'm trying to make good inrastructure, dealing with abstractions, interfaces and so on. At the same time I try some little concrete things to make sure I know how this certain piece will done and unfortunately these researches take much time too. And then... I begin to refactor my abstractions, because they already don't meet my actual needs. Looks like it's a bad habit or some hidden attempt to escape from the real challenge. Hidden part of iceberg becomes too huge in comparison of what I'd expected. Looks that one of my part likes to "play programming" which is unacceptable by my other part: produce result! I didn't mention the requirements because in my current project I know exactly what the program should do, even in details. All this gives some result anyway, but too slowly. I definitely know that I must increase my productivity. My mind (when it's clean enough, heh) produces some directions of improvment:   1. Trainings on concentration   2. Become a manager for someone else (I currently work alone)   3. Stop programming and start something else   4. Just work more   5. Move to big city and join professional team   6. Read some books with related ideas   7. Begin to ask such questions :)   8. ... What line I should take at first, or may be there are some other advices? I simply want to know what attempts you make (or would make in my context) to stay on the edge of perfect productivity, and also how detect that it is time do some something else, just for a while. And sorry about such non-specific question, but I really think I overpass something. I'm new to SO btw. Thanks.


Use of Apache 2.0 Licensed K9 Email Android App in Commercial Email App

I want to improve usability of K9 Email client, Make a new UI and implement some additional functionality. This software is Licensed Under Apache 2.0. http://code.google.com/p/k9mail/ https://github.com/obra/k-9 Can I use the whole source code of this app with some modifications to some of classes and make this app a Commercial One? I want some legal Advice. If I succeed in this then I have wish to share revenue with original developer of this app. Please give me some pointers on this. I have read about Apache 2.0 license. I am not clear about this line.. "provide clear attribution to The Apache Software Foundation for any distributions that include Apache software" From Apache FAQ http://www.apache.org/foundation/licence-FAQ.html And Clause 4 D from this link http://www.apache.org/licenses/LICENSE-2.0 Please Provide your Inputs on this..


How to invoke anonymous functions in testing?

Below is Java code. I need to cover the below function. I searched for many websites, but I still have no ideas. Is there any methods to cover the override anonymous classes?                 public static void addEnterListener(Text text, final String methodName, final Object callee) {         text.addKeyListener(new KeyListener() {         @Override         public void keyReleased(KeyEvent arg0) {         if (arg0.keyCode == '\r') {           try {             Method method = callee.getClass().getMethod(methodName, KeyEvent.class);             method.invoke(callee, arg0);           } catch (Exception e) {e.printStackTrace();}         }       }            @Override       public void keyPressed(KeyEvent arg0) {        }     });     }


Prepared statement alternatives for this middle-man program?

I have an program that is using a prepared statement to connect and write to a database working nicely, and now need to create a middle-man program to insert between this program and the database. This middle-man program will actually write to multiple databases and handle any errors and connection issues. I would like advice as to how to replicate the prepared statements such as to create minimal impact to the existing program, however I am not sure where to start. I have thought about creating a "SQL statement class" that mimics the prepared statement, only that seems silly. The existing program is in Java, although it's going to be networked anyways so I would be open to writing it in just about anything that would make sense. The databases are currently MySQL, although I would like to be open to changing the database type in the future. My main question is what should the interface for this program look like, and does doing this even make sense? A distributed DB would be the ideal solution, but they seem overly complex and expensive for my needs. I am hoping to replicate the main functionality of a distributed DB via this middle-man. I am not too familiar with sql-based servers distributing data (or database in general...) - perhaps I am fighting an uphill battle by trying to solve it via programming, but I would like to make an attempt at least.


Licenses that allows distributing an application without the source

Let's say I'm planning to sell a _.NET_ application in my website. If I need to use a library `A` (a reference to the compiled assembly, not the source code)... **Under which license could be`A` so I can do this?**


Understanding unit tests/TDD for ASP.NET webforms

I'm the lead programmer at a small software firm (currently 4 developers including myself), we develop bespoke ASP.NET WebForms applications for businesses. I joined there in 2010 just after graduation, so it was my first real job. After more senior programmers left, I was promoted to lead and we hired a bunch of junior devs for me to mentor. My issue is that currently, we have a huge amount of work from delayed projects (some 2-3 years delayed) so our development is very rushed and testing is left to the very last minute, and our releases often go out with obvious bugs we should have picked up. This really brings down morale and gets everyone very stressed, including myself. We have no testing framework at all, or barely even any organisation to what we're meant to be doing. We never use unit tests, and all testing is manual and very laborious. This sort of methodology is all I've been exposed to since becoming a programmer, but I'm fast learning that this is not how a software house should work. I've been trying to familiarise myself with TDD and Unit testing, but it's all extremely foreign to me and I'm having a hard time visualising how we could actually use these in our applications. Most of the logic inside our apps are in the code behind for each page (something I am now pushing to get away from) and from what I've read this makes testing much more difficult. Does anyone have any advice, or know of any good tutorials, that'll help us get up to scratch with TDD? We have a lot of other issues, including not using SVN efficiently, having a very basic HelpDesk for our bugs and giving our team fairly vague specs. Again these are things that I want to learn myself, but I'm needing to spend a lot of time actually teaching myself all of this. So if anyone has any advice for this I'd appreciate it but our testing is the most crucial thing right now.


How to make the switch to C++11?

I've been programming in C++ for a while now, but mostly things centered around the low-level features of C++. By that I mean mostly working with pointers and raw arrays. I think this behavior is known as using C++ as C with classes. Despite this, I only having tried C recently for the first time. I was pleasantly surprised how languages like C# and Java hide these details away in convenient standard library classes like Dictionaries and Lists. I'm aware that the C++ standard library has many containers like vectors, maps and strings as well and C++11 only adds to this by having std:: array and ranged loops. How do I best learn to make use of these modern language features and which are suitable for which moments? Is it correct that software engineering in C++ nowadays is mostly free of manual memory management? Lastly, which compiler should I use to make the most of the new standard? Visual Studio has excellent debugging tools, but even VS2012 seems to have terrible C++11 support.


How to include conditions in UML sequence diagrams?

I like to draw a UML sequence diagram to display the sequence of actions and interactions of different parts of my system (I think they called actors). However, I need to include `if then else` statements here. Do I do something wrong? Can I use conditional if statements in my UML sequence diagram? How?


What are the reasons to create UIView subclass?

I've noticed that there are a lot of UIView subclasses in my legacy project. Mostly the only reason of such a subclass is to split bigger view into custom subviews and provide layout for its subviews and delegation of UIButtons actions through the view delegate protocol. So I'm wondering, is it a correct design?


Industry attitude towards what is called an "undergraduate Master's"

I'm enrolled in an undergraduate Master's degree. It will be my first degree - 4 years course - but it will be called Master's. I will not get any intermediate degree. It's from one of the most prestigious institutes in India ranked in Top 20 in Asia for technology and science by Asia Week. How does the industry treat this? On par with other MS candidates or on par with other BS candidates?


What are CPU registers?

This question has been bothering me for some time now and today I figured I would Google it. I've read some stuff about it and it seemed very similar to what I've always known as processor cache. Is there a difference between the two or am I right when I think they are the same? Is a register actually required to be inside a CPU for it to work? According to Wikipedia a register is a place in the CPU where memory can be quickly accessed and modified before being sent back to the RAM. Did I understand this wrong or are the cache and register actually the same?


How to charge customers for AGPL-3 based solution?

If I talk about openERP its and source (AGPL-3), I have studied it, but can't find some question e.g 1: we have developed a School Management System using openERP Version 7.0, as according to my understanding, we cannot sale it to any customer as it appears to be free like other modules of openERP. So I should charge my client for my services? what should be the criteria for that? OR still there is a chance that I can sell my newly developed module?


Is catching general exceptions really a bad thing?

I typically agree with most code analysis warnings, and I try to adhere to them. However, I'm having a harder time with this one: > CA1031: Do not catch general exception types I understand the rationale for this rule. But, in practice, if I want to take the same action regardless of the exception thrown, why would I handle each one specifically? Furthermore, if I handle specific exceptions, what if the code I'm calling changes to throw a new exception in the future? Now I have to change my code to handle that new exception. Whereas if I simply caught `Exception` my code doesn't have to change. For example, if Foo calls Bar, and Foo needs to stop processing regardless of the type of exception thrown by Bar, is there any advantage in being specific about the type of exception I'm catching? Maybe a better example:               public void Foo()     {         // Some logic here.         LogUtility.Log("some message");     }          public static void Log()     {         try         {             // Actual logging here.         }         catch (Exception ex)         {             // Eat it. Logging failures shouldn't stop us from processing.         }     }      If you don't catch a general exception here, then you have to catch every type of exception possible. Patrick has a good point that `OutOfMemoryException` shouldn't be dealt with this way. So what if I want to ignore every exception but `OutOfMemoryException`?


Content of AUTHORS file

GNU recommends making an `AUTHORS` file to list the authors and contributors of a program. But how many "levels" of authors and contributors should the file contain? E.g. if I write a program `foo` that actively use some library, should I include the authors of that library in the `AUTHORS` file? It seems that the answer is "yes," because total code of `foo` contains code from the library. But if yes, that means I should also include the authors of all other libraries, including standard libraries of the compiler, authors of the compiler and other tools for producing final executable code, authors of the OS... When I should stop?


Pros and Cons of RESTful architecture

The most common discussion I've seen regarding the pros and cons of REST tends to frame that discussion relative to SOAP. I have no experience in either. I am currently faced with a decision which my lack of experience is making hard for me to evaluate. I am beginning to develop an application that has several components - primarily an administrative aspect that allows the owner to administer several sites - and a public facing user interface that allows the user to interact with data held on the host. I need to evaluate the implications of allowing the latter part to be hosted anywhere and communicate with the former via a RESTful architecture - or demanding that both components reside on the same host. What are the key implications of developing RESTful architecture, particularly with regards to it's capacity in the following areas: 1: Security 2: Performance 3: Interface complexity EDIT: Looking at some of the answers to this question - I should clarify. I'm not looking for a comparison to SOAP - rather an overview of REST applications vs applications where all components reside on one host. (thanks for those answers though!)


What should be done when upgrading compiler introduces bug in existing project?

We've 4 embedded firmware at hand. Two of them are released, are in maintenance phase. Other two are going to be released. The released product uses OKI 411 micro, where as yet to be released products are on OKI 431 micro. So far we've been compiling the code using OKI's CCU8 3.08 compiler. It supports both 411 and 431 hardware. Recently they've updated the compiler to 3.10 and we started using it for all the products. Suddenly we've found that 3.10 is producing unexpected behaviour in one 431 based project. It is related to compiler optimization. So the release build exhibited a bug and two whole days were wasted to figure it out that the firmware works fine if compiled with 3.08 version of the compiler. Note that the other 431 based product didn't show any issue. So we've decided to abandon the latest compiler for all projects and use the previous one. What steps should be taken when this kind of situation occurs? Also when upgrading compiler, what should be done to ensure that it will not break any build?


Model-view-presenters and user-interactions involving separate dialogs

I have a UI form written using model-view-presenter that has, among other things, a listbox containing a number of different domain objects. The form also contains an add/update button which pulls up a dialog allowing the user to add/update a domain object. The domain-object form is general and is used to gather basic information, like the name of the object. It's essentially a humble dialog that collects information and dispatches an event with said information when the form is closed successfully allowing the domain object to be added or updated accordingly. To clarify a bit more, I'm unsure in a number of different areas:   * Is there a standard interaction model or are there standard interaction patterns for use between UIs when using MVP?   * Should the responsibility for displaying any required forms or dialogs lie with the presenter, view, or neither?   * Does the fact that I'm using a humble dialog for the information gathering violate "tell, don't ask" and make things harder than needed?   * Is the answer UI specific and, if so, what questions would guide me to a good answer? Other notes:   * It feels like the responsibility for displaying required forms and dialogs lies more with the view than with the presenter, as other views could use alternative means to gather that information -- the presenter only needs be appropriately alerted.   * I'm more interested in the related patterns and practices than in technical details.   * In the spirit of low coupling, I typically use message passing between forms and components.


How to be a responsible early adopter?

A disconcertingly high number of new technologies/paradigms are overhyped (as is evident from replies to this question). Combine this with the fact that being early adopter is inherently risky. This makes evaluation of technology before adoption critical. So how exactly early adopters among you go about it. I can think of following general criteria.   1. For early adoption technology must address previously unaddressed issue and/or   2. For acceptance beyond early adoption technology should address performance   3. One indicator that something is **not right** is when there is too much of jargon for technology which is either irrelevant or there is no evidence to back it up What is your opinion. Update: 4\. BTW, the biggest reason to **fear** technology is when it is imposed by the tech-unaware management based entirely on number of buzzwords.


How to create a feature map?

I have a big side project that I do now for 3 years. It has a lot of extra small tools to help me do tasks. Most of those tools are so old that I forgot what I have there. How to create a feature map to have easy reminder of what is possible ? Is there some special UML diagram notation for it? How to do it? I think graphic version would be better than a readme text file.


How to license my closed source & freeware (donation ware) - using creative commons?

After doing a bit of research about licensing my free software, I reached this: Attribution-NonCommercial-NoDerivs 3.0 Unported - http://creativecommons.org/licenses/by-nc-nd/3.0/ * * * how do I include it in my software or website ? * * * going here: https://creativecommons.org/choose/ I see the text that I should include: > This work is licensed under the Creative Commons Attribution-NonCommercial- > NoDerivs 3.0 Unported License. To view a copy of this license, visit > http://creativecommons.org/licenses/by-nc-nd/3.0/.


How to decide : Phone App or Web App

From your real life experience & executed work. How to choose between starting a project as a Phone App or a Web App ? From what I've read, it is a matter of : the need vs time & $ cash to solve it. I am not sure for the long term & with a limited budget what path to take. My main concerns and comparisons : Phone App   * locked in on a given platform   * specific to each device   * specific dev skills needed for each device   * cost of programming    * cost of distributing   * limited distribution channel  Web App   * open platform    * multiple devices friendlier    * overlapping dev skills    * cost of programming    * no distribution cost   * no distribution channel What are your Pros / Cons


Java Certified Programmers: Was there anything in particular that caught you off guard on the Certification Exam?

I am about to take the Java 6 SE Certification Exam on Thursday. Just wondering if any of you found anything unexpected on these exams or things you wished you had paid more attention on. Any general tips, tricks, or warnings, would be greatly appreciated. (Please don't waste time trying to tell me that I am wasting my time/money, because I am just doing this so that I can get an instant A in my Java class.) Thanks!


How are line/column position data dealt with in parser combinator libraries?

I'm building a parser using a parser combinator library. I need to keep track of where AST nodes started and ended in the textual input -- line and column numbers. How is this problem approached and/or what are strategies for dealing with it? **Clarification:** I'm asking about how/when/where the line and column data is calculated. Two possible alternatives are 1) as an extra piece of state ala monads and monad transformers, that is updated whenever a token (character) is consumed, and 2) preprocessing the token stream to add the line/column to each one. Drawbacks: 1) would result in the same work being done multiple times if there's backtracking. 2) would increase memory usage a lot if the entire input stream were done up-front.


Is "White-Board-Coding" inappropriate during interviews?

This is a somewhat subjective quesiton but I'd love to hear feedback/opinions from either interviewers/interviewees on the topic. We split our technical part into 4 parts. Write Code, Read & Analyse Code, Design Session & Code on the white board. For the last part what we ask interviewees to do is write a small code snippet (4-5 lines) on the whiteboard and explain as they go through it. Let me be clear the purpose is not to catch people out. We're not looking for perfect syntax. Hell it can even be pseudo-code. but the point is to give them a very simple problem and see if their brain can communicate the solution to us. By simple problems I mean "Reverse a string", "FizzBuzz" etc... **EDIT** > Just with regards the comment about Pseudo-Code. We always ask for an > explicit language first. We;re a .NET C# house. we've only said "pseudo- > code" where someone has been blanking/really struggling with the code. My question is **"Is it innappropriate / unreasonable to expect a programmer to write a code snippet on a whiteboard during an interview ?"**


"Opportunity" to take over maintenance of a small internal website. What should I do?

I have been offered an `"opportunity"` to take over maintenance of a small internal website run by my group that provides information about schedules and photos of events the groups done. My manager sent me the link to the site and I checked it out. The site looked clean and neat but loaded in ~5 seconds. I thought this was a little long considering the site really didn't contain a lot of content. This prompted me to take a look under the hood at the pages source code. To my horror it'd been totally hacked together using **nested tables**! I'm new so I really can't say no to this `"opportunity"` so what should I do with it? Every fiber of my being feels that the only correct thing to do is overhaul the site using CSS, Div's, Span's and any other appropriate tags that a sane/good web developer would used to begin with instead of depending on the render incentive magic of tables. But I'd like to ask programmers with more experienced then me, who have been in this situation. What should I do? Is my only realistic option to leave the horror as is and only adjusting the content as requested? I'm really torn between good development and the corporate reality I'm part of. Is there some kind of middle ground where things can be made better even if they're not perfect? Thanks ahead of time. **Edit:** I've been looking into this a little deeper and noticed an extension type that rendered as HTML but was actually ".cfm". After looking into it I found out this was a ColdFusion file. Which is apparently an Adobe WYSIWIG program which must have been used by my predecessor to create this site. This means maintenance will be trivial once I get a copy of ColdFusion. I will probably still need to do things like create thumb nails and move some of the content on the home page elsewhere to improve load times. I doubt I can go much further in optimizing the site past this without throwing out ColdFusion. I am very grateful for all the good advice and will keep it in mind for future "Opportunities".


Why was Rails written in Ruby?

I know PHP and Ruby. Using a PHP Rails clone (not out of choice), called Symfony, (which is apparently the best PHP framework), I notice that it's a clone of Rails. I think Symfony is stupid and that (SensioLabs is a clever business) because Rails already exists. Apart from open-source projects gaining money, I don't understand why people are making Rails clones in PHP, when Rails already exists. Why not use Rails? Surely DHH coded Rails with Ruby for a reason. Using Symfony, I notice that something doesn't quite feel right but I don't know what it is. I learnt Rails through a crap Sitepoint ebook and forgot it, so now I'm learning it through the PragProg ebook and I love that ebook. I don't fully know Rails, but I understand how it works (thanks to Symfony). I would love finish getting through the whole ebook so I can make 2 Rails apps. I remember Rails being more fun than Symfony using the Sitepoint ebook that I couldn't finish, and that had nothing to do with Ruby's pretty syntax.   1. Why is Rails coded in Ruby?   2. What is it about PHP Rails clones, that don't feel right?   3. What is it that Rails is doing, that Rails clones aren't doing?


is it allowed to create a app with overscroll feature?

As Apple won lawsuits against Motorola and Samsung with the so called `overscroll patent`, I am asking myself what the legal consequences of releasing an application with such a feature are? I think if one releases the app in IOS it would be okay, but what happens in Android or Windows? Am I getting sued? What happens if I am writing an app for the browser? Isn't this overscroll patent a design patent? If this is true, all apps that use overscrolling and not written by Apple, would be illegal. Very confusing. Can anyone explain is?


How does Python's handling of line-breaks differ from JavaScript's automatic semicolons?

Javascript has a feature called Automatic Semicolon Insertion where basically if the parser encounters an invalid token, and the last token before that was a line break, then the parser will insert a semicolon where the linebreak is. This enables you to basically write all your javascript code without semicolons, but you have to be aware of some edge cases, mostly if you have a return keyword and then the value you want to return on a new line.               function test(){         // This will return 'undefined', because return is a valid statement         // and  "john" is a valid statement on its own.         return                "john"     }      Because of these gotchas there are dozens of articles with titles like 'Automatic semicolon insertion is Evil', 'Always use semicolons in Javascript' etc. But in Python no one ever uses semicolons and it has exactly the same gotchas.               def test():         # This will return 'undefined', because return is a valid statement         # and  "john" is a valid statement on its own.         return          "john"      Works exactly the same, and yet no-one is deadly afraid of Pythons behaviour. I think the cases where the javascript behaves badly are few enough that you should be able to avoid them easily. Return + value on a new line? Do people really do that a lot? Any opinions? Do you use semicolons in javascript and why?


What are the licensing issues involved in the Oracle/Apache java dispute?

I've just started following with interest the soap opera involving Oracle's acquisition of Java and the detriment of goodwill it seems to have generated in the open source community. Specifically, I'm now trying to get my head around the implications of Oracle's decision to refuse Apache an open source license for Harmony. My questions: 1) What is Harmony anyway? Their website states "Apache Harmony software is a modular Java runtime with class libraries and associated tools". How is this different than J2SE or J2EE? Or is Harmony akin to Andriod? 2) The crux of this issue is around the Java Technology Compatibility Kit (or TCK) which certifies that your implementation adheres to the JSR specifications. If I understand correctly, Oracle refuse to offer free or open source license access to the TCK, denying projects like Harmony from being released as open source. Why is this such a big deal for Apache? E.g. why can't (or don't) they release Harmony under a restricted license? 3) From this site is the following quote: > It looks like Oracle’s plan is to restrict deployments of Java > implementations in certain markets, particularly on mobile platforms, so > that it can monetize its own Java offering in those markets without any > competition. Presumably anything Oracle produced would be subject to the same restrictions it is imposing on others with respect to end-technology licensing, so how could they get a leg up on the competition? While no doubt distateful, wouldn't other competitors such as Google or Apache be able to release competing platforms under the same license as Oracle?


Should the build drive your tags or should the tags drive the build?

Our current method of creating a product release is to tag all of our component repositories with the next appropriate version and then modify a master build script with these new version numbers for each component. The master build script will then be run and it will perform a SCM checkout of each component, then modify the AssemblyInfo.cs file so that the compiled .exe (or .dll) has the correct version number, and then compile the component. All of these components are then coalesced into a product release which is "versioned" with a pure marketing decided number. So our process falls under the "tags drive the build" description, but I am not certain that is the best method. Specifically, where I see this failing us is if we were to integrate our release build into the CI process, it seems like it would be backwards. Not just that, but where in a typical release-management process does the decision for the new component version numbers come in? Someone has to decide when component A goes from 2.1.4 to 3.0.0 and if library B should change from 6.3.2 to 6.3.3 or 6.4.0. Where are these version numbers stored and at what stage are they decided? Currently, we make these decisions at the "last moment" and they are stored in the master build script. The master build script itself is versioned and is tagged with the "marketing" version number.


Contractor - Acceptable Payment Terms?

I'm wondering whether or not I've done the right thing as a contractor. Basically I'm in to my 3rd month, and my current client messed up the payment in the first month, and I just found out that they are again late in paying me for my 2nd month. It wouldn't be so bad if I wasn't in a bit of a financial situation due to this being my first contract experience. But as a matter of principal, I walked out on them and will be telling them that I will not be going back in until they resolve the pay. Part of me feels as though this was not a very professional thing to do, but I also don't feel that it was very professional for them to mess my payments up, twice in a row. Did I make the right decision? I still want to work for these guys and enjoy the job, but I have a life to attend to that requires finances and I can't afford to keep getting messed up with pay like this. I attempted to phrase the question to be oriented around contractors behaviour around clients that mis-treat them, and as some of the answers that have been posted so far, it's a good discussion. The answers coming in are great around different subjective situations. Update: In answer to some of the responses, the set-up is Me -> Umbrella Company -> Client. I am an employee of the Umbrella Company who's terms are that I do not get paid unless the client paid up. Thus, when I found out that the client was going to be late paying the Umbrella company, I was quite upset. Also, I do believe that in THIS instance, it was a bad move to have simply walked out. The most professional way to handle it would have been to have made my issues known to my immediate manager and then let him resolve it, instead, his boss and others found out way before him and he was left with crap to deal with, with no chance of handling it before it got out of control. If I was still unhappy with their solution, then I could of told the Umbrella Company that I wasn't happy and was prepared to walk out, which then they could of advised me in a more professional way what my options were. Later which I found out, there were lots of other more professional ways of handling this. However, I've not contracted for long and had a very emotional response to the situation that I've not been in before. I'm positive that a more professional and mature response would have been anything but simply walking out, creating a difficult situation for my boss and now other people in the company and myself. Absolutely great answers so far. Thank you all for your experienced advice.


Is SQL important if I know ORM frameworks well?

I don't have any serious experience in SQL and I even hate to write SQL instead of LINQ. I am happy enough with ORMs. From the employers and sector view point, is it important to know SQL? Do I have to master on it? Are companies that prefer pure SQL over ORM frameworks a "dinosaur" in the programming world?


Tips for going from personal projects to enterprise scale projects

I wanted to know if anyone had any tips for transitioning from small personal projects and coursework, to a large enterprise scale project? Im in my second year at university and have attained a placement with a large tech company, to work on a pretty large project, I'm just a little apprehensive about 'finding my way around' such a large project.


What steps can I take to avoid character encoding issues in a web application?

In previous web applications I've built, I've had issues with users entering exotic characters into forms which get stored strangely in the database, and sometimes appear different or double-encoded when retrieved from the database and displayed back in the browser. I'm starting a new project now, and I want to prevent these issues right from the start. What I'm looking for is a checklist of things I can do to prevent character encoding issues such as these, no matter what users enter into forms. If I set my database tables to UTF-8, and set all of my web pages to assume content is UTF-8, is this enough? Will some characters still appear differently than the user entered them? Should I do some validation on the client side that doesn't let users enter in certain characters?


Cyclomatic complexity with two IFs - why it is 3?

I have read an article with following example:               void func()     {     if (condition1)     a = a + 1;     if (condition2)     a = a - 1;     }      It says the CC is 3 as there are three possible paths. How come? Why not 4? I Would expect TRUE,TRUE; FALSE,FALSE; TRUE, FALSE and FALSE, TRUE. Does not matter what the statements are. CC=Ifs-EndPoints+2. It is always 3 for 2 IFs and one ending..


Parser and interpreter knowledge as a way to gauge programmer ability

This is only anecdotal evidence but from my past encounters with programmers at various workplaces the programmers that understand the fundamentals of parsing and interpreting seem to be overall better programmers. They also tend to be less religious about their tools. My subjective experience indicates they tend to write better code as well. I've mostly worked with application programmers and I know this is a very limited sub-discipline of programming in general so take my limited experience for what it is and nothing more. What are some other foundational components of CS that tend to be correlated with programming skill and ability? I'm assuming some basic understanding of basic data structures so that's a given.


What is the best practice for reading a large number of custom settings from a text file?

So I have been looking through some code I wrote a few years ago for an economic simulation program. Each simulation has a large number of settings that can be saved to a file and later loaded back into the program to re-run the same/similar simulation. Some of the settings are optional or depend on what is being simulated. The code to read back the parameters is basically one very large switch statement (with a few nested switch statements). I was wondering if there is a better way to handle this situation. One line of the settings file might look like this:               #RA:1,MT:DiscriminatoryPriceKDoubleAuction,OF:Demo Output.csv,QM:100,NT:5000,KP:0.5 //continues...      And some of the code that would read that line:               switch( Character.toUpperCase( s.charAt(0) ) )     {         case 'R':              randSeed = Integer.valueOf( s.substring(3).trim() );              break;         case 'M':               marketType = s.substring(3).trim();               System.err.println("MarketType: " + marketType);               break;         case 'O':               outputFileName = s.substring(3).trim() ;               break;         case 'Q':               quantityOfMarkets = Integer.valueOf( s.substring(3).trim() );               break;         case 'N':               maxTradesPerRound = Integer.valueOf( s.substring(3).trim() );               break;         case 'K':               kParameter = Float.valueOf( s.substring(3).trim() );               break;      // continues...     }