My boss has a bad case of "Not Invented Here"

My department specializes in converting customer data into our database schema so that they can use our software. Right now, we have C# applications that take an `IDataReader` (99% of the time it is a `SqlDataReader`), perform some cleaning and mapping, insert it into a `DataRow` object, and then use a `SqlBulkCopy` to insert it in to our database. Sometimes (especially when the source database contains images as `varbinary` objects), this process can really bog down with a SQL transfer from the server to the app to just then turn right around and go back to the server. I feel that if we re-wrote some of the conversions as SSIS packages it could speed things up a lot. However the biggest stonewall I keep running into is when my boss, in Not Invented Here fashion, pushes back and says "What if Microsoft drops support for SSIS? We will have all this obsolete code and we will be screwed." This is not the first time that I have hit a "What if they remove that feature...?" answer from my boss. I don't have the time to write the conversion the old way, self-teach myself SSIS, and also write it the new way to demonstrate/test the benefits (None of us have used SSIS so there would be a period where we would have to learn how to use it). What should I do in this situation? Stop pushing the new technology? Wait till he leaves the department (I am the 2nd most Sr. person in the department after him, but it could be years before he quits/retires)? Find a new way of getting him to stop being afraid of 3rd party tools?


Architecture change from using disk to RAM to read and write key/value pairs coming over a network

A WebApp writes a stream of data coming over a network to disk as key/value pair and then reads & send it over network again after few milliseconds in 99% of case. In 1% of cases write/read can be few hours to days apart (really don't know). Latency is strict "no" in the app and we have to serve 100% of customers therefore I am planning to put data into RAM and later read and send it over network and only write to disk if the data is not read from RAM within a certain prefixed interval. What could be possible solution to this problem? P.S - Memcached looks like a good solution for using RAM instead of disk but Can memcached read/write of disk after time_to_live? I also looking at Couchbase but I don't want to write to disk in all cases as 99% write/read happens in the matter of milliseconds. Is it possible that after time_to_die Memcached could write the key/value to Couchbase instead of removing it from RAM and read it on demand? **[Edit 1]** After spending last few trying to explore various options. The following looks like a possible solution   1. Write the data stream simultaneously to the RAM (using Memcached) and disk using (GlusterFS).   2. In case the data is demanded by the application layer check it first in the RAM (Memcached) if it return the data ok, if it does not check the data on disk GlusterFS.   3. Remove data stream from RAM if data is demanded by application or when time_to_live is reached whichever is earlier. Suggestion most welcome.


Css design skills

I have seen this article: **CSS3 Loading elements** at HTML5 and CSS3 Tutorials pages. How did someone made this calculations? what angle, how much space, how much rotation to give? If I do it with hand, starting number one, I fear it takes too long as a process to complete. Is there some tool, or some trick that do this or is it based on some technique that I am unaware somehow? [EDIT] I am trying to tweak the width and height of this CSS, in order to make it smaller, and is broken. It seems to be calculated as is and you can't touch it.


Are there any surveys regarding Scrum efficiency?

Years passed since Scrum had been widely adopted in software world. I’m wondering if there is any efficiency survey done by more or less independent people/institutes. Obviously scrums gurus who travel around the globe giving lectures and training always find numbers of excellent showcases, however I’d rather listen someone who doesn’t sell Scrum. By efficiency I mean total productivity (delivered value/cost), but not some internal characteristics like communications inside teams and so on. Update based on discussion in comments: One of the ways to do such survey/analysis could be based on comparison of similar projects developed with Scrum and without Scrum. I believe even 10 years ago there were projects similar to some current. Of course, it does not make sense if applied technologies are completely different, so these projects have to be implemented on same/similar technology.


Best practice on if/return

I want to know what is considered better way of returning when I have `if` statement. Example 1:               public bool MyFunction()     {        // Get some string for this example        string myString = GetString();             if (myString == null)        {           return false;        }        else        {           myString = "Name " + myString;           // Do something more here...           return true;        }     }      Example 2:               public bool MyFunction()     {        // Get some string for this example        string myString = GetString();             if (myString == null)        {           return false;        }             myString = "Name " + myString;        // Do something more here...        return true;     }      As you can see in both examples function will return `true/false` but is it a good idea to put `else` statement like in first example or it is better to not put it?


Naming convention for associative entity

When designing Many-to-Many relationship on a database, we need to put another table in the middle so it become 3 tables with 1-to-many relationship. Wikipedia told me that it's called associative entity I always have problem naming these kind of tables. Is there any convention for them? or how do you name these tables?


A software architecture document should present the technology used?

When writing a software architecture document, should we present the technology used and how it connects to the system qualities we want achieve? For example, we chose .NET because arg1, arg2 .. My feeling is NO, architecture should be stable in change; but the concrete realization of some modules can change in respect to the technology used.


Primes and multi-threading

I use to compute primes using linear code which took a long time. As I've an 8 cores processor I thought about multi-threading. At first I use to put a huge number of int in a vector then share the vector between the threads which takeout each number which is not a prime. The first thread processed the 1st/ _nthread_ part, the second processed the 2nd/ _nthread_ and so on. Which leads me to a resource issue due to concurrent access. Then I tried to split the vector in _nthread_ vectors to give one vector to each thread, removing concurrent access issue. But I'm not convinced that it's the best way to do it since processing the primes from 1 to 10 000 is faster than processing primes form 10 001 to 20 000.   * Is there a better way to take profit of the multi-threading ?   * If no, what is the best way to split vectors so the thread would take the same time ?


Trying to get first software job...Having tremendous difficulty (BS degree from top state school)

I have years of Java coding experience, but no apps or code samples of my own. 1)Will an Android/iOS app help me get into Enterprise Java work, or because the fields are so different will it be irrelevant? 2)If (1) is irrelevant, what else can I do to avoid becoming a front end(HTML/CSS) web developer/designer. Thank you


Unit Tests work but there are still bugs?

**Brief History** I am new to Automated Unit Testing and Mocking objects world; previously we used to do Unit Testing (including Integration Testing and we mistakenly referred that as Unit Testing) manually, but now ~~we have planned to change all of that to~~ I am pushing our organization to do Automated Unit Testing. **Problem is:** I have a component for which I have written unit Tests (note: I am not using any TDD here, code is written first and then Unit Tests are written) covering each and every branch(if/ else or loops) of code. If I run the Unit tests suite it says that every method works as expected. That's good; but when I try to traverse the entire flow, I see there are many bugs( missing method) that should have been added. Is there a way to check this automatically? **Update** As per the below Answers from KeithS and Schleis, it seems that I need Functional tests (or integration tests). Are there some useful links on automated functional tests? I tried it on Google but they are all showing generic results talking about manual testing.


How to become an expert in C++

I have some experience in Java programming and enterprise application development. I have done OOP, data structures in C++ for my undergraduate studies. But I couldn't touch C++ for years. Now I am interested in C++ again and I would like to polish my C++ knowledge and become an expert in C++ . How do I start my journey in C++ again? In this journey would like to learn some advanced concepts in C++ like network programming, distributed computing,.. etc.


Which child process will inherit threads of parent process?

What happens when one process have child threads and child process , will child process inherit all child threads of parent process.? Assume OS is Linux . Let it be Java Threading model.


Should multi-threading be used for tasks which does not involve IO operation?

I was reading a book on OS and got confused between different terminologies. I hope i will get my doubt cleared here. These questions might be very basic for some experts, but i find this platform best suitable for such clarifications. Processes are run by CPU and this whole operation is managed by OS. For Single core CPU, at any instant only one process will be running. CPU saves the state of a process to Process Control Block and starts running another process which was waiting and this switching is so fast that it feels like all processes are running simultaneously. Need of different threads in a process was felt to get more fine-grained control over process , that means if process is waiting because of some I/O bound operation then even if this process is selected by CPU, it will not do anything. So, if multiple threads are running under one process, then if one thread takes care of I/O activity , other threads can do some real computation, provided this process is selected by CPU. Here are my questions: Is Multi-threading effective only if task involved I/O activity? Why is Multi-threading preferred over Multi-processing ? (is it because threads will share same memory space? ) Why Multi-core processors are better for multi-threading? (I think they will be better even if you don't use multi-threading, why so excitement in name of multi-threading?). And anyway threads in different processes will not share same memory, so two threads running in different processes on different cores are like running different processes. It is just that they will be parallel, and the real parallel, not the pseudo parallel.


What are the benefits of using comments

I just accepted a new job. Our application is in the 50,000 lines of code area. None of which is commented. I am finding it difficult to understand how the application works. Id like to prevent this for the next person that joins the project by getting the team to start to use comments. Forget about if you support comments or consider them code duplication. What are some of the benefits of using comments that I can use as reasons for the team to start using them. What arguments are there in favor of comments (Not looking for opposing arguments). Are there any publications or studies done that show that using comments improves code quality or something like that?


Why is the 'final' keyword used so little in the industry?

Since I discovered the powers of the `final` keyword in Java a few years ago, it helped me to make my codes a lot more readable, since people can easily see what are read-only variables. It may also provide a little boost to the JIT, and while that's a very limited one, it can't harm, especially when targeting embedded devices such as android platforms. But more than everything, it contributes to make a design more robust to changes, and guide other committers when they need to modify the code base. However, while browsing some of the JDK source code, I never stumbled upon this keyword, either for classes, methods, or variables. The same applies for various systems I had to review. Is there a reason? Is it a common design paradigm to let everything mutable from the inside?


Why is the dollar sign used to abbreviate the description of a cache?

What's the historical significance of abbreviating say, an L1 cache as L1$?


Where can I find high-quality resources for programmers who are not-English speakers?

I've recently reviewed a resume for a very promising student who is not a native English speaker (I believe his native language is Bengali). His academic record has some gaps, too - he could use a couple of solid data- structure and algorithms type courses. Where would you advise this student to look, in order to find programming/training resources that are likely to be good quality, and in his native tongue? He is far from fluent, and has indicated that the language barrier is too high for him to try a course that's taught in English. Is it even possible for him to both study English and fill in the gaps in his training at the same time, or would you advise that he just do the two serially?


Ideas on making potential customer trust the web-site database

I'm developing a site for a potential customer who will need a lot of features for members and the various roles they will have, but also wants to have confidence in the "database". It is this latter item that makes them want to purchase a canned system from someone "established", that is both rather expensive, and is generic / not as customizable to what is needed. Do you have any thoughts or ideas on what I can do to inspire confidence in them that the database will be solid? I've thought about generating test data to fill the database, doing database backups, and readily being able to switch between database, and ? I'm implementing the web-site using Grails and am currently using a MySql database. Customer is very small ... just worried about the scenario of their stuff really "taking off", becoming large fast. I guess I'm just looking for high level thoughts from some of you experts out there (but specifics/references don't hurt either! :-) Thanks, Ray P.S. The Grails Security Core and UI plugins look really cool for all the user / role / security stuff, got all that plugged in and working in a couple hours yesterday ... thanks Grails framework and plugin developers!!


Why do certain code elements (classes, methods etc.) in public APIs get deprecated over time?

Today our professor discussed with the class that what "class X or method X get deprecated" means? From what I understood, it means, for example, that we are not going to get that method or class in the Java API in the future so we better use another method or class instead of this class. Then comes another question, why do they get deprecated? My guess for this question was that it is because the Java API developers may find those classes or methods are using an algorithm which is not efficient and they replace them with another class(es) or method(s) which are more efficent. But the professor wasn't happy with my answer and told me to google. And I couldn't find anything. Can you please tell me why the classes get deprecated?


Is it i normal for a programmer to be maverick? or is it considered as an attitude issue?

Dictionary Says that a **maveric** is someone who is >   * Someone who exhibits great independence in thought and action >   * Unorthodox >   * Rebel (A person who takes part in an armed rebellion against the > constituted authority, **especially in the hope of improving conditions** ) > None of those are bad things but good in fact, I see. But people use the term rebel or maverick with a negative connotation w.r.t programmers. Is it justifiable? In fact, I personally feel that a programmer should be a maverick bringing in new ideas and improvements over the existing. also being orthodox a sin in the realm of programming. My environment is that, if your superior looking at sun says that it is night then , it IS night; you dont deserve to be a skeptic! If you turn skeptic that qualifies you to be a Maverick/Rebel and no managers will entertain you in their project. I just am curious to know if this is same across all organizations, To know how much rebel you can be.


Why is time complexity of k-way merge sort O(nk^2)?

I'm comparatively new to algorithm analysis and am taking a related course on coursera where I came accross k way merge sort. The time complexity of 2 way merge sort is `n log2 n`, of 3 way merge sort is `n log3 n` and of 4 way merge sort is `n log4 n`. But, in the case of k-way the complexity is nk^2. This is because we pay attention to the merge part of the algo; `(2n + 3n + 4n...kn)`. But, in case of 2, 3 and 4-way algorithms, we pay attention to the recursive call of one function; `(2T(n/2) + c.n)`. Can anybody please explain why this is so? Or correct my approach to this question.


What is the usage of Splay Trees in the real world?

I decided to learn about balanced search trees, so I picked 2-3-4 and splay trees. What are the examples of splay trees usage in the real world? In this Cornell: http://www.cs.cornell.edu/courses/cs3110/2009fa/recitations/rec-splay.html I read that splay trees are 'A good example is a network router'. But from rest of the explanation seams like network routers use hash tables and not splay trees since the lookup time is constant instead of O(log n).


Why do we put private member functions in headers?

The answer to why we put private member variables in C++ headers is that the size of the class must be known at points where instances are declared so that the compiler can generate code that appropriately moves about the stack. Why do we need to put private members in headers? But is there any reason to declare private functions in the class definition? The alternative would be essentially the pimpl idiom but without the superfluous indirection. Is this language feature more than a historical error?


How "commercially savvy" should software developers be?

I have been watching answers to many questions on this site, and have come to the conclusion that commercial pragmatism does not factor into many software development discussions. As a result, I seriously wonder at the commercial skills within the industry, specifically the ability to deliver projects on time and to a budget. I see no indication from the site that commercially successful project delivery is a serious concern, yet the industry has a reputation for poor performance in this. Rarely, if ever, does the cost of time factor into discussions. I have never seen concepts such as opportunity cost, time to market, competitive advantage or cash flow mentioned, let alone discussed in technical answers to questions. How can you answer virtually any question without understanding the commercial background on which it is asked? Even Open source projects have a need to operate efficiently and deploy their limited resources to providing the most value for effort. Typically small start-ups have cash flow issues that outweigh longevity concerns, yet they are typically still advised to build for a future they probably won’t have if they do. Is it fair to say that these problems are solely the Managers and Project managers to solve, or are we, as developers, also responsible for ensuring successful on time, within budget delivery of projects, even if those budgets do not allow use to achieve engineering excellence?


Adaptative interface with Open GL and machine learning in C#

For my Semester project I have to go for any Adaptative Interface Design. My language is C# and I have to Use OpenTK (wrapper for OpenGL). I have an idea that I should show two points and some obstacles and my subject (user) would drag an object from one place to the final place avoiding the Obstacles. Also (s)he can place obstacles randomly. My software should be able to learn some paths by doing test runs and then after learning it should be able to predict the shortest path. I do not know how stupid this idea sounds but it is just an idea. I need help regarding any ideas for adaptative interface possible small projects or if my idea is ok then please can you tell me what should be used to implement it? I mean that along with OpenGl for the Graphics what can I use for machine learning?


blurry lines between web application context layer, service layer and data access layer in spring

I Originally asked this question in SO but on advice I have moved the question here... I'll admit I'm a spring newbie, but you can correct me if I'm wrong, this one liner looks kinda fishy in a best practices sort of way:               @RepositoryRestResource(collectionResourceRel="people"...) public interface PersonRepository extends PagingAndSortingRepository<Person, Long>      For those who are unaware, the following does many things: It is an interface definition that can be registered in an application context as a jpa repository, automagically hooking up all the default CRUD operations within a persistence context (that is externally configured). and also configures default controller/request-mapping/handler functionality at the namespace "/people" relative to your configured dispatcher servlet-mapping. Here's my point. I just crossed 3 conceptual layers with one line of code! this feels against my seperation-of-concern instincts but i wanted to hear your opinion. And for the sake of being on a question and answer site, I would like to know whether there is a better way of seperating these different layers - Service, Data, Controllers - whilst maintaining as minimal configuration as possible


Attachment handling for web application with Jackrabbit

I need to manage attachments on my Spring web application and I thought to use an open source repository. My app it's a job approval system using **J2EE / SPRING 3 Framework** and **Postgress DB** to allow user to tracks the job,right through every step of the approval process. It is a fully managed, collaborative system that operates from a central server and is accessed by a standard internet browser. An user should be able to add an attach to a request or an approval step, so, I though to use **Jackrabbit** with **Postgres database persistence manager**. I took a look to this post: http://onjava.com/pub/a/onjava/2006/10/04/what-is- java-content-repository.html?page=1 It's really interesting but, I've some question about this kind of solution :-   * I seen that Jackrabbit standalone as a Derby database embedded solution for persistence, is it enough for a professional use of the repository with more than 50 request / days (with attachment) ?    * Is there a reason for which I should use another database manager for persistence instead of the default one ?


Can a client sue you for "broken" software if you're a contractor paid hourly?

I've been working for a client for over a year and a half at an hourly rate. He's been pretty happy with the work thus far, and he has paid all invoices without objection, but his business has started to decline recently, causing him a lot of stress, expense resentment, and strained relations between us. I quit the project a few days ago (for a host of reasons) and he was not happy about it. He basically said that I need to continue working or he would sue me for some amount of money he has paid me as he doesn't feel the work is "what he paid for" (that is completely not the case, but irrelevant here). We do not have a signed agreement. The only "agreement" we have is a verbal / email one, stating that I will provide services to him at the rate of X an hour. I have copies of all the invoices I've sent him that have been paid, and they are broken down by hourly charges. His business also sends me a 1099 every year. Also, I did not leave anything "broken" or even in an un-finished state (for what it's worth). I don't think he has a leg to stand on, but I've never been sued before, and so I'm really worried. I know now that I should have insisted on getting something in writing before starting. Does anyone have any advice? **Does he have a legitimate case?** DISCLAIMER: I realize that any legal advise given is pretty much worthless here and I should consult a lawyer :).


Inheritance vs containment while extending a large legacy project

I have got a legacy Java project with a lot of code. The code uses MVC pattern and is well structured and well written. It also has a lot of unit tests and it is still actively maintained (bug fixing, minor features adding). Therefore I want to preserve the original structure and code style as much as possible. I aim to inject a new behavior into an existing class. Like a Duck that was trained to jump. Then I ask all my Ducks to jump. Those who can - jump. Those who cannot do nothing which is perfectly OK with me. The new feature I am going to add is a conceptual one, so I have to make my changes all over the code. In order to minimize changes I decided not to extend existing classes but to use containment:               class ExistingClass     {        // .... existing code                  //  my code adding new functionality        private ExistingClassExtension extension = new ExistingClassExtension();        public ExistingClassExtension getExtension() {return extension;}     }           ...     // somewhere in code     ExistingClass instance = new ExistingClass();          ...     // when I need a new functionality     instance.getExtension().newMethod1();      All functionality that I am adding is inside a new ExistingClassExtension class. Actually I am adding only these 2 lines to each class that needs to be extended. By doing so I also do not need to instantiate new, extended classes all over the code and I may use existing tests to make sure there is no regression. However my colleagues argue that in this situation doing so isn't a proper OOP approach, and I need to inherit from `ExistingClass` in order to add a new functionality. What do you think? I am aware of numerous inheritance/containment questions here, but I think my question is different. EDIT: Most of people replying to my question presume that a containment relationship looks like that:               class NewClass     {        OldClass instanceOfOldClass;        void oldFunctionality() { instanceOfOldClass.oldFunctionality();}             void newFunctionality() { // new code here }     }      But isn't this a kind of a containment relationship too?               class OldClass     {        void OldFunctionality();        NewClass instanceOfNewClass;             void NewFunctionality {instanceOfNewClass.NewFunctionality();}     }


Wrong encoding in DataReceivedEventArgs

I start cmd.exe process and redirect stdin to pass script to it and redirect stdout and stderr to read cmd's output. Here is the code of my DataReceivedEventHandler:               (o, a) => {         if(!String.IsNullOrEmpty(a.Data)) {             bw.Write(a.Data.ToUTF8());             bw.Write((byte)'\n');         }     }      In the code `bw` is instance of BinaryWriter, `ToUTF8` is string extension method, that converts a string to UTF8 encoded byte array. When I use this code in a separate process it works well, however when I use this code as a shared library inside some other process a.Data doesn't contain valid localized characters (like russian characters for example). So how should I convert characters? How to get cmd's OEM encoding? Why does the code works well in a separate process and doesn't work as a shared library inside some other process?


Programming Language vs Markup Language vs Scripting Language

Up until now I don't know the **KEY** differences between these three. When someone asks me about this, I only tell them that C# is a programming language, HTML and XML are Markup Languages, and JavaScript and VBScript are scripting languages. But what are the key differences that distinguish them from one another?


Is backing up a MySQL database in Git a good idea?

I am trying to improve the backup situation for my application. I have a Django application and MySQL database. I read an article suggesting backing up the database in Git. On the one hand I like it, as it will keep a copy of the data and the code in sync. But Git is designed for code, not for data. As such it will be doing a lot of extra work diffing the MySQL dump every commit, which is not really necessary. If I compress the file before storing it, will git still diff the files? (The dump file is currently 100MB uncompressed, 5.7MB when bzipped.) Edit: the code and database schema definitions are already in Git, it is really the data I am concerned about backing up now.


After HTML and CSS

I want to create dynamic professional websites. I have finished learning HTML and CSS, but as I understand, those two technologies allow to create static websites only. I heard about PHP and JavaScript as something which enables to create dynamic websites. Is that true? What is the difference between both? Are there other languages?


Placing images into Git for a CRM

I have built this CMS that has the option to add entries to the database. Each entry that is created has about 5 to 10 new images showing the product for sale. Each image is about 150Kb in size. I already know that images should always be stored in Git however my problem is that the sales team users that add new entries in the CMS are obviously working on the production server using the master branch. Our normal development is development code in your "dev environment" on a branch, then push those changes to the "staging environment" for QA and lastly if all the tests pass, push those changes to "production/live server". What will be the best way to get those new images that are uploaded on a daily basis into our repository seeing as those images are already on the live server?


Is using the new System.Tuple class bad design?

I like the concept of System.Tuple in that it allows me to return multiple parameters in a single function call without instantiating a new class, however does this defy any good programming practices such as Microsoft Patterns & Practices, SOLID Principles, etc. I'm just trying to gauge how liberally I should use this feature or if I should only use it in edge case scenarios when necessary.


Code base migration - old versioning system to modern

Our current code base is contained in a versioning system that is old and outdated (Visual Sourcesafe 5.0, mid 1990's), and contains a mix of packages that are no longer used, ones that are being used but no longer updated, and newer code. It is also a mix of 4 languages, and includes libraries for some of our systems (Such as Dialogic, Sun Tzu {clipper}) implementations. This breaks down into the following categories:   1. Legacy code - No longer used (Systems that have been retired or replaced, etc)   2. Legacy code - In current use (No intentions for upgrades or minor bug fixes, only major fixes if needed)   3. Current code - In current use, and will be used for future versions/development   4. Support libraries - For both legacy and current code (Some of the legacy libraries are no longer available as well) We would like to migrate this to a newer versioning system as we will be adding more developers, and expanding the reach to include remote programmers. When migrating, how do you structure it? Do you just perform a dump of all the data and then import it into the new system, or do you segregate according to type before you bring it into the new system? Do you set up a separate area for libraries, or keep them with the relevant packages? Do you separate by language, system, both? A general outline and methodology is fine, it doesn't need to be broken down to individual program level.


What should be included on an About page/form?

I was looking to add a simple form that states my project's build number on a form to quick identify what version I am running. Then I realized I'm not sure what fits on an about page. In my highschool projects I would make silly splash screens with this info, with images and other unnecessary information. What are standard/appropriate elements to include on an "About" page in an application?


Is this a good way to compare two numbers?

If we have double numbers, let's say I want to see if some double parameter is equal to zero that is passed as double:               public bool AlmostEqual(double x, double y)     {         double epsilon = Math.Max(Math.Abs(x), Math.Abs(y)) * 1E-15;         return Math.Abs(x - y) <= epsilon;     }      considering double shows 15 accurate digits. So do you think what I wrote is good? or it has issues? well then I just wrote a simple method like this:               public bool ReallyEqual(double x, double y)     {         return (x == y);     }      and then I couldn't find a case that return values of those two methods are different. they were always returning the same result. :(


Introduce the work of a software developer to school children using a social network

I often represent my software development company at conferences and other events. However this time I got assigned to introduce school children (12-18) years to the job of a software developer. Now the problem is that our PR guys told me to use Facebook ("use the cool stuff kids know") to leave a good impression. Now I'm stumped and have no idea how to bridge the gap between presenting the role of a software developer, requirements engineers, and programming in general to Facebook. I intend to give a 5 minute talk and then let them "do something" that invovles Facebook. Has anyone got an idea how to do something like that? Is it possible to let them develop a simple facebook app?


What is the best way to access multiple child properties?

I have a situation where I have to access several "sub-properties" of an object and find it quite appalling to write such code. I was wondering how best to deal with this situation:               void Main()     {         MyAClass aClass = new MyAClass();         aClass.BClass.CClass.DoSomething();     }      In addition to it being an eyesore, there are no null checks, and if one were to do them, the code would look even more cluttered. At the moment I create shortcuts, but they are a bit of a code smell too:               public class MyAClass     {         public MyBClass BClass { get; set; }              public void DoSomething()         {             if (BClass == null || BClass.CClass == null)                 throw new Exception();                  BClass.CClass.DoSomething();         }     }      What's the best way to access multiple properties like this?


Should I pass an object into a constructor, or instantiate in class?

Consider these two examples: ### Passing an object to a constructor               class ExampleA     {       private $config;       public function __construct($config)       {          $this->config = $config;       }     }     $config = new Config;     $exampleA = new ExampleA($config);      ### Instantiating a class               class ExampleB     {       private $config;       public function __construct()       {          $this->config = new Config;       }     }     $exampleA = new ExampleA();      Which is the correct way to handle adding an object as a property? When should I use one over the other? Does unit testing affect what I should use?


Can I market an application I wrote at work?

I work at a bank and I developed an in-house web application that helps keep track of past due loans and all the interaction between the bank and the customers. I was recently told by an outside consultant, who frequents many different banks, that each one of these banks would die to have a loss mitigation system like the one I built. I just read Joel's response to a similar question about copyright ownership. In his example he said that even though **_Joe was hired to write the code, he still owns the copyright._** So, do I own the copyright to this app and can I resell it to other banks? ### Update 05/20/2011: Thank you all for your honest feedback on this issue. I have always understood that software written at work by an employee as belonging to the employer. I was stunned when I read scenario described by Joel, and thought I would ask your opinions. It's nice to know that I have always held the same beliefs as you... the code belongs to the employer.


Help deciding on the appropriate software license type

I'm working on a piece of software which i'd like to sell; however i'd like to keep the source 'open' in the sense that I see no reason why people should be not able to browse it for educational purposes. Most of my personal learning process involves looking at similar examples of other people's work. I'd like to protect my intellectual property, but also give something useful to the programming community (without which many of us wouldn't have gotten too far). I'm not super worried about theft of my 'algorithm' since what i'm doing isn't all that profound. I'd likely wait until the software was ready for release before publishing the source anywhere. Are there any licenses which are appropriate for this sort of thing? Alternatively, are there better resources than this site that I should direct my search toward? Thanks, brian


Allow Administrator users to login as other users

Do you think it's a good practice to implement a possibilty to allow an administrator user to login in as another user, by-passing password? This could by implemented by a master password or a function inside the user administration, "Login as this user". Administrators are asking for a such function to be able to try to reproduce a reported problem or to check if grants are ok, for example.


Suggestions for search methodology requested

I am throwing this question out to the 'greater creativity' for some suggestions on search methodology that might solve this problem. I have come up with a somewhat contrived example to attempt to explain the problem well enough that some solution(s) might be recommended. The problem: We are using a relational DB (MSSQL), and need to search across products with the following constraints:   * Availability   * Market   * Price We also need to group and sort on price, market, and larger entity roll-up. Let me see if I can explain using semi-real world entities: Think of an application that allows users to search for hotel rooms that they can book. The following criteria might be available for the search: days that the rooms would be booked for, the market in which they want a hotel room (e.g. NYC, Boston), amenities that the hotel room(s) might have (hot tub, fireplace, number of beds, suite or not). In all cases, the search criteria above may or may not be selected. So, a very broad search is possible (on these dates, I don't care which market), or varying the levels of specificity (in NYC, 2 beds, with fireplace). To add complexity, we also need to return the prices of the hotel rooms for the selected criteria. Obviously, special pricing, different prices for the different days of the stay (one price on Thursday night and a different price on Friday and Saturday nights for a weekend stay). Some of the things we've played around with are: Solr, Endeca, SQL querying, implementing in C# code and optimizing when/where necessary (think of the decorator pattern). What I'm looking for here is some suggestions from the community on: which of the above is NOT suited for this problem, which might be well suited for this problem, which other technology might work better that we haven't thought about, techniques that others have used on similar problems that worked well (non-technology specific).


How do Java tests by IKM compare to Sun certifications?

Is the IKM test more difficult when compared to Sun certifications? Can you share your experience taking the test for Java/J2EE? What types of questions are asked?


Is there real value in a portable language targeting very different runtimes?

Another question over on SO introduced me to Oxygene, formerly Chrome before the browser of the same name came to prominence. It's in the Pascal syntax family, but brings in a lot of object-oriented grammar and elements from the C family, notably Java/C#. One of its big advertised strengths is that the language is implemented as runtime-independent; programs written in Oxygene can target .NET, J2EE, Android, or Cocoa, making it a memory-managed language almost as portable as C/C++ is in unmanaged-land. However, my question is whether that kind of independence is really useful, given that the frameworks and environments it targets are so different (and incompatible). There are a host of problems inherent in writing one program that can be compiled as-is to target all three of these runtimes, and a common language is only the tip of the iceberg. Java doesn't have a System.Windows.Forms namespace; it has java.swing, and the classes underneath are totally different. Similarly, Java's database interop is via JDBC, while .NET has the ADO.NET sub-framework. While having a common language is nice, being fluent in a "language" is as much (more, IMO) about being fluent in the targeted libraries as it is with the syntax of the language. Does anyone have a common example of where runtime-independent languages have been leveraged to create truly portable programs across all supported runtimes?


Can a GPLv2 program rely on Apache-licensed libraries?

Can a software program licensed GPL (version 2) rely upon libraries licensed under APLv2 without running afoul of the GPL? The language here suggests to me perhaps not. In my specific case I'm looking at a daemon that uses some APLv2-licensed external libraries. **UPDATE** (In response to answers/comments.)   1. For the purpose of this question, I cannot relicense the main program (the daemon)   2. The main program has been extended with functionality that uses `apr-util` and perhaps other APLv2 components My question is, can I release the extended daemon under the GPLv2, or is this something I need to keep to myself (no distribution) and/or re-implement without APLv2 if I am committed to **(a)** releasing this extension, and, **(b)** keeping the daemon GPL'd?


Realtime (almost) bidrectional communication in Java

I will explain the context of the problem first. For a University project I'm going to implement an Android application. The Android application (and others) will be able to send data to a remote source, that remote source will also be able to send messages to the Android applications. For example the messages may be "apply configuration x", "what is your status". I want the remote source to be able to send these messages to:   1. Reduce overhead. I don't want the Android devices sending data when its not necessary. This uses data and power.   2. So that I can scale it, for example version 1 might allow you to check what value x is on the Android applications, version 2 might let you check what y is etc. I have looked at implementing this using Sockets in Java. Having the Android application talk to the remote source is easy. I configure the router (port forward) and everything is OK. The problem is having the remote source to talk to the Android application. They may be using public WiFi hotspots, have their 3G on etc, I wouldn't be able to address the device directly via sockets right? The approach to solving the problem is not that common I believe, which makes me believe I'm trying to do something that shouldn't be done. Can anyone shed some light on this and offer me some guidance? Many thanks.


Write to stdout and redirect or write directly to file?

I can see two ways to fill an empty file with data:               $ run_program arg1 > data_file      or, specifically write code that manages a file and write to it? ie. a file stream? **Which is better to implement?**


Web App vs Portal Platform - convincing the customer

We're evaluating a set of requirements for a customer who wants Liferay which mainly has AAA and Web CMS requirements, and allowing user to upload their own content. Also all inetgration is via web services. However there is no need for other features such as actual "portlets", i18n, mashups, skins, themes, tagging, social presence, no collaboration etc So we feel we can do this as a standard JEE web app and not use Liferay (or any other portal product) since these are overheads we dont need. The customer feels the **Web CMS requirements + user upload justify the "portal" product.** Can anyone help me with some points to convince the customer? Assuming our point of view is right.


Session serialization in JavaEE environment

Please consider the following scenario: We are working on a JavaEE project for which the scalability starts to become an issue. Up until now, we were able to scale up but this is no longer an option. Therefore we need to consider scaling out and preparing the App for a clustered environment. Our main concern right now is serializing the user sessions. Sadly, we did not consider from the beginning the issue and we are encountering the following excetion:               java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.catalina.session.StandardSessionFacade      I did some research and this exception is thrown because there are objects stored on the session which does not implement the `Serializable` interface. Considering that all over the app there are quite a few custom objects which are stored on the session without implementing this interface, it would require a lot of tedious work and dedication to fix all these classes declaration. We will fix all this declarations but the main concern is that, in the future, there may be a developer which will add a non `Serializable` object on the session and break the session serialization & replication over multiple nodes. As a quick overview of the project, we are developing using a home grown framework based on Struts 1 with the Servlet 3.0 API. This means that at this point, we are using the standard `session.getAttribute()` and `session.setAttribute()` to work with the session and the session handling is scattered all over the code base. Besides updating the classes of the objects stored on session and making sure that they implement the `Serializable` interface, what other measures of precaution should we take in order to ensure a reliable Session replication capability on the Application layer? I know it is a little bit late to consider this but what would be the best practice in this case? Furthermore, are there any other issues we should consider regarding this transition? Thank you in advance!


Can you choose your tools or do you take what you get?

I often see questions about what tools to use for a particular problem, or suggesting that one tool is preferable over another, and that it says something about the quality of the programmer who uses the subpar tool. Some of that is religious arguements, but some tools generally are considered less than ideal. In every job I've had, the environment and tools are already bought and in use. I start using what they have, and while I might have some small say in a future direction, have no say in the current environment. Is it common for a company to allow the programmer to choose the tools they will use? Or is it more common that a programmer is dropped into an existing environment, and they make use of what they are given? I'm guessing a contract programmer has more say than a FT programmer -- true? (For an example, at my previous job we used Access for a database, Visual C++ for a programming language, and Visual Studio for an IDE, with WinXP for an OS. We also had Source Safe and Test Track. So, that's what I used. In my current job I get SQL Server and Oracle instead of Access, more ColdFusion than C#.net and VB.net, and we're moving from XP to Win7.)


Why are C++ template error messages so horrific?

C++ templates are notorious for generating long, unreadable error messages. I have a general idea of why template error messages in C++ are so bad. Essentially, the problem is that the error isn't triggered until the compiler encounters syntax that is not supported by a certain type in a template. For example:               template <class T>     void dosomething(T& x) { x += 5; }      If `T` doesn't support the `+=` operator, the compiler will generate an error message. And if this happens deep within a library somewhere, the error message might be thousands of lines long. But C++ templates are essentially just a mechanism for compile-time duck typing. A C++ template error is conceptually very similar to a runtime type error that might occur in a dynamic language like Python. For example, consider the following Python code:               def dosomething(x):        x.foo()      Here, if `x` doesn't have a `foo()` method, the Python interpreter throws an exception, and displays a stack trace along with a pretty clear error message indicating the problem. Even if the error isn't triggered until the interpreter is deep inside some library function, the runtime-error message still isn't anywhere near as bad as the unreadable vomit spewed by a typical C++ compiler. So why can't a C++ compiler be more clear about what went wrong? Why do some C++ template error messages literally cause my console window to scroll for over 5 seconds?


Could I learn more about programming from deconstructing drupal rather than continuing with ZF?

When I was deciding how to go about learning to design PHP web applications, it made sense to sort of shoot toward the middle and go with Zend Framework so that I could be closer to the lower level, but I would be able to get down to business fairly easily, too, while learning about design patterns, etc. That seemed to work out pretty well, but now I'm wondering if I wouldn't have learned more about design from a more top-down approach, like creating a drupal site and deconstructing it. I realize that the degree of topness vs. bottomness in this context is pretty negligible in the spectrum of all programming experiences, but I think it matters very much where you start, especially at the very beginning, because your world is small; it's home base, and how you develop your personality there "at home" can determine how you approach other problems in the future--I believe people tend to try to repeat their successes, which often means adopting a preference for what's familiar to them. I didn't want to "learn myself into a corner," so to speak, so I tried to aim for a level that would prepare me for the greatest amount of other experiences. LAMP with ZF seemed like a well-rounded, holistic choice, because I'd be learning about database design, patterns, web app development, server configuration, and a C-based programming language all at once. Okay, great, but I haven't really progressed as far as I had hoped I would, honestly. And now I'm starting to wonder if I've done myself a disservice for wanting to start nearer to the bottom vs. learning to produce as much as possible right away. My instincts at the time were that, "sure, a CMS will get you up and running, producing stuff right away, but you'll eventually hit a wall and need to learn the lower-level stuff anyway, and you'll probably hit it sooner than later so you might as well start there. Don't eat dessert first." But now I'm thinking "what would have stopped me from digging into the gears of a CMS?" Maybe I would have learned more from seeing a more complete implementation and deconstructing it rather than reinventing the wheel. Or, I could be exactly where I should be having only started in December? And I just don't know the answer. I want to start a new project (redoing my website--I'm actually a composer (of music)). I know the basics of Zend Framework, and I'm fairly sure I could code a simple CMS for myself for my purposes, but would I learn more from deconstructing an out of the box CMS like drupal?


If we only know that a video is 720P, 480P or 240P can that unambiguously tell us of the resolution?

The main issue I have here is are the 720P, 480P, 240P... classes for defining video quality or do they unambiguously define the resolution of the video? For example, the wikipedia article about 240P refers to a family of resolutions.


Open source and updates

I have found an open source library that can work fine with my project, but I have noted that It's not frequently updated and I'm afraid of not having the necessary support. Is the frequency of updates a proper criterion for choosing an open source library rather than another?


c++ exceptions vs. preliminary error condition checks

## Preamble One of the concepts used in writing Python code is "Easier to ask for forgiveness than permission", aka _EAFP_. Literally this means that instead of doing checks, whether an operation is possible, you do the operation and "ask forgiveness" if what you do fails. Technically this means (just an example with no particular meaning):               try:         obj.x = 10         obj.y = 20     except AttributeError:         pass      This technique is oftenly used when the code in `try..except` block is known to run without any errors in most cases, or if the code is rearly executed. The same code with preliminary checks would look as follows:               if hasattr(obj, 'x'):         obj.x = 10          if hasattr(obj, 'y'):         obj.y = 20      ## C++ practices While generally not an issue in Python, C++ has a "heritage" flame war of "function returning error status" vs. "throwing exceptions". This has been discussed a lot, but I can't find any good source of information which describes whether the Pyhton-like EAFP is applicable in Python. E.g. consider the following:               if (node.has_element('x')) {         node['x'] = 10;     }      versus               try {         node['x'] = 10;     }     catch(ElementNotFoundException e) {         // pass     }      Which approach is generally used in C++ code? If performance is not the issue, would you write EAFP-fashioned code? Thank you.


Finding developers for collaboration in enterprise open-source project

I am a founder and only developer of an open-source software designed for a small subset of enterprises. It was originally developed for and now runs at one of businesses of the type it was designed for. It's my biggest project and I wanted to make something even bigger of it. Creating a software developing company and selling the product is not an option to me, so I decided to make the project open-source and sell the deployment and support services to enterprises in my area. The problem I faced is that I can't find developers to contribute to the project. Most articles and books on growing open-source community state that developer arrive from the users base, however my project's users base is small and is not related to IT. So it's really unlikely that one of my customers will happen to be an opensource enthusiast who happen to know the stack of technologies I use. I have been thinking about it for a long time, and seems like the only way to attract someone to collaboration is to look for programmers in my area and offer them to cooperate in both development and commercialization of the project. No one else would be interested in contributing to my project. _Is that correct and no other option exists?_ The generalized question is: **How do opensource projects with small, non-IT users base (like enterprise software projects) find developers to collaborate?**


Use Windows Store controls in a Windows 8 desktop app?

Is it possible to use the Windows 8 Store controls in a Windows 8 desktop app? Controls like the FlipView and SemanticZoom would be useful. I haven't found any information about this and would presume the answer is no, but thought someone would have a more definitive answer.


Best and safest API for a function which fills a buffer with variable-length data

I have a function which receives a buffer and returns some data in the buffer. The data can be smaller than the buffer capacity. Which is the best and safest API for this?   * `int fn(void *buffer, size_t buffer_len)`: the size of the data written to `buffer` is returned by the function. Downside: the return value must also have a way to indicate that some error occurred (in-band error indicator).   * `errno_t fn(void *buffer, size_t *buffer_len)`: in this case, `buffer_len` works both as input (the buffer capacity) and output (the data size). The function can return an error code. I think this is OK, but somewhat awkward.   * `errno_t fn(void *buffer, size_t *data_len, size_t buffer_len)`: like the previous, but with input/output separated in two arguments. Also returns error code, but is also awkward due to too many arguments. (Any other options?)


Would using a hash table in garbage collection solve the stop the world problem of mark and sweep?

In mark-sweep-compact garbage collection algorithm you have to stop-the-world when relocating objects because reference graph becomes inconsistent and you have to replace values of all references pointing to the object. But what if you had a hash table with object ID as a key and pointer as value, and references would point to said ID instead of object address... then fixing references would only require changing one value and pause would only be needed if object is tried to be written into during copying... Is there a mistake in my line of thought?


Ideal "intermediate" file format to use for structured/styled text?

I have files that I want to make available in an variety of formats:   * HTML   * PDF   * EPUB   * Plain Text (maybe) Most of the files will be _sourced_ in doc, docx, or rtf format, so that needs to be considered. So I need some kind of format that converts well from docx, doc, and rtf and has plenty of libraries for converting into PDF, EPUB, HTML etc. Ideally libraries in Python, but Java is also okay.


What is the best/most standard way to measure server load?

I'm a bit green to web applications although I am in the final phases of developing one for a client. I'm using Django with Gunicorn/Nginx on an AWS m1.medium. The database (MongoDB) is on a separate instance. The client is paranoid about scaling and so I threw together a crude monitoring server which has the ability to spin up new AWS instances, install the app code and load balance (I know, I know, I could have used ELB. I said I was green, and it was fun writing it anyway). The question is, I don't really know what metrics I should be aware of. How will I know when my app server is under 'high load'? CPU? RAM? Request latency? All of the above? Any guidance in this area would be appreciated.


Are there new API's in Windows Phone 7 (Mango) which need new phone hardware? Gyroscope stuff? BTW, is AppHub the only Microsoft's official forum for WP7? Registration page is asking for 'Publisher name', website and payment? I just want to ask questions in the forum.


why the terms used in Scrum are so strange?

I'm not a native English speaker, currently I'm reading some articles about Scrum. I was wondering if the English terms used in Scrum seem strange to you? For example, backlog instead of todo; artifact instead of element; retrospective instead of review; even the name of Scrum, it make no sense to me as a process name. Can anyone give some hint to me? For example, I don't see the relationship between a scrum in football and iteration process. Fei


Non-lvalues as function parameters in C++

I'm reading Accelerated C++ and in Chapter 4 they bring up the concept of lvalues. There's an example of something that _shouldn't_ work, but after trying it myself I found that it does indeed work. Specifically they state that, given these functions:               // return an empty vector     vector<double> emptyvec()     {       vector<double> v;       return v;     }          // read things from an input stream into a vector<double>     // (I'm leaving out the function body here because it's irrelevant)     istream &read_things(istream& in, vector<double>& hw);      This should not be allowed:               read_stuff( cin, emptyvec() );      Because emptyvec() is an expression and returns a temporary object (a _non- lvalue_ as they called it in the book). However, this not only compiles but actually runs (Windows 7/VisualStudio 2010). So, what's going on? Was this just a bad example on the authors' part, or is there something else happening that I don't understand. Thanks.


How can we make a certain thing inbuilt in c language with our own header file?

I want to make the basic trigonometric functions in maths inbuilt functions using my own header file . so as the users can do trigonometry in c language compilers.


Designing a list class with filtering and sorting

The app I'm developing needs to display lists of items. Simple enough, but there are a number of things which can change based on user input:   * Items can be added to/removed from the list.   * The items in the list can be updated. Multiple items can be updated simultaneously!   * The filters can be updated. Multiple filters can be updated simultaneously!   * The sort order of the items can change. Possibly relevant info:   * It's a multiplatform Java app.    * One of the platforms we distribute on is MIDP, so that limits which language features/libraries/etc we can use.   * The implementation is currently split into a model class (in the common code) and device-specific view/controller classes. I've tried a couple of approaches to designing a suitable list implementation, but both have drawbacks: **Approach 1:** The platform-specific controller implementations are responsible for calling a `refresh()` method whenever anything happens which could change the list. This approach keeps the list class (model) implementation fairly straightforward, but leaves much of the responsibility up to the platform- specific controller implementations. The more logic there is in these classes, the greater the chance of bugs creeping in. It also encourages the controllers to directly notifying the view of updates, which feels like poor design. **Approach 2:** The model is entirely responsible for raising events to notify the platform- specific views of changes. The list items, filter, and sorters notify the model when they change, which then notifies the views of changes. This keeps the platform-specific classes much simpler, and feels like a stronger design (less coupling between the classes, etc). However, the list class implementation becomes much more complicated. My main problem with this approach is dealing with a proliferation of events when multiple items/filters are updated in a single operation. **My questions:**   1. Is there other approaches I could/should be trying?   2. Is there a recognised way to manage/avoid the explosion of events in approach #2?


Should developers do their own software releases (if there is a prod support team in place)?

I know there are going to always be differences depending on the particular size, staff etc, but i wanted to get feedback in general around: **In an environment where you have a production support team doing first line support and release management, is it better to simply have developers manage their own releases instead? In this case, its internal software at an insurance company but the question should be valid at any company, size, etc I think.** Currently, we have our production team do releases but there is an argument that its inefficient and that if you allowed developers the ability to do it, they will focus more on making it simple and efficient and avoid basically passing on scripts, etc to run to another team. The counter argument is that if you don't have a check and balance, you could get a software team (or an individual) that doesn't a very hacky job about getting their software out there (making on the fly changes, not documenting the process, etc) and that by forcing the prod support team to do the actual release, it enforces consistency and proper checks and balances. I know this is not a black or white issue but I wanted to see what folks thought on this so the discipline and consistency is there but without the feeling that an inefficient process is in place.


How to deal with asynchronous functions when you really just want things synchronized

I am fairly new to NodeJS and I'm having a hard time wrapping my head around the asynchronous nature of functions when I really want one call to follow the other in a synchronized way. Say for instance I am calling web service methods. Every method has a callback function. But what if I want to call 10 of them in a specific sequence? Do I really need to chain / embed all the functions in the first callback? What if the second time the chain is slightly different? Are there any elegant patterns to deal with situations where you actually do want things to be synchronous? Or should I really let go of this kind of programming get used to a different way of thinking? If that's true maybe someone can point me to a clean example of a longer chain of functions using callbacks...


hiring a web designer: design task

I need to hire a web designer. How do I test his creativity and skills before I hire him. Ideally I'd like to give him a fairly open-ended task i.e. I give him a problem statement and ask him to design a PSD file. Any suggestions on the problem statement I might give him? Also, is there a better way to hire /test a web designer?


How to properly validate your code?

I have about 4000 lines of code for a web-application in JavaScript / PHP / CSS / HTML. How can I test it properly? I only support the latest version of IE and Safari. I've worked out all the bugs. Is there a good way to test it so that I could go so far as to call the code robust? I've considered using perl Mechanize to auto fill in forms or do something similar. I also have a PHP test class to test the inner working of my PHP classes. However is there some sort of standard or conformance guidelines to be met? Is there a way to say this code passes IEEE xxx foo standards for code robsustness etc.? I have validated my HTML using W3 validators and I've validated my JavaScript using jslint.com. Here is list of dilligence items:   1. HTML / CSS passes W3 validation   2. JavaScript passes jslint   3. PHP passes internal PHP Test Class User Testing   1. Create a set of User Actions and Implement using perl mechanize or similar. Are there standards or procedures for releasing code to the web?


Testing Facades, Is it a good idea?

I stumbled across a need to create a thin I/O Layer interface to abstract away a class from the need to know about I/O               public interface IFileIOProvider {         Task WriteFileAsync(String contents, String path);         Task<String> ReadFileAsync(String path);     }      Is it a good idea to test a default implementation that _only_ falls back to standard .Net System.IO classes, no logic attached?. I think it might be overkill, but just want to get my strategy checked out by more experienced programmers


How does the concept of a class change when passing data to the constructor instead of method parameters?

Let's say we're making a parser. One implementation could be:               public sealed class Parser1     {         public string Parse(string text)         {            ...         }     }      Or we could pass the text to the constructor instead:               public sealed class Parser2     {         public Parser2(string text)         {            this.text = text;         }              public string Parse()         {            ...         }     }      Usage is simple in both cases, but what does it _mean_ to enable parameter input to `Parser1`, compared to the other? What message have I sent to a fellow programmer, when they look at the API? Also, are there any technical advantages/disadvantages in certain cases? Another question comes up when I realize that an interface would be quite meaningless in the second implementation:               public interface IParser     {         string Parse();     }      ...where an interface on the first one could serve at least some purpose. Does that signify anything in particular, that a class is "interfaceable" or not?


If Instance is for Class, what's for Template?

I am not able to find the right technical term to mention child or instance of a template.   What's the right one, child or instance or something else I am not aware of? Sorry for my unclear original question.   Its not related to any language. The Template I am talking about is a business concept in my application. Say for example, I have a "chair" template. I would set a few property values to it to create it's usable instances. I need this for naming and documentation stuff.   Shortlisted 3 terms: Instance, Definition, Child. Whats suits better?


Is it okay to make coding style changes on an open source project that doesn't follow best practices?

Recently, I came across a number of open source Ruby (or majority of it was Ruby) projects on GitHub that when checked with a code analyzing tool like Rubocop, create a lot of offenses. Now, most of these offenses include using double quotation marks instead of single quotes (when not interpolation), not following the 2 spaces per level rule, exceeding the 80 character line length rule, or using `{` and `}` for multi-line blocks. > [The] Ruby style guide recommends best practices so that real-world Ruby > programmers can write code that can be maintained by other real-world Ruby > programmers. ~ Source: Ruby Style Guide Although they are small and easy to fix, is it appropriate to change the coding style of an open source project by fixing the offenses and making a Pull Request? I acknowledge that some projects, like Rails, do not accept cosmetic changes and some are just too large to "fix" all at once (Rails for example generates over 80,000 offenses when Rubocop is run - regardless, they have their own small set of coding conventions to follow when contributing). After all, the Ruby Style Guide is there for a reason together with tools like Rubocop. People appreciate consistency so making these kinds of changes is kind of doing a good thing for the Ruby community in general, right? > [The author(s) of the Ruby Style Guide] didn't come up with all the rules > out of nowhere - they are mostly based on my extensive career as a > professional software engineer, feedback and suggestions from members of the > Ruby community and various highly regarded Ruby programming resources, such > as "Programming Ruby 1.9" and "The Ruby Programming Language". ~ Source: > Ruby Style Guide Isn't not following community coding style conventions and best practices basically encouraging _bad_ practices?


How does a program process concurrent executions

I have a console application that is run by taking the input parameters. It can be configured by passing report name parameter, for e.g. `reportgen.exe sales.xml`. It hits the database and retrieves the data into xml file and sends to sftp site. Whole of this process is logged and the `xml files` are being saved in a directory. This `exe` needs to be scheduled on daily basis, so what happens if the exe is scheduled at same time with different parameters. Is it thread safe and can be considered as independent execution doing what it supposed to do? **Edit:** It uses log4net for logging the debug info. into a file. So, how does it write log statements into single file for concurrent executions.


FRC Robotics Laptop? Windows 7 or 8?

I’m mentoring FRC Robotics team and we’re buying a new computer. I’m looking at Lenovo Thinkpad W540. We’ll be using C++/WPILIB and SolidWorks for design. Anyone out there have experience with this laptop? Should we stick with Windows 7-64bit or go to Windows 8? I’m also curious to know whether anti-virus software interferes with performance … errr ... should that be separate discussion? Thanks!


How much should we spend on improving software security?

Is there a "scientific" method to determine how much resources/money should be spent on improving the security of a piece of software? I work in a team where our work is prioritized by a product owner (ala Scrum). The product owner is kind of sales driven and focuses on new functionality requested by customers and less on the infrastructure. I think I need a way to convince him that we need to spend more time on improving the security. Of course I don't want to convince him by spreading fear and I'm not sure myself how much money we should spend on improving security. Of course, the security of our software is improved all the time but I suspect - without knowing for sure - that it would be sane to double the efforts in the area. I have a weak memory reading about this, where something like the following was suggested:   1. Think about a weak point in the security in the system   2. Estimate what a succesfull attack would cost in terms of lost/dis-satisifed customers (X)   3. Estimate how likely that it is that this would occur in a given year. (Y)   4. Calculate how much should be spend on fixing the weak points, based on X and Y. We don't have to solve the issue immediately, but we should spend Z percent on it.


How to handle assumptions while designing any system?

I have been going through various system design examples to understand how we approach any system design question. Here is what I have understood till now.   1. Know the system first and find out how it works.   2. Think of all use case.   3. Identify key components and their responsibilities.   4. Connect all the components so that they can communicate to each other.   5. Use all standard practices while integrating components and if possible use standard design patterns. Sometimes we make assumptions about the system, so those assumptions should be used to remove one use case or to add a variation. I will put this question in context of Parking Lot design. If I assume that Parking Lot is not commercial, and it is free parking lot, then design of parking lot should handle free parking lot as one of use cases , and it should be generic. OR Simply design parking lot which will never work for Commercial parking lot. Main idea is that if someone asks you to design a parking lot and that is free parking lot, then design should be generic or specific?


How do you make the node_modules folder read/write in WebStorm

I'm using WebStorm on a Node.js project and want to edit the files in the node_modules folder but WebStorm won't allow this. I found the padlock at the bottom right on the IDE but switching that between lock/unlock makes no difference. Any ideas?


What is the best computer programming content that an aspiring technical cofounder (for a 2-person team) can consume?

**My background is as follows:** I have almost no programming experience to speak of (I programmed a game mod in Jr. High and have since been dormant for 15 years). I'm quite comfortable with both vim and emacs (having used them general purpose text editing in the past). I have a graduate degree in mathematics with research experience in logic. I've read from cover to cover _The C Programming Language_ (doing about 1/4 of the exercises) and _The Pragmatic Programmer_. I felt that the concepts discussed in these books came quite natural to me, although I suspect _reading_ about programming is akin to reading about how to have sex (i.e., next to worthless in practice). **My primary programming goal is to be able to construct rough software prototypes as rapidly as possible.** I'd also like to understand the big picture of how things are operating at the software level. Unfortunately, I don't yet know if our first prototype is going to involve an iOS application or a web app. With this in mind, what's the best technical content I can consume in the short-run (with an eye towards rapid prototyping) before I know what it is I'm actually trying to build and test?


Is video game programming usually physics related?

I know this is obviously not true for some games, minesweeper, card games, etc. But what about any game involving simulating the real world environment. Obviously these games have some form of a physics engineer powering the graphics. For someone like me who personally did not enjoy physics but loves video games, do I have a chance at ever getting involved in the development cycle of a video game such as this while disliking physics?


What are some best practices for minimizing code?

While maintaining the sites our development team has created, we have come across include files and plugins that have proven to be very useful to more then one part of our applications. Most of these modules have come with two different files, a normal source file and a min file. Seeing that the performance and speed of a page can be increased by minimizing the size of the file, we're looking into doing that to our pages as well. The problem that we run into is a lot of our normal pages (written in ASP classic) is a mix of HTML, ASP, Javascript, CSS, and include files. We have some pages that have their JS both in include files and in the page, depending on if the function is only really used in that page or if it's used in many other pages. For example, we have a common.js and an ajax.js file, both are used in a lot of pages, but not all of them. As well as having some functions in a page that doesn't really make sense to put into one master page. What I have seen a few other people do online is use one master JS file and place all of their javascript into that, minify it, gzip it, and only use that on their production server. Again, this would be great, but I don't know if that fully works for our purposes. What I'm looking for is some direction to go with on this. I'm in favor of taking all of our JS and putting it in one include file, and just having it included in every page that is hit. However, not every page we have needs every bit of JS. So would it be worth the compilation and minifying of the files into one master file and include it everywhere, or would it be better to minify all other files and still include them on a need-to-use basis?


PHP Simplest XML tokenizer for string processing?

I need to do some _text processing tasks_ with _short XML fragments_. The section "details" shows an example... My solution is to use a _tokenizer_ based on _regular expresions_ , but it is not elegant and not uses any build- in function. The candidate build-in functions (that others indicates to me) are strtok and SimpleXML. So, my question have two parts:   1. **My assumptions are correct?** There are no other "candidates", only strtok and SimpleXML? Is correct to think DomDocument as an "elephant" (with big CPU overhead) for a simple _text processing task_?   2. **How to use SimpleXML to do the same (illustred) task?** PS: I not need all algorithm or implementation, only some clues. * * * # Details PHP offers a tokenizer, strtok, very simple, and I not see how to use it with XML string. The option, SimpleXML, is perhaps heavy for tasks like ''text processing'' (see this example and the below), and is more than a tokenizer. What exactly I whant to say with "tokenizer" and "text processing"? See example below. I used a "regex parser", but **I would like an algorithm based on some built-in function like SimpleXML, if it is simpler and faster**.                $xmlFrag = '
  Hello world!

  Beautiful day today.
';           // TOKENIZING TAGS AND ENTITIES:      $reg=array();      $xmlFrag = preg_replace_callback(         '/<!\-\-.+?\-\->|<.+?>|&[a-z0-9]+;/is',          function ($m) {             global $reg; $reg[]=$m[0]; $n=count($reg)-1;             return "##$n#";         },         $xmlFrag      );      echo $xmlFrag;     // results:      //  ##0###1# Hello world!##2#  ##3###4###5# Beautiful##6# day today.##7#           // PROCESS THE TEXT: any, in one step. Example: lower, upper, change orthography, etc.      $xmlFrag = strtoupper($xmlFrag);      echo $xmlFrag;      //  ##0###1# HELLO WORLD!##2#  ##3###4###5# BEAUTIFUL##6# DAY TODAY.##7#           // EXPAND TOKENS:      $xmlFrag = preg_replace_callback(         '/##([0-9]+)#/is',          function ($m) { global $reg; return $reg[$m[1]]; },         $xmlFrag      );      echo $xmlFrag;      //
  HELLO WORLD!
       //
  BEAUTIFUL DAY TODAY.
      * * * ## Using SimpleXML How to implement a SimpleXML algorithm to resolve the illustrated problem (code above)? PROBLEMS:   * Load a XML with named entities (as ` ` in the example).   * Traverse XML to get only text nodes. With `$sx->xpath('//text()');` I can not edit the nodes. ## Using DomDocument It is out of context, because my XML fragments are short and DomDocument imposes a big CPU overhead (? is this a preconception?) for the simple text processing.


Should I open pull requests from a branch on the official repo or my fork?

I have commit access on an open source project named Foo hosted on GitHub (there are many other committers if that is relevant). I would like to make a change via pull request so that someone else reviews it before it gets committed to the master branch of the Foo codebase. To make this pull request, I can either make a branch on the official Foo repository or I could fork Foo and commit to a branch on my fork. What issues should I consider when I'm deciding whether to make my pull request on the official repo or my fork?


What is the best way to store configurations of shell/script code to execute later?

I am working on a tool (Python, may or may not be important) that will allow a user to maintain a configuration file containing arbitrary shell and/or language code to be executed on particular events and intervals. The code will potentially involve multiple statements. I understand there are potential behavioral and security risks associated with executing arbitrary code from a file, but I don't think this is a concern because the configuration file is managed only by the end user. However, let me know if I'm overlooking something major. My main question: what is the best way to store this code in a configurable way? * * * Some concepts I'm considering to store the code... In a shared config file (which many Python libraries already look for):               # setup.cfg     [my_program]     command_1 = cd /tmp && touch foobar      In a YAML file:               # my_program.yaml     command_1: cd /tmp && touch foobar      In a source file as arguments to `subprocess.call()`:               # settings.py     command_1 = [['cd', '/tmp'], ['touch', 'foobar']] # requires special handling of 'cd'      In a source file as a function:               # settings.py     import os     import subprocess     def command_1():         os.chdir('/tmp')         subprocess.call(['touch', 'foobar'])


Store HighRes photos in Database or as File?

I run a site which has a couple of million photos and gets over 1000 photos uploaded each day. Up to now, we haven't kept the original file that was uploaded to conserve on space. However, we are getting to a point that we are starting to see a need to have high-res original versions. I was wondering if its better to store these in the filesystem as an actual file or if its better to store them in a database (ie: mysql). The highres images would be rarely referenced but may be used when someone decides to download it or we decide to use it for rare processes like making a new set of thumbnails sizes/etc.


C++ and function pointers assessment: lack of inspiration

I've got an assessment to give to my students. It's about C++ and function pointers. Their skill is middle: it the first year of a programming school after bachelor. To give you something precise, here's a sample of a **solution** of one of **3** exercices they had to do in 30 minutes (the question was: " _here's a version of a code that could be written with function pointers, write down the same thing but with function pointers_ "):               typedef void (*fcPtr) (istream &);     fcPtr ArrayFct [] = { Delete , Insert, Swap, Move };          void HandleCmd (const string && Cmd)     {         string AvalaibleCommands ("DISM");         string::size_type Pos;         istringstream Flux (Cmd);              char CodeOp;         Flux >> CodeOp;              Pos = AvalaibleCommands.find (toupper (CodeOp));              if (Pos != string::npos) {             ArrayFct [Pos](Flux);         }     }      * * * Any idea where I could find some inspiration? Some of the students have understood the principles, even though it's very hard for them to write C++ code. I know them, I know they're clever, and I'm pretty sure they should be very good project managers. So, writing C++ code is not _that_ important after all. Understanding is the most important part (IMHO). I'm wondering about maybe break the habits, and give half of the questions about the principle, or even better, give some sample in _other_ language and ask them why it's better to use function pointers instead of classical programming (usually a big `switch case`). Any idea where I could look? Find some inspiration?


Actor based concurrency and cancellation

I'm reading about actor based concurrency and I appreciate the simplicity of actors sequentially processing messages on a single thread. However there is one scenario that doesn't seen possible. Suppose that actor A sends a message to actor B, who then performs some long running task and returns a completion message to actor A. How can actor A force actor B to cancel the long running task after it has started? If actor B is running the task in its message queue thread, it won't pick up the cancellation message until it had completed the task; if actor B runs the task in a background thread then it seems to be violating the principle of actors. Is there a common way that this scenario is handled with actors? Or does each actor language/framework take a different approach? Or is this not a suitable problem to tackle via actors?


What is a good script language for writing server administration tasks?

I am administering hundreds of RHEL servers. There are many daily tasks to perform. Right now I am working with bash scripting and python. I was wondering if other languages such as Erlang, Lua, Ruby, Haskell, or Clojure.


What are the steps involved in creating a testing process?

I've been asked this question as part of an assignment. The question is a bit vague, and after searching the Internet, I cannot seem to find any particular set of steps related to this question. The best I could find are the following:   1. Design test cases   2. Prepare test data   3. Run program with test data   4. Compare results to test data Are these valid steps which can be done to create a test process? Or am I misinterpreting the question?


Can initial inefficient solutions INSPIRE better ones and thus lead to faster problem solving?

When faced with writing an algorithm to solve a small project/problem is it better to come up with pseudo code that isn't efficient/optimum but solves the problem and then try to use the inefficient code to **inspire** a better/good solution? The solution must be acceptable, not necessarily "super-amazing-out- of-this-world" type. The answer is subjective, but I am looking for a general opinion or consensus from experienced programmers in order to develop a better algorithm generation/problem solving process. _The reason I ask this is that I often start composing the most intuitive algorithm but then get derailed thinking about how inefficient it is and if I should be using a better data structures etc etc._


How to find siblings of a tree?

On my interview for an internship, I was asked following question: > On a whiteboard write the simplest algorithm with use of recursion which > would take a root of a so called binary tree (so called because it is not > strictly speaking binary tree) and make every child in this tree connected > with its sibling. So if I have:                      1           /   \            2     3           / \     \          4   5     6         /           \      7             8      then the sibling to 2 would be 3, to four five, to five six and to seven eight. I didn't do this, although I was heading in the right direction. Later (next day) at home I did it, but with the use of a debugger. It took me better part of two hours and 50 lines of code. I personally think that this was very difficult question, almost impossible to do correctly on a whiteboard. How would you solve it on a whiteboard? How to apprehend this question without using a debugger?


Is this a correct situation to use a constant?

So my professor was giving back some feedback on a project I've been working on. He docked a few marks for this code:               if (comboVendor.SelectedIndex == 0) {       createVendor cv = new createVendor();       cv.ShowDialog();       loadVendors();     }      This is in a combobox "index changed" handler. It's used when the user wants to create a new vendor, my top option (index 0, that never changes) opens the "Create a new Vendor" dialog. So the content of my combo box ends up looking like this:               Create New Vendor...     Existing Vendor     Existing Vendor 2     Existing Vendor 3      His problem is with the first line code:               if (comboVendor.SelectedIndex == 0)      He claims that the 0 should be a constant, and actually docked me marks because of that. He claims I shouldn't use literals in my code at all. The thing is, I don't understand why I would want to make that code in that situation a constant. That index will never change, nor is it something that you would need to tweak. It seems like a waste of memory to keep a single 0 in memory that's used for a very specific situation and never changes.


How can I test a parser for a bespoke XML schema?

I'm parsing a bespoke XML format into an object graph using .NET 4.0. My parser is using the `System.XML` namespace internally, I'm then interrogating the relevant properties of XmlNodes to create my object graph. I've got a first cut of the parser working on a basic input file and I want to put some unit tests around this before I progress on to more complex input files. **Is there a pattern for how to test a parser such as this?** When I started looking at this, my first move was to new up and XmlDocument, XmlNamespaceManager and create an XmlElement. But it occurs to me that this is quite lengthy and prone to human error. My parser is quite recursive as you can imagine and this might lead to testing the full system rather than the individual units (methods) of the system. So a second question might be **What refactoring might make a recursive parser more testable?**


Instantiating a class implementing an interface

I have an interface called `Cell`. In the start of the code, I read input data from which I can come to know the implementing class (not as a class object but I can know for example the string). And after that I need to call the constructor for the implementing class to initialize an object. What would be the best way to implement that. The first thing in my mind is to do something like this (`Cell` is an interface, `Sphere` and `Rectangle` implements `Cell`. I can set a boolean flag called `sphere` after reading the input data):               Cell startcell;     if (sphere)         startcell = new Sphere(0);     else         startcell = new Rectangle(0);      But is this good design?


Parallel Threading in Multi-Language Software?

I'm developing a software that contain many modules/Daemon running in parallel manner, what i'm looking for is how to implement that, i cannot use Thread because some of those modules/Daemon are perhaps implemented in other languages (C,java,C#...). For example I'm using C for Hooking Messages exchanged between Windows kernel and top level applications, Java/C# to use some free library to simply parse XML(for example) or to accept and execute commands over the network..this can be done by C Language but just to improve productivity... Finally for GUI I'm using Ultimate++ (c++) that is like the main process that call and monitor(activate/deactivate/get state) of all other modules/Daemon through an interface. I admit that the development of each module/Daemon in a separate language greatly facilitates maintenance, but especially I am obliged to do that.. What is the best practice way to do that ? All helps will be appreciated.


What is preferred for file I/O in Java?

Of the three   * BufferedReader/Writer  * Binary Streams  * Channels     which is more preferred **in real life** for file I/O in Java and why?   I prefer channels for binary data to be put into file or read from and BufferedReader/Writer for String data


Does Dart have any useful features for web programmers?

http://www.dartlang.org/ I've checked out the site very briefly, and got curious. Is there any advantages of using Dart? Is it just a replacement for JavaScript? It looks like simpler Java. Writing quite a lot of C# at work, the language feels very much like what I'm used to, so learning the syntax looks like a breeze to learn. Has anybody any opinions or experiences with the language? (Compared to CoffeeScript (= I'm not doing Ruby syntax) the syntax looks more familiar to me).


I just read a question asking how Facebook blocks console-based script attacks. The reason for this block was to prevent a recently famous "hack" where one would trick a user to inject a malicious script through the console with the promise of something (instant likes, who viewed me etc). And then I wonder: _Why do browsers these days ship with dev tools anyways?_ Now, some thoughts:   * Not everyone is a developer, and one wouldn't have any need for these tools just to surf the web and read some email.    * If one really would want to debug a page, they could have just shipped it as a separate add-on, much like how Firefox had Firebug before it also had its own dev tools.   * If troubleshooting was the concern, then wouldn't an error console, like in Firefox 3, suffice? And browsers in the older days didn't have debugging tools, only some interface to show the errors (IE had the status bar. Firefox had an error console).   * Wouldn't it be an additional weight to the browser if it had those tools tucked in? So why is this the trend in browsers these days? Is there something I missed that makes vendors push with shipping the tools along with the browser.


How did programmers implement Linked list ideas before the object oriented paradigm?

Linked lists, as far as I have seen, are largely implemented using object- oriented ideas. (having an object that holds some information and the address of the next link). How were Linked-lists implemented before the object- oriented paradigm came out? Were they only invented(?) once the OOP was developed?


How to make consistent progress towards the goal of becoming better, as opposed to just coding for fun?

I'm in senior year in high school. I enjoy programming (Java) very much and aspire to do it as a career in the future. However this isn't the topic of this question. My question is: how can I start making **consistent progress towards the goal** of becoming a great programmer? What I mean is this: I work on my own projects, enjoy doing so and feel like I'm slightly improving with every project I finish. However, I don't feel like I'm consistently moving towards 'the goal of becoming a great programmer'. I want to have a sense of 'working towards the goal'. What I feel right now is more like "I'm coding stuff which is a lot of fun and I'm improving, but I don't feel like I'm **'making progress towards my goal'** ". "Slightly improving over time because I'm coding stuff" doesn't really feel like "making progress towards a goal". To those of you who are experienced developers: **what advice can you give me on making consistent progress towards the goal of becoming great at programming,** as opposed to just coding stuff for fun?


Localizing an app whose data is tied to one language

I develop a mobile app that displays information about the bus system in one U.S. city. The de facto official language is English, but there are many students from other countries—China and South Korea, especially—and I’d like to internationalize and localize my app, both to make it more appealing to non-native English speakers and because I want the experience of localizing an app. I’m a little hazy on where I should draw the line between strings that should be localized and those that should stay in English. The bus system itself uses only English names. It was easy for me to decide not to localize the stop names: there are thousands of them, meaning that translations would be expensive, and moreover most of the stop names are proper nouns that wouldn’t necessarily _have_ Chinese translations (for example), making localization pointless. Since the stops will only ever be displayed in English, is it reasonable that the app’s list of all stops should only ever use English collation? The bus system uses colors to name most of its routes. It _would_ be possible to translate these, but should I? The sign on the front of the bus is only ever going to display the English name of the route. With that in mind, is there any benefit to my app displaying a translated name that the user will just have to mentally convert back into English anyway? (I’m leaning toward “no”.)


Why is asynchronization so popular in Javascript?

Asynchronized programming seems to be natural in Javascript - it is the "first choice" to do many things. But in most other programming languages, asynchronization is more like a second choice rather than first choice. What makes asynchronizated programming so popular and natural to Javascript?


Code checking role

Consider there is a manager and a programmer in a project. A manager crates a task which a programmer performs. In this situation who should check that a programmer didn't make some non- testable mistakes like using non thread-safe map in a singleton service? And who checks the overall project code structure?