Is there an expiration date for well regarded, but old books on programming?

After reading a question about books every programmer should read, I wonder if the following should be considered obsolete:   * Code complete: 1st edition in 1993; 2nd edition in May, 2004   * Introduction to algorithms (Cormen, Leiserson, Rivest, Stein): 1st edition in 1990; 2nd edition in September, 2001; 3rd edition in 2009   * The Pragmatic Programmer: October, 1999   * Structure and Interpretation of Computer Programs: 1st edition in 1984; 2nd edition in September, 1996   * The C Programming Language: 1st edition in 1978; 2nd edition in April, 1988 All these books seem very old. Isn't there a difference between modern computing and what was current when those book were written? For example, my 61-year-old teacher explains things very nicely but forgets to take into account all that has been done between when he began to teach 25 years ago and now. Isn't the same true for those books? Aren't there any more modern books that teach principles and technologies that are closer to current practice? Or do you consider them to be useful and relevant even today?


Can you successfully keep managing when you are forced back into development?

For about eight months I managed a development team doing a re-write of a web based application. During this time, I was focused on many aspects of the project that did not involve directly writing code, even though by trade that's what I started out as. Recently the number of developers assigned to the project has dropped and I am now forced to drop back into a developer/management role. Since that time I have found that it's very difficult to focus on a feature and get it completed while at the same time trying to stay ahead of the other developers and make sure that we're keeping on track. My questions is this: can you successfully keep managing a project when you are forced back into development?


Non-mathematical Project Euler (or similar)?

I checked the post (Where can I find programming puzzles and challenges?) where there's a lot of programming challenges and such, but after checking several of them, they all seem to be about algorithms and mathematics. Is there a similar site for purely logic/functionality-based challenges? For example:               - Retrieve data using a web service     - Generate output X from a CSV file     - Protect this code against SQL injection     - Make this code more secure     - What is wrong with this code (where the error is in logic, not syntax)     - Make this loop more efficient      Does a challenge site like that exist? Especially one that provides hints and/or correct solutions. That would be a very helpful learning site.


Using alternative MVC framework

I am new to ASP.NET MVC and EF. I read about open source implementations of MVC pattern like Spring, FubuMVC, Castle etc. I want to know how flexible these alternatives are when compared with ASP.NET MVC. Which one is widely used and whose help is easily available on the NET?


cost trade-offs for deploying changes to prod, stored procs vs. LINQ

Some context for thisi question: it is not about development time over the _entire_ iteration of development, but just the stage of deploying changes from dev to prod environment. "LINQ" here really means LINQ, ORM, or C# where T-SQL would otherwise be used. And here "stored procs" is just a general term that encompasses database objects which include stored procs, functions, and views. Question was just phrased as "LINQ", "stored procs" since the two are commonly compared in questions. To narrow the scope of the discussion we can assume web applications. Now finally the question is, What are the _trade-offs_ in the cost of deployment (from dev to prod) between the two approaches? Some say it's easier to rollback Db schema changes than rollback changes across C# files in a solution. Others say it's easier to version or source control C# code than Db schema objects. If you make changes to LINQ queries, you'll most likely need to recompile the app to push the changes to prod. If you make changes to database schema, then that may require having a T-SQL script run in order to sync the changes to prod. As with many decisions with programming, the chosen solution may be context- sensitive. e.g. for data structures some situations may call for a hash map, and for others, it may be best to use a stack. Each has its own advantages/disadvantages.


How to communicate inefficiency before it's implemented?

This is a problem I come across pretty often. Basically we are using an application to make art content. Often times this requires writing custom tools for it. Sometimes you run into parts of the application where doing something is not directly supported in the UI, which means it will either be a little more involved or communicating this to the software company that makes this software so they can address it in the future. But I see some of the more experienced people suggesting to use methods that are extremely inefficient. For example let's say you want to access the value of the last item in a 10M item array. Let's say it's not directly doable. So you could write some code that would be inconvenient in this case because you just want it directly doable in the app. But instead of this, they suggest you to let's say create a spare property for each item in the array, that will basically store the same thing, and then by using a built-in tool which will go through each element and set the value of ALL these new properties to the last item read. So it will be like:               for i=0 to array.Length:         new_property[0..array.Length - 1] = array[i];      So this will indeed give you the last item when the operation is done, but it will be extremely slow. How can you communicate this to the people suggesting these methods? Because they think it's quite reasonable and since they have more experience and this is mainly an art application, it shouldn't involve more work for us/them.


Any changes/improvement for LINQ 2010 vs LINQ 2008

I'm VB.NET user and now learning LINQ. The book I'm reading now focus on LINQ 2008 VB.NET. I want to know whether there are changes/improvement in LINQ 2010? p/s: I'm reading this book: Pro LINQ Language Integrated Query in VB 2008


The Joel Test's equivalent for measuring a programmer

I understand that to measure a project or code, we can use _The Joel Test_ , but is there any simple standard test (like The Joel Test) that is able to measure and filter how good a programmer is? My plan is to have this test as a quick filter first before going to a more detail test.


What does facebook's new photo tagging patent mean for developers?

This is a re-post of Blueplastic's question from SO, which was closed. I think this is a excellent question and I would like to hear what people thinks. To expand this further, look at the patent that Yahoo is suing Facebook for: http://paidcontent.org/article/419-meet-the-10-patents-yahoo-is-using-to-sue- facebook/ Some of these patent are so broad and I wouldn't be surprised that many developers could inadvertently developed their application to function in such a way. I understand that patent is supposed to protect intellectual property and promote innovation. However, it seems that if certain popular techniques are patented, it will become a hindrance to innovation.   * What if there is a patent on URL shortening?   * What if there is a patent on WYSIWYG editor?   * What if GO4 patented their design patterns? I am not a lawyer so these items may not be patent-able, but that's also part of the question I guess. **Edit** Anothe excellent article discussing the issue: http://www.wired.com/epicenter/2012/03/opinion-baio-yahoo-patent-lie/ http://stackoverflow.com/questions/6052154/what-does-facebooks-new-photo- tagging-patent-mean-for-developers > Yesterday it was published that Facebook has gotten a patent for tagging > people in pictures: http://www.insidefacebook.com/2011/05/17/facebook- > patent-photo-tagging/ > > What does this mean for other developers? > > So, if I want to make a web-based photo sharing application where I want to > let users tag their friends, does it mean that I have to give Facebook > royalties? > > I believe iPhoto and Picasa also have people tagging features. Do they now > also have to give Facebook royalties?


Is obscuring/obfuscating public-facing database ids really a "best practice"?

I've heard people lecture here and there on the internet that it's best practice to obscure public facing database ids in web applications. I suppose they mainly mean in forms and in urls, but I've never read anything more than a mouthful on the subject. **EDIT** : Of course, now that I ask this, I find some resources on the subject:   * http://stackoverflow.com/questions/2374538/obscuring-database-ids   * http://stackoverflow.com/questions/1895685/should-i-obscure-primary-key-values   * http://joshua.schachter.org/2007/01/autoincrement.html These links satisfied some of my curiosity, but the SO posts don't have many votes and aren't necessarily centered around the topic in this context so I'm not sure what to make of it, and some of them claim that the third link is bogus. I'll leave the rest of my post intact: * * * I understand the differences between obscurity and security, as well as how the two can work together, but I can't imagine why this would be necessary. Is there any truth to this, is it just paranoia, or is it just totally bogus altogether? I can think of ways to do it, but of course it adds a lot of complexity to the application code. Under what circumstances would this be useful? If this _is_ something people frequently do, how is it usually deployed? Hashing the identifiers? Something else? It seems like a lot of work for not much extra security. I'm not looking for real solutions, I just want to get an idea of how/why people would do this in the real world. Is this really considered a "best practice" or is it merely a micro- optimization of little value? **NOTE** : I think a few folks might have gotten the wrong idea: I'm not suggesting that difficult-to-guess ids would be the _only_ security mechanism, obviously there would have be the usual access checks. Let's assume those are in place, and that simply knowing the id or hashed id of a record is not enough to grant access.


Do I infringe copyright if I turn a book into a program?

Suppose I own a copy of a physics book containing _original_ research. Suppose that this book is licensed under a non-free license. If I use the formulas and concepts explained in that book in my program, am I infringing the book's copyright? In my opinion the answer is no because I'm copying ideas, not text, and ideas can't be copyrighted. Though, I must say that in order to use the formulas, I'm forced to copy parts of the text, hence the question. **Update:** I have no problems crediting the author and citing the book; my aim is to have freedom to choice the license I want for my software, without being limited by the book's license.


Is this an open source license?

I have been messing with code in The Unix Archive and have found that most of the code references a (non existent) license, however, this is in the root of the mirrors and apparently covers all of the code (typed from a PDF, so excuse the typos): (source pdf is here > The following copyright notice applies to the source code files for which > the license is granted. > > Copyright(c) Caldera International Inc. 2001-20012. All rights reserved > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions are met: > > Redistributions of source code and documentation must retain the above > copyright notice, this list of conditions, and the following disclaimer. > > Redistributions in binary form must reproduce the above copyright notice, > this list of conditions and the following disclaimer in teh docuemtnation > and/or other materials provided iwth the distribution. > > All advertising materials mentioning features or use of this software must > display the following acknowledgement: This product includes software > developed or owned by Caldera International, inc. > > Neither the name of Caldera International, Inc. nor the names of other > contributors may be used to endorse or promote products derived form this > software without specific prior written permission. > > USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA > INTERNATIONAL, INC. AND CONTRIBUTORS ''AS IN'' AND NAY EXPRESS OR IMPLIED > WARANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO > EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE OFR ANY DIRECT, INDIRECT, > INCIDENTAL, SPECIAL, EXEMPLRARAY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY > OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING > NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, > EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Is this an open source license? It kind of seems to be very BSD-ish, with the exclusion of the clause "all advertising materials mentioning features or use of this software must display the following acknowledgement: this product includes software developed or owned by Caldera International, Inc" Does that clause prevent this from being an open source license?


How to overcome programming by coincidence?

In the book The Pragmatic Programmer, the writers mention the _programming by coincidence_ concept. It explains what it is, why it is caused, what are the dangers you may encounter and it compares with a landmine field in a war. > Do you ever watch old black-and-white war movies? The weary soldier advances > cautiously out of the brush. There’s a clearing ahead: are there any land > mines, or is it safe to cross? There aren’t any indications that it’s a > minefield—no signs, barbed wire, or craters. The soldier pokes the ground > ahead of him with his bayonet and winces, expecting an explosion. There > isn’t one. So he proceeds painstakingly through the field for a while, > prodding and poking as he goes. Eventually, convinced that the field is > safe, he straightens up and marches proudly forward, only to be blown to > pieces. > > The soldier’s initial probes for mines revealed nothing, but this was merely > lucky. He was led to a false conclusion—with disastrous results. > > As developers, we also work in minefields. There are hundreds of traps just > waiting to catch us each day. Remembering the soldier’s tale, we should be > wary of drawing false conclusions. We should avoid programming by > coincidence—relying on luck and accidental successes—in favor of programming > deliberately... But I am not really satisfied on the way they describe the "how to overcome it" issue. Yeah, you have to think ahead before writing the code, but how to practice that? The only thing I can think is by adding features to existing Open source projects, where you must have knowledge on both the "what I am doing now" and the "How the other pieces of code are working", and it is not that applicable when you are writing your own projects. EDIT: a summary from your posts:   * Dont guess your next move, prove it is correct   * Unit test and refactor much as possible, when neccessary   * Add features-complile-test often   * If you cant explain the code to a noob you re probably programming by coincidence. Btw, it is hard to accept an answer, it is really hard. All answers are really great :)


What stops HTML5 and JS apps to perform as good as native apps?

From what I understand,   * HTML is a mark-up language, so is the content of XAML, XIB and whatever Android uses and other native UI development frameworks.   * JavaScript is a programming language used along with it to handle client side scripting which will include things like event handling, client side validations and anything else C#,Java,Objective-C or C++ do in various such frameworks.   * There are MVC/MVVM patterns available in form frameworks like Sencha's, Angular etc.   * We have localStorage in form of both sqlite and key-value store as other frameworks have and you have API specification for almost everything that it missing.   * Whenever a native UI frameworks has to render UI , it has to parse a similar the markup and render the UI. **Question break-down**   * What stops from doing the same in HTML and JS itself ?   * Instead of having a web-control or browser as a layer in between why can't HTML(along with CSS) and JS be made to perform the same way ?   * Even if there is a layer,so does .net runtime and JVM are in other cases where C++,C are not being used.    * So Lets take the case of Android, like Dalvik, why Can't Chromium be another option(along with dalvik and NDK) where HTML does what android markup does and JavaScript is used to do what Java does ? So the Question is, Even if current implementations aren't as good, but theoretically is it possible to get HTML5 based applications to work as other native apps specially on mobile ?


What algorithms are there for picking colors for plot lines on graphs?

I'm interested in **what algorithms or rules I can programmatically implement to generate RGB or HSV colors for plotlines** to keep them visually distinct from the neighbors. I know that in professional mapmaking, there are algorithms or rules that make sure that no two adjacent countries on a map are the same color. I can also think of Microsoft office Excel as picking good tints/shades for plot lines (red, then blue, then purple/orange). Here's an example of what I'm talking about - I need to generate colors for 12 lines on a black background. The colors here I've hardcoded by hand using web- safe RGB color codes. The problem arises when these lines overlap - it's hard to tell if one is looking at purple, slighly darker purple or violet. **I'm looking for a better algorithm to produce colors for plotlines like these.** ![Multiple plot lines color example](http://i.stack.imgur.com/5zi6d.png) Here's an example using Flot plotting library for jQuery, it has nice succession of colors for graphs: ![enter image description here](http://i.stack.imgur.com/pv2c7.png)


Creative Commons 3 vs Common Public Attribution License Version 1.0 for my PHP Script

I am currently working on an open source PHP script and trying to adopt an attribution license. The ones that I found are CC 3.0: http://creativecommons.org/licenses/by/3.0/ and CPAL 1.0: http://opensource.org/licenses/CPAL-1.0 They seems very similar to me. What's the difference, pros and cons? What I want is:   1. Allow use for free and commercial work, modify it to suit their needs if required, but can not redistribute it as a new product or with a different name (no sublicensing?). EDIT: I am bit confused about CPAL license on this, what does it allow and disallow?   2. Copyright info in the source codes can not be removed   3. Copyright attribution on the frontend and backend (admin panel) can not be removed. But I will adopt dual licensing model by adding commercial license to allow removing them with a fee (only the frontend and backend, not the copyright info in the source codes).   4. Any plugins or themes created for this script doesn't need to adopt my license as long as the main source codes are not modified, it can be any license(commercial, MIT, GPL, CC, CPAL) adopted by the authors. I think that's basically it. I am also open to suggestions for other kinds of license types and why


Can I use a package visible constructor for creation?

I need a class where this can be done:               // user program     elder_tales.Player p = elder_tales.generate_player();     elder_tales.level_up_player( p );      but not:               // user program     elder_tales.Player p = new ...whatever     p.set_stats();     p.set_server();     p.calculate_experience()     elder_tales.level_up_player( p )      Basically, I want the package to do the instantiating while not allowing the user to do their own instantiating; because instances of type Player are constructed in a complex manner, I decided not to put too much strain on the user to create them with a public constructor.


Choose license and business model for Android app

Sorry if this is the wrong place for this question. I'm starting to develop an Android application, but I would like to choose a license and a business model before to write any code. My requirements are the following:   * Make the app open source (completely or partially)    * Sell the app for a small price on Google Play I see essentially two alternatives to choose from:   1. Let's say I want a single paid binary on Google Play and I let the (advanced) users build the app for itself, if they want (or maybe take the app from F-Droid or similar third party stores). In this case, which open source license should I use? I'm not sure whether the GPL license allows me to sell the binary.   2. Let's say I want to provide, on Google Play, a basic version of the app for free and a _pro_ version for a small fee. The basic version would be open source, but what about the pro version? Open or closed source? Feel free to suggest an additional model!


How to measure team productivity over time using consistent story sizes?

How do I measure team productivity over time using consistent story sizes? To take a simple example, if I can do a story every two days, then I can do five stories in a two-week sprint. By definition (as one story is two days), I will continue to complete five stories per sprint forever. In order to demonstrate improvement over time, I would need a new measurement, for example, value, right?


How to retain student/intern programmers?

We have a small team in our department and typically employ 1-3 students/interns. The problem we have is retention. We like to hire a student that will stick around as part of the team for more than just a summer quarter. The problem is though the last 4 students we hired, up front we discussed this with them and they all ended up leaving earlier than we would have liked. The relationships all ended in a good fashion, the students either obtained teaching assistant or research positions within the university, or went on to bigger and better things. This is all understandable and we do not hold it against them for doing what is best for them. But my perspective is different as I worked within our department for 2 years during undergraduate at which point I was brought on full time upon graduation. How can we retain students? We give them hardware they need/want, we provide them with problems to solve in anyway they see fit (within reason). All in all to me this type of job for a student programmer is so flexible and awesome I cannot see how anyone would want to leave. Thoughts ?


Same constructor signature with different semantics?

Occasionally, I'm confronted with the problem that I have to provide some constructors in order to initialize objects with different sets of data. These sets can be mathematically transformed into each other, for example:                       public Element(int x, int y, int width, int height)             {                 setValues(width, height, x, y);             }                  public Element(int RectTop, int RectLeft, int RectRight, int RectBottom)             {                 setValues(RectRight - RectLeft, Math.Abs(RectBottom - RectTop), RectLeft, -RectTop);             }      With such an desired overloading, which actually isn't any because of the same signatures, it is probable that the wrong constructor is invoked, e.g. you provide the Rect-Values and the first constructor is invoked. Assuming, we would have different types, we could achieve it by swapping types with good knowledge that this is a bad practice. But that's simply not the case in this easy example with four times int type. Can you think of some elegant alternatives to achieve the desired behavior that we have the convenience of overloading, but with the same signature?


Best example for mixins in .NET

I want to present the concept of mixins and their implementation in .NET. The way they work in .NET is you add extension methods on an interface and decorate classes with said interface. What would be the best examples for this pattern (other than linq)?


Techniques to Enable Dynamic Query / Calculation at Runtime

I'm working on a C# project which provides users an on-demand method of importing data from various formats and then performs mail-merge-like actions to complete a template. The process works for basic data types. However, I need to add the ability to perform calculations on the existing data (which is not present in the source) so the results can be placed on the output. **Example 1** :   _Date range_ \-- if there is data in both the start date and end date fields then the output should contain the two dates separated by " - ". If only one is present then just that date is output. **Example 2** :   _Conditionals_ \-- if data in field X meets criteria Y then output Z. **Example 3** :   Format text before conversion to number and format output as currency.   Source Field: "000059975"   Desired Output: "$599.75"   _Note that the text version of the number was of fixed length and included both whole and partial units of currency (dollars and cents in this case)._ I understand how to perform these actions in code; however, all configuration of the data sources and the "calculated" fields must be done at runtime via strings. All data, once imported, is placed in a DataTable, so any solution will have access to the capabilities thereof in C# 4. Some ideas I've considered so far:   * lambda functions with a regex replace   * direct C# expressions   * scripting language (e.g., SQL / JavaScript / Python) processing   * A DSL (though I have no experience with designing/implementing such) I've not successfully identified a way to implement any of the above possibilities. Note also that while this is an internal business application which will largely be used by a small group of IT staff, I'd prefer to stick with a solution which limits the possibility of arbitrary code execution. What techniques exist to address this need?


MyListActivity, MyCursorAdapter, MyViewHolder -- nested classes or not?

I am using several activities based on the `ListActivity`. All of them display information from different SQLite queries, and all of them use the `ViewHolder` optimization. The cursor adapter have to be specialized, and the view holder is also special for the purpose. Therefore, they are defined as `private class`es inside the `MyListActivity` definition. Not having too much experience with Java, my question is whether the chosen approach is correct. Possibly the non-nested classes (i.e. flat, separate *.java file) is not better for reasons unknown to me. What are the pros and cons of nested/flat approaches? To be more specific, here is the code skeleton:               public class MyListActivity extends ListActivity             implements LoaderManager.LoaderCallbacks<Cursor> {              private MyCursorAdapter myAdapter;              @Override         public void onCreate(Bundle savedInstanceState) {             ...             initLoaderAndSetListAdapter();         }              private static class MyViewHolder {             public TextView code;             public CharArrayBuffer codeBuffer = new CharArrayBuffer(20);             ...         }              private class MyCursorAdapter extends CursorAdapter {                  private final LayoutInflater mInflater;             private final int mLayout;                  public MyCursorAdapter(Context context, Cursor c, int flags) {                 super(context, c, flags);                 mLayout = R.layout.the_specific_view_for_the_list_item;                 mInflater = (LayoutInflater)                         context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);             }                  @Override             public View newView(Context context, Cursor cursor, ViewGroup parent) {                 View v = mInflater.inflate(mLayout, parent, false);                 MyViewHolder holder = new MyViewHolder();                 holder.code = (TextView) v.findViewById(R.id.code);                 v.setTag(holder);                 return v;             }                  @Override             public void bindView(View view, Context context, Cursor cursor) {                 MyViewHolder holder = (MyViewHolder) view.getTag();                 cursor.copyStringToBuffer(1, holder.codeBuffer);  // COLUMN_CODE                 ...                 holder.code.setText(holder.codeBuffer.data, 0, holder.codeBuffer.sizeCopied);                 ...             }         }              private void initLoaderAndSetListAdapter() {             getLoaderManager().initLoader(0, null, this);             myAdapter = new MyCursorAdapter(this, null, 0);             setListAdapter(myAdapter);         }              @Override         public Loader<Cursor> onCreateLoader(int id, Bundle args) {             Uri uri = ... set the uri based on situation... ;             String[] projection = { ... };             CursorLoader cursorLoader = new CursorLoader(this,                     uri, projection,                     null, null,                     orderingInfo);             return cursorLoader;         }              @Override         public void onLoadFinished(Loader<Cursor> loader, Cursor data) {             myAdapter.swapCursor(data);         }              @Override         public void onLoaderReset(Loader<Cursor> loader) {             myAdapter.swapCursor(null);         }     }      The question is specific to the described situation that I meet repeatedly. Please, do not consider it as general _nested classes or not_.


difference between accounting and potential methods in Amortized Analysis

I was going through the Introduction to Algorithms by Cormen et al.In the chapter titled Amortized Analysis,the difference between accounting and potential methods is given like this > The accounting method overcharges some operations early in the sequence, > storing the overcharge as “prepaid credit” on specific objects in the data > structure. ... > > The potential method maintains the credit as the “potential energy” of the > data structure as a whole instead of associating the credit with individual > objects within the data structure. I tried to understand this using the example of resizable array which doubles its size when there is no space to insert an element.What I couldn't understand was the following sentence > storing the overcharge as “prepaid credit” on specific objects in the data > structure Using Accounting method: ci = the charge for the i-th operation c'i = amortized cost of the i-th operation Si = array size after the i-th operation bi = balance of credit after the i-th operation               i   1  2  3  4  5  6  7  8  9 10     si  1  2  4  4  8  8  8  8 16 16     ci  1  2  3  1  5  1  1  1  9  1     c'i 3  3  3  3  3  3  3  3  3  3     bi  2  3  3  5  3  5  7  9  3  5      what exactly does "storing on specific objects in the data structure" mean here? In potential method ,if I use phi to be 2n-m where n = number of currebt elements in the array ,and m=array size                               n     m    phi     empty            0     0    0      add first elem   1     1    1     add secondelem   2     2    2     add third elem   3     4    2     add fourth elem  4     4    4     add fifth  elem  5     8    2      In this ,what does it mean by "...the “potential energy” of the data structure as a whole instead of associating the credit with individual objects within the data structure."


Possible design patterns for base function with possible additions

I have various interfaces i have to implement. Let's assume ITypeA, ITypeB. They have following methods:               ITypeA       Connect       Disconnect       GetData       SetData       ClearData          ITypeB       Connect       Disconnect       GetData       SetData       Start       Pause       Stop      They have some base functionality: `Connect`, `Disconnect`, `GetData` and `SetData`. If I want to add ITypeC in the future, it will have these base functionality too. I want to access to the base functionality and if there is additional functionality, I want to get this too. What design patterns are available that are capable of this situations? I found one here: Extension Interface. In this, you create a base interface and multiple extension interfaces that are implementing the additional functions. In the base interface you can ask for the available extension interfaces of the component. But this approach seems complicated: I have to create interfaces for each type, factories for the interfaces, I need some tables to save what Interface belongs to what Factory... What is the basic solution for this problem? Extension Interfaces? Are there any other possible alternatives for my problem?


Is using a global to maintain the currently logged in user bad practice?

I'm doing some android development in a relatively inexperienced group, and all of the data used by our application is managed in a database. There are several instances where we'll need to pull info from the database using the identifying information/PK of the user who is currently logged in. Because the only info from the user that is important is the PK (IE we don't need an entire class to represent the types of users or any associated data), and because this ID is important throughout the scope of the application and will not change once it is defined, we considered storing the ID/PK of the user in a global on successful login. Is the use of a global variable in a circumstance like this bad practice? Is there a better way to handle it?


How to compare features of two curves?

I need to compare two curves f(x) and g(x). They are in the same x range (say -30 to 30). f(x) may have some sharp peaks or smooth peaks and valleys. g(x) may have the same peaks and valleys. If so I want a measure on how well these features coincide without visual inspection. I have tried to solve this problem in the following way.   1. Normalize both functions by dividing each data point by the total area of the function. Now the area of the normalized function is 1.0   2. At each x get the minimum value out of f(x) and g(x). This will give me a new function that is basically the overlapping area between f(x) and g(x).   3. When I integrate the resulting function of step 2 I get the total overlapping area out of 1.0 However this does not tell me whether the peaks and valleys coincide or not. I am not sure if this can be done but if someone knows a method I would appreciate your help. ==EDIT== For clarification I have included an image. ![Sample curves](http://i.stack.imgur.com/JafS4.jpg) The difference between the two curves (black and blue) may not be the same but will have complementing shapes. Background: The functions are projected density of states (PDOS) of atomic orbitals of a compound. So I have states for s,p,d orbitals. I want to determine whether the material has s-p, p-d or d-d hybridizations (orbital mixing). The only data I have is the PDOS. If say the PDOS of s orbital (function f(x)) has the peaks and valleys as at the same energies (x values) of the PDOS of p orbital (function g(x)) then there is s-p mixing in that material.


pair programming and teaching

Pair programming is seen as a helpful teaching strategy - in fact, compared to singleton work, almost a magic bullet:   * better learner satisfaction   * higher exam scores   * for longer - later exams continue to show higher scores   * better results in later work that relies on the pair learning Are there pitfalls to the strategy? When is pair programming most efficient for learning and when is it best avoided?


Should I use non-standard tags in a HTML page for highlighting words?

I would like to know if it's a good practice or legal to use non-standard tags in an HTML page for certain custom purposes. For example: > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam consequat, > felis sit amet suscipit laoreet, nisi arcu accumsan arcu, vel pulvinar odio > magna suscipit mi. I want to highlight "consectetur adipiscing elit" as important and "nisi arcu accumsan arcu" as highlighted. So in the HTML I would put: > Lorem ipsum dolor sit amet, <important>consectetur adipiscing > elit</important>. Nullam consequat, felis sit amet suscipit laoreet, > <highlighted>nisi arcu accumsan arcu</highlighted>, vel pulvinar odio magna > suscipit mi. and in the CSS:               important {      background: red      color: white;     }          highlighted {      background: yellow;      color: black;     }      However, since these are not valid HTML tags, is this ok?


should I be putting database connections into a class library?

This might be a stupid question but I've never created a class library before The reason I don't want to be connecting to a database through the class library is error handling.. should I just leave the errors to throw back to whatever code is using the class library? should I handle it there? or should I just leave it completely and take the whole database object out of the library, creating it seperately/ copying and pasting every time I want to use it. This is a small project with only 12 classes, all under 200 lines and is only going to be used on in house company applications. I'm probably going to be the only one using it to develop with unless I leave and someone needs to make changes to the applications. It's c# if that makes even the slightest difference?


What operating systems use both a Render thread and a UI thread?

Microsoft employees commonly describe Windows 8 as having both a Render thread and UI thread. Typically they say the Render thread performs animations and the UI thread handles most other operations: parsing, layout, applying templates, data binding, input processing, most app callbacks, etc. > Animations can be calculated from beginning to end when they are created. > Sometimes the changes to the property being animated don’t affect rest of > the objects in a scene. These are called independent animations and they are > run on the **composition thread instead of the UI thread**. This guarantees > that they remain smooth because the composition thread is updated at a > consistent cadence... Is this a common architecture or unique to Windows 8? What about Windows Phone 8? Android? iOS?


Randomization of biomes

You know how in Minecraft, the World is ever-expanding and all the biomes are randomized? My generalized question is: In relation to a space simulation that is also ever-expanding as the player moves about the world, how would one go about programming this randomization in Java? My real question is: Could I get a simplified example broken down into these example classes:   * astroids (This would include how many astroids there are, their positioning in space, their size, how often the larger astroids occur, how close they are to each other, the limitations of how many of the large asteroids can be in one field, how often astroid fields are generated, etc.)   * star-types (size, color, type, how often they occur, where hey occur, etc.)   * inhabitable-planets (size, positioning, how often they're generated, where they are generated, etc.) This would be very helpful currently since I wish to make a simplified version of such a program.


Any tips on getting hired as a software project manager straight out of college?

I graduated with a BS in compsci last September, and I've been trying (unsuccessfully) to find a job as a project manager ever since. I fell in love with software engineering (the formal practice behind it all, not just coding) in school, and I've dedicated the last 3-4 years of my life to learning everything I can about project management and gaining experience. I've managed several projects (with teams around 12 people) while in school, and I worked with my university's software engineering research lab. My résumé is also decent - I worked as a programmer before I went to school (I'm 27 now), and I did Google Summer of Code for 3 summers. I also have general "people management" experience via working as the photo editor for my university's newspaper for 2 years. My first problem with the job hunt is not getting enough interviews. I use careers.stackoverflow.com, which is awesome because I usually get contacted by non-HR people who know what they're talking about, but there's just not enough companies using it for me to get interviews on a regular basis. I've also tried sites like monster.com, and in a fit of desperation, I sent out no less than 60 applications to project management positions. I've gotten 3 automated rejection letters and that's it. At least careers.stackoverflow gets me a phone interview with 8/10 places I apply to. But the main (and extremely frustrating) problem is the matter of experience. I've successfully managed projects from start to finish (in my software engineering classes we had real customers come in with a real software need and we built it for them), but I've never had to deal with budgets and money (I know this is why HR people immediately turn me away). Most of these positions require 5+ years PM experience, and I've seen absurd things like 12+ years required. Interviews are also maddening. I've had so many places who absolutely loved me and I made it to the final round of interviews, and I left thinking things went extremely well and they'd consider me. However, when I check in with them a week later, they tell me "We really liked you and your qualifications are excellent, but we're hoping to find someone with more experience." The bad interviews I can understand - like the PM position that would have had me managing developers both locally and overseas - I had 3 interviews with them and the ENTIRE interview process was them asking me CS brainteasers and having me waste time on things like writing quicksort on paper or writing binary search trees. Even when I tried steering the discussion towards more relevant PM stuff, they gave me some vague generic replies and went back to the "We want to be Google/MS" crap. But when I have a GOOD interview, they say my "qualifications are excellent" but they want "more experience"...that makes me want to tear my hair out. What else can I DO? While I'm aiming for technically-involved PM positions (not just crunching budget numbers), I really don't want a straight development job because I like creating software from the very high-level vs. spending a lot of time debugging memory leaks. In fact, I can't even GET development positions that I'm qualified for because I make the mistake of telling them that my future career goals are as PM (which usually results in them saying something like "Well we already have PMs and this position isn't really set up to get you there." - which I take to mean "No, that's my job, stay away.") My apologies on the long rant, but I'm seriously hellbent on getting hired as a PM since it's both my career goal and the passion that keeps me awake at night. Any suggestions on what the heck else I can do? I'm currently writing a blog where I talk about my philosophies about software engineering, and I'm writing up specs for an iOS app which I will design, code, and show employers, but this takes an awful lot of time that I don't have.


Is it evil to model JSON responses to classes when they are mostly smilar?

Here's the problem : While implementing a C# wrapper for an online API (Discogs) I've been faced to a dilemma : quite often the responses returned have mostly similar members and while modeling these responses to classes, some questions surfaces on which way to go would be the best. Example : Querying for a 'release' or a 'master' will return an object that contains an array of 'artist', however these 'artists' do not exactly have the same members. Currently I decided to represent these 'artists' as a single 'Artist' class, against having respective 'ReleaseArtist' and 'MasterArtist' classes which soon becomes very confusing even though another problem arises : when a category (master or release) does not return these members, they will be null. Though it might sound confusing as well I find it less confusing than the former situation as I've tackled the problem by simply not showing null members when visualizing these objects. Is this the right approach to follow ? An example of these differences :               public class Artist     {         public List<Alias> Aliases { get; set; }         public string DataQuality { get; set; }         public List<Image> Images { get; set; }         public string Name { get; set; }         public List<string> NameVariations { get; set; }         public string Profile { get; set; }         public string Realname { get; set; }         public string ReleasesUrl { get; set; }         public string ResourceUrl { get; set; }         public string Uri { get; set; }         public List<string> Urls { get; set; }     }          public class ReleaseArtist     {         public string Join { get; set; }         public string Name { get; set; }         public string Anv { get; set; }         public string Tracks { get; set; }         public string Role { get; set; }         public string ResourceUrl { get; set; }         public int Id { get; set; }     }      Edit : I decided to keep things as simple as they can be : separated. ![enter image description here](http://i.stack.imgur.com/y7Ggj.png) There are few weird names but it'll always be less confusing than the previous situations.


Need suggestion for Mutiple Windows application design

This was previously posted in StackOverflow, I just moved to here... I am using VS2008, MVVM, WPF, Prism to make a mutiple window CRM Application. I am using `MidWinow` in my `MainWindow`, I want   1. Any `ViewModel` would able to make request to `MainWindow` to create/add/close `MidChildWindow`, `ChildWindow`(from WPF Toolkit), `Window` (the Window type).   2. `ViewModel` can get the `DialogResult` from the `ChildWindow` its excutes.   3. `MainWindow` have control on all opened window types. Here is my current approach: I made `Dictionary` of each of the windows type and stores them into MainWindow class. For 1, i.e in a `CustomerInformationView`, its `CustomerInformationViewModel` can execute `EditCommand` and use `EventAggregator` to tell MainWindow to open a new `ChildWindow`. CustomerInformationViewModel:               CustomerEditView ceView = new CustomerEditView ();     CustomerEditViewModel ceViewModel = CustomerEditViewModel ();     ceView.DataContext = ceViewModel;     ChildWindow cWindow = new ChildWindow();     cWindow.Content = ceView;     MainWindow.EvntAggregator.GetEvent<NewWindowEvent>().Publish(new WindowEventArgs(ceViewModel.ViewModeGUID, cWindow ));     cWindow.Show();      Notice that all my `ViewModel` will generates a `Guid` for help identifies the `ChildWindow` from `MainWindow`'s dictionary. Since I will only be using 1 View 1 ViewModel for every Window. For 2. In `CustomerInformationViewModel` I can get `DialogResult` by `OnClosing` event from `ChildWindow`, in `CustomerEditViewModel` can use `Guid` to tell MainWindow to close the ChildWindow. Here is little question and problems: Is it good idea to use Guid here? Or should I use HashKey from ChildWindow? My `MainWindows` contains windows reference collections. So whenever window close, it will get notifies to remove from the collection by `OnClosing` event. But all the Windows itself doesn't know about its associated Guid, so when I remove it, I have to search for every KeyValuePair to compares... I still kind of feel wrong associate ViewModel's Guid for ChildWindow, it would make more sense if ChildWindow has it own ID then ViewModel associate with it... But most important, is there any better approach on this design? How can I improve this better?


Avoiding Object Oriented Pitfalls, Migrating from C, What Worked for You?

I've been programming in procedural languages for quite some time now, and my first reaction to a problem is to start breaking it down into tasks to perform rather than to consider the different entities (objects) that exist and their relationships. I have had a university course in OOP, and understand the fundamentals of encapsulation, data abstraction, polymorphism, modularity and inheritance. I read Learning to think in the Object Oriented Way and Learning object oriented thinking, and will be looking at some of the books pointed to in those answers. I think that several of my medium to large sized projects will benefit from effective use of OOP but as a novice I would like to avoid time consuming, common errors. Based on your experiences, what are these pitfalls and what are reasonable ways around them? If you could explain why they are pitfalls, and how your suggestion is effective in addressing the issue it'd be appreciated. I'm thinking along the lines of something like "Is it common to have a fair number of observer and modifier methods and use private variables or are there techniques for consolidating/reducing them?" I'm not worried about using C++ as a pure OO language, if there are good reasons to mix methods. (Reminiscent of the reasons to use GOTOs, albeit sparingly.) Thank you!


What is a good strategy for testing UserControls?

A UserControl cannot be dragged-dropped onto a winform. Instead, I must compile the assembly add it to my toolbox, then I can drag it onto a Form. Doing this toolbox approach just to test out a control and then "tweak" it repeatedly is quite cumbersome. Right now, I plan to simply have this toolbox item pointing to a bin/debug assembly which will be repeatedly re-built. I imagine this will come with it's own set of problems. So what is a good strategy for testing UserControls?


Resources for popular domain models

I have come across many situations where I had to build a system for a library or a clinic or other popular domains.   The thing is a domain model for a library was probably done 1000 times already with different level of details of course. Here is an example. Is there a popular website or community where one can find ready made domain models for popular systems?   The whole purpose I'm trying to achieve is to quickly get a grasp of the domain I'm modelling and customise it to my needs. Re-inventing the wheel seems really absurd when the same system might have been modelled properly previously. **Note**   I know Google might sound like the perfect source, but it will better if there is a repository out there that people can post there models, so that others can share them.


May I remove ads from feed in my news reader app?

I'm creating a News Reader app for Tablets and PCs. My app is fetching data from news sources by **RSS feed** of websites (in the server-side). But some of these sites are showing some advertising banners at the end of each article. Should I remove those banners from the feed? Am I legally/ethically allowed to do this? And what about If I want to put some other ads in my application? (Right at the end of each article) I mean, If I want to have my own advertising service... _Update:_ And what if I **use feed for content titles and summaries** , but use **other thing** , like Readability API **to show full article** , and then put my own ads below content? (Readability gets the HTML page, and gives you a clean page without any ads and such.)


Domain Models (PHP)

I have been programming in PHP for several years and have, in the past, adopted methods of my own to handle data within my applications. I have built my own MVC, in the past, and have a reasonable understanding of `OOP` within php but I know my implementation needs some serious work. In the past I have used an `is-a` relationship between a model and a database table. I now know after doing some research that this is not really the best way forward. As far as I understand it I should create models that don't really care about the underlying database (or whatever storage mechanism is to be used) but only care about their actions and their data. From this I have established that I can create models of lets say for example a Person an this person object could have some Children (human children) that are also Person objects held in an array (with addPerson and removePerson methods, accepting a Person object). I could then create a PersonMapper that I could use to get a Person with a specific 'id', or to save a Person. This could then lookup the relationship data in a lookup table and create the associated child objects for the Person that has been requested (if there are any) and likewise save the data in the lookup table on the save command. This is now pushing the limits to my knowledge..... What if I wanted to model a building with different levels and different rooms within those levels? What if I wanted to place some items in those rooms? Would I create a class for building, level, room and item with the following structure. building can have 1 or many level objects held in an array level can have 1 or many room objects held in an array room can have 1 or many item objects held in an array and mappers for each class with higher level mappers using the child mappers to populate the arrays (either on request of the top level object or lazy load on request) This seems to tightly couple the different objects albeit in one direction (ie. a floor does not need to be in a building but a building can have levels) Is this the correct way to go about things? Within the view I am wanting to show a building with an option to select a level and then show the level with an option to select a room etc.. but I may also want to show a tree like structure of items in the building and what level and room they are in. I hope this makes sense. I am just struggling with the concept of nesting objects within each other when the general concept of oop seems to be to separate things. If someone can help it would be really useful. Many thanks


help for choosing an encryption method for a database column

I'm storing some phone numbers in the database which should kept totally secret (they're supposed to access via web). BTW, because of the position of these people, I need to prevent any chance for leak of their numbers. So, the only solution I could thinking of is Encryption. As the database could contains bunch of data, I won't encrypt the database entirely. Also, I actually prefer to use different key for each person to encrypt their phone numbers, so in the case of leaking one key, the other phone numbers should be safe at least. The problem is that other people also need to send SMS messages via the application through a web-interface and also some more privileged persons need to see these numbers, so I also need to make these numbers visible to the other privileged persons by the way. I'm wondering of something like a public-key/private-key structure, but it's too much for just encrypting a phone number per person, and also there would be a problem for new users, because the previous numbers didn't encrypted with their public-keys. So, is there any solution you might recommend to me? maybe I should to revise or update the structure of how I'm trying to do that, huh?


Access functions from user control without events?

On some generic functions, it seems that accessing a function on mainform directly from the usercontrol is easier than raising an event. For example: A function on main form that displays one desired usercontrol centered and tweaked. Making this function static, or access this function by reference from the user control to its parent, rather then raising an event, seems very convenient. Like this:               usercontrol_A uc_a = new usercontrol_A();     MainForm mainform_functions = (MainForm)Parent;     mainform_functions.DisplayControl(uc_a);      Raising an event seems more complex in such cases - I need to declare all new userControl_B's events (which also includes initiating usercontrol_C and displaying it) inside the event that shows (and initiates) userControl_B:                 userControl_A.ShowUserControl_B+= (s,e) =>      {      usercontrol_B uc_b = new usercontrol_B();   DisplayControl(uc_b);         uc_b.show_uc_c += (s2,e2) => {usercontrol_C uc_c = new usercontrol_C(); DisplayControl(uc_c); }      }         _too much clutter here_. That's hard to code and to read later. (In addition, passing parameters to another usercontrol is a nightmare like this - I need to save the parameter artificially on the sender usercontrol class and then cast it back later inside the event) **What is your opinion? Is it a completely "prohibited" to code like this, at least on generic functions like I mentioned? Isn't clearer code that needs some small tweaking for reuse preferable?**


What's the difference of an object being final and an object being immutable in java?

final String str = "do not change me";     str = "why not?"; //it will result in compile time error saying that final fields can not be re-assigned once created i.e. the reference cannot be changed          String str1 = "hello world";           System.out.println(str1.replaceAll("h", "q"));         str1 = str1.replaceAll("h", "q");         System.out.println(str1);  //An immutable object on the other hand means that, there is no way for you to change the object or its contents other than changing the reference.      Is the above understanding of definition of a **final** object and **immutable** object correct?


Is server validation necessary with client-side validators?

I recently created a .net web app that used over 200 custom validators on one page. I wrote code for both `ClientValidationFunction` and `OnServerValidate` which results in a ton of repetitive code. My sql statements are parameterized, I have functions that pull data from input fields and validates them before passing to the sql statements or stored procedures. And the javascript validates the fields before the page submits. So essentially the data is clean and valid before it even hits the `OnServerValidate` and clean after it anyways due to the aforementioned steps. This makes me question, is `OnServerValidate` really needed when I validate on the clientside? **Edit:** My `OnServerValidate`s do simple things like making sure a skip pattern is enforced or that a short appears in a text (which is enforced anyways with my code that pulls data from text fields into parameters i.e. GetShort()). And these are being place in patient surveys, which most of the time are filled out by staff members. So it seems like if I didn't have the `OnServerValidate` for these basic checks and just client side the following situations are:   1. A user turns off javascript and cannot submit the form, which is expected as buttons are javascript driven for postbacks.   2. A user forces a post. Which if this occurs my `OnServerValidate` would do jack to stop whatever they are trying to do since it is just looking at skip patterns, or would it? Situation 2 is where I am getting lost. It seems like the user forcing a post is more than likely not to be caught by these simple `OnServerValidate`s


Protecting yourself from intellectual theft

I have been working on a project for about 6 months and it is finally _done_. Done meaning the bones of the software, all the servers are in place, the beta testing is ready to begin and in the real world. The project No Free Time is ready to get a **real name** _(scary right)_. Domains need to be bought... you get the idea. Where to go now though, when developing a for profit piece of software like a webapp there are a lot of issues and I do not even know square one. There are intellectual property concerns, there are trade marks, there is lawyer stuff. All of those things are expensive and probably don't need to happen at once. Is that the first step, and which of those steps are the most important. How do you get a webapp or piece of software off the ground safely? How do you begin to establish and protect your software/website/intellectual property, what are the cheap first steps, what steps can be postponed, and what must absolutely be completed before your software touches the public?


Teaching programming, quickly to those adults that haven't programmed

I want to be very specific in my question to avoid duplicate question. Hopefully this is adequate. I am working with non-programmers on a project. They are adult and in IT but they may not have the math background or any programming or heavy computer experience. What are the quickest ways to teach them programming concepts. Just the concepts so that they quickly get programming (as much as they can). Let's say that you have 2 weeks to understand X programming language oriented technology. And these are adults not students. What are some of the best ways for them to understand some of those concepts? What are some solid techniques that really help a non-programmer get the big picture quickly? And I was trying to avoid talking about specific language implementations. **Notes:** I see two major hurdles with non-programmers, (1) They don't understand what a computer really is. To them, it may seem like a magical device. (2) They don't have the time to hack out or even learn programming. There are just some concepts like recursion or understanding data structures that may take at least one all-nighter. They don't have the time to debug and test out a solution. I have worked with people and gone through a programming task (editing properties) and gone through that task step-by-step and asked them to repeat those steps exactly. This works but once they miss a step, then they can't recover. Basically, they aren't understanding what is going on.


In event sourcing, is it ok to introduce a dependency in my message class?

Following Martin Fowler's explanation on event sourcing, I have a message class that looks something like this:               ShippingEvent     {         Process(Ship ship) {}     }      However, in my case, I need to talk to another component in the `Process` method. More specific, I need to access a repository to get some basic data. Is it ok to add this repository to the method, i.e.:               ShippingEvent     {         Process(Ship ship, IBasicDataRepository repo) {}     }      I could put it in the constructor of my message too, of course. However, I can't pass in the basic data, because the repo will be called multiple times with different parameters, depending on what's in the ´ship´ object. So is it ok to introduce external dependencies in the event/message class or is there a better way?


Scrum is methodology or framework?

I am confuse about scrum .it is methodology or Framework?. I want to use scrum for development but i want to develop scrum tool but i am confuse scrum is methodology or framework?


Algorithm for indexing strings in "list"

Imagine I have file called `strings.dat`. Inside this file there is alot of string, for example: one million. **String are sorted**. Now I want to find specified string, so I can write method like this:               public long FindByName (string text)     {       // ...     }      This method can return to me a position within a file where this string occurs. But iterating through lots of data is not efficient. I can do some indexing system, like an `Dictionary<char, long>` which tells about at what position within file is placed first string with its value starting from given char. Example: if I got 5 strings: hello   hello2   world   world2   Zzz So my dictionary will be like:   h 0   w 2   z 4 But it's not efficient if I will have 1000 string with "d" char as first letter, and 10 million with "r" letter. Do you know any good algorithms do ahieve what Im asking for?


Switching CSS to use asset pipeline in Rails?

I have a lot of legacy CSS files from what was a Rails 2.x app that got upgraded to Rails 3.2.8, and I want to switch over to using the Rails asset pipeline for stylesheets. The issue is, the CSS stuff is messy in terms of huge lines of code, duplicate file names, and unorganized folder structure. After looking through individual pages, and trying to add individual stylesheets and folders into the asset pipeline and spending some cycles debugging, I realized there's probably a better approach. Is there a way to test to make sure the old CSS matches up with the asset pipeline CSS? What are some good tools for testing and debugging CSS?


How to convert a Bazaar repository to GIT repository?

We have a large bazaar repository and we want to convert it to a git repository. The bazaar repository contains the folders of each of the interns. Any documentation/code prepared by interns is committed in their directory so there are a huge number of commits. What steps should be performed to securely convert the bazaar repository to a git repository so that we do not lose any commit information. We firstly need to create a backup of the existing bazaar repository and then convert it. Edit: I followed this link: http://librelist.com/browser//cville/2010/2/9/migrate-repository-bzr-to-git/ It's working fine on my system with Ubuntu. But when I try to run it on the actual server it gives me EOF error and crashes               Starting export of 1036 revisions ...     fatal: EOF in data (1825 bytes remaining)     fast-import: dumping crash report to .git/fast_import_crash_11804      Edit 2: I also tried it on a new CentOS system and received the following error               fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.     Use '--' to separate paths from revisions


What benefit do I get from good methodology?

One of my friends has worked for nearly 10 years, asked me why he needs to learn new things such as unit-testing, MVC, Multi-tier architecture (he creates 3-tier application but designs like 2-tier), Object-oriented programming or etc? He has worked for a decade without unit-testing, uses code-behind and structure programming and it works for him. He can deliver product to customer and he has a high income. What benefit will he see from those methodologies?


What was the first consumer-oriented hardware/software solution?

We all know the story of the personal computer as a consumer-oriented product. But I just thought that real end user solution should have appeared before that time. So a product that was probably expensive, but allowed using it as a service charging for it, for example computer-terminal for transport time- table access or game machine. On the other site, the video terminals as we know them appeared not so long ago. So if there was something like this, this could be hardware/software most likely offering no interactivity, but probably printing some information based on user actions.


Is acoustic fingerprinting too broad for one audio file only?

We were looking for some topics related to audio analysis and found acoustic fingerprinting. As it is, it seems like the most famous application for it is for identification of music. Enter our manager, who requested us to research and possible find an algorithm or existing code that we can use for this very simple approach (like it's easy, source codes don't show up like mushrooms):   1. Always-on app for listening   2. Compare the audio patterns to a single audio file (assume sound is a simple beep or beep-beep)   3. If sound is detected, send notification to server With a flow this simple, do you think acoustic fingerprinting is a broad approach to use? Should we stop and take another approach? Where to best start? We haven't started anything yet (on the development side) on this regard, so I want to get other opinion if this is pursuit is worth it or moot.


Actions and Controllers managing strategy in MVC apps

Can anyone name any usefull strategy/architectural pattern for allocating actions between different controllers when using MVC pattern for developing web application? I am now developing web app using asp.net Mvc3 framework and still can't figure out how to manage actions and controllers. One approach is to create single action controller for each url, but it's not the best choice since to much controllers have to be created. Should I list all available urls that are supported by me web app, devide them into groups and create separate controller for each group or act in any different manner? It seems like I will become face to face with some kind of mess with no consistent approach in managing actions and controllers.


How do I best go about updating my programming skills?

I have worked in a highly specialized position for 10 years which involves RPG, CLP programming on an AS400, mainly to supplement a poorly written EDI app. My company does not hire enough people so I have also been wearing other hats up to and including help desk. The job is so demanding and frustrating that I am ashamed to say I have lost some of my skills in other programming languages and I have not had time nor the money to pay for any refresher courses. In fact I would not even know where to start. What is the easiest way for a person like me to transition from doing something I hate to something more fun or at least a change of pace.. like Web Development? I am looking at taking a training course and eventually getting an MCPD certification..would this do it? Also, do you really have to have some hands on experience with these languages to get certified or would 10 years of programming in another language suffice? Any advice would be helpful as I am extremely unhappy with my current professional life.


Can certain expectations of behavior be part of an interface's contract?

Given the following code:               public interface IUserDataProvider {                 ICollection<SomeClass> getSomeClassRecordsForUser(int idUser);     }      Is it possible to define (via documentation) an expectation that any implementing class returns null instead of an empty collection (or vice versa) when no records are found? I realize interfaces do not have explicit control over how they are implemented, but considering that interfaces are said to define a contract, I'm wondering how far the jurisdiction of that contract can rightfully extend. Thanks in advance for your responses.


Organizing a git repository with several projects sharing code

I have several small projects running on different embedded hardware, and about 50% of their code is identical (typically some drivers, their operating system, and some libraries). I want to merge those small projects into a single git repository so that it becomes easier to centrally maintain them, for example to update a driver. However, when modifying the code shared between the different projects, let's say a driver, I don't want to have to test it on every hardware platform before pushing to the git repo. It would not scale at all as to test the code for a given project I have to test it on a specific per-project hardware and if necessary correct the project-specific bugs which could be introduced by the modification of the shared code. It is a lot better to delay the testing of the shared-code modification on a given project the next time I want to modify this project. At the moment, here is the solution I came with: the directory structure would be as such: > >                      . >                      |--shared_code >                      |--projects >                         |--projectA >                         |--projectB   >                         |--projectC >   I would create a git branch per project, which would only represent until which commit the code was tested for a given project. Hence I would push code only to the master branch, and merge the code from the master branch to a project branch once it has been tested on this platform. Like this a project branch would always be in a stable (tested) state. The master branch would be unstable for most of the projects. git structure: > >                                                  master >                                                    | >       commits: 1 <-- 2 <-- 3 <-- 4 <-- 5 <-- 6 <-- 7 >                      ^     ^                       ^ >                      |     |                       | >       branches:      A     B                       C >   Is this the correct way to solve this problem? Is there a better solution?


Do good project managers need a programming background?

Sometimes I can't stand it when project managers ask me to estimate time to complete for various tasks. An estimate is a guess, and guesses can be wrong. Generally, bad requirements and documentation will lead to bad guesses. So I often wonder if the project managers were ever in my shoes trying to guess at how long task X and Y will take, and how difficult it is to assign a number to it based on what little is known and collected from the client. My question then is: **Do good project managers need to have a programming background?** Or maybe the question should be, **do good project managers need to have been a _good_ programmer before?** Is there any correlation?


Is Apple getting out of the general purpose development platform business?

I've been doing general ANSI C/Console C++/Java/Web development on Mac hardware for about ten years. I make no claims of objective superiority over other platforms, it just satisfies my personal tastes. With the success of the iPhone and the related App store there was some speculation that Apple would get out of the general purpose computer market, and become a closed software ecosystem, focusing on consumer appliances. I pooh-poohed the speculation at the time, but this week Apple announced that a) they were opening an App store for the Mac, b) Java applications would not be eligible for the App store, c) the Apple JVM was being deprecated and might not be available for future releases of OS X. I'm not a Java developer per se, but I work in a research lab that occasionally writes Java applications, and also depends on tools written Java. This has the potential to be a huge pain in the butt for us. As of now, there is no other JVM for OS X that we can point our end users to. Soy Latte and OpenJDK might be appropriate for developers, but the complexity of the installation makes them inappropriate for end users. Eventually I expect Oracle/SUN will produce a replacement JVM for OS X. More worrisome to me is that Apple used to specifically advertise that it was an excellent platform for scientific development, because they supported all major language platforms. Is the deprecation of their JVM a sign that this market no longer interests them?


Should we call Web API from MVC application in same solution?

I am working on a project in MVC that has mobile application so one thing is clear that we have to use Web API so it can used in mobile application. After creating API when we started to develop Web site we are confused and had discussion on whether to use API or directly access to the Business object. And we ended up after having opinion form more experienced developer to consume Web API instead of using Business object directly. I'm having confusion regarding to this solution structure. 1) Why we should use Web API and make HTTP request (which is time consuming) to get or put data instead of business object directly which is in same solution. 2) After having arguments they said what if client wants to host API and web on different cloud server and apply scaling only on API or may be he want to have different url for accessing API and Web (which is some what logical). So in that case should we call Web API from MVC application in same solution? 3) If we're hosting API and Web on different hosting so it means our Web will use WebClient and have HTTP call on each navigation. Is it right? 4) If we'll business object form both API and Web hosting on different server then if something change in BL will need to update build on both server. 5) Or we should create only one project for API and can add views or html pages to develop Web interface so in that way we can directly call API from ajax. As per my knowledge #5 is the best solution or API is only for 3rd party access. If we have DB, EF, data layer and business layer in same solution then we should not use API to make HTTP calls and directly access business object. (correct me if I'm wrong)API is needed when mobile application or desktop or any one want to access application so we can have same repository and data layer. In my scenario I've to create API as we also have mobile application, and in project API side we called business layer (separate project) and business layer communicate to data access layer (separate project). So my question is if we host our API and web to different servers then calling API which is a HTTP request may take longer rather than using method from business layer as we create the project and we've .dll of business layer. In API controller we just convert out put of our business to json format. I've searched on internet but didn't get convincing answer. I've found a blog http://odetocode.com/blogs/scott/archive/2013/07/01/on-the-coexistence-of-asp- net-mvc-and-webapi.aspx discussing same point but again in that blog my question is why we need to consider scenario #3? Update: We can have different API project and MVC project and we can call API from web using jvascript or can use MVVM pattern.


Becoming an expert vs boredom

I am a college student, and I love to program, period. I code all kinds of things in different kinds of languages. Although I enjoy programming, I have an extremely hard time sticking to one project for a long time. I attribute this shortcoming to my high level of curiosity, exploring different technologies, languages, libraries, etc. What would be best? Should I settle down more and spend time on becoming an expert in one or two programming fields, or should I be more of a jack of all trades, trying out all kinds of new technologies, languages, programming methods, etc.? I'm guessing that somewhere in the middle would be best. I'm always amazed at how many developers are able to create one or two projects, and develop on them for years. What techniques do you guys employ to help you stay focused on a project?


How do you coordinate with co-workers to give a balanced interview?

My company has been conducting a lot of interviews lately for candidates with various experience levels, ranging from interns to senior candidates. We put our candidates through five 45 minute interview sessions where we try to ask a range of questions. One person always asks the same questions that test logic and communication. The rest typically split time between a whiteboard coding question and a discussion of previous projects, technologies the interviewee has worked with, and what he/she is looking for a job. Generally, we know the range of questions that other people on the loop will ask. Sometimes we switch things up and end up having redundancies. Today, 3 interviewers asked tree-related questions. Other times, we've all honed in on the same project on a resume and have had the interviewee talk about it with everyone. I think a smooth interview process would help us learn more about the candidate while giving the impression to the candidate that we have our act together as a team. **How do you coordinate with others in the interview loop to give a balanced interview?**


What should I aware of , when preparing a document of website for later maintenance use?

The development team has finished a website and my duty is to prepare a document so that other programmers can maintain the website with ease. I have no experience in this and would like to ask what should be mentioned (document structure) in that report? So far my idea is only to prepare a ERD diagarm for the database and flow chart for each function. Any other suggestions, eg. what cookies stored?


What to consider when choosing a framework for a development team?

As I'm finishing a web development course with a few friends with whom I have worked in many projects we're aiming to begin a professional team of developers. Functions are well defined between programmers, analysts and designers, and the team shouldn't get to a much larger number than six members. To quicken development and keep each developer's work from overlapping with others', an MVC framework has been considered by the group. The front-end developers shouldn't mind which one is chosen since it's all based around web standards for them, but me and the other programmers have been considering a few options. Since the question is getting really verbose, I'll just summarize what I would like more experient developers' opinions on:   * What should be considered when choosing a web framework? For small projects, performance shouldn't be a killer factor, but would it still be reasonable to remove Ruby/Python systems from the competition?   * Is being able to work on more than one programming language, or more than one framework in a given language something important?   * Should the learning of one or more frameworks be done in group, or on each developer's own, and then gather opinions on them?


In C++11 can Auto be used to get around mis-casting of void * parameters in functions?

If I have a generic function that takes a void* as a parameter, can Auto in C++11 help stop any bad casting of that parameter? For instance, we may have an event system that sends events and a pointer to some data that is relevant for the event it sends.               void EventClass::SendEvent (eventTypeEnum eventType, void* eventData)     {       int* castEventData = static_cast<int*> (eventData);            //.. Do something       }      In the above example, one eventType could be sent with eventData as a float* and another as a pointer to a structure. The static_cast there will be mis- casting and causing problems. Is there a way auto could be used to avoid this issue. Please note, this is just an example (not a great one though sorry) to help me understand the possibilities of auto and not an actual issue I have.


How to parallelize a sequential algorithm?

What thought process should one follow to convert a sequential algorithm to a parallel one ? Are there any specific code pattern that can be parallelized. Some patterns that I normally use are:   * Looking for loops that can parallelized.   * Try to break algo in some form of Map-reduce format.   * Looking for producer-consumer pattern.


What kind of innovative non-cash financial benefits do I offer to my developers to retain them along with a competitive salary?

Stock options don't make much sense, since the company's private. [It still does, if you are a facebook of sorts AND the regulatory system permits sites like secondmarket, but I digress.] I could think of some:   1. Health benefits to parents and parents-in-laws   2. Sponsoring a fuel-saving bike to drive to office    3. Gift cards for occasions like completion of 1, 3, 5 years of service I really could do with more suggestions here. **EDIT:** Thanks everyone for the response. To summarize, here are the additional things my HR could do:   1. Matching contribution to employee retirement fund provided the employee contributes   2. Funding continuing education, professional courses etc.   3. Company subscription to ACM, IEEE, Safari Books etc.    4. Meal vouchers   5. Membership to gyms   6. Hosting a recreation room at office   7. Spot bonuses    8. Time off for code spikes in recognition of individual contribution    9. Sabbaticals


How to design to allow for future logic revision?

The typical programming designing method that I've come to use goes like this:               1. ID the problem and what's required     2. Make your program do something simple     3. Test it     4. Make your program do a little bit more     5. Repeat 2 until all the micro problems are solved by the program as a whole      Basically, incremental design. So, all the pieces can be split apart and each micro problem is solved by a micro problem function; does a great job with cohesion and reduces coupling. Then, sometime in the future, the program comes across a problem that is just like the problem it is built on, but requires a little extra. So, I'd say add the functionality to the program, to make up for it. If, when you're adding that functionality, the already established working logic has to be edited to make the new functionality work, it suddenly seems like you're messing with something you shouldn't. So, is there a designing method where every program developed with it can be added onto without compromising working logic? Example:               word = yes,no,"maybe,so"          oldCSVSplit(word, ",") -> {"yes", "no", "\"maybe", "so\""}     newCSVSplit(word, ",") -> {"yes", "no", "maybe,so"};      The oldCSVSplit function does what it should, split on ",". Then, sometime in the future, commas inside quotes must be ignored to properly get entries. Adding the functionality to ignore single/double quotes would severely alter the logic, with more ifs and checks and even a stack for keeping track of starting quotes. Is such a scenario avoidable? What method can make such additions painless and less compromising to working logic?


Database design grouping many tables with their common fields

Is this a valid DB design? A user can create an organization, link as many offices to it, have an inventories that host items linked to organization or office, have clients for his business etc.               | users |   |taxonomy|   |settings|     |-------|   |--------|   |--------|     | id    |   | id     |   | tax_id |     | login |   | user_id|   | title  |     | etc.. |   | parent |   | value  |                 | type   |   | name   |                              | type   |      I have 3 tables:   1. **Users** contain all people, be they "users" or ,"clients", since the 2 types are people, _even though client does not have access to the app_ \- yet he is a human and he use exact same fields as app user (name,dob,address,phone number,ss number etc.) and the fields client doesn't use (login,password) should not hurt anyway.   2. **Taxonomy** is a bigger deal, since basically everything a user can create inside the website is in defined in this table. Type is limited to values of "organization, office, service, inventory, blog".   3. **Settings** is where the extended information about the above definitions are kept in. For example "office taxonomy has 3 other rows in settings title: address, opening_hour, closing_hour, etc." so whenever I fetch an office I pivot it around its settings to construct office complete table - "pivot in code not sql" So basically taxonomy and settings are the DEFINITION of the environment that the user creates for himself, there are a lot more tables that contain elements like table "blog_posts" that contains posts for the taxonomy Post, or "encounters" for the encounters of user/client inside the taxonomy "office". etc... The reason i came up with such schema was   1. Laziness (why create a table for each taxonomy when i can group them all?)    2. I'm not sure about the exact fields for most of my inventory, and I like to keep my options open. This DB is working fine for me _for now_. Is this a valid way to design DB? Is there any pattern that acts like this one, or is there something I didnt account for and will haunt me in the very near future if I continue using this schema?


Handling Types for Real and Complex Matrices in a BLAS Wrapper

I come from a C background and I'm now learning OOP with C++. _As an exercise_ (so please don't just say "this already exists"), I want to implement a wrapper for BLAS that will let the user write matrix algebra in an intuitive way (e.g. similar to MATLAB) e.g.: A = B*C*D.Inverse() + E.Transpose(); My problem is how to go about dealing with real (R) and complex (C) matrices, because of C++'s "curse" of letting you do the same thing in N different ways. I **do** have a clear idea of what it should look like to the user: s/he should be able to define the two separately, but operations would return a type depending on the types of the operands (R*R = R, C*C = C, R*C = C*R = C). Additionally R can be cast into C and vice versa (just by setting the imaginary parts to 0). I have considered the following options:   * As a real number is a special case of a complex number, inherit `CMatrix` from `RMatrix`. I quickly dismissed this as the two would have to return different types for the same getter function.   * Inherit `RMatrix` and `CMatrix` from `Matrix`. However, I can't really think of any common code that would go into `Matrix` (because of the different return types).   * Templates. Declare `Matrix<T>` and declare the getter function as `T Get(int i, int j)`, and operator functions as `Matrix *(Matrix RHS)`. Then specialize `Matrix<double>` and `Matrix<complex>`, and overload the functions.   * Then I couldn't really see what I would gain with templates, so why not just define `RMatrix` and `CMatrix` separately from each other, and then overload functions as necessary? Although this last option makes sense to me, there's an annoying voice inside my head saying this is not elegant, because the two are clearly related. Perhaps I'm missing an appropriate design pattern? So I guess what I'm looking for is either absolution for doing this, or advice on how to do better.


.properties files in regular src folder okay?

I work on a Java project with a suggested structure (separate src folders for java files and resource files). After moving the message / text related properties files to that folder, the externalize strings mechanism in Eclipse does not work as before. Usually when hovering over the key string in a getString("") call, the tooltip showed the content of the properties file with the default locale. That has been extremely helpful for me personally. It seems as if that feature only works if the properties file is in the same source folder as the Java code that manages the BUNDLE_NAME stuff. Can I make a strong case for moving the properties file back to the src- folder, or should they be kept separate from the java source files? Anything else that I can try to get the feature to work again with the new structure?


import existing pdf using TCPDF library

I'm trying to import an existing pdf file to digitaly sign it using TCPDF library > $pdf = new TCPDF_IMPORT; $pdf -> importPDF('example.pdf'); when I do so I get somthing like this ![enter image description here](http://i.stack.imgur.com/Vn0xD.png) So, what is the best way to import a pdf under TCPDF


What specifically does expressive power refer to?

Expressive Power is defined by Wikipedia as: > .. the breadth of ideas that can be represented and communicated in that > language. Does "ideas" refer to the things (operations, structures, algorithms, etc.?) we can communicate _to the machine_? Or does it refer to the "human" concepts that can be captured and communicated with the language to other humans? How is expressive power assessed and measured? For instance, if we took a language like JavaScript and imposed a weird restriction on variable names, such as _variable must be an 8-digit number preceded by an underscore, matching`/^_[0-9]{8}$/`_, would we lose expressive power? Or would that _only_ be absurd and annoying? * * * **To clarify:** Is expressive power measured by the _general_ ideas inherent to the language:   * integers and strings   * loops   * conditionals Or the number of _specific_ , unique ideas that the language can represent:   * the integers 1, 2 ... 2^32   * strings containing "what does the fox say?" and "wha pah pah pah pah pah pow"   * for each _frog_ in _my collection of frogs_   * if _frog_ is _green or something_ then _do something_


Can I create a query which allows me to do this?

I have a table which stores user information, one column stores their ID. I had implemented four different attributes in the same table which stored a bit indicating which file operations that user could perform (read, create, update, delete). Thankfully, I realized that was terrible implementation and instead created four different tables with one column (the userID) which indicated which actions they could perform. It's really about me being annoyed by the over- whelming number of zeros. It does save on space, even if it's negligible. However, this database is also queried by an application in an OOP language, and one of the objects frequently created is a User. This class naturally stores which file operations the User can perform. In the old implementation, these (boolean-valued) object fields could be quickly populated from the user table, but not now. Now I'm confused on how I should populate these object fields. I feel like I should be able to perform a single query telling me which permission tables the user belongs to, but cannot find the write syntax (if it even exists). So my question is: is there a way to perform a single query to figure out which tables (which only consist of a single column) a value occurs in? Or do I have to query each table independently to fill these object fields?


Storing a single read/writeable value for a web service

I'm writing a web service for some physical visualizations of data we are collecting and showing as part of a project we are running locally http://tenisonroad.com/ Some of the visualizations will be screen based and some will be physical (e.g. page 25 of this presentation from Resonate 2014). One thing my web service will do is signal to the visualizations when to change dataset. To do that I have a single integer, `DemoDataSetsDwellTime`. I started off in SQL thinking to add this value amoung my existing table declarations, e.g.               CREATE TABLE ActiveDemoDwells      (secondsDwell INT NOT NULL)      But this seems wrong - why make a table that is only ever going to store one single number, one single record. So then I thought of using application settings in the Web.config file               [Route("api/getdemodwelltime/")]     [AcceptVerbs("GET", "POST")]     public int GetDemoDwellTime()     {         return Int32.Parse(ConfigurationManager.AppSettings["DemoDataSetsDwellTimes"]);     }      with corresponding entry               <appSettings>       <add key="DemoDataSetsDwellTimes" value="20"/>     </appSettings>      But I have realised (from this answer) that the settings file should not really be used for writeable data, it is more suited / intended for read-only settings. So finally I thought about using a simple flat file, i.e. something like this               [Route("api/getdemodwelltime/")]     [AcceptVerbs("GET", "POST")]     public int GetDemoDwellTime()     {         var lines = File.ReadAllLines("settings.txt");         var dwellTimeLine = lines.TakeWhile(line => line.StartsWith("dwellTime=")).FirstOrDefault();         int result;         return (dwellTimeLine != null && Int32.TryParse(dwellTimeLine.Remove(0, "dwellTime=".Length), out result)) ? result : -1;     }      But that may get in a mess in the (unlikely) event that get and set methods are called simultaneously (I think, I'm not sure how web servers manage local file system access). So, which of these is the 'correct' approach, or is there another solution that I have overlooked?   1. Store the single readable and writeable value in its own table in a database,   2. Store it as an application setting in the Web.config file, or   3. Store it in a flat file.


Diagram to express parallelism in a process workflow

I'm modelling part of a software architecture on which several processes run as a workflow. The architecture involves data parallelism, where a certain serial process produces N pieces of data which need to be distributed to N processes that must run in parallel. I'm looking for a good way of expressing parallelism in a diagram. The objective of this diagram is to be informative and will be included in a paper about the system architecture. It does not need to be a formal model or strictly follow UML. I've drawn 3 ways of representing the parallelism, one of which (2) basically follows the UML 2.0 Activity Diagram. I would like to know which one, if any, will more clearly convey the parallelism. What other information this sort of diagram should include? ![Parallelism diagram](http://i.stack.imgur.com/Rkc7U.png)


What is a good way to structure my UI classes?

So, I have a program which has a swing GUI. (Java - duh!) I really, really don't think the way I'm structuring my classes now is good, so I am reorganizing from the ground up to follow best practices. **Classes:** **UI** \- The big daddy. It's intended usage is to first create the containing JFrame, call for the construction of all of the subcomponents of the UI, then add them in a border layout to the JFrame (would it be wise to structure this as a singleton? After all, I don't want two UI's?) **RightPanel** , **LeftPanel** , **BottomPanel** , **TopPanel** , **CenterPanel**. Different panels of UI subcomponents. I have a class for each of these panels. **Menu** \- The menubar. A seperate class just to keep menu duties seperated from the rest of the UI code. I'm not quite sure how to structure these, within relation to each other. A few possible options I have thought about, (just what I've come up with, there is probably a better way to do all of this):   * Make all classes an inner class of UI. I don't like this option for obvious code bloat reasons.   * Make each class independent of UI. Possibly even make each class a singleton, since I'd only ever need one UI along with all of it's components.   * The millions of better ideas that haven't even crossed my mind. What is a good way to do this? I'm by no means an expert on design patterns yet. I'm still trying to get an exceptionally solid grasp on OOP concenpts. _(Unnecessary additional concerns):_ Additionally, I obviously need a way for my program to interact with the UI, updating displayed information on multiple components from one event, and for buttons within different subcomponents to dispatch to a handler, sending data along on it's way and possibly even modifying other UI stuff. If you could devise an efficient way to structure this I'd love you even more