title: Does non-virtual-by-default lead us to composition-over-inheritance?

text: There are some design guidelines about testable code in “The Art of Unit Testing”. The first one is “Make methods virtual by default”. I’m curious to know your idea about non-virtual-by-default behavior in C#. I’ve read about Hejlsberg opinions but I think one the most important reasons could be that it may lead us to “composition over inheritance” principal. Could “composition over inheritance” be one of those reasons which make non- virtual-by-default preferred over virtual-by-default? **UPDATE** Regarding this subject, please consider test-driven point of view; where we want to write testable code. While we are encouraged to make all members virtual by default (at the mentioned book), we can follow "composition over inheritance" and keep going non-virtual-by-default. Isn't it better?


title: Google App Engine -- should we use it?

text: I'm considering using Google App Engine for an online matchmaking (and possibly ranking, not sure) of users in a (currently hypothetical) RTS game. However, I just read this bad review, which has made me nervous. Which problems have they solved (or are planning to solve), which might be an issue for me, and are there any alternatives?


title: What are the current problems involved in software engineering programming patterns?

text: can someone suggest me the current problems in software engineering and the research links for it? i have some knowledge on MVVM being a pattern but i would like to know more about others and also current problems as to why people go for the patterns and how they help and what are still current problems involved and the research involved in this field any help is greatly appreciated, Thank you


title: Strategy while coding

text: I read in one of the article "45 minutes of coding and 15 min of resting". I started implementing this, Initially for smaller task, I felt very nice, but as tricky and complicated tasks came,I was not able to finish the task in 45 min and it started putting pressure upon me and I stressed out. what would you suggest me on this strategy, Is this good one to apply? or are there any other good ones?


title: How to evaluate how well one knows functional programming

text: I've been wondering how to determine if I _know_ functional programming. By know I mean in a Journeyman sense, not a master, but competent enough to do the work. I like languages w/ query/data shaping constructs built in, but is knowing the ins and outs of maps, filters, and aggregates in the form of `Linq`, `Sql`, and `Reactive Extensions` sufficient to claim that one knows functional programming? Or are additional specific concepts and skills required? Edit: I've been working in OO and languages that identify primarily as OO langs for 15 years. As I'm not in an env that is self-identified as functional, there's little to measure against. Is avoiding immutable state and knowing how to use `fold` all there is?


title: Anyone who has taken 70-515 TS: Web Applications Development with Microsoft .NET Framework 4 exam?

text: I'm planning to take 70-515 exam and I can't find any training kit for it from MS press at the moment. Therefore, I'm reading the book for 70-562 which covers framework 3.5. I would like to know if someone has taken 70-515 exam and knows if 70-562 training kit can be helpful for the exam 70-515. Are there any resources someone might like to suggest which can help me pass this exam? I would really appreciate any help.


title: Exception handling class: static or object-oriented?

text: I am working in a windows service (using VB.Net) for internal use of my department. When ever a certain type of exception (`FooException` for now on) is captured, I follow the same logic:   * Log the exception   * Send an email to someone. In order to reuse code and not to copy-paste the same lines in every `catch FooException` block I have created a `FooExceptionHandler` method inside my `ExceptionHandling` class. So I ended up with a code like this:               FooExceptionHandler(fooException)     {        //log the exception        try        {           //send email        }        catch SmtpException        {           //log  the smtp exception        }     }      My question is about how to organize the code. Should this be a static method? Should all the exception handling class be static? Should it be a singleton? Should it be object-oriented? If the object-oriented case is the best way, should I create a new object in every catch block or is it better to have a class variable?


title: A question on choosing the next programming language between C/C++ and other languages

text: I am a java developer (web app and standalone applications) who knows JavaScript, HTML, CSS and has mostly worked on Web applications. I have no knowledge of C/C++ or any other lower level languages. I feel like I should strengthen my CS basics by learning a fundamental language. Should it be C or C++? I am also inclined to learn Objective-C. Does it need basics of C or C++? Or should I go for new languages like Python, Google's Go etc. I know this is a cliche question asked very frequently, but I can use some help here.


title: Would you use UML if it kept stakeholders from requesting changes frequently?

text: As much as programmers hate to document their code/system and draw UML (especially, Sequencing, Activity and State machine diagrams) **or other diagramming notation** , would you agree to do it if it kept managers from requesting a "minor change" every couple of weeks? IOW, would you put together visual models to document the system if it helped you demonstrate to managers what the effect of changes are and why it takes so long to implement them? (Edited to help programmers understand what type of answer I'm looking for.) 2nd edit: Restating my question again, "Would you be willing to use some diagramming notation, against your better nature as a programmer, if it helped you manage change requests?" This question isn't asking if there might be something wrong with the process. It's a given that there's something wrong with the process. Would you be willing to do more work to improve it?


title: Improving ZooKeeper to increase availability

text: Running Apache ZooKeeper (this applies to PAXOS style system just as well) with 2 members - which is not recommended - does not make sense, because if either   * member1 goes down   * member2 goes down   * there's a network partition between member1 and member2 , ZooKeeper will declare business hours to be over, as there's no single sub cluster with a clear majority of members (in this case: > 1). So running ZooKeeper on 2 members makes it less available than running a single member. Why can't the majority constraint be relaxed so that when the there's a **sub cluster of exactly 50% of members, it is considered the active sub cluster if it contains the eldest member**? (Eldest as of the just before the partition happened, i.e. when the cluster was member-complete) Who's eldest is information ZooKeeper already keeps track of, so implementation looks easy. That way, we don't run into the dreaded split-brain scenario, and the ZooKeeper cluster could stay up in 2 of the 3 cases above, improving availability, especially when running 2 members only. Anything speaking against this?


title: Algorithm Vs Design

text: > **Possible Duplicate:**   >  Is it essential to learn algorithms to be a real programmer? This question is, perhaps, related mostly to **web developers** who, like myself, code enterprise applications and use high level languages like **Java, C#** mostly. Due to nature of enterprise web-apps, which essentially do **CRUD** operations, and since we rely heavily on libraries that the language provide, **what is the significance of learning algorithms?** I know the web is filled with articles profoundly stating that "code is algorithm", but when was the last time anyone wrote _quicksort_ algorithm in such an application? I see far more benefits in learning Design patterns and anti-patterns, which are used a lot.


title: How can I create a set of random numbers based on a total and number of objects?

text: For example with:   Total population = 400000   Number of villages = 800   The average population is 500 How can I randomize the amount of people in each village using a specified deviation (eg +-50) so that it equals the total population? I came up with a solution using this normal distribution class   Basically I created a normal distribution and used the Probability Density Function to determine the amount of villages at each discrete level (until the population total was hit). This is something I wrote quickly to demonstrate:                NormalDist dist = new NormalDist(500.0, 50.0);      int popX = 500;      int numberOfPopXVillages = Convert.ToInt32(Math.Floor(dist.PDF(popX) * 800)); ;      int totalSum = 0;      do      {          Console.WriteLine(numberOfPopXVillages);          totalSum += popX * numberOfPopXVillages;          totalSum += (1000 - popX) * numberOfPopXVillages;          ++popX;          numberOfPopXVillages = Convert.ToInt32(Math.Floor(dist.PDF(popX) * 800));      } while (numberOfPopXVillages >= 5);      Console.WriteLine(totalSum);      The total sum here is 400000. The algorithm isn't perfect but I'll keep working on it. Thanks everyone.


title: Sending Whole Data Object As Argument Or Just Required Fields?

text: Let's say I have a class that just stores data:               ClassData         Field1         Field2         Field3      Now let's say I have a function that uses Field1 and Field2:               public void DoStuff(string field1, string field2){         if(field1 == "something"){              //Do something         }         if(field2 == "somethingElse"){             //Do something else         }     }      vs               public void DoStuff(ClassData data){         if(data.field1 == "something"){              //Do something         }         if(data.field2 == "somethingElse"){             //Do something else         }     }      It seems like this is a type of "more art than science" type thing, but I have a few thoughts also. Passing specific fields shows you the required information right from the get-go, which can make it easier to read and understand the function. Sending just the data object does have advantages because it makes the code look cleaner. I wouldn't be surprised if I'm missing pros and cons for both and would be interested in hearing what you think. Thanks!


title: Naming convention for classes that represents different versions of the same thing

text: Let's imagine I have an abstract class named `ProtocolA` that represents the basic operations to work with the protocol **A**. Such protocol is in version 1, but new revisions are expected in the future. Version 2 is coming. How should I name the classes that implements that abstract class for each version? `ProtocolA1` and `ProtocolA2`? Cheers.


title: what to do with your bin directory

text: To get off my noob status i am following the Learn python the hard way course. I really like it but at one point it says make a bin directory. In all games and other programs i saw to a bin directory but what does it do?


title: Avoiding bloated Domain Objects

text: We're trying to move data from our bloated Service layer into our Domain layer using a DDD approach. We currently have a lot of business logic in our services, which is spread out all over the place and doesn't benefit from inheritance. We have a central Domain class which is the focus of most of our work - a Trade. The Trade object will know how to price itself, how to estimate risk, validate itself, etc. We can then replace conditionals with polymorphism. Eg: SimpleTrade will price itself one way, but ComplexTrade will price itself another. However, we are worried that this will bloat the Trade class(s). It really should be in charge of its own processing but the class size is going to increase exponentially as more features are added. So we have choices:   1. Put processing logic in Trade class. Processing logic is now polymorphic based on the type of the trade, but Trade class is now has multiple responsibilites (pricing, risk, etc) and is large   2. Put processing logic into other class such as TradePricingService. No longer polymorphic with the Trade inheritance tree, but classes are smaller and easier to test.  What would be the suggested approach?


title: How can I handle Bots in a site that creates a database item every page

text: I have an eCommerce platform that creates a basket as soon as the user lands on the site if they don't already have one (from session or cookies). It then stores the basket information in session and in cookies to remember what the user has added to their basket for a month. The problem is if they aren't capable of having a session or cookies, such as a bot, then it creates a basket every time they visit a page. This means a bot crawling through the website can easily create hundreds of baskets. One of the options we're exploring is changing our code so that a basket is only created when a user adds an item, and so far it seems the best option, but it's also the most time consuming option as a lot of the code base assumes a basket exists at all times. That would need to be changed so that it checks for a basket and handles a basket not existing. We'd like to find a less intensive solution if possible. Another option we've explored is periodically clearing out the table in the database of all old baskets to help mitigate the issue. However this is just mitigating, and not solving the issue. I'd like to solve the problem if I can. How can I identify if the user is incapable of having a session and cookies so that I can stop the basket from being created? Or is there a better way of dealing with bots in this instance?


title: Design Issue: Service layer/ trying to maintain RESTful architecture

text: I'm trying to design a web-application - and after doing a lot of reading on REST + design patterns, I'm at a loss on how to handle my requirements. I think I may be getting caught-up in all the design-patterns, but at the same time want to produce a well-architect-ed design. I have 2 major business-objects, `Customer` and `Order`, with a _Has Many_ relationship. Currently, I have no service layer, and the REST API is in the BL:               GET Customers                         GET Orders     GET Customers/id                      GET Orders/id     POST Customers                        POST Orders     PUT Customers/id                      PUT Orders/id     DELETE Customers/id                   DELETE Orders/id      But things become hard to design when I have to architect for legacy means of user-data input, and well as for the future:   * **Now:** Users upload an **Excel .xlsx** file containing Customer, Order information, which I parse, extract, create `Customer`/`Order` business-objects for, and perform validations. In order to have a pleasant User-experience, I don't save these objects right away, I return them to the User (along with any errors from the verifications) so they may make any needed changes before finally submitting them. (this 2-step submission just adverts the requirement of correcting sources of any validation errors directly in the Excel file).   * **Future:** Customer/Order data will be maintained, and uploaded, through a web service/platform. I don't know how to handle these requirements gracefully, and intelligently. Is this a case where I need to expose a Service Layer that publishes an interface for the soon-to-be-legacy Excel-upload, as well as an interface for the web service? Any design help would be appreciated, as I'm rather new to this type of development and rather not make a major architectural mistake that will come back to bite me later.. Thanks in advance. **edited as comments suggest**


title: A new i/o library: a good idea or a really bad one?

text: For a long time I worked almost exclusively with input/output streams in java. However a few years ago I started exploring async I/O as well (e.g. running on jboss netty). However when working in the async I/O world, I could not reuse any of my sync utilities. I also had to start on a rather large library of new I/O utilities and wasn't sure whether to aim for blocking or non-blocking. As things go...I wrote an API on top of the existing I/O which supports both blocking and non-blocking and the utilities are written against that. However because I/O is such a pervasive thing, I am unsure whether it is a wise thing to do. As an example take a Base64 encoder. Yes apache has a sync I/O version and yes java 8 finally has an async encoder. But I needed an encoder that could do both. Same for quoted-printable, deflate,... and of course it should work for sockets (regular & ssl), files,... in single-threaded and multithreaded situations,... I needed utilities to chain together I/O sources, use delimiter-based or fixed-length I/O wrappers,... I needed protocol handlers for http, ftp,... Many of these problems can be expressed in a blocking-neutral fashion or -given enough thought- could support both async and sync, allowing wide reusability. In short: is it wise to introduce an abstraction on top of I/O, forcing basically every library that uses it (directly or indirectly) to use it as well? **UPDATE** At the core are the ReadableByteContainer and WritableByteContainer that -to the discerning eye- will look like a cross between stream I/O and channel I/O.               public interface ReadableByteContainer extends Closeable {         public int read(byte [] bytes);         public int read(byte [] bytes, int offset, int length);     }          public interface WritableByteContainer extends Closeable {         public int write(byte [] bytes);         public int write(byte [] bytes, int offset, int length);         public void flush();     }      One of the utils built on it is the "Transcoder" api:               public interface ByteTranscoder {         public void transcode(ReadableByteContainer in, WritableByteContainer out);         public void flush(WritableByteContainer out);     }      which allows you to do something like:               ByteContainer container = IOUtils.newByteContainer();     container = IOUtils.wrap(         container,         TranscoderUtils.wrapOutput(container, new Base64Encoder())     );     container.write("test".getBytes());     System.out.println(new String(IOUtils.toBytes(container)));      This code will output the base64 encoded bytes of "test". The thing is, the Base64Encoder is capable of encoding the data in an asynchronous manner, it won't block if the output container reports that no data was written nor will it block if the input container reports that no data is available. You can continue the transcoding by calling "transcode()" again. This works both in a jboss netty context where you get the content piece by asynchronous piece and in the streaming world where everything blocks until it can read/write.


title: Client-server application design issue

text: I have a collection of clients on server's side. And there are some objects that need to work with that collection - adding and removing clients, sending message to them, updating connection settings and so on. They should perform these actions simultaneously, so mutex or another synchronization primitive is required. I want to share one instance of collection between these objects, but all of them require access to private fields of collection. I hope that code sample makes it more clear[C++]:               class Collection     {         std::vector< Client* > clients;         Mutex mLock;         ...     }          class ClientNotifier     {         void sendMessage()         {              mLock.lock();              // loop over clients and send message to each of them         }     }          class ConnectionSettingsUpdater     {         void changeSettings( const std::string& name )         {             mLock.lock();             // if client with this name is inside collection, change its settings         }     }      As you can see, all these classes require direct access to Collection's private fields. Can you give me an advice about how to implement such behaviour correctly, i.e. keeping Collection's interface simple without it knowing about its users?


How can I move a library inside a project's source tree and compiling static binaries? I want to use a particular tool that utilizes ANCIENT binaries without upgrading it's API usage. This way I can use the old libraries inside the single binary without wrecking the local host environment. I am on nix with netbeans/eclipse/code::blocks. I don't have a problem reading, just looking for a starting point. Any thoughts?


title: Using an AGPL 3.0-licensed library for extra functionality in an iOS app

text: I am building an iOS application, and I am planning to incorporate an AGPL 3.0-licensed library to it to provide some _extra (non-essential) functionality_. I’ve got a couple of questions regarding this:   1. Do I understand it right that this still obliges me to publish the source of my app open? If yes, does it have to be open to the general public, or only to those who have downloaded the app?   2. Does this allow me to distribute the app for a fee?


title: How is encapsulation used for safety?

text: I am learning OOP. I have studied much about encapsulation but the more I read the more I became confused. I understand we hide (by making private) data and expose it to user of class (other developers) as properties or methods. I also understand by encapsulation we hide details. In an article (http://www.csharp-station.com/Tutorial/CSharp/lesson19) I read: **Abstract from article** When designing an object, you must think about how others could use it. In a best-case scenario any program using the object would be well designed and the code would never change. However, the reality is that programs do change often and in a team environment many people touch the same code at one time or another. Therefore, it is beneficial to consider what could go wrong as well as the pristine image of how the object _should_ be used. In the case of the BankAccount object, examine the situation where code outside of your object could access a decimal Amount field or a string CustomerName field. At the point of time that the code is written, everything would work well. However, later in the development cycle, you realize that the BankAccount object should keep track of an int CustomerID rather than string CustomerName because you don't want to duplicate relationships between information (or some other valid reason to alter the definition of internal state). Such changes cause a **rippling effect** in your code because it was built to use the BankAccount class, as originally designed (with CustomerName being a string), and you must now change code that accesses that state throughout your entire application. The object-oriented principle of Encapsulation helps avoid such problems, allowing you to hide internal state and abstract access to it though type members such as methods, properties, and indexers. Encapsulation helps you reduce coupling between objects and increases the maintainability of your code. **Question** How will encapsulation help when making changes in code and from its rippling effects. For a data member, if I change its type from int to float, (even if I am exposing this using property) I will need to change variable type where I am using already using this code. Kindly guide me how encapsulation will help with such changes. Thanks for this help and guidance.


title: Strategies for porting application from Win32 API to GTK+

text: I have a legacy application written in C, using the raw Win32 API. The general level of abstraction is low and raw dependency on <windows.h> is common. I would like to port this application to GTK+. There are any kind of guidelines or best practices on how to do this? I've previously ported a MFC application to Qt, but the application was very abstracted - it draw it's own set of widgets, for example - and initial porting was very straightforward. I've been thinking at first using Winelib to build a native Linux executable and then trying to slowly refactor it into a GTK+ app. Does some one have best practices or previous experiences to share about this?


title: What are the best tools to help work with large ant files

text: I just started working at a company that has a very large ant build file that imports lots of other large/small ant files. Needless to say it's giving me a headache trying to figure out what is going on. What are the best tools out there for:   * Getting some kind of concise answer on what is happening   * Visualizing the various targets   * Seeing performance on tasks Can be multiple tools. Any other tips/suggestions?


title: Is C a regular language?

text: Are C or C++ regular languages? If not, under which category do we place the programming languages like C/C++, perl, Python?


title: Executing ajax calls in setTimeout after set intervals?

text: We develop an application involving a lot of ajax. Such as showing users notifications, updating what they see via ajax while they are on the web page. This update is due to the actions of other users in the application.   1. In the code base we are generating a query inside setTimeout function of javascript. This makes an ajax call.    2. Every call is a separate query to the database.   3. There are many calls on the same page. So we run queries against the database after 15 seconds, no matter if something changes or not. Will this approach work if we are expecting high traffic?


title: Does this function do one thing only?

text: Is the following method considered to be doing one thing only? I'm wondering about that since it takes an optional argument.               public function findErrors($name = null)     {         if ($name) {             return isset($this->errors[$name]) ? $this->errors[$name] : [];         }              return $this->errors ?: [];     }      If not, would it be better / matter to have it separated like the following:               public function findErrors()     {         return $this->errors ?: [];     }          public function findErrorsOf($name)     {         return isset($this->errors[$name]) ? $this->errors[$name] : [];     }


title: What should my redirect URL be for OAuth2.0 in Azure if my application is a local windows application?

text: I am setting up OAuth2.0 on Azure. I am at the stage where I have been allowed access to the application and a Code has been returned in my redirect URL. My application is a local windows application. When i type my OAuth endpoint address in the browser with the client ID, i successfully get redirected to my redirect URL, and the AuthCode is attached to the URL. Problem: When I have tried doing webrequests and similar strategies (in my C# code, not the brwoser) using my OAuth2.0 endpoint address, I cant seem to get the REDIRECTED url in my C# code. I have seeing some stuff about changing my redirect URL in azure to localhost and listening for a return, but I feel like that brings more variables into the equation. any advice?


title: Java-Like 'throws'-information in method signature C#

text: From Java I know that the signatures of methods that can throw exceptions contain a `throws` block, that contains the Exception(s) that might be thrown.   In C# there is no such thing and it is also not common practice to include such info in the XML-Header.   Is there a generally accepted way of drawing attention to potential exceptions or a place to commonly denote them?


title: How should compound words be handled when coding? Is there a definitive list of compound words?

text: **QUESTION:** How should you handle compound words when programming? Are there any good lists available online for developers of generally accepted technology-related compound words? I can see how this is highly ambiguous, so should I just use common-sense? **EXAMPLE:** I would be inclined to do this: _filename_ **NOT** _FileName_ **or** _login_ **NOT** _LogIn_ However, the microsoft documentation indicates that _filename_ is not compound. So I wonder, is there a more definitive source? See also, this english.stackexchange discussion  on _filename_. Under the section "Capitalization Rules for Compound Words and Common Terms" located here: Microsoft .NET Capitalization Conventions only offers a limited introduction into the topic, and leaves it up to the developer to use their intuition with the rest.


title: Create new variable or make multiple chained calls?

text: What is the best way to get this attributes, thinking in performance and code quality? Using chained calls:                   name = this.product.getStock().getItems().get(index).getName();         id = this.product.getStock().getItems().get(index).getId();      Creating new variable:                   final item = this.product.getStock().getItems().get(index);         name = item.getName();         it = item.getId();      I prefer the second way, to let the code cleaner. But I would like to see some opinions about it. Thank you!


title: Books about learning programming with C++ as a first language

text: > **Possible Duplicate:**   >  Recommended books on C++ Is there a canonical book on learning programming with C++ as a first language? I have toyed with Java and Python but when my laptop broke I couldn't program anymore. That was months ago and between now and then I have decided my real first language should be C++. Now my question is what book I should read. Is there a book out there that is both a good introduction to programming for a first time programmer and recommended for learning C++ as a first language?


title: Jack of all trades, master of none

text: I've got a question similar to this one: Is constantly looking for code examples a sign of a bad developer? though not entirely. I got off college 2 years ago and I'm currently struggling with a University study. Most likely I'll have to drop out and start working within the next couple of months. Now here's the pickle. I have no speciality what so ever. When I got out of college I had worked with **C** , **C++** and **Java**. I had had an internship at NEC-Philips and got familiar with **C# (.NET)** and I taught myself how it worked. After college I started working with **PHP, HTML, SQL, MySQL, Javascript** and **Jquery**. I'm currently teaching myself **Ruby on Rails** and thus **Ruby**. At my university I also got familiar with **MATLAB**. As you can see I've got a broad scope of languages and frameworks I'm familiar with, but none I know inside-out. So I guess this kinda applies to me: _"Jack of all trades, master of none."._ I've been looking for jobs and I've noticed that most of them require some years of experience with a certain language and some specifications that apply to that language. My question is: **How do I pick a speciality? And how do I know if I'll actually enjoy it?** As I've worked with loads of languages how would I be able to tell this is right for me? I don't like being tied down to a specific role and I quite like being a generalist. But in order to make more money I would need a specialisation. How would I pick something that goes against my nature? Thanks in advance, Rope.


title: Self-updating application - philosophy

text: This is a philosophical question. Given a hypothetical desktop application, and a desire to provide automatic updates (rather than forcing people to go to a website, check for an update, download an update, install), which of the two is more of a "best practice" approach?   1. Like iTunes, it checks to see if there is a new version and prompts the user to download the new version. If so, it downloads a full install executable (in this case, a Windows Installer file (.msi)) that installs the full version (not just an upgrade to the previous version - too much to manage if there are multiple versions out there). So, let's say, it's version 10.1.1 - whether you are installing fresh or upgrading, you use the same file. After it downloads, it instructs the user to close the application and run the install file themselves.   2. Similar to the other one, it checks for a new version and prompts user to download it, but instead of just downloading an executable and prompting the user to run it, it actually runs it for them - shutting down the program they have open, acquiring the necessary security to install files. Issues with #2: many issues around closing down program, since the program can open other programs (Outlook and Excel), or what if the user was in the middle of something. Also around security, you need local administrator access to install, what if you don't have it? In later versions of Windows, you cannot just override the person's security. Issues with #1: some people believe this will be too hard, too much effort for the end-user. I would strongly prefer to go with #1 because it will save 80-120 hours on my project, and is simpler to implement and maintain. However, we have people who feel strongly on all sides. What is a best practice for this sort of thing?


title: What is the industry term for those "earn credit by affiliates" programs in iPhone/Android/etc games?

text: In iPhone, Android, and other gaming platforms you can sometimes earn credit by installing other games, going to someones website, even signing up for a credit card. For iPhone, for example, there are entire networks set up for this kind of affiliate marketing. What is the industry term for this?


title: Licensing a project

text: Can someone clarify the following things for me ? Let's say I want to build a website and add publicity to it so I can make money out of my work.   I would use Html5 for the interface and C# with ASP.NET for the background programming.   I would use Visual Studio as my IDE and SQL server as a database. This is just an example on the top of my head but I don't know where to start for the licenses. Do I need one :   * For VisualStudio and SQLServer only ?   * For VisualStudio, SQLServer and pay some kind of rights for Asp.net ?   * The whole package.. Both VisualStudio, SQlServer plus rights for Asp.net AND C# ? I know this question is a little vague but I really don't know where to start and the opinion of someone with experience int this might give me just the help I need to get started.


title: Domain Model Examples Website Similar to Databaseanswers.org

text: When I was trying to understand database design databaseanswers.org was phenomenal. Now I'm trying to understand the Spring Framework and I'd like to know if there are any sites out there that have domain models already created that I could use as a basis for learning Spring.


title: How were Fortran's original control structures insufficient?

text: In my Programming Language Concepts class it was mentioned in passing that Fortran's original control structures were insufficient. It was alluded that they were too similar to machine instructions for the IBM 704. Was this the case? What exactly made them insufficient?


title: MVC and delegation

text: I am a beginning iOS programmer and use the Model-View-Controller model as a design pattern: my model doesn't know anything about my view (in order to make it compatible with any view), my view doesn't know anything about my model so they interact via my controller. A very usual way for a view to interact with the controller is through delegation: when the user interacts with the app, my view will notify my controller, which can call some methods of my model and update my view, if necessary. However, would it make sense to also make my controller the delegate of my model? I'm not convinced this is the way to go. It could be handy for my model to notify my controller of some process being finished, for example, or to ask for extra input of the user if it doesn't have enough information to complete the task. The downside of this, though, is that my controller would be the delegate for both my controller and my model, so there wouldn't be really a proper way to notify my model of changes in my view, and vice versa. (correct me if I'm wrong.) Conclusion: I don't really think it's a good idea to to have my controller to be the delegate of my model, but just being the delegate of my view would be fine. Is this the way most MVC models handle? Or is there a way to have the controller be the delegate of both the controller and the model, with proper communication between them? Like I said, I'm a beginner, so I want to do such stuff the right way immediately, rather than spending loads of hours on models that won't work anyway. :)


title: Is a programmer supposed to be self-sufficient?

text: At my current workplace, we don't have any testers, the rationale for that from the management being: "if we had testers, you wouldn't test your own code at all". This kind of thinking seems to be detrimental to product quality, as while I do test my own code, there are a lot of things that I will miss just for the fact that I know the system inside out and don't know how to use it "wrong". Black box testing doesn't really work as I subconsciously avoid the pitfalls that a dedicated tester would fall into. A lot of my time goes into fixing bugs that have slid into production code and found by the end user. The system in question is large but is developed solely by me. This has also caused some managemental duties to fall on my lap, such as defining schedules and working on specifications. Should these kind of tasks be my responsibility? I see myself strictly as a programmer and nothing else. And if these are my responsibility, to what extent? When is a project so large that it requires testers? Should a programmer have to refine the specification, worry about management of the project or even provide customer support? ### Note Some might have got the impression that I am against widening my responsibilities - that is not the case, I'm eager to get a role that involves more management duties, but currently it is not in my job description. Until I'm officially employed as such or the additional duties start showing in my paycheck, I'm going to think of myself as 'just' a programmer. Unfortunately, as a junior developer, shifting to managerial duties is not going to happen very soon. Excellent answers so far, keep them coming if you have something to add or personal experiences to share!


title: Web Crawler for Learning Topics on Wikipedia

text: When I want to learn a vast topic on Wikipedia, I don't know where to start. For instance say I want to learn about Binary Stars, I then have to know other things linked on that pages and linked pages on all the linked pages and so on for the **specified number of levels**. I want to write a web crawler like HTTracker or something similar, that will display a hierachy of the links on a certain page and the links on those linked pages. **I wish to use as much prewritten code as possible.** Here is an example: **Pretending we are bending the rules by grabbing links from only the first sentence of each page** The example archives and "processes" _two levels deep_ The page is Ternary operation ## The First Level In mathematics a ternary operation is an N-ary operation ## The Second Level ### Under Mathmatics: Mathematics (from Greek μάθημα máthēma, “knowledge, study, learning”) is the abstract study of topics encompassing quantity, structure, space, change and others; it has no generally accepted definition. ### Under N-ary In logic,mathematics, and computer science, the arity i/ˈærɨti/ of a function or operation is the number of arguments or operands that the function takes ### Under Operation In its simplest meaning in mathematics and logic, an operation is an action or procedure which produces a new value from one or more input values ## \------------------------------------------------------------------------- I need some way to determine what order to approach all these wiki pages to learn the concept ( in this case ternary operations )... Following along with this example, one way to show the path to read would a printout flowout like so: ![enter image description here](http://i.stack.imgur.com/1fLex.png) This shows that the first sentence of the Mathematics page doesn't link to the first sentence of pages linked on ternary page two levels deep. (Please tell me how I should explain this ) ---> In other words, the child node of the top pages first sentence, ternary_operation, does not have any child nodes that reference the children of the top pages other children nodes- N-ary and operation. Thus it is safe to read this first. Since N-ary has a link to operations we should read the operation page second and finally read the N-ary page last. Again, **I wish to use as much prewritten code as possible** , and was wondering what language to use and what would be the simplest way to go about doing this if there isn't already something out there?


title: Banking Applications need Auto save?

text: We are developing a banking application. It's internal project of the bank. The application has to capture huge data to process. So auto save is recommended approach to capture? How to perform validations in case of auto save? And on jsp unload saving the data is correct approach? Which is best way of saving form data in case of auto save? If any network errors occur, how to handle, mean giving end user the data is not saved? I think it's just a feasible solution. Please suggest me optimal solution.


title: Writing code vs using drag & drop tools

text: If you drag & drop, you're letting the editor to build code for you. Surely that means you're not really programming. You're building an application that has no proper code logic, correct? I drag simple controls on a web form in .NET, but surely you cannot rely 100% on building an app that way? Though some tutorial books in .NET have you dragging and dropping all over the place. An example, reading from a database using ASP.NET. You can drop SQL controls onto the markup, or you can program the retrieval in the code behind. I prefer the code behind as you have proper control imho. Thoughts?


title: How to decide the token expiry time in REST web service

text: I am working on creating a REST ws exposing few API's. A token is required for each API call. I am confused about the expiry time to be set for the token. Security+Performance wise what is the ideal expiry time for token (if there is one)?


title: Model-View-Controller: who caches the data?

text: I am building a GUI to interface an embedded device to a PC host. The GUI provides control over the device parameters and displays some feedback from it. The GUI also has to emulate some of the device functionality and present it to the user. I have been advised to use a Model-View-Controller pattern, so that if the device does not acknowledge some command, the the user knows about the ineffectiveness of his actions. Trouble is, I cannot decide which component(s) should cache data. Example: when a value is printed on the screen, the view clearly has to know it. However, the model also has to know it, as it uses it to calculate other values. Furthermore, the controller also has to know it as, for example, the value change could be proportional to a logarithm of the user action. How do I pull this off properly?


title: Access Token Verification

text: I have spent quite a few days reading up on Oauth and token based security measures for REST API's and I am currently looking at implementing an Oauth based authentication approach almost exactly like the one described in this post (OAuth alternative for a 2 party system). From what I understand, the token is to be verified upon each request to the resource server. This means the resource server would need to retrieve the token from a datastore to verify the clients token. Given this would have to happen upon every request I am concerned about the speed implications of hitting a datastore like MySQL or NoSQL upon every request just to verify the token. Is this the standard way to verify tokens by having them stored in a RDBMS or NoSQL database and retrieved upon each request? Or is it a suitable solution to have them cached (baring in mind that we are talking millions of users)?


title: Why Beta versions have so many bugs?

text: When I worked in Microsoft on MSE antivirus, we had several stages of pre- release: Alpha, Beta, RC. The biggest difference between these stages were bug fixes. Each time we fixed more bugs, and usually updated some minor features. Apple works in the same way. Look here: http://www.techrepublic.com/article/pro-tip-how-to-create-a-bootable-usb- installer-for-os-x-yosemite/ They released a beta of Yosemite OS, but the beta is full of bugs. Why do these big companies work like this? Isn't it better to release a beta version that was tested very thoroughly but one that just doesn't provide all the features that the final version will provide?


title: Is it a good idea to use a kitchen-sink server for various services?

text: My (new) development team is setting up its software development environment. I won't describe the whole scenario, since that's another, much-maligned question. Anyway, we're going to have services such as source control (mercurial), a wiki, an issue tracker, a file/document server, DNS and possibly other things. My question: Is it a good idea to put as many as possible as these on a single 'kitchen-sink' server machine? Or is it better to spread them out as much as money, power and server room space allows? **Notes:**   * I know that some things have to go on a different server, like continuous/periodic building, with a lot of crunching involved. I'm talking about the (theoretically) lighter stuff.   * Our team has 4 people, expected to grow to maybe double that within the next couple of years.    * We're not going to be 'hammering' services, as far as I can tell.   * The expected hardware for the server is a plain vanilla PC, ~ $1,000 at most, maybe with an SSD.


title: What is the proper way to create a cross-fade effect?

text: When creating an image slider, using a cross fade is one of more popular effects. Various sliders use differing techniques to create such an effect. Major techniques I've found so far are:   * **Method 1:** Use an overlay and underlay `<div>` and fade in and out each other's `visibility`.    * **Method 2:** Create a `<div>` matching the exact size of the slider during initialization, play with its `z-index` property, and then fade each other. Using `method-1`, it needs creating two unneeded and over exploited block elements most commonly a `div`. First the background property is applied to the underlayed-div then the overlayed-div is faded out and subsequently changed in z-index property to be positioned lower that other one. Using `method-2`, it creates only one extra div and now container's background is changed and the overlay div is faded out. Implementing this effect now limits the transition effect that can be build (but _this is not the question in hand_ ). The reason why I believe this could be better is because extra elements will always have to be added to give the effect. Due to this reason, creating effects like that of `nivo-slider` requires creating 12 to 15+ divs to give the effect. Adding up to number of elements to create the element does not seem to be the right way. Are the methods I mentioned above used so much, because there aren't any other ways? There has to be better ways that to create the cross-fade effect. So my question is simple, _Is there a better way to create this effect?_ If yes, What are they?


title: How to use DI and DI containers

text: I am building a small PHP mvc framework (yes, yet another one), mostly for learning purposes, and I am trying to do it the right way, so I'd like to use a DI container, but I am not asking which one to use but rather how to use one. Without going into too much detail, the mvc is divided into modules which have controllers which render views for actions. This is how a request is processed:   * a Main object instantiates a Request object, and a Router, and injects the Request into the Router to figure out which module was called.   * then it instantiates the Module object and sends the Request to that   * the Module creates a ModuleRouter and sends the Request to figure out the controller and action   * it then creates the Controller and the ViewRenderer, and injects the ViewRenderer into the Controller (so that the controller can send data to the view)   * the ViewRenderer needs to know which module, controller and action were called to figure out the path to the view scripts, so the Module has to figure out this and inject it to the ViewRenderer   * the Module then calls the action method on the controller and calls the render method on the ViewRenderer For now, I do not have any DI container set up, but what I do have are a bunch of initX() methods that create the required component if it is not already there. For instance, the Module has the initViewRenderer() method. These init methods get called right before that component is needed, not before, and if the component was already set it will not initialize it. This allows for the components to be switched, but it does not require manually setting them if they are not there. Now, I'd like to do this by implementing a DI container, but still keep the manual configuration to a bare minimum, so if the directory structure and naming convention is followed, everything should work, without even touching the config. If I use the DI container, do I then inject it into everything (the container would inject itself when creating a component), so that other components can use it? When do I register components with the DI? Can a component register other components with the DI during run-time? Do I create a 'common' config and use that? How do I then figure out on the fly which components I need and how they need to be set up? If Main uses Router which uses Request, Main then needs to use the container to get Module (or does the module need to be found and set beforehand? How?) Module uses Router but needs to figure out the settings for the ViewRenderer and the Controller on the fly, not in advance, so my DI container can't be setting those on the Module before the module figures out the controller and action... What if the controller needs some other service? Do I inject the container into every controller? If I start doing that, I might just inject it into everything... Basically I am looking for the best practices when dealing with stuff like this. I know what DI is and what DI containers do, but I am looking for guidance to using them in real life, and not some isolated examples on the net. Sorry for the lengthy post and many thanks in advance. EDIT: after reading a bit more, it seems that injection the container itself into objects and making them use the container to find stuff is actually service location, not dependency injection. So my latest idea is to use factories for the stuff that should be dynamically acquired based on something (like getting controllers based on what the router says), and the container would be injected into the factories where it would be used more like a service locator. The non dynamic components would be registered beforehand, and those components would be built by the container and returned fully operational, with all their dependencies filled. So the flow would look like this:   * get Main from the container, Main is injected with Request, Router and ModuleFactory which uses the container to find modules. This is all pre-configured   * Main uses ModuleFactory to create the Module, injected with ModuleRouter, Request, ControllerFactory and ViewRenderer.   * Module uses ControllerFactory to create a Controller, injected with any service that it depends on, and then the Module calls the action on the controller, and sends the result to the ViewRenderer to render the view. Am I getting anywhere with this?


title: How can you predict the time it will take for two processes in two different machines in a cluster to communicate?

text: I am trying to develop a computing application which needs a lot of memory (>500gb). Buying a single machine for that is overly expensive. I can, though, buy ~100 small instances on Digital Ocean or similar, divide the memory in blocks and use TCP to emulate shared memory between the instances. Now, my question is: how can I measure/predict the time it will take for two processes in two different machines like that to share information, in comparison to IPC and shared memory? Are there rules of thumb? I don't want exact values, but knowing more or less how much faster one is would be very helpful in visualising the feasibility of this approach.


title: Is ICCP certification valuable for a programming career?

text: In looking at various professional societies the AITP lead me indirectly to the ICCP Certified Computer Programmer certification (and others from the ICCP). I had never heard of this program, but both the AITP and, more significantly to me, ACM have members on the ICCP board. Is anyone familiar with this certification? The webpage isn't confidence inspiring to be honest, but looking at it the program seems aimed at those in the Fortune 1000 internal software world. Anyone ICCP certified in some way? Does it make a positive different for a career in software development?


title: Example(s) of "A subscript ([ ]) expression that does not evaluate to an array" in C

text: I think I have never seen a [] that doesn't mean array in C. Background:   I was reading about l-values and r-values here: http://msdn.microsoft.com/en- us/library/bkbs2cds.aspx and there it says so. I am curious.


title: Reusable VS clean code - where's the balance?

text: Let's say I have a data model for a blog posts and have two use-cases of that model - getting all blogposts and getting only blogposts which were written by specific author. There are basically two ways how I can realize that. **1st model**               class Articles {              public function getPosts() {             return $this->connection->find()                 ->sort(array('creation_time' => -1));         }              public function getPostsByAuthor( $authorUid ) {             return $this->connection->find(array('author_uid' => $authorUid))                 ->sort(array('creation_time' => -1));         }     }      **1st usage** (presenter/controller)               if ( $GET['author_uid'] ) {         $posts = $articles->getPostsByAuthor($GET['author_uid']);     } else {         $posts = $articles->getPosts();     }      **2nd one**               class Articles {              public function getPosts( $authorUid = NULL ) {             $query = array();                  if( $authorUid !== NULL ) {                 $query = array('author_uid' => $authorUid);             }                  return $this->connection->find($query)                 ->sort(array('creation_time' => -1));         }          }      **2nd usage** (presenter/controller)               $posts = $articles->getPosts( $_GET['author_uid'] );      To sum up (dis)advantages: 1) cleaner code 2) more reusable code Which one do you think is better and why? Is there any kind of compromise between those two?


title: Generic log analyzer that produces reports

text: About 600 customers use our application. We have very detailed logs for everything that happens in the application, from changes in the data model, memory and CPU/GPU usage to clicks on the UI elements. We want to be able to parse the logs coming from these customers and analyze them to understand how users use our application and what happens internally in the application. Is there a log analyzer that can produce such reports automatically?


title: How do you find partners for open source projects?

text: I've created a few open-source projects in the past, and had some success. The process was generally the following: I'd start alone, create something that works, promote it, and finally (maybe) get some contributions. I have less that to contribute to open-source now, but I still have ideas and can still code :) So I wonder if there is a place or a way to meet people (online), discuss ideas and design, and then start working together on the project? The reason I'm thinking about an online way to do this, with strangers, is that while I do have programmer friends, we only very rarely have the same needs and interests at the same time. It seems to me that it would be easier to find such in match in the online global community. Any insight?


title: Is a project without license public domain?

text: If a project has no a license or has unknown authors, is it public domain?


title: 'Situations gone wrong' for web apps

text: I know there's some decent material floating around relating to more specific areas, but wanted to get some opinions from people who have had bad experiences in the past. I have a project where I can have a say on the design of a B2C web app, which has some external API interfaces. UX is crucial as is speed. Not sure what technology will be used at this stage. In designing this application, I want to make sure obvious features are not left out (i.e. ones that make maintenance/development easier). So can you guys tell me about 'situations gone wrong' that could have been avoided had more consideration taken place? Am looking to gather feedback in general, so don't worry if your example is industry/technology specific - so long as it pertains to web. Thanks for reading, I look forward to your responses!


title: How to get started with this project?

text: I recently finished my C++ programming class, and I'll start school in september. There is a limited online Parking spot registration and it always gets filled very quickly. I would like to create a code that will quickly access the page and register for me. The question is, how is this feasible? I guess I could use python, or Javascript, but I have no idea how to go on from my C++ class. What should I learn/do to program this code? EDIT: I posted this question on other forums also and I've been receiving a lot of answers like this: you need to use the library ... Sorry if I'm a noob, but I've never used library and I have trouble understanding it. Is it like #include like the library will give me access to many functions by doing #inlude?


title: How to determine most challenging test-cases to test any algorithm?

text: While solving any problem, we write algorithms. Some efficient, some not, some work, some fail. But sometimes we end up writing something which is mostly a success when we do a dry test run, perhaps, the way we frame the test data is prejudiced, but the algorithm fails in some other cases. For some algorithms , the nature of data can be diverse and magnitude large, for example like the problem: > Find the maximum subsequence sum of an array of integers which contains both > positive and negative numbers and return the starting and ending indices > within the array. Can anyone tell me is there any specific and generic thumb rule by which we can design the most stringent of test cases to test the correctness of algorithms like this one ?


title: How to build MVC Views that work with polymorphic domain model design?

text: This is more of a "how would you do it" type of question. The application I'm working on is an ASP.NET MVC4 app using Razor syntax. I've got a nice domain model which has a few polymorphic classes, awesome to work with in the code, but I have a few questions regarding the MVC front-end. Views are easy to build for normal classes, but when it comes to the polymorphic ones I'm stuck on deciding how to implement them. The one (ugly) option is to build a page which handles the base type (eg. IContract) and has a bunch of if statements to check if we passed in a IServiceContract or ISupplyContract instance. Not pretty and very nasty to maintain. The other option is to build a view for each of these IContract child classes, breaking DRY principles completely. Don't like doing this for obvious reasons. Another option (also not great) is to split the view into chunks with partials and build partial views for each of the child types that are loaded into the main view for the base type, then deciding to show or hide the partial in a single if statement in the partial. Also messy. I've also been thinking about building a master page with sections for the fields that only occur in subclasses and to build views for each subclass referencing the master page. This looks like the least problematic solution? It will allow for fairly simple maintenance and it doesn't involve code duplication. What are your thoughts? Am I missing something obvious that will make our lives easier? Suggestions?


title: Resurrecting a 5,000 line test plan that is a decade old

text: I am currently building a test plan for the system I am working on. The plan is 5,000 lines long and about 10 years old. The structure is like this:               1. test title        precondition: some W needs to be set up, X needs to be completed        action: do some Y        postcondition: message saying Z is displayed     2. ...      What is this type of testing called ? Is it useful ? It isn't automated.. the tests would have to be handed to some unlucky person to run through and then the results would have to be given to development. It doesn't seem efficient. Is it worth modernising this method of testing (removing tests for removed features, updating tests where different postconditions happen, ...) or would a whole different approach be more appropriate ? We plan to start unit tests but the software requires so much work to actually get 'units' to test - there are no units at present ! Thank you.


title: Industry switch to space technologies

text: I'm a CS grad and have been programming for past 5 years. I like it. As an experienced programmer I'd like to transition more towards the Space industry. **What skills** do you think a programmer would already have/ need to get to make that transition? Also **why** these particular skills and **how** do you see them relating to the Space industry?


title: Thinking pragmatically about scalability

text: I was recently asked as an exercise to design a scalable graph. My first intuition was how to seperate the graph and distribute it (sharding,consistent hashing..etc) Turns out my thinking was on the wrong line, I know what scalability is, but it seems it is a bit hard to think about it pragmatically. What is the pragmatic way of thinking about scalability. I know I need high- availability, replication, fault tolerance, but what are some of the common patterns/paradigms needed to implement these key points?


title: Why do we need to put private members in headers?

text: Private variables are a way to hide complexity and implementation details to the user of a class. This is a rather nice feature. But I do not understand why in c++ we need to put them in the header of a class. I see two annoying downsides to this:   * It clutters the header from the user   * It force recompilation of all client libraries whenever the internals are modified Is there a conceptual reason behind this requirement? Is it only to ease the work off the compiler?


title: Starting point for learning natural language processing in Java

text: Currently I am a high school student and new to the natural language processing field. I am trying to write a Java program that can provide answers that can be understood by humans to the questions that are in natural language. I have looked at Java documentation and Lynda.com site but I am afraid that I am jumping in further than I can reach. I am learning very quickly so I might be going into the deep end. For example I know that I can use the `split` function for minimal parsing but I am unsure where to move past to get actions that I require and I am not getting in enough hours per day to sit down and read all the vasts amount of information. It would be great if there was an entry point for a student like myself that I can take one section at a time. What would be an ideal starting point in terms of CS topics (and documentation) to get myself immersed in this topic?


title: Is it Considered Good SQL practice to use GUID to link multiple tables to same Id field?

text: I want to link several tables to a **many-to-many** (m2m) table. One table would be called **location** and this table would always be on one side of the m2m table. But I will have a list of several tables for example:   * Cards   * Photographs   * Illustrations   * Vectors Would using GUID's between these tables to link it to a single column in another table be considered 'Good Practice'? Will Mysql let me to have it automatically cascade updates and delete? If so, would multiple cascades lead to an issues? ![Diagram example of proposed structure](http://i.stack.imgur.com/BR6LX.jpg) ## UPDATE I've read that GUID (a hex number) Generally takes up more space in a database and slows queries down. However I could still generate 'unique' ids by just having the table initial's as part of the id so that the table card's id would be c0001, and then Illustrations be I001. Regardless of this change, the questions still stands.


title: What are the advantages of the delegate pattern over the observer pattern?

text: In the **delegate pattern** , only one object can directly listen to another object's events. In the **observer pattern** , any number of objects can listen to a particular object's events. When designing a class that needs to notify other object(s) of events, why would you ever use the delegate pattern over the observer pattern? I see the observer pattern as more flexible. You may only have one observer now, but a future design may require multiple observers.


title: Collective term for shaking device and using accelerometer of a device

text: Does anyone know what the collective term for shaking a device to achieve something or using the accelerometer of a device to do something is? Is it haptic technology?


title: What math skills are required to learn machine learning?

text: I am interested in taking this online course on machine learning. As it stands my math is very elementary, and I am basically learning math from scratch on khan academy. Programming-wise I have a decent amount of experience, and a good overall understanding. My question is, what math skills are required for me to be able to effectively understand and utilize machine learning?


title: How do you handle / what do you charge for documentation, training, warranty, changes in scope etc…

text: I am working with a client right now that wants me to sign a contact with a warranty for a year for no additional charge. As well as any reasonable changes he wants during the contract that are outside of the guidelines for no additional charge while not affecting deadlines. And lastly documentation and training for all staff for no additional charge. Red flags are going everywhere in this contract and I wanted to hear from professionals how you guys handle / what you charge for documentation, training, warranty, changes in scope etc...


title: Reducing complexity of our custom framework

text: At our company, we have a custom software application using our own framework. The framework was built in approximately 2002 or 2003, long before I showed up at the company. Majority of the functions in the framework are solid so we still use them as we've never had any issues with them, I'm talking about the database functions and functions to grab get/post parameters and escape data, etc. It used to be just me working on the projects so I never had any issues with the code-base, however we now have up to 6 developers who started working on the framework recently so things have become more complicated. In our current framework have it set up such as:               /cms/     /cms/modules/     /cms/modules/filemanager/     /cms/modules/filemanager/index.php     /cms/modules/pages/     /cms/modules/pages/index.php     /cms/...      Now inside each index file of each module we have the following:               require_once '../../config.php';     require_once '../../database_functions.php';     require_once '../../url_functions.php';      I am finding it more and more difficult to maintain the changes now and now that certain modules are interacting with other modules it is just getting crazy to maintain this among all of our development team. It used to be very simple but now our page module actually integrates other modules into the main module, into placeholders basically so one can put any content from individual modules into the page. The issue comes when we make a change to our gallery module and now I need to make changes on the front-end (html output), the gallery module itself, the database and then debug all the errors that come about in other modules that are currently using the data from the gallery module. It becomes a chain reaction of changes basically. Does anyone have any suggestions of how to streamline things or a better way to control the maintenance of our application? We are still using a very structured way of coding using straight scripting and functions rather than OOP, as I am used to coding in C and I don't like to complicate anything more than necessary. * * * Aside from these issues, we don't use anything like versions in our software right now, we've distributed great work and clients love the software we give out, we just don't have versions on them and no builds or anything, which is probably a big mistake in itself. Any ideas or suggestions or even a link out to somewhere that can help us figure out how to better structure our development process (if that's an issue) would be greatly appreciated.


title: Fuzzy search for a sub-string without tokens

text: Let's say I have the following lines:               Lorem ipsum dolor sit amet, (tag) consectetur adipiscing elit.     Phasellus congue nisi vel lorem dignissim tristique. (tag)     Etiam vulputate lacus nec velit lobortis ut adipiscing mauris condimentum. (tag )     Vestibulum quis nulla id nisi ultricies placerat. (teg)     In tempus vulputate ante, quis suscipit nunc euismod in. (teg )     Phasellus iaculis diam in felis pellentesque tristique. (ta g)     (tag Praesent vestibulum sollicitudin velit, non mollis lacus scelerisque in.     Nunc ac erat enim, at lobortis libero. (interesting)      There's supposed to be a tag in each line enclosed in parenthesis. But as you can see the data is very dirty and there's extra spaces inside tags, missing parents, misspelled tags, etc. How would I identify the lines containing "(tag)" or something similar? The output I would expect in the example is to retrieve all lines, except for the last. I need to compare a long string to a shorter sub-string, so something like Levenshtein distance wont work (or will it?). Tokenized techniques seem to rigid, because although I might tokenize everything in parenthesis, what happens when a parenthesis is missing?


title: How to make a recurring event? Such as an entry in a agenda

text: I have an entity (model) called Notification, shown to Users of the system. So far, Notifications were created and showed instantly to users when they were enabled, and hidden when disabled or deleted. Also, Users can close/cancel the Notification so they don't see it anymore and that action is persisted in a collection (database table) of Notifications viewed by Users. The system must now implement repetitions of those Notifications, like agendas or calendars in which entries can be repeated daily, weekly, monthly, etc. and also send a email to the User the day before the Notification instance date. Conceptually how it is implemented? How about calculation of repetition? So far, I've been thinking of persisting three new properties on the Notification entity, one for the type of repetition (daily, weekly, etc.), one for the start date(time) and another for the end date(time) and a new collection (database table) where I save "instances" of those Notifications (not instances like class instance, but a more generic concept of a single occurrence of something), with properties like notification id and start and end date(time) of that instance. That way Notifications themselves wouldn't be presented to Users, but the instances of those Notifications. Then, I thought of a scheduled task (cronjob) that runs couple of times a day, generating instances from Notifications collection calculating when those repetitions should happen and also sending email when calculated instance date is tomorrow. Not sure if this is the best way and I'd like to hear recommendations. I started to implement it that way and so far it seems easy, but I'm about to start with the logic of the scheduled task (the hardest part) and I wonder if it will be very complex to calculate the date of the instances based on repetition specification (daily seems easy, add a day to the date value, but how about each third friday of the month?).


title: Where can I learn more about Low Level Programming

text: So First of all, I did Graduate from a University with a B.S. in Computer Science, and while I feel I got a multitude of programming experience.....I really missed out on the SUPER low level stuff. I know C pretty well as well as C++, but I basically know no assembly. I don't really know what things like Stack traces are......and for that matter I don't really understand the Stack, Stack Overflow or Buffer overflow or anything like that. Basically anything on the low end spectrum (which I really need to learn). Also I find Hacking/Cracking interesting (from an Educational point) that utilize these low level things (Like Stack Overflow). Where would I learn about things like this? What would be a good way to start?


title: How should one handle "free projects"? Should one accept them or not?

text: Ok, as a software engineer, I feel that my skills are valuable in other contexts, for instance, a friend came to me and asked me to setup a website for her research and I did it for free. At first I thought it would put my name out there and give me something to work with and hone my skills in my spare time... But I couldn't stop thinking that I was wasting my time with an unpaid job. Now, a second friend comes to me with the same story: "Could you do it for me? I will put your name there, you know, it will get tons of views... Yadda Yadda..." How do you handle this? Do you charge for services in your spare time, even if we are talking about friends? If so, how would you charge for it, for instance, as a consultant?


title: Which code snippet would you rather come across?

text: I was just taking a look at CodeIgniters encryption class and found the following function:               function sha1($str)     {         if ( ! function_exists('sha1'))         {             if ( ! function_exists('mhash'))             {                 // use CI implementation                 require_once(BASEPATH.'libraries/Sha1'.EXT);                 $SH = new CI_SHA;                 return $SH->generate($str);             }             else             {                 // use alternate built in function                 return bin2hex(mhash(MHASH_SHA1, $str));             }         }         else         {             // use built in function             return sha1($str);         }     }      If I was writing this function I would do so like this:               function sha1($str)     {         // use built in function         if(function_exists('sha1'))             return sha1($str);              // use alternate built in function         if(function_exists('mhash'))             return bin2hex(mhash(MHASH_SHA1, $str));              // use CI implementation         require_once(BASEPATH.'libraries/Sha1'.EXT);         $SH = new CI_SHA;         return $SH->generate($str);     }      Which is better and why?


title: How do you keep your basic skills from atrophy?

text: I've been programming for about 10 years, and I've started to migrate to more of a project management position. I still do coding, but less often now. One of the things that I think is holding me back in my career is that I can't "let go". I think I fear letting hard-won programming skills atrophy while I sit in meetings and annotate requirements. (Not to mention I don't trust people to write requirements who don't understand the code.) I can't just read books and magazines about coding. I'm involved in some open source projects in my free time, and stackoverflow and friends help a bit, because I get the opportunity to help people solve their programming problems without micromanaging, but neither of these are terribly structured, so it's tempting to work first on the problems I can solve easily. I guess what I'd like to find is a structured set of exercises (don't care what language or environment) that…   * …I can do periodically   * …has some kind of time requirement so I can tell if I've been goofing off   * …has some kind of scoring so I can tell if I'm making mistakes Is there such a thing? What would you do to keep your skills fresh?


title: Vector operations: vec1.dot(vec2) vs vec1 * vec2 vs dot(vec1, vec2)

text: What's your preferred way to implement/use vector operations?   * vec1.dot(vec2)      * allows to reuse vec1 but is hard to read for longer equations   * dot(vec1, vec2)      * A friend of mine prefers this as "dot" isn't a property of vector   * vec1 * vec2      * probably looks best, but not possible in all languages (e.g. Java)


title: Moving from PHP to Python - framework considerations

text: As a long time PHP developer, I am now starting to explore the Python world. I have narrowed the choice of framework down to Django and Pyramid, probably no big surprise there. I have played a bit both both frameworks. I really like Djangos admin, and the fact that everything is already integrated. My concern with Django, however, is that it appears more difficult to break out of doing things the way that they want you to. For a large complex site, that could be problematic down the road. Is this a valid concern? What really caught my eye is that the community for Django seems MUCH larger. Let alone the massive number of docs and tutorials for Django (couldnt fine much for Pyramid outside the official docs?). Of biggest concern is the sheer number of apps that have been built specifically for Django: south, tastypie, multi-tenancy, registration, etc. Am I right to assume that these apps are (mostly?) Django specific, and that they cant be used in Pyramid? Where are the Pyramid specific apps? Or, will they interoperate just fine?


title: CSRF Protection with codeigniter

text: I have very little knowledge in application security. I have often seen to protect your application from csrf attacks developers use tokens and pass these tokens with request to validate. I want to know if i just validate the request is coming from my server and rejects all requests coming from any other server how can it be unsafe?


title: Use of the Visitor pattern and possible over engineering

text: I am developing a small application in .NET and am thinking of using XML to save the object model. My first thought was to separate the model and the generation of XML by using the Visitor pattern. The class would walk the object hierarchy and create the XML. But then I thought about the Extreme Programming method and the "you ain't gonna need it" (YAGNI) principle. I don't envisage needing to create another Visitor to output the data in some other way (it's a simple app) I just want to use a human readable format to save the application's data. Should I use the Visitor pattern or am I just over engineering the solution?


title: Structure of a single page app

text: I'm looking to develop a one page app, and will likely be using node.js for my server side coding. I'm trying to get some advice regards the client-side coding. While i realise that something like backbone.js would really help me, since im very new to development the learning curve is very high for me. So i'm going to be using something like dust.js for my client side templating. Currently i'm creating some mockup screens (there are 4 in total) that are being built in just plain html/css. When i come to doing the client side and server coding, is it better for me to combine all my presentation code into one html file, or into multiple files and then call them separately, considering it's a one page app that i am creating?


title: How to choose between lightweight or heavyweight framework for web application

text: In my current role as a software developer in a **Java/Spring/Hibernate/JSF** shop, I am sometimes asked to develop large-scale web apps with many interfacing systems and/or large databases _as well as_ small-scale web apps with low traffic and/or simple databases. To accommodate this variation, I would like to have 2 technology stacks to choose from, depending on the type of application I'm asked to develop. I think this would benefit us because I think our technology stack that I mentioned above is a bit over-engineered or cumbersome for small, simple CRUD applications. If, for example, I have chosen **Spring Framework** for my large-scale apps and **Play! Framework** for my small-scale apps, how do I choose which one to use for a given application? In other words, how can I tell if a proposed web application qualifies for a heavy framework like Spring or could stand to benefit more from a lightweight, agile framework like Play? Can someone give me some rough checkpoints to help me decide which type of framework to use (heavy or light)? If you use this two-framework approach, please tell me what criteria you use to decide which framework is the best fit for a given web application.


title: Does the syntax of programming languages depend upon their implementation?

text: Although, my question may be entirely irrelevant, but I have sensed a pattern between most programming languages and their official implementations. **Interpreted** (byte-interpreted?) languages like Python , Lua etc. usually have an extremely lenient and easy syntax and are generally type-less or do not require the developer to explicitly write variable types in source code; **Compiled** languages like C , C++ , Pascal etc. usually have a strict syntax, generally have types and mostly require more code / development time Languages whose official implementations are **JIT-Compiled** like Java / C# usually are a unique compromise between the above two with some of the best features of both. Some of the more modern compiled programming languages like D and Vala (and the GNU GJC implementation of Java) are perhaps an exception to this rule and resemble the Syntax and features of JIT-Compiled languages like Java and C#. My first question is, is this really relevant? Or is this just a coincidence that most interpreted languages have easy syntax , JIT-Compiled ones have a moderate syntax and features etc. Secondly, if this is not a coincidence, then why is it so? Like, for example, can some features only be implemented in a programming language if you are, say, JIT-Compiling it?


title: Should I change author name in class file if I make more than 80% changes?

text: I am refactoring existing set of java test classes for automated UI tests. At times I end up in making massive changes in class file or completely revamping it. This makes me think that when I am rewriting entire class then should I change author name in comment section to mine? Am I being greedy? or is it going to be useful for one to see my name and ask me in case of doubts?


title: Are More Comments Better in High-Turnover Environments?

text: I was talking with a colleague today. We work on code for two different projects. In my case, I'm the only person working on my code; in her case, multiple people work on the same codebase, including co-op students who come and go fairly regularly (between every 8-12 months). She said that she is liberal with her comments, putting them all over the place. Her reasoning is that it helps her remember where things are and what things do since much of the code wasn't written by her and could be changed by someone other than her. Meanwhile, I try to minimize the comments in my code, putting them in only in places with a unobvious workaround or bug. However, I have a better understanding of my code overall, and have more direct control over it. My opinion in that comments should be minimal and the code should tell most of the story, but her reasoning makes sense too. Are there any flaws in her reasoning? It may clutter the code but it ultimately could be quite helpful if there are many people working on it in the short- to medium-run.


title: Which framework for HTML5 mobile web app?

text: I used to be an iPhone app developer. Now there are frequent enquires on cross-platform mobile app. So I look for a web based solution and find Sencha Touch. Are there more options? What's your experience and comment on these frameworks? Thanks!


title: Which GOF design patterns are already implemented as first-class language features in C#?

text: (This question was closed on Stack Overflow due to being "too broad" and "not a real question" so maybe it's more appropriate here?) Inspired by this question. We know events are a language-level implementation of the Observer pattern. Are there other design patterns implemented as language features in C#? I want to keep this question C#-specific because there are lots of design patterns implemented in other languages, and I want to keep this focused. I'm not looking for pattern implementations in the BCL (such as decorator in many WCF classes or Factory Method in `WebClient`), but _language-level_ patterns. So far I'm aware of observer (`event`) and iterator (`foreach` in combination with many BCL classes and interfaces). There are probably other obvious ones I'm missing.


title: front end development test - html/css/jquery/javascript

text: We are continually revamping our front end developer test that we do in-house after a candidate has passed an online test. The online test has questions such as:   * How does a for loop start?   * What is the correct way to write a JavaScript array?   * Write the css selector for the 3rd list item within an ordered list with the id "myList"   * For var shoppingList = ["milk", "dumplings", "bread"]; - how would you return dumplings into a variable named groceryItem?   * FizzBuzz So we cover the basics, and try to get an insight into their knowledge. But, in house, we really want to test their problem solving skills, their logic approach, etc. And I don't think we've found a good way to do that for front end developers. For UI guys, it's easier - we give them a design challenge and a white board and see if they ask for more information, how they approach the problem, etc. But we haven't found a way to replicate this approach with web developers (for the record, I am one of the web developers on the team) Thoughts on how to approach?


title: Light bulb for prolonged computer use

text: I would like a recommendation on choosing which light-bulb type (e.g. CFL) and color temperature is best for prolonged computer usage. I am also in a field where color consistency is important so if a specific lamp temperature is useful, I would like to know as well.


title: What are the alternatives to "overriding a method" when using composition instead of inheritance?

text: If we should favor composition over inheritance, the data part of it is clear, at least for me. What I don't have a clear solution to is how overwriting methods, or simply implementing them if they are defined in a pure virtual form, should be implemented. An obvious way is to wrap the instance representing the base-class into the instance representing the sub-class. But the major downsides of this are that if you have say 10 methods, and you want to override a single one, you still have to delegate every other methods anyway. And if there were several layers of inheritance, you have now several layers of wrapping, which becomes less and less efficient. Also, this only solve the problem of the object "client"; when another object calls the top wrapper, things happen like in inheritance. But when a method of the deepest instance, the base class, calls it's own methods that have been wrapped and modified, the wrapping has no effect: the call is performed by it's own method, instead of by the highest wrapper. One extreme alternative that would solve those problems would be to have one instance per method. You only wrap methods that you want to overwrite, so there is no pointless delegation. But now you end up with an incredible amount of classes and object instance, which will have a negative effect on memory usage, and this will require a lot more coding too. So, are there alternatives (preferably alternatives that can be used in _Java_ ), that:   * Do not result in many levels of pointless delegation without any changes.   * Make sure that not only the client of an object, but also all the code of the object itself, is aware of which implementation of method should be called.   * Does not result in an explosion of classes and instances.   * Ideally puts the extra memory overhead that is required at the "class"/"particular composition" level (static if you will), rather than having every object pay the memory overhead of composition. My feeling tells me that the instance representing the base class should be at the "top" of the stack/layers so it receives calls directly, and can process them directly too if they are not overwritten. But I don't know how to do it that way. [EDIT] It seems that many people reading this question think that I am debating if I should use Composition or Inheritance, and that "guiding" me to the one or the other will solve my problem. This is not the case. I always use inheritance when I can, for the simple fact that composition requires more coding, and also more memory. No need to convince me that inheritance is not evil. I have a very good reason to want to use composition. I want to create a system that model domain objects that can "change nature" over time. That is they can both gain and loose functionality/properties over time, as a result of some actions. This is a lot more natural when modeled as composition. If the components that can be dynamically added and removed where composed only of properties, it would be easy. In fact I have already found 14 different possible designs that support that case, with varying compromise on code complexity, memory usage, and speed. The real problem comes when all those components need to be aware of each other, and talk to each other. This is not required when they are just "beans" (in the Java sense). I want to know if there are any, and hopefully several, ways of allowing the components to talk to each other, and more specifically how to have several components _of the same type_ , where one serves as base- class and the others progressively override some of it's methods. I can see two ways to simulate the overriding present in inheritance. The first is to have a base component, and all overriding components are built as wrapper on top of another component of the same type. Like that, you can choose at runtime which hierarchy of components you want. This is like pipes and filters. But the problem is that with inheritance, not only can the derived class call methods of the base class, but it works the other way around too. A base class can declare a pure virtual method, which is implemented by the sub-class, and the base class can call this method. I don't see how to accomplish that using whole component wrapping. Also, if we have N inheritance/wrapping layers, then calls to method of the base component then gets N level of delegation, even if the method was not overwritten by any of the wrapping components. The other alternative, like I said in "One extreme alternative ...", is to do it like above, but forcing each component to contain _a single method_. In that case we solve the problem of the base-class not seeing/calling the methods of the derived classes, for all methods, except it's own method. So it works now correctly for all cases except for recursion. But the price we pay in memory consumption is high, at least in Java. And Java isn't "functional", so there is a lot of syntax overhead to turn every object method into an individual object. If there any better alternatives then the two mentioned above, I would like to know about it.


title: How broad should a computer science/engineering student go?

text: I have less than 2 years of college left and I still don't know what to focus on. But this is not about me, this is about being a future developer. I realize that questions like "Which language should I learn next?" are not really popular, but I think my question is broader than that. I often see people write things like "You have to learn many different things. Being a developer is not about learning one programming language / technology and then doing that for the rest of your life". Well, sure, but it's impossible to really learn everything thoroughly. Does that mean that one should just learn the basics of everything and then learn some things more thoroughly AFTER getting a particular job? I mean, the best way to learn programming is by actually programming stuff... But projects take time. Does an average developer really switch between (for example) being a web developer, doing artificial intelligence and machine learning related stuff and programming close to the hardware? I mean, I know a lot of different things, but I don't feel proficient in any of those things. If I want to find a job as a web developer (that's just an example) after I finish college, shouldn't I do some web related project (maybe using something I still don't know) rather than try to learn functional programming? So, the question is: How broad should a computer science student's field of focus be? One programming language is surely far too narrow, but what is too broad?


title: How to structure a trainee program?

text: At my company we are thinking about starting a trainee program for software developers. We are thinking about attracting people with a CS degree, but little or no experience (or people with relevant experience but no degree). I'm wondering what the trainee program should offer and how to structure it. We want the trainees to be real members of our development team, but use a higher level of supervision, peer review, pair programming etc. We should also provide some amount of lecturing/mentoring and provide some required reading. I'm thinking the program should contain a plan for two years, but I'm not sure. Trainee programs are not common for software developers in my country. So what elements would you include? How do you suggest we structure the mentoring? What principles and practices should we focus on, and how should we draw up the "curriculum"? PS: Our current team consists of four highly skilled agile developers. We mostly do .NET and practice TDD.


title: Minimum billable time unit - industry standard for contract programming?

text: We're a client that recently hired a contract programming company for some fairly focused work (essentially writing 'scripts' to extend the functionality of a third-party enterprise application). We're trying to evaluate their performance on and the value of some work they did for us, but we're a little new to using contract programmers and could use some help:   1. If you were hiring a company as a contractor to do computer program development for you, and the minimum billing time unit was not mentioned in the contract, would you expect to be billed in whole-hour increments (so that a phone call of 5 minutes is billed as 1 hour)?   2. What is industry standard practice for the minimum billable time unit in contract programming work?   3. If you hired a contracting company that had two employees, would you expect each person's time to be broken out and rounded up to the minimum billable time unit? Let's say the senior guy worked with the junior guy for 15 minutes, and the junior guy worked 4:15 that day. Would you take exception to a bill for 1 hour (senior guy) plus 5 hours (junior guy), or would you expect a bill for just 5 hours? You may find my follow-up question about key contract points interesting.


title: What sort of role does "language cultural history" play with a platform?

text: I recently stumbled accross this article from a few years ago. It argues that significant differences in the culture surrounding VB and C#, not the actual differences in the language, contribute to C# coders being generally more talented than VB coders. Obviously, that caused a lot of flame wars and the question of whether C#ers or VBers are the dumber will never be answered. That being said, the writers claim that the culture surrounding a particular platform contributes to the quality of the team could still be plausible. For example, even though Java is more efficient to develop apps with at the moment, a team of Google Go developers would seem likely to be of a higher caliber on average than a team of Java developers, since to learn Go, a developer probably has to be a super-early adopter and a frontier-hacking whiz. So, in a nutshell, **how does the culture surronding one platform or another affect the quality of the average developer on that platform, if at all?**


title: Writing programs without graphical IDE

text: I am not sure if this is even possible but I have watched a few videos with programming examples where it seems like the program is being written in some kind of command prompt rather than a nice graphical IDE. Im just curious as to what might be going on in these videos. Is it possible to write a program without an IDE? heres two examples: http://www.youtube.com/watch?v=hFSY9cWjO8o( @ 6 min) http://www.youtube.com/watch?v=tKTZoB2Vjuk (@ 5 min) Could anyone explain how this is done? Thank you all for the great feedback!


title: Scaling Up applications

text: What should I consider when taking an application (web) from a few users to hundreds or thousands? Basically, what should I be considering when thinking about escalating?


title: How did you become a const correctness convert?

text: After 15 years of C++, I've still haven't learn to love using const. I understand it's use, but I've never actually been in situation where being const correct would have avoided the problem I was facing. So how did you come to love benefits of consts?


title: Multi-Threaded JavaScript?

text: I know, I know--it isn't possible presently BUT my question is this: Would it be possible to write a browser plug in for the major browsers that _enables_ true, multi-threaded JavaScript? It just seems like this would be possible and, if so, it would take the web (not to mention JavaScript) to new heights. Thanks!