Homogeneous vs. heterogeneous AST representation

**What are the reasons to choose a homogeneous vs. a heterogeneous AST representation for implementing a complex domain-specific programming language?** Just to be very clear about what I'm asking, here is some extra background: By homogeneous, I mean a tree constructed of nodes which are a single _generic type_. For example, I think this question is really language independent, but using a C++-like struct for illustration, I'd consider this a minimal homogeneous abstract syntax tree node:               struct Node {       int tag;       void *data;            Node *first_child;       Node *next_sibling;     };      By heterogeneous, I mean a tree constructed of nodes which are multiple _individual types_ (e.g. one for each grammar production). For example, I don't want to assume a particular language, but again using C++-like structs for illustration, I'd consider these types part of a hierarchy used to build a heterogenous abstract syntax tree tree:               struct Node {};          struct Integer_Node : Node {       int value;     };          struct Plus_Node : Node {       Node *right;       Node *left;     };          struct If_Statement : Node {       Node *Condition;       Node *Then_Expression;       Node *Else_Expression;       };          // ... more types, depending on the language ...      Over the years, I've implemented several small, special-purpose compilers, usually in a very ad-hoc way. I've never used much of a real "AST" because usually syntax-direct translation has been good enough. Now I'm in the process of designing and implemented a new, much more complex language, where I will be building an AST and then walking over it with multiple passes for verification, semantic analysis, and so forth. For example, it seems that using a homogeneous scheme reduces the amount of code up front, but I wonder if a heterogeneous scheme will pay off better in the long run for reasons I'm not considering. On the other hand, the heterogeneous scheme seems like it allows benefiting from the compiler's static type checking, virtual method dispatch, etc, but I wonder if any of that is really very useful when developing semantic passes and so forth. _Basically, I'm hoping to gain some insight from those who may have some real experience here. I've read many compiler books and have a moderate amount of basic compiler-writing experience, but I haven't seen this particular dichotomy addressed in any literature I can get my hands on._


Saving user profiles in SQL database

So, I got a table _UserProfiles_ in my database, that, similar to C#'s Settings file, holds a property with the appropriate datatype and the specified setting in the profile. Now each time I add a new setting, I need to update the database, the model and end up rewriting the queries. I've then thought about changing the table to only contain two columns: _Key_ and _Value_ with a varchar datatype to store the users settings... But what is considered to be best practice in such design-questions? Is this approach advisable (for example because it needs custom parsing from string to the needed datatype)?


Algorithm for Cyclical Sequence Alignment

Let's say we have 3 cyclic sequences, each of them of length n and containing every number from the interval 1..n once. The goal is to align the sequences in order to maximize the number of matches between the sequences. By a match I mean a column that contains 3 identical values. Since the sequences are cyclical, we can move each sequence cyclically by any number of positions (so 1->2->3 may become 2->3->1 and 3->1->2 but not 1->3->2). Example:   1 5 4 3 2   1 3 2 4 5   2 1 5 4 3 The answer should be 3 and the corresponding alignment is shown below (fives, threes and twos are matched). 1 5 4 3 2   4 5 1 3 2   1 5 4 3 2 A simple quadratic algorithm I came up with is: for i in 1..n:       align the sequences so that column (i, i, i) is created       count the number of matches       if larger than current maximum, then set new maximum  Unfortunately the sequences may have length 1000000 and thus my approach is not fast enough. I would appreciate I someone could suggest a subquadratic (linear, loglinear?) algorithm for this problem.


Beginning to think functionally

I've recently gotten into learning about functional programming. I've been coding in Scala most of this past year and am just now starting to fully grasp the power of a functional language. I want to build a data-driven website from scratch using functional techniques. I'm having trouble wrapping my head around how to start thinking about this. I've done this many times over using standard Java OO techniques. I usually think about the end product, build my object model off of that, then build my DB CRUD layer, then my services layer (business logic), then my web/ui layer. My question is: how can I reason about/design a large, data-driven web application in a functional manner? EDIT: Good points made so far. How about this: In a data-driven web application (database, MVC, HTML forms, etc.) where does it make sense to use FP? I'm still working on getting a good understanding of exactly what FP is, so please bear with me in my questions.


Using a Finite State Machine for access management?

My intranet site uses LDAP and Active Directory to authenticate users. There are 2 kinds of Users: Managers and Employees. They are differentiated by having membership in a particular AD group. In an effort to improve my code I'm trying to use (hopefully appropriately) formal design patterns. I _think_ perhaps a Finite State Machine might work here. But I'm not sure which of the following models (or some other entirely) would be best:   1. 2 transitions with simple conditions `Unlogged --- auth==TRUE---> Employee ---group==TRUE---> Manager`   2. 1 transition with a compound condition `Unlogged --- auth==TRUE && group==FALSE---> Employee` `Unlogged --- auth==TRUE && group==TRUE---> Manager` The first feels cleaner. The second is closer to what should actually be happening. Am I on the right track? Would a different design pattern entirely be better?


what does the term bandwith mean?

I am a pure internet product so i don't have any it degree or training so i am quit confused about bandwith. is it the memory resource server or processor resource or database server load? If i use sqlite database instead of mysql server for small projects, will it speed up my site performance (since sqlite file will be used only by me)


Why can't an xml comment contain two hyphens

I was applying markdown comments in the xml comments of a config file when the XmlParser reported that two hyphens (`--`) are not allowed in xml comments. Checking the XML Specification, it appears that xml comment isn't designed to contain two hyphens for compatibility reasons with SGML parsers. Why do SGML parsers disallow double hyphens in comments?


What should I expect from a technical evaluation for C++?

I have been asked to go for a technical test/evaluation for a job as a junior developer, mainly using C++. This is my first test/evaluation, and it is 2 hours long. My C++ is a bit rusty as I have been doing projects recently on PHP. This is a UK company, however im guessing technical testing of candidates will be pretty much the same everywhere. What should I expect in one of these tests?


Document management system frameworks?

I'm working on an enterprise LOB software. The next piece that will be added to the system is document management. Most entities throughout the system will have documents attached to them. I clearly see the need to organize, search, share, upload and scan documents. I was wondering if a document management system with the following requirements exists:   1. Not a monster (not Sharepoint, etc)   2. Easily embeddable, my environment is .NET Silverlight   3. No royalties. Preferably just pay for it once and use it as custom controls, etc. I bet such an animal exists as I don't want to reinvent the wheel.. Thanks!


Is there a minimum team size required to see a benefit from Agile?

I work at a company that has repeatedly cut the sizes of its development team, to the point that previous 10-man teams are now down to one developer per product (and a couple of testers shared between 5 products). We used to be fairly process heavy, having been a spin off from a larger company, and inherited its multi-stage waterfall process. It has come down from the executive team that we are not releasing software fast enough, and that this is likely the fault of the process (which may be a contributor, although the 90% loss of manpower probably didn't help). There has been a push for us to move to an Agile process to avoid spending time writing design documents, etc. I guess I'm just curious as to whether a switch to Agile will help with single-person teams. It was my understanding that a lot of the benefits come from higher visibility and more communication between team members, but I know what I'm doing and so does my manager. I already do TDD since we have no one to test the product anyway. **TL;DR version:** I guess what I'm really asking is, can you implement Agile with single-person 'teams', and do you see any benefits from it, or is it usually something that's more effective for larger teams?


Please tell me I'm not alone (can't program on paper)

So I went to a job interview today. Long story short, the interviewers were delighted with my knowledge and experience, they were practically showing me to my new desk. Needless to say, what delighted them was a factual and unexaggerated description of things that I've actually worked on. But then suddenly, as I was getting ready to leave, one of the interviewers says to me: "Well, I know that this is probably too easy for someone with your experience, but because of protocol, we need you to complete a simple test". No problem I thought... After this I get handed a piece of paper, a pencil (seriously wtf? who uses these primitive devices anymore?) and instructions telling me to code a function returning a Fibonacci number and another doing that with recursion. God I hate math. I distinctly remember doing this precise exercise on 3rd semester of college. I probably nailed it back then, but not so much today. It took me about 40 minutes and I got close, but the functions didn't work. Ironically, I knew exactly why they were wrong and what erroneous result was being returned, but I just couldn't figure out how to fix them. Something about having to scratch graphite marks off a paper, just made me really, really nervous. Or perhaps it's that I'm self-conscious about having my math skills evaluated. I can't calculate a tip with a waiter watching because I'm slow with numbers, and it makes me feel embarrassed. All of this got me thinking about this Coding Horror article. Apparently, 199 out of 200 applicants pretend to know how to code, but actually can't. I think there's something else going on here. I mean, none of you are going to hire me, I've no reason to lie to you when I tell you that I've coded much more complex things. And yet I couldn't code a simple function, not under those conditions. Has anyone else experienced this?


Derived Class Method Naming

I'm having a hard time coming up with a good naming convention for methods in derived classes that serve the same purpose as the methods in the base class. For example, if both the base class, and the derived class, need to initialize:               public class Foo()     {         public void Initialize()         {             // base class initialization code here             InitializeDerived();         }              // force derived classes to implement their own initialize method         protected abstract void InitializeDerived();     }          public class Bar() : Foo     {         protected override void InitializeDerived()         {             // initialization code here         }     }      InitializeDerived() seems clunky. The only other option I can think of is to make the base class Initialize() method virtual. Then the derived class could override it, using the same name, and call the base class Initialize() method first. Is there a better way? A better naming convention? ** EDIT ** This may be a better example, because constructors won't solve the problem here. In this example, we have a rules engine where the client code polymorphically calls Process() on each rule:               public class RuleBase()     {         public void Process()         {             // base class processing code here             ProcessDerived();         }              // force derived classes to implement their own process method         protected abstract void ProcessDerived();     }          public class RuleValidateHeight() : RuleBase     {         protected override void ProcessDerived()         {             // derived class processing code here         }     }      The consuming code:               foreach (Rule rule in rules)     {         rule.Process()     }


Why would I use Angular?

From the basic Angular tutorial, it seems like all it does is fetch some JSON from an API and display it. Also, there's its double binding magic. But why would I use it instead of a backend solution (like Rails) that builds the view in the backend and serves it to the user, with everything in place already? What are the use cases?


In C++, how much programmer time is spent doing memory management

People who are used to garbage collected languages are often scared of C++'s memory management. There are tools, like `auto_ptr` and `shared_ptr` which will handle many of the memory management tasks for you. Lots of C++ libraries predate those tools, and have their own way to handle the memory management tasks. **How much time do you spend on memory management tasks?** I suspect that it is highly dependent on the set of libraries you use, so please say which ones your answer applies to, and if they make it better or worse.


A hint to create a db schema

I need to realize a database in this mode:               TABLE restaurant      with "classic" fields of a place: address, street number, phone, website, etc etc etc. I need to indicate also the days of opening // closing. E.g. From Monday to wednesday close, saturday only evening and sunday lunch + evening. So, I did think at another table with 14 rows:               ID_RESTAURANT  MONDAY_LUNCH MONDAY_EVENING [...] SUNDAY_EVENING         12         0             0                    1         And "finally" every restaurant has his own cooking ("international", "chinese", "japan") Another table with a column for every cooking? Finally, several services. "Conditioned Air", "Credit Card", "Animals permitted" "children addicted" etc etc. Another table with a column for every "service"?               ID_RESTAURANT    CONDITIONED    CREDIT_CARD     ANIMALS         12              1              1              0         13              0              1              1      I hope that I'm clear. Thank you very much!


Best way to auto login in web application

This question could be titled "Place password hash and salt in query string?" as well to be less subjective, but the point remains the same: I want to create kind of a launcher application for my web application, which should allow the user to specify his credentials to auto login into my web application. Now since plaintext is almost always awful, I thought about passing the password hash and salt as a querystring to my application to perform an auto login. Something like: http://myapp.com/login/?autologin=true&passwordhash=foo&salt=bar But I wonder if there is any better or more secure way instead of doing this?


subclass of immutable object not immutable, can this work?

So I'm finishing up refactoring some code to remove a number of previously- mutable objects and add a better generic processing for all the classes in the domain. Just as I thought I was finishing I eralized that there is one sub- class that has some additional state. The additional state is a link to other classes that are used as part of the logic for knowing when new domain objects will be created, deleted, or modified. However, this sub-class is only created at bootup, or when someone runs a command to re-read and update to new configuration files. I know that this object will _always_ be created before any of the other objects in my domain that are dependent on it are, such that anyone pointing to this object are all gaurenteed to point to the same instance. I effectively have the Memorization pattern by an accident of how the structure is created. I could refactor away the mutability; but it would require a bit of work modifying bootup logic that I would prefer to avoid. Or I could change the has and equals methods to ignore this one set of mutable values so my model will treat this object exactly like it's immutable parent and trust that my knowledge of the method it is constructed prevent me from aliasing issues when I do try to use it's mutable traits. So how 'wrong' is it to bend my contract for thie class this way be?


Layer Encapsulation without Model Overload?

I'm starting a new project, so it's time to re-evaluate how I do things. In the recent past I have created a 3 layer/tier project (UI, Domain, Data) with each tier with it's own separate model. The the DAL has it's data entities consumed by the Domain layer, which mapped them to domain models which were consumed by the UI which mapped them to ViewModels. This did allow for some differentiation at each level (especially UI) but the mapping was overwhelmingly tedious (Automapper helped a little) and the Domain and Data layers were basically 1:1, with the UI view models being the most useful. I'm trying to figure out how to simplify for my next project and I could use some suggestions.


How many programmers makes a company small / medium sized / large?

I am a freelancer so I really don't know what you guys put behind the words when you say "working in a **small** company is X different compared to a **medium sized** one, and Y to a **large company** ". Could you please tell me (roughly) what are the boundaries between these categories ? I am asking specifically for how many programmers ( _IT-related workers_ *) in a company instead of how many workers because:   1. To avoid the "this is not a programming related question" spam; and   2. Because I (logically) care about the differences related to programming, a company with 100 workers, only 2 of which are related to IT inherits the just-a-few-programmers working environment, and is obviously smaller compared to a company of 10 workers who are all programmers. Smaller by the classification given on this site, for different situations binded to the size of the team(s). * _I suppose project managers, QA, team leaders, etc. also goes under the countable people._ **Thanks**.


Why doesn't Mono implement WPF?

I haven't been able to find a reasonable justification of Mono team not working on WPF. What could be the possible reason? Especially when they've already implemented Silverlight.


Legality of modifying and distributing the JRE

I see that Google App Engine apps run on a so-called secured sandbox JRE; that is, a JRE that Google modified and that makes changes to certain JRE types. This is how GAE prevents developers from writing apps that can do things like:   * Access the local file system via `File`   * Make remote JDBC calls   * Use JNDI   * Lots of other restrictions We have a similar need where we have an app that developers will be able to write plugins for. These plugins will need to utilize an API (a JAR) that we distribute with our app. We cannot afford for plugins to do certain things, particularly on the end user's file system, and need to modify the `File` class in a similar manner that GAE does. **Long back-story short, this means we'll need to ship our app with a custom, modified JRE.** My question: **is this legal to do** , or did Google likely pay Oracle some fee to modify/distribute their own JRE for app engine?


When doing up a quote, do I see my client in person, or send it via email?

Client need something done, I need to write up a quote, how do I approach it? If you have any general strategy on this issue would also be appreciated. This is to build a website/database for a few grand.


*Code owner* system: is it an efficient way?

There is a new developer in our team. An agile methodology is in use at our company. But the developer has another experience: he considers that particular parts of the code must be assigned to particular developers. So if one developer had created a program procedure or module it would be considered normal that all changes of the procedure/module would be made by him only. On the plus side, supposedly with the proposed approach we save common development time, because each developer knows his part of the code well and makes fixes fast. The downside is that developers don't know the system entirely. Do you think the approach will work well for a medium size system (development of a social network site)?


Where to store the private key?

Say I want some parts of my software to be encrypted. For example, the credentials for a database, etc. I need to store those values somewhere, but doing so in cleartext would make it easy for an attacker to gain unauthorised access. However, if I encrypt some cleartext, then where do I store the key? Anything that software has access to, a determined attacker would have access to, no matter what level of obfuscation:   * Say the key is protected by the filesystem's security model; but what about (malicious) superusers, or platforms that don't provide such fidelity?   * Or the key is hardcoded into software binaries, but it could always be decompiled and what about open source software or interpreted code?   * If the key is generated, such an algorithm would need to be deterministic (presumably) and then the same problem applies to the seed.   * etc. Cryptography is only as strong as the weakest link in its chain and this seems like a pretty loose one! Presuming it's the right tool for the job (humour me), then how can one secure such information robustly? * * * Regarding the right tool for the job: Probably, in -- for example -- the case of service access (DBs, authentication servers, etc.), you would restrict access at this tier with a service account, maybe with some service-level auditing, etc. and so having the credentials in cleartext isn't such a worry. To me, however, that still seems inadequate: I don't want anyone poking around where they shouldn't be!


BSD/MIT license changes when copy/pasting a function from another BSD/MIT licensed package

I frequently find myself wanting to use some small function from another library but end up not doing because it's not worth pulling another dependency. Considering BSD/MIT licenses, if I just copy/paste a function from another package, what would be the legal requirement when licensing my code? Also, as matter of _netiquette_ , what would be the preferable way to give credit to the original author? I understand this depends on the specific circumstances of each situation. The safe way would be to always ask the upstream author what does he want, but, sometimes, this happens so frequently that having a a default proposition for the upstream author can make the interaction smoother.


Extending GPL code will make the new code GPL too?

I am currently adding some functionality to a popular open source project. It written in C and in Every file GPL license text is embedded. The functionality I am adding is not supported by the project. So you can say its some sort of extending. My code gets compiled when the main project is compiled. My code is inside the main project and its integrated heavily. Let me explain more thoroughly. Basically I know of two types of linking.   1. My _program_ uses mysql c api. so I link my c code with `libmysqlclient`. Here I am **using** `libmysqlclient`   2. My _code_ adds hash-table functionality on `libmysqlclient` so user can access fields by column name. My project is of second type. Should it be GPL? What about the first scenario (I am curious)?


How should I populate a list of database-sourced models?

I have a model which sources its data from a MySQL database using a `load()` public method. If I have a collection of models, I have to loop through each model and call its `load()` method individually; meaning multiple queries are executed which is slow and inefficient. Should I have something like a `populate()` method on my model that is called from a controller (MVC) and fills the model with data so that the MySQL queries are as few and efficient as possible? Or is there a better way to do this? I'm worried that if I load model data from outside the model, I'm leaving proper encapsulation behind, and bloating my code with nearly-the- same-but-not-quite copypasta.


Combining getters and setters

JavaScript libraries such as jQuery, combine 'getters' and 'setters' in the programming interface for example:                $('element').css({'color','blue'});      will set the color or                $('element').css();      will get the css for an element. Is there a name for such a pattern and is it a good practice to use in applications?


Best practices for generating new identifiers for persistent objects?

In a typical scenario, an object that needs to be persisted in the database will be created in application code without an identifier, and later saved to a table in the database. Some database construct, such as an identity column, will generate a new identifier, typically an integer that's unique for all of the rows of that table. This identifier can then be returned to application code and then treated as a key.               CREATE TABLE Users (         UserId int IDENTITY(1,1) NOT NULL, DisplayName nvarchar(max),          UserName nvarchar(50), [Password] nvarchar(50))     GO          INSERT INTO Users (DisplayName, UserName, [Password])          VALUES ('Joe Shmo', 'jshmo', 'pw1')     SELECT @@IDENTITY      Another common scenario is for the identifier to be GUID:               CREATE TABLE Users (         UserId uniqueidentifier NOT NULL, DisplayName nvarchar(max),          UserName nvarchar(50), [Password] nvarchar(50))     GO          DECLARE @id uniqueidentifier = NEWID()     INSERT INTO Users (UserId, DisplayName, UserName, [Password])          VALUES (@id, 'Joe Shmo', 'jshmo', 'pw1')     SELECT @id      This second way provides the following advantage: the GUID can be generated in application code, which can then be used as a key for application caching/referencing purposes before the object is ever saved. However, there is a cost associated with using GUIDs in size and, especially look-up costs. These may be trivial when the table is small, but can become a major factor when the table is massive. Are there any best practices, or techniques for the cases where an identifier unique to the object type needs to be generated in application code, but cannot be a GUID for whatever reason? One thought was to have a another table generating identifier wrapped by an identifier service which application code could call.


Do you know of any encryption techniques used to validate url redirection

I'm adding a click-tracking feature on my website to track click-thrus for my advertisers. So, on my site, instead of having a _direct link_ , I link to my _re-direct page_ passing the destination url as an argument. This re-direct page then tracks the click thru and then 301 re-directs the user to the correct external url. I want to prevent 3rd partys from harnessing this system to make it re-direct to arbitrary urls. I'd like the code that creates the links to: Create `special token` using ( `destination url` \+ `secret` ) Then, pass the `destination url` \+ `special token` arguments as query string parameters to my _re-direct page_ in public. Upon receiving the arguments the re-direct page will do a check: Given ( `destination url` \+ `special token` \+ `secret` ), `destination url` is either:   * good - re-direct it to destination   * bad - do not re-direct it to destination and it should _not_ be possible for Doctor Evil to: Create `secret` using ( `known valid destination url` \+ `its special token` ) * * * Ideally the `re-direct` page would not have to do any url-specific look-ups on data to validate the parameters - it should just be able to tell from 'the two params given + the secret + the known algorithm'. I'm not very knowledgeable about encryption so was wondering what kind of method one would use to create and validate the parameters given the shared secret. I'm sure this is a common technique but I have no idea what its called - thus its difficult to learn more about it. Any help is appreciated.


How does one interface C++ with the web (at Google, for example)?

Google is well known for the ridiculous amount of C++ they've coded over the years. Correct me if I'm wrong, but a large part of Google's core search engine is written in C++, isn't it? How does one take a program written in C++ and interface it with a website? Note: I'm not looking for how Google in particular does this, just how it might be done in general.


Why do my java programs run faster in eclipse than in BlueJ?

I've been programming for about 2 years, and so far Java is all I know. When I made the switch from BlueJ to eclipse I noticed my old projects ran much faster. What would be the reason for this, as far as I knew the executing of java byte code is handled by the JVM and I still had the same JVM after I switched. Other than that does eclipse have had a different compiler? That's the only other thing I could think of. **Edit:** I timed it, the average runtime for, we'll call it A(100), in blueJ was 1 Minutes; 8 Seconds; 846 Milliseconds. In eclipse A(100) only took 8 Seconds; 459 Milliseconds. I've also noticed the increase for all my other programs too. I haven't measured those yet but the difference is definitely noticeable. A() is a function that does alot of computation than prints of a chart of information based on what it found, fyi.


What open source C# projects exemplify separation of concerns and good solution structure?

I'm looking for something showing best practices in N-tier enterprise application design with focus on code re-use and scalability. Possibly using DDD or CQRS methodology. Don't really care about UI, as that's already well understood.


Is it wrong to copy ideas from other languages?

In the making of a programming language, is it wrong to copy features and ideas from other programming languages? If it is not a problem, why not? Is it possible to license and copyright these things?


Tutorial for getting started with bare bone rails

I am trying to pick up Rails, but there are a ton of things that it does that it's not under my control and that's scary (http://blog.zawodny.com/2011/06/13/i-actually-tried-learning-rails/). Is there a tutorial where it explains only the exact things you need to do in order to pick up the framework? (specs, controllers and views)


How do I cope with a manager who’s always interfering in what I do, but doesn’t really understand it?

We've all had them, managers who have either come from sales or last looked at code 10 or more years ago but think they know how to write code. What can I do to give the impression that I'm grateful for his intervention, but keep it as short as possible so I can get on with my work? Or, should I be engaging more with the manager to educate him/her with modern coding techniques and practices? After all, a manager who understands these will be able to talk sensibly to clients and more senior management when discussing the project and its timescales.


Can JavaScript be used as a general scripting language?

I've used JavaScript and some frameworks (jQuery, Prototype, some node.js) for client-side web programming, but never on the desktop, where I do most of my scripting work in either Python or Bash. But IMHO, JavaScript would make a great scripting language if used outside of the browser. Has anyone tried this? Can JavaScript be an adequate replacement for Python/Perl/Bash for quick and dirty scripting tasks?


Team Foundation Server - Deployments

We currently have 5 developers working on quite large Silverlight application. We have 3 servers:   * Test   * User acceptance server   * Production Each person works on something completely different and rarely do they run into each other's code. When they do, they just merge it while checking in their changes. The biggest problem we have currently is following scenario:   1. One person works on some module and it's finished but we don't want it to be released yet.    2. Second person works on some bug fixes etc. those need to be released. Both people checked in their code. Now how do we select/pick changes we would like to keep in a specific build. **Is there a way of creating custom build based on specific check-ins? Can we revert some changes?** I have previous experience in git/hg and I only just started using TFS for this project. What I used to do in Git was to create a new branch per feature and each person would work on their branch. If a person was working on general bug, they would then check it in to the master branch and other people would just pull it to make sure they are up to date. When the feature was finished we would then merge the branch into the master branch. TFS seems to be very fragile and every time I tried doing something with it I either ended up losing some changes I made or ending up with many hours trying to fix some random issues I created by doing simple tasks such as check it or get latest. **Are there any tutorials (more hands on) available?**


How to stop the development spec from changing in mid development?

**Problem** : It seems with almost every development effort I'm involved in, no matter how much time is spent planning prior to starting development, there is always a large amount of changes required either midway or towards the end of the project. These are sometimes big changes which require alot of re- development. I don't work for clients who pay money, this is an in-house development team on in-house development websites. So, it's not like I can charge for it or anything. And at the end of the day, we have to try to hit deadlines. **Questions** : What are some of the best ways you guys have found to minimize and prevent spec changes from cropping up midway or after development?


Applying DRY to an inheritance hierarchy

I'm working on refactoring a legacy application where I implemented the State pattern successfully as shown in the following diagram: ![State Pattern UML](http://i.stack.imgur.com/ceQNx.png) As you see there is a common behavior between the 3 states, so I decided to extract the common method `Refund()` to a parent abstract class `RefundableState` where I implemented it: ![Refactoring for common operations](http://i.stack.imgur.com/j4SAX.png) Refactoring further I notice that the `Ship()` method is common between the 2 states `Cancelled` and `NewOrder`, so I go for another round of extracting the common behavior to another parent class `ShippableState`: ![Refactoring problem!!](http://i.stack.imgur.com/QHbLO.png) Now I need my `Cancelled` state to extend 2 classes and in the same time I can't group the `Refund()` and `Ship()` function together as not all state permit the 2 actions. How can I fix this? **Notes:**   * This question is mainly about applying **DRY** and refactoring not about how to implement the state pattern.   * I'm using PHP 5.3, but I'm open to answers in any other languages.


How do we handle Categories in database schema and model classes

I am trying to develop an ecommerce solution but stuck on the categories management issue and don't know how to proceed further. See, A category will have a parent category, which in-return can also point to another parent and so on, until the root category is reached. I tried to design the following database schema, **Please tell me if that's right ?** ![enter image description here](http://i.stack.imgur.com/kew7U.jpg) OR **Is there any tutorial on categories and parent categories that can help me understand this scenario better ?**


DB centric iPhone app question

The iPhone app i have an idea for deals with processing of the data stored as part of Oracle database at work. It'll be an interface to a dynamic set of data that is updated tens of thousands of time a day. Each time you look, results are likely to be different. That being said, the company i work for does not have an enterprise appstore, which (as i understand it) means that i would have to publish my app onto the regular appstore with some kind of access key. > Q1. Is this a common practice, given no company specific app store exists? I wonder if any of the cocoa API allows for east access and synchronization with Oracle databases. > Q2. If you know of one and can point me in the right direction, i'd be very > grateful. Is there anything else i should know when dealing with such a problem? Security is obviously a concern, the data will likely be of absolutely no interest to an outsider, but then again, we do want to be as prudent as we can be. Please let me know


Is it a basic principle, or highly desirable, to have class methods that return "$this" rather than a value?

I've really just begun to learn OOP. I started about a year ago and have written probably 15,000 lines of it. But I wrote it all with hardly any experience looking at other people's OOP. Most of my class functions return a value or make a change to the class properties and return true/false. Some of the ones that return a value also save that value into a class property (after first checking if the class property is already set, which can avoid a database call). Now I'm doing a lot of digging in Magento/Zend and I notice a lot of their class methods return "$this". As I understand it, unlike in regular functions, class methods that return $this act by reference not by value, so that you get back the same object you started with rather than a copy. Is returning `$this` something that I should be doing much more of? Does it make the code easier to maintain and use? Is returning `$this` necessary in order to chain class methods?


Finding occurrences of a useful words and phrases in strings

I am building an app that analyzes posts by people by pulling their Tweets and Facebook posts. I need to process all the posts and find _useful_ phrases. What I mean by useful is that, any word or phrase that is a noun/adjective/verb that would represent a discrete object or an idea, or in other words, I am looking for keywords. For example, if someone has posted those three posts (in a very simple sense): `i am a big fan of progressive metal music! it is fantastic!` `Look what I've found: a new Progressive Metal band!` `a good genre in music is progressive metal` Analyzing those simple examples, I need to extract `progressive metal` and `music` with the highest occurrence rank. But if I pass the occurrences of words simply, I'll be getting `a`, `is`, `I` as the most common words. If I get away with the propositions, then I'll be getting single words such as `progressive`, `metal`, `music`. What I really need is to get phrases such as `progressive metal`, or `progressive metal music`, which together actually make sense. As a word, `progressive` and `metal` have other meanings, but the phrase `progressive metal` defines a musical genre, which has nothing to do with the single words themselves. Iteratively searching occurrence of every possible phrase in all the posts (e.g. first search `i` in all posts, then `i am`, then `i am a` etc.) is computationally extremely expensive and is not an option. I've looked at some similar questions: Available options for classifying words in text? Language parsing to find important words But both are overkills, solving (or trying to solve) more general problems. My problem is more specific and I'm thinking of a simpler solution that doesn't involve NLP. An idea one might come up with is to compare the posts against a valid word/phrase list, but people might be talking about a brand related name, or a specific event, that are not available in a dictionary, such as `Twitter API`, or `death of Michael Jackson`. I am currently evaluating posts against the user's Facebook likes, which makes a good dictionary of valid phrases about the user, but it fails when we are on Twitter, without the notion of "likes", hence, no valid dictionary. Is there any simple way of checking occurrence of valıd terms in a large array of sentences? (not necessarily grammatically correct) UPDATE: It's an iOS app so I'm in Objective-C, to keep in mind in library recommendations.


How to make my web app restful

I have a web application which I want to make RESTful. Here is the structure of the app:   1. Top level has a bunch of search screens, they are basically tabs which search different parts of database with different parameters.   2. After the search is done we display search results in a new tab, inside this tab is a table with a list of results.   3. From the list of results we can drill down to individual details for each row (they also open in a new tab)   4. Inside the details there are further additional details (and some sub-searches relevant to the the item). These additional details are also open in a new tab. So, now I want to make this app RESTful - the goal is for people to share their searches and screens easily, have simpler URLs, get rid of some information stored in session.   * Is this feasible for the design we have to make it RESTful?   * The main difficulty I see is that we have multiple tabs with different searches and details, how do I reflect it in the URL?    * Also, the search could be quite complex - users can enter 50 different filters and could enter multiple ids - up to a thousand at the same time. What would be a preferred solution in this case? If this is not quite works, then is there a way to have several tabs that correspond to different URLs in one URL?


What kind of abstraction/SoC should I use here?

I am starting a new project, and I want to follow the separation of concerns pattern, and I have been reading on the topic, and now I am in doubt of how I should go about this. * * * **Here is how I thought I should go about it:**   * Application/Presentation Layer uses the Business Layer. Works with the entity _interfaces_.   * The Business Layer uses the Data Access Layer (repositories, models/entities). Works with the entity _interfaces_.   * The Data Access layer works with the Database, and is using an OR/M solution - the solution itself may change. Works with the entity implementations, but returns _interfaces_ to the business layer. The business layer would get a specific repository implementation injected. The repository would return entities in the form of Interfaces, so the business layer would not care what kind of OR/M we use. If we decided to switch from using e.g LLBLGen to NHibernate, we would do the following:   1. Code a new set of entity classes to be used with NHibernate, because the entities we have were generated by LLBLGen.   2. Create a new repository implementation that worked with the new entities + framework.   3. Switch out the repository implementation being injected into the business layer with the new one - the repository works with interfaces, so business layer could remain unchanged. The main point of interest _(pain)_ here, apart from having to modify the generated entities to implement our model interfaces, is that we have to create **entirely new entities** just because we are switching frameworks. The same would be necessary if we switched out the datasource to something the OR/M didn't support. This is the way I've been doing it (because hey, _auto-generating your entities is how you get all the ladies, right?)_ , but then I came across this excellent article! * * * **Here is how I think I should go about it now**   * Entities are stored in a separate namespace/project - `MyProject.Model`   * Application/Presentation Layer uses the entities in `MyProject.Model` to display stuff. Uses Business Layer to retrieve/save them.   * Business Layer also uses entities in `MyProject.Model`. Uses a repository from Data Access Layer that gets injected, depending on what OR/M we are using   * Data Access Layer uses the OR/M frameworks with **code-first** , so we can work with `MyProject.Model` regardless of what OR/M, or even Data Source we are using. * * * Pro's and con's for solution 1:   * Pro: Can use Database-First to auto-generate entities. Timesaver!   * Pro: Works with interfaces for entities   * Con: Works with interfaces for entities (this may be too much abstraction?)   * Con: Have to use an entirely new set of entities to implement a new OR/M or Data Source. They need to be modified to conform to my interfaces, chances are they can't because of how they do relationship-management. Pro's and con's for solution 2:   * Pro: Write entities/models once, use for any DAL implementation   * Pro: No need to use interfaces for entities   * Con/Pro: Stuck with code-first for every OR/M. On the other hand, gives you full-flex on how you want them to look.   * Con: Some framework (e.g EF) are simply easier to get rolling with when using DB First. I had more pros and cons before, but I lost them again.. * * * Conclusion: What solution would you pick, and why? Or do you have an even better solution? Please don't close as "not a question", because I really need an answer. Thank you.


Storage Client Library 2.0 - Why is the API not as intuitive to use as 1.7?

I am migrating to using the new Storage Client Library for my Azure Table Storage. **Querying with the previous _Storage Client Library 1.7_ namespace:**               var orders = serviceContext                      .CreateQuery<Order>(tableName)                      .AsTableServiceQuery<Order>()                      .Where(e => e.PartitionKey == partitionKey && e.RowKey == rowKey)      **Querying with the new _Storage Client Library 2.0_ classes:**               string partitionKeyFilter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey);     string rowKeyFilter = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, rowKey);     string combinedFilter = TableQuery.CombineFilters(partitionKeyFilter, TableOperators.And, rowKeyFilter);          var query = new TableQuery<Order>().Where(combinedFilter);     var orders = table.ExecuteQuery<Order>(query);      Please correct me if I'm wrong, but 1.7 is cleaner, uses strongly-typed entities, implements the IQueryable interface and utilizes the full power of LINQ. Version 2.0 makes me feel like I'm working with ADO.NET Datasets again. Am I completely missing the plot here? I understand that there have been major performance improvements, but version 2.0 feels like a downgrade of an API. Why isn't there a `IQueryable<T>` interface for 2.0?


Mock up class object

For example I have class `ItemDownloader` which has method `downloadItem`. This method creates instance of another class - `Download` to perform actual downloading. Question is: I want to test `ItemDownloader` in isolation, so I will probably mock up `Download`. How should I do it? P.S.: Question is more about design than implementation, I can certainly mock up class object in languages like Smalltalk or Objective-C, or use Prototype pattern in C++. But as I understand there is better solution.


What exactly is DevOps Engineering?

If someone were to work as a DevOps Engineer, what sort of things would he/she do on a daily basis and what would their responsibilities entail?


difference between Visual Studio and RADs?

What is the main difference between a Rapid Application Development tool like MonoDev and Visual Studio, is an RAD more focused on one thing? I'm looking to make a web application, are there advantages to using a Web Based Rapid Application Development Tool as opposed to Visual Studio with the .NET framework 3.5 support?


Information Technology -> Specialization of Computer Science?

My friend said to me "IT is a specialization of Computer Science". I said it isn't. Is he correct? Can someone clarify the difference between IT and CS? I know they are related but according to me calling IT a specialization of CS doesn't make sense.


Starting on a large project, should I split it into more concise parts?

Background: Currently an intern at a company and working on repurposing older programs (still in use, but for different departments) for use in testing new hardware. The new hardware is different in terms of register layout and firmware interface from the older iterations of hardware. I have been given free reign on how to setup this project as it is to be used for the new hardware exclusively. Currently there is a single .c file and 5 different header files that make up the program. The .c file is currently over 10000 lines long and comprises EVERY single function in use of main(). My question is, should I split the code into more recognizable chunks of .c files? It is currently only a mild annoyance to go through and find the methods I need, but it is time-consuming and I do have deadlines. What are the benefits and tradeoffs of doing so now, rather than later? I aim to finish re-purposing the program by next week (this is heavy optimism, it will most likely take two weeks), so is it more efficient to start culling and moving around code now, or will I benefit more from just attempting to force my way through as is?


metro style on windows and android

I want to develop a rather simple app using windows 8 metro style for GUI. But i need this app to have the same appearance, GUI, for both platforms, so that end users that uses it both on PC and a mobile device to have the same visual experience and a flawless navigation. So, does anyone have knowledge of a Java framework or library to satisfy these needs? Or maybe a method to create a web-based app using HTML, PHP, JScript etc. (maybe something using a local server, on the same machine, because a web server is out of discussion, at least for the moment)? Any idea, method, technology related to the subject is also helpful. And if what you are thinking at can be used for IOS too, the better.


What are appropriate metaphors for the pieces of a word processor?

A word processor is a complicated creature of many layers and pieces, but it represents a relatively simple concept: a piece of paper with writing on it. This leads to the problem of having many abstractions without enough intuitive names to describe those abstractions. Not everything can be a document. The solution to this sort of problem is usually finding powerful metaphors that make life easier. Here are some of the abstractions for a document that need intuitive names:   1. The data structure that breaks up plain text into meaningful pieces such as chapters, sections, headings, and various kinds of emphasis. This is the most abstract document because it avoids all rendering information like fonts, colors, underlines, or alignments.   2. The data structure that provides text with rendering information such as fonts, colors, sizes, alignments. This also represents a document, but at a level that is closer to the printed page. It probably uses an instance of the first kind of document to help generate the content.   3. The data structure that arranges glyphs into lines of text. This document can be given the number of a desired paragraph, a position within that paragraph, and a maximum width in pixels, and it produces a data structure that represents a line of text ready to draw. It makes sense to base this document abstraction upon an instance of the previous document abstraction because they both represent documents at different stages in the rendering process.   4. The final data structure stores lines of text in their relative positions on the screen or page. It is capable of drawing an entire screen of text, inserting figures, and making columns. It knows which part of the document is currently visible, handles scrolling or dividing the document into pages for printing. This document abstraction is the very closest to the paper, but does that make it most worthy to be called document, or is the most abstract layer the true document since it is what the user is truly editing? All four concepts are documents in their own way, but I can't call them all documents; that would be confusing. What is the proper metaphor to use here? Something that intuitively reflects the complexity of the task better than a document? On top of all that, there are three different ways to represent a position within a paragraph.   1. Measured in characters from the start of the paragraph   2. Measured as a line number starting from the first line of the paragraph and then measured in characters from the start of the line   3. Measured in pixels as the paragraph is rendered on the screen These three representations are all positions, but things become confusing if I call them all positions. I need a simple way to distinguish them, something that fits well with the improved metaphor that I'll use to distinguish the four kinds of document. I have looked into typography in search of good metaphors, but nothing jumps out at me. I have also considered a metaphor from constructing a building. The first kind of document could be a Blueprint, the second kind could be a Foundation. Unfortunately #3 and #4 aren't clear, and it doesn't seem to help with the issue of paragraph positions.


Any good, easy to learn from books or tutorials for learning assembly?

I've been a developer since 2009 and I've learnt a lot of languages since, but I've always wanted to understand and be able to code in the lowest level language so I can directly (or at least very close to directly) speak to machines through my code. There was a point in time when someone showed me how to do an if statement in assembly, but out of all the books that I got, I could never really understand where/how to start learning to code in assembler. any help please? I'm obsessed with learning this! PS: if you have any software suggestions, I use ubuntu and am looking to convert to backtrack soon, so it would be preferred if you could give me something that'll be easily installed on debian linux, otherwise don't sweat it, give me the name of the windows software and I'll find an equivalent myself


How to break the "php is a bad language" paradigm?

PHP is not a bad language (or at least not as bad as some may suggest). I had teachers that didn't even know PHP was object oriented until I told them. I've had clients that immediately distrust us when we say we are PHP developers and question us for not using chic languages and frameworks such as Django or RoR, or "enterprise and solid" languages such as Java and ASP.NET. Facebook is built on PHP. There are plenty of solid projects that power the web like Joomla and Drupal that are used in the enterprise and governments. There are frameworks and libraries that have some of the best architectures I've seen across all languages (Symfony 2, Doctrine). PHP has the best documentation I've seen and a big community of professionals. PHP has advanced OO features such as reflection, interfaces, let alone that PHP now supports horizontal reuse natively and cleanly through traits. There are bad programmers and script kiddies that give PHP a bad reputation, but power the PHP community at the same time, and because it is so easy to get stuff done PHP you can often do things the wrong way, granted, but why blame the language?. Now, to boil this down to an actual answerable question: **what would be a good and solid and short and sweet argument to avoid being frowned upon and stop prejudice in one fell swoop and defend your honor when you say you are a PHP developer?**. (free cookie with teh whipped cream to those with empirical evidence of convincing someone —client or other— on the spot) P.S.: We use Symfony, and the code ends being beautiful and maintainable P.P.S.: Facebook **is** written in PHP, compiled to C++ via HipHop and deployed on Hadoop. Here: http://arstechnica.com/business/2012/04/exclusive-a- behind-the-scenes-look-at-facebook-release-engineering/1/


Best setup/workflow for distributed team to integrated DSVC with fragmented huge .NET site?

So we have a team with 2 developers one manager. The dev server sits in a home office and the live server sits in a rack somewhere handled by the larger part of my company. We have freedom to do as we please but I want to incorporate Kiln DSVC and FogBugz for us with some standard procedures to make sense of our decisions/designs/goals. Our main product is web-based training through our .NET site with many videos etc, and we also do mobile apps for multiple platforms. Our code-base is a 15 yr old fragmented mess. The approach has been rogue .asp/.aspx pages with some class management implemented in the last 6 years. We still mix our html/vb/js all on the same file when we add a feature/page to our site. We do not separate the business logic from the rest of the code. Wiring anything up in VS for Intelli-sense or testing or any other benefit is more frustrating than it is worth, because of having to manually rejigger everything back to one file. How do other teams approach this? I noticed when I did wire everything up for VS it wants to make a class for all functions. Do people normally compile DLLs for page-specific functions that won't be reusable? What approaches make sense for getting our practices under control while still being able to fix old anti-patterns and outdated code and still moving towards a logical structure for future devs to build on?


Is the output of Eclipse's incremental java compiler used in production? Or is it simply to support Eclipse's features?

I'm new to Java and Eclipse. One of my most recent discoveries was how Eclipse comes shipped with its own java compiler (ejc) for doing incremental builds. Eclipse seems to by default output incrementally built class files to the projRoot/bin folder. I've noticed too that many projects come with ant files to build the project that uses the java compiler built into the system for doing the production builds. Coming from a Windows/Visual Studio world where Visual Studio is invoking the compiler for both production and debugging, I'm used to the IDE having a more intimate relationship with the command-line compiler. I'm used to the project _being_ the make file. So my mental model is a little off. Is whats produced by Eclipse ever used in production? Or is it typically only used to support Eclipse's features (ie its intellisense/incremental building/etc)? Is it typical that for the final "release" build of a project, that ant, maven, or another tool is used to do the full build from the command line? Mostly I'm looking for the general convention in the Eclipse/Java community. I realize that there may be some outliers out there who DO use ecj in production, but is this generally frowned upon? Or is this normal/accepted practice?


Why are tools like git-svn that allow git to integrate with svn useful?

I have read these related questions:   * I'm a Subversion geek, why should I consider or not consider Mercurial or Git or any other DVCS?   * git for personal (one-man) projects. Overkill? ...and I understand why git is useful. What I don't understand is why tools like git-svn that allow git to integrate with svn are useful. When, for example, a team is working with svn, or any other centralised SCM, why would a member of the team opt to use git-svn? Are there any practical advantages for a developer that has to synchronize with a centralized repository?


Automating Unit Test Creation

What are some strategies that could be used to automate the creation of unit test cases? What aspects would you need to look at in each class to be able to generate at least a decent test case skeleton? I realize a comprehensive automatic solution isn't practical, but I'd like to speed up the test creation a little at least by creating a skeleton. I'm not looking for code examples, just perhaps some suggestions for where to start or examples of where something like this has been done so that I can see how they approached it and what might be possible. I'm particularly interested in methods for creating unit test skeletons in PHP, which doesn't provide all of the tools that other languages afford, like complete type hinting, for example.


Estimate of each localization's prospects on Mac App Store

I write utility programs (converters, compression tools, etc.) with simple UI’s, which I put for sale of for free download on the Mac App Store. I write these programs in English, and usually add a French localization (which I do myself). By comparing the distribution of sales per country between a localized app and nonlocalized one, I can estimate how much the French localization boosts my sales. (The apps themselves are pretty generic and not country-specific, which makes the comparison possible.) For example, on nonlocalized app A, my sales in France are 2.5% of all sales, while on localized app B, sales in France amount to 10%. This means _localization increased my overall revenue by 8.4%_.[1] My question is: **does someone have an estimate of how much localization is worth for each language?** (according to this metric, i.e. potential added revenue) This would be a great help to prioritize new localizations (which I cannot do myself). * * * [1] And not, that's not 8.5%.


Should "tags" be an nvarchar field in a table, or should it be another table altogether?

I am building a photography website and I want to allow the user to put tags on their photos for easy searching. But I'm not sure if I want the tags to be an nvarchar field in each picture and then search for that tag in each record or if I want to pull them out and create a separate table of tags and tagIds and then have a look up table, so I can just search the database for that ID. So, what I'm asking is which would be better efficiency-wise and scalability- wise. The database will have over 3-4000 pictures.


Why validate XML?

I am looking for an explanation on just why XML needs to be validated. I have been testing DTD's and Schema's for the past month and recently tried to find out why I am doing this. I know it makes the XML better and more Semantic but what are the overall benefits of validating XML?


How to find local maxima in matrices?

I need to develop an algorithm for finding all the local maxima in a **two- dimensional array** : how to search for local maxima in the the most efficient way? Are there algorithms about it? Moreover, the algorithm should be able to handle even the "flat" peaks, that is it should find the central coordinates of each peak. Here's an example with a one-dimensional array: some consecutive elements have the same peak value, so the algorithm should return the central location.                                      |       flat peak       |                            |-----------------------|     array = [...  0.8  0.9  1.0  1.0  1.0  1.0  1.0  0.9  0.8  ...]                                        |                                 desired result      How to handle the problem of the flat peaks in a two-dimensional array? In the flat peaks, the neighbor elements are equal to each other and form a single local maximum, so I would like to get the central coordinates of this neighborhood.


Why does it take so long to finalize the HTML 5 spec?

I was reading this and one sentence caught my eye (emphasis mine): > So Ian Hickson, XHTML’s biggest critic, fathered HTML 5, an action-oriented > toddler specification that _won’t reach adulthood until 2022_ , although > some of it can be used today. Is that true? Is that really the HTML 5 development cycle? Why is it taking so long? What makes it so difficult to get right that it won't be final until 11 years from now?


Becoming a Better Bug-Fixer

I love being a programmer. There, I said it. However, with that said, I've realized lately that I really can't _stand_ bug-fixing. At all. In fact, while I'm developing something, my productivity is extremely high. Even when writing unit-tests and doing self testing of my development, I'm generally really productive. I can focus well, and I can get tasks done. However, when QA time comes around and I'm working on fixing bugs, my inspiration takes a massive nosedive. I have to force myself with pretty extreme measures (you know, high BPM music, excessive amounts of caffeine, etc.) to get _anything_ done. My job is usually involved with stepping into an existing massive project and adding new features or fixing bugs, so I can't exactly tell my employer that I need a couple weeks to write unit tests for all of their code :) In addition, the server technology that we often use is very prohibitive to both unit and integration testing, as it has quite a few Java classloader issues. I'm not completely against bug-fixing, sometimes it can be fun, but it's _not fun at all_ when you have to make minor changes and wait 30 seconds to 3 minutes to be able to see if they worked or not (due to the way the system works). How can I improve my productivity and motivation when bugfixing? Is this something that most programmers deal with?


Design tips for a program with GUI's for basic, intermediate, advanced & expert users

I've been asked to develop a program with four interchangeable GUI's so that users can switch from basic to intermediate to advanced to expert mode seamlessly and at will. I have a good understanding on how to separate the GUI from the business logic. That's taken care of. My question is exclusively about how to organize, design, implement the GUI part for this particular requirement. If any of you can help with information from languages/frameworks other than C#/NET, it will be appreciated just the same.


Extract all related class type aliasing and enum into one file or not

I have many models in my project, and some other classes just need the **class declaration** and pointer type aliasing. It does not need to know the **class definition** , so I don't want to include the model header file. I extract all the model's declaration into one file to let every classes reference one file. model_forward.h               class Cat;     typedef std::shared_ptr<Cat> CatPointerType;     typedef std::shared_ptr<const Cat> CatConstPointerType;          class Dog;     typedef std::shared_ptr<Dog> DogPointerType;     typedef std::shared_ptr<const Dog> DogConstPointerType;               class Fish;     typedef std::shared_ptr<Fish> FishPointerType;     typedef std::shared_ptr<const Fish> FishConstPointerType;          enum CatType{RED_CAT, YELLOW_CAT, GREEN_CAT, PURPLE_CAT}          enum DogType{HATE_CAT_DOG, HUSKY, GOLDEN_RETRIEVER}          enum FishType{SHARK, OCTOPUS, SALMON}      Is it acceptable practice? Should I make every unit, which needs a **class declaration** , depends on one file? Does it cause high coupling? Or I should put these `pointer` type aliasing and `enum` definition inside the class back? `cat.h`               class Cat     {         typedef std::shared_ptr<Cat> PointerType;         typedef std::shared_ptr<const Cat> ConstPointerType;              enum Type{RED_CAT, YELLOW_CAT, GREEN_CAT, PURPLE_CAT}         ...     };      `dog.h`               class Dog     {         typedef std::shared_ptr<Dog> PointerType;         typedef std::shared_ptr<const Dog> ConstPointerType;              enum Type{HATE_CAT_DOG, HUSKY, GOLDEN_RETRIEVER}         ...     }      fish.h               class Fish     { ... };      Any suggestion will be helpful.


Does anybody recognize this scheduling problem? Is there an algorithm for it?

Consider the following problem: * * * **Description** : There are n jobs J1...Jn with cycle times C1....Cn. Find a _time quanta_ and a scheduling table considering that:   * any element of the table contains at most one job   * the job handler will process an element at a time, i.e. execute the job (if any) then, after _time quanta_ passes, moves to the next element.   * the job handler will loop-back, i.e. after the last element it will continue with the first.   * the ciclicity must be maintained, i.e. the distance between any two consecutive (including loop-back) occurances of job Jk (k = 1,n) must be equal to Ck / _time quanta_.   * the table must be as short as possible. **Example** :   * J1 \- 4 seconds ciclicity   * J2 \- 6 seconds ciclicity   * J3 \- 8 seconds ciclicity **Example solution** : time quanta = 1s               0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 seconds     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+     |J1|J2|J3|  |J1|  |  |J2|J1|  |J3|  |J1|J2|  |  |J1|  |J3|J2|J1|  |  |  |     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+      * * * My feeling is that this belongs to the family of scheduling problems and that it may be a special case of a more general problem. **Is this so?** I tried to search for it online but didn't find anything that looks similar. Since I don't have any experience with scheduling problems I'm not even sure what to search for. From what I see:   * the total duration of the schedluing table should be the smallest common multiple of C1...Cn.   * the time quanta should be at least GCD(C1,...,Cn) / n. - This is not necessarly the optimal solution. This leads me to believe that there is a straight forward solution and not one involving dynamic programming. **Is this so?** Can somebody point me to some resources, maybe even an algorithm, for this problem? I'm also curious about variations where there the jobs can be distributed between more than one scheduling tables. * * * GCD = Greatest Common Divider **Edit** : I'm not asking how to schedule N jobs with given cycle times; I'm sure there are more dynamic ways to do this as some suggested. My problem is " _Find a time quanta and a scheduling table considering that:[...]_ ". It's even possible that it may have it's roots in some parts of mathematics.


How to handle timezone for dates?

With a YYYY-MM-DD HH:MM:SS date I always store the UTC time. When I pull to display I translate timezones with built-in PHP functions and classes. I believe that is one correct way to do it and it makes sense to me. May I handle YYYY-MM-DD the same way?


Can a version of Python's shelve module that knows when its entries have been modified be written in any programming language?

`shelve` is a Python module that makes it easy to persist a Python dictionary to disk (under the right conditions). The documentation for shelve gives this example to demonstrate one of the pitfalls of using a shelf:               import shelve          d = shelve.open(filename)          # ...snip...          # as d was opened WITHOUT writeback=True, beware:     d['xx'] = range(4)  # this works as expected, but...     d['xx'].append(5)   # *this doesn't!* -- d['xx'] is STILL range(4)!      The documentation explains: > Because of Python semantics, a shelf cannot know when a mutable persistent- > dictionary entry is modified. By default modified objects are written only > when assigned to the shelf (see Example). To say that shelves behave this way "because of Python semantics" seems to me to be measuring Python via a high bar! It would be hard to for shelve to know whether any object contained in a shelf has a reference to something which has been mutated (or a reference to something that has a reference to something that has been mutated). Can this be done in any programming language?


Pattern for a web application

I'm developing a web application for a university project. My professor wants we to use a multi-tier architecture (Client, Web, Business and Data tiers) with EJB. For the Web and Business I have chosen to use the MVC pattern. Anyway, little by little, I build the tiers in this way: the View (JSP and Servlet) ALWAYS forwards any request from the client to the Controller (Session Beans), which checks if the user can see the page, and if he can it sends to the Servlet the right data (taken from the Entities). Since the MVC pattern provides an interaction between Model and View, I think that I don't use it (my View interacts only with the Controller). So I'm asking: which is the name for the pattern I'm using? Or is it still the MVC?


Who's responsible for a master / slave switch?

We are introducing a master / slave replication schema in our web application. At certain scenarios we would prefer to explicitly direct reads to a slave and writes to the master, which to me is an obvious advantage of the schema. Instinctually, I'd prefer for the switch to happen somewhere in the ORM, we use Doctrine and it offers a neat solution. But that's not really a solution for us, because we don't have a very practical way of distinguishing when a read is in reality a write (such as in update scenarios). The next best thing would be to delegate the responsibillity for the switch to the controller and / or some custom libraries that in a cliche MVC approach could be considered as supercharged models. Although this is a very practical solution and probably the one that would require less time, I somehow fear there's something very important I'm missing and it will come back and bite me hard. There are vague time constraints, and management support to feveresly refactor, but for this specific scenario we mostly agree that we should go with the practical approach, even if it means limit ourselves only where we've identifed the database as a major bottleneck. To add to the confusion, I can't really say I'm experienced in replication schemes, when the issue was first discussed I thought a better solution would be to adopt a multi-master scheme, but when I started researching how easy those fail and how robust their implementation should be, it stopped feeling reasonable. Help?


How to handle large numbers?

Well, I've just started doing puzzles and it's so annoying to see puzzles which are easy to do but also need to handle very large numbers. That's the problem. Say I have to deal with numbers like 10 ^ 6 / 2147483647 / etc. Need to do arithmetic operations on! However, I feel that these shouldn't be handled in brute force way but the math theorems/ statements just don't click in my mind at times. How could I possible handle such puzzles (shouldn't use external lib)


Continuations, coroutines, and tail-call optimization

I am trying to learn continuations and use them to implement coroutines in Scheme. I have two procedures (coroutines) `a` and `b`, and I switch between them in the following way:               ;; c is a continuation.     (define (a c)        ...        ;; Switch to the other coroutine.        (call/cc c)        ...               (define (b c)        ...        ;; Switch to the other coroutine.        (call/cc c)        ...      I start the execution with               (a b)      I have tested a small example and, indeed, the execution switches back and forth between the two procedures until one of the two terminates without calling the continuation it was given as an argument. I have two questions:   1. Is my example an appropriate / idiomatic implementation of coroutines using continuations?   2. Is tail-call optimization mandatory for implementing coroutines with continuations? In my solution, switching too often between the two coroutines might cause a stack overflow if Scheme did not provide TCO. Are there other solutions that do not require TCO? **EDIT** Basile's comment seems to be sufficient to answer my question. The background of the question is that I would like this approach to implement coroutines in Python, where I do not have TCO.


Does object-orientation really affect algorithm performance?

Object orientation has helped me a lot in implementing many algorithms. However, object-oriented languages sometimes guide you in "straightforward" approach and I doubt if this approach is always a good thing. OO is really helpful in coding algorithms fast and easily. But could this OOP be a disadvantage for software based on performance i.e. how fast does the programm executes? For example, storing graph nodes in a data structure seems "straightforward" in the first place, but if Node objects contain many attributes and methods, could this lead to a slow algorithm? In other words, could many references between many different objects, or using many methods from many classes, result in a "heavy" implementation?


Programmer-Tester-Ratio

Are there any substantiated recommendations how many testers a team should have per programmer? I'm more interested in opinions referring to an old- school development approach (no agile stuff) and larger projects. Sources are welcome.


Computation Program Not Running at 100% CPU Utilization

I have a program which has a GUI and performs some very heavy mathematical computations for a couple of minutes and then outputs a result. When I try to directly interface it through its DLL's, it runs fine, but it doesn't run at 100% CPU usage like the GUI does. Why is this? I understand the reason why computational heavy program might not run at 100% is due to I/O that it might be doing but this program doesn't do any, not even a single printf(). Files are being generated at the end of execution in both the GUI and DLL versions of the program. The interface program makes mulitple calls to the DLL during execution as well. It is written in C, compiled using VS2008 CL compiler running in Release mode. Running on Intel i5 CPU with 4GB RAM (60% utilization average, never above 70%). When I set affinity to the process to one CPU (in this case, 1/4 "CPU's", 2 cores with 2 threads each), the GUI uses 100% of that dedicated CPU for about 2 min. My interfacing application uses anywhere from 60-80% CPU for about 5 minutes. I use Window's Performance Tab upon performing `CTRL`+`SHFT`+`ESC`. \---EDIT--- I found that database calls (there are a few specific ones) are being preempted a lot for extended periods of time (usually 5 times slower). Using Process Explorer I was able to find out that each program uses exactly the same amount of CPU time -> leading to my conclusion about preemption. For anyone that doesn't know about this tool, download Process Explorer from SysInternals, very useful. \---EDIT--- I found that the GUI opens a single static connection to the database. While my interface doesn't do that, leading to opening and closing the connection thousands of times. Opening it once for the lifetime brought the CPU up to 100%.


What are the problems of bringing C++-like const into a language?

I am interested in the idea of C++-like `const` not that particular execution (like casting away `const`). Take for example C# -- it lacks C++-like const, and the reason for it is the the usual -- people and time. Here additionally it seems the C# team looked at the C++ execution of `const`, marketing CLR and had enough at this point (see why there is no const member method in c# and const parameter ; thank you Svick). Be if **we** move further than that, is anything else? Is there something deeper? Take for example multi-inheritance -- it is usually seen as hard to grasp (for the user) and thus not added to the language (like diamond problem). Is there something in **NATURE** of `const` that pose a problem that it is better for language to avoid it? Something like deciding if `const` should be deep or shallow (having `const` container does it mean I cannot add new element or alter existing elements as well; what if elements are of reference type)? **UPDATE** : while I mention C#, and thus making a historical perspective I am interested in the nature of potential problems of `const` to the language. _This is not a challenge of the languages. Please ignore such factors as current trends or popularity -- I am interested only in technical issues -- thank you._


Is the microsoft C compiler (cl.exe) a compiler driver or a compiler?

`gcc`and `clang` are both known to be compiler drivers. As such, the `gcc` executable does not compile anything itself. Rather, it calls the compiler (`cc1`), assembler (`as`) and linker (`ld`) with the right flags as needed. Is this setup true also for the Microsoft C compiler, `cl.exe`? Is there actually some other executable that does the compilation? I assume that at least the assembling and linking are done by separate executables, since I know that `ml.exe` (known as MASM) and `link.exe` exist as separate executables, so `cl.exe` probably calls them.


Best practices for recovering usernames

I've seen a lot of information on best practices for dealing with lost password on websites, but what about usernames? Is there a standard way of dealing with this? My basic idea is to ask for the users email and send the username to that email. I'm wondering if something more secure along the lines of password recovery (hint questions, etc) is in order.


Handling large web based processes

I am working on a new function for a ASP.NET MVC website. The execution time is quite long at present so I am considering options. The function takes an excel spreadsheet, uploads it to the web server. It then needs to select all of the rows and using Entity Framework insert the rows in to a database. Each row matches the required entity model. Currently at only 50000 rows, this process takes a while and I would assume the row count will grow in the future. I have a few options for processing here and I am wondering if there is a better way to handle it. The two ideas I have just now are 1) Pass the work off to a service, which on completion emails the user. The obvious upside being the user doesn't need to keep that browser window open. 2) Add a progress bar and have the service pass updates back to jquery/javacript to do visual updates. I will attempt to reduce the time, possibly moving the queries away from relying on Entity Framework. Sometimes stored procedures are a lot faster than Linq To Entities but with that aside, the process may still take more than a few seconds, which I don't really want to burden the user with. Can anyone think of other/better ways to handle long running processes on a web application? Are there any best practice schools of thought on handling these situations?


javascript - would you consider 'prototype' to be the same as 'parent'

I'm learning javascript. I see that with an object, I can use .prototype, is it fair to say that, in a class/tree hierarchy I am effectively using the 'parent' (or 'ancestor' perhaps) by doing that? Can a class only have 1 prototype at a time as in Ruby? Call it Personal Homework that I set myself.


What conventions or frameworks exist for MVVM in Perl?

We're using Catalyst to render lots of webforms in what will become a large application. I don't like the way all the form data is confusingly into a big hash in the Controller, before being passed to the template. It seems jumbled up and messy for the template. I'm sure there are real disadvantages that I haven't described properly... Are there? One solution is to just decide on a convention for the hash, e.g.:               {       defaults => {         type => ['a', 'b', 'c']       },       input => {         type => 'a'       },       output => {         message => "2 widgets found of type a",         widgets => [ 'foo', 'bar' ]       }     }      Another way is to store the page/form data as attributes in a class (a ViewModel?), and pass a whole object to the template, which it could use like this:               <p class="message">[% model.message %]<p>          [% FOREACH widget IN model.widgets %]      Which way is more flexible for large applications? Are there any other solutions or existing Catalyst-compatible frameworks?


Is it possible to use python as a shell replacement?

Recently I was looking at python's `shutil` and `subprocess` etc... And I started wondering: wouldn't it be ok to use python instead of e.g. bash? What am I missing?


How are the skills used in typical interview questions applied in the real job?

For SQL and C# app dev jobs, the interviewers usually ask questions about tree,graph and linked list traversals using pure C and pointers. In the 3 years I've spent in my job, I've never had to actually > find the path to the 1st node to the right of a given node which is a > multiple of the given node for example I can see that these skills might be used in jobs where you need to write compilers, drivers and work on the OS kernel. Other than those, where else are these skills used?


mvc pattern - splitting model into data-access and business logic layers

I've had a chance to try it out and I like it very much. I'm thinking of using it in all of my future projects. I'd like to hear some critique and opinions about it. I've done a little research on the subject and I'm not sure I've seen this approach around, but I'm pretty sure that it must have been tried by some more experienced people and I'd like to avoid any pitfalls that come with it The idea is that model is split into: 1\. db access layer (dal) 2\. business logic layer (bll)   1. so db access layer contains (ideally) no logic at all other then db access logic - prepared queries that are supplied with parameters, when called, and which return results from db, if needed (in case of SELECT queries). these classes are not tested (if no logic is inserted into them), since they don't contain any if/for/while/throw... commands   2. business logic layer which contains actual logic of the app. controllers do not see dal and only call bll which in turn calls dal when needed. bll needs to be tested (i use unit testing) and since it is kept separate from the db access, when read-only functionality is being tested, db access can be mocked using dependency injection (create mock class alternative for every dal class with all the same methods, load them via the factory method when requested from bll and depending on whether the call came from testing environment or not load either mock or 'real' class. of course in case of write functionality (DELETE, INSERT), testing would have to include db calls, so in that case 'real' class would be called, rather then mock, but this can still be very useful if system has more read then write db calls Benefits of this approach:   1. code separation - it keeps your business logic clean of db access code which improves readability, especially in big methods that need to make several calls to db. it makes it easier to maintain code and also allows you to encapsulate db access logic, which can be called from a numer of blls which also makes it easier to maintain   2. it makes it easier to switch databases at any point, which is not something that happens often, but if it does happen, it's not an easy thing to do, everybody who had to do it at some point know what i'm talking about   3. when testing bll with mock classes, it makes tests run faster since no calls to db are made. this is not too significant, but can help when you are tweaking some functionality intensively and testing it along the way. at the same time it makes it much easier to test performance of 'pure logic' detached from db calls drawbacks:   1. more cluttering because of adding whole new layer of classes to the system   2. slightly lower performance due to the added dependancy injection which takes time to resolve   3. while mock classes do nice work, they do have to be created and maintained so there is added bureaucracy to the whole system Am I missing anything? Do you prefer system that I described or good ol' fashion 3 layer mvc and why? I'm no guru, I'm still exploring various architectures, but I like this one very much and would love to hear what my more experienced colleagues have to say about it


Writing map of data to XML according to a format which is user-defined

I need to write a map of string data to an XML document. The XML document has a specific format. An entry key determines where in the XML document the value will be written to. See below for an example (pseudo-code where appropriate);               map = {"document_id": "123"; "document_type": "type_A"}      Produces an XML file like this;               <document>         <document_id>123</document_id>         <document_type>type_A</document_type>     </document>      I need the format of the target XML document (and where the map data is written to in it) to be user-configurable. For example;               <node name="document">         <node name="document_id">${document_id}</node>         <node name="document_type">${document_type}</node>     </node>      I feel like my proposed solution would be complex and a re-invention of the wheel. I figure there must be some established way to do this but after searching the internet I can't seem to find it. Can anyone offer suggestions on how I may achieve what I want to do?


Accessing a remote server from desktop application

Web applications (.jsp / Java) have the advantage that they can be run from any client browser by putting a single URL into the address bar, and off you go. However, the average web application is slow, clunky, and maintaining the code behind it is hell on earth. Conversely, a typical desktop application (Java / c#) can have a slick interface, snappy response, and the code behind it is often much neater, compartmentalised, and often a pleasure to work with. Is there a way or technique to connect to a remote server through a Java / c# desktop application, that can be distributed to any Windows computer, that doesn't first require the computer to connect to the remote server through a VPN, as a separate user procedure? (Usernames /passwords / connection details will obviously need to be stored in a config file associated with the application). The remote server would be hosting a 'communal'(?) SQLServer database, and I suppose, possibly some files.


Programming interview question on Trees

I was asked this interview question at a top internet website company recently. Certain empty glasses of water are arranged in the following order ![enter image description here](http://i.stack.imgur.com/g0TS4.jpg) > When you pour liquid into the 1st glass if it's full, then the extra liquid > would be flown into the glasses 2 and 3 in equal quantities. When glass 2 is > full, the extra liquid would be flown into 4 and 5 and so on. Given an N > liters of liquid and maximum capacity of each glass is 1 litre, give the > amount of liquid present in any glass if you empty N liters of liquid by > pouring into glass by filling out the function getWaterInBucket(int N, int > X) where X is the glass number. So for example if I want have 4 liters at > the beginning and I want to find the water in glass 3 the function is > getWaterInBucket(4, 3) How do I solve this programmatically? I basically tried to find a math solution(e.g Pascals triangle) to it. The interviewer said not to because it'd get tough quickly(damn). So I said let me consider it to be a tree so I can add a parameter like this getWaterInBucket(BTree root, int N, int X) and then try some recursive solution for each level , he said that you can't add parameters(damn).All this led me to think that I missed something obvious, some trick, did I? It seemed like he was more confused about how to solve it than I was, which is never good in an interview.


What can I do to advance my knowledge as a supplement to a Software Engineering course?

I studied in a technical school and learned programming, among other subjects related to IT and gained the title of IT Technician. I decided to follow programming as my career choice and began a stage at a local company in order to learn more and pursue a programming career. So during this stage I developed in C#, VB.NET and VB6, but I was developing in VB.NET for the most part. I concluded this stage 1 year later, and although I was technically better, I felt a bit lost in programming bases and theory. I could program simple things, get some pages done and learn on my own but I still felt like what I knew was poorly backed by the lack of some Algorithmics. I got a job in a consulting company and I develop web applications in ASP.NET MVC 1. I feel like I've learned a lot while working here but I would like to learn a lot more in correct programming manners and upgrade my capability of developing algorithms. I will study Software Engineering but I can only attend the course during the next year. During this year, I would like to do something at home, like doing some projects that could get me better at programming and logic and read some good books on the area. What exercises, projects and/or books do you people recommend? I'm all in for good advice.


Trying to come up with a mapping convention for C# objects

_so this is C# but it could apply to any OO language where different sets of objects exist across different layers of an application._ We have been trying to come up with a convention within the team for where to put the code when mapping objects in one layer to objects in another layer. For example; mapping a Data Transfer Object to a Service Object that is used by a WCF service, or something of the like. I have the following methods that I have seen being used and am trying to decide which would be preferred by someone new looking at the code, and which of these fits best with the natural C# idioms. These examples use AutoMapper to map an object **Foo** to an object **Bar** , but it applies to any mapping framework, or just manually creating Bar from Foo with an object initialiser. Both these objects represent the same data, but they are in different assemblies: 1) Constructor on **Bar**               public class Bar     {         public Bar(Foo foo)         {             Mapper.Map(foo, this);         }     }      2) Factory method on **Bar**               public class Bar     {         public static Bar CreateFrom(Foo foo)         {             return Mapper.Map<Bar>(foo);         }     }      3) Method on **Foo** to return **Bar**               public class Foo     {         public Bar GetBar()         {             return Mapper.Map<Bar>(this);         }     }      4) Explicit type conversion operator on **Foo** so it can be casted to **Bar**               public class Foo     {         public static explicit operator Bar(Foo foo)         {             return Mapper.Map<Bar>(foo);         }     }      5) Some implementation of the factory pattern               public class BarFactory : IFactory<Bar>     {         public Bar Create(Foo foo)         {             return Mapper.Map<Bar>(foo);         }     }      6) Just doing it in the piece code you need it in                   public void SomeMethod()         {             Foo foo = fooRepository.GetFoo();                  //I need it to be bar now...             Bar bar = Mapper.Map<Bar>(foo);              }      **Disclaimer:** I wish I hadn't used AutoMapper in this example. Just imagine "AutoMapper" here reads "IMappingProvider" or "IObjectConverter" or something


Weight based mapping algorithm

I am writing automatic assignment of tasks to the users. Every user has a weight (integer) and tasks should be distributed to the users according to their weights. For example I have 10 tasks and User A with weight 5, User B with weight 3 and User C with weight 2. Mapping function should assign User A with 5 task, B with 3 tasks, C with 2. This example is very straightforward, but it is not that easy when it comes to 34 users and 230 tasks for example. Is there any known algorithm i should look for?


What are the most common programming mistakes PHP programmers make in Java?

I am more practiced in PHP than in Java, and when I use Java I find myself looking at it from a PHP perspective. This can cause trouble, so I'd like to know, what are the most common programming mistakes PHP programmers make in Java?


MS-Access to Sharepoint conversion?

I do some volunteer work with a non-profit organization on the side occasionally. My main area of expertise is ASP.NET, C#, and SQL. They currently rely heavily on an Access database for their day to day operations. One of their technology guys has been looking into Sharepoint as a migration point for their Access database, to better support multiple locations. I am, regrettably, mostly unfamiliar with Sharepoint. Though, what I have heard does not seem to promote Sharepoint's use as a database. The base of my question is, what are the challenges of migrating or even making the two systems coexist? And is it even a good idea?


What Impact Do Scripting Languages Have on Junior Programmers?

I had a discussion with one of my teachers the other day. We debated the impact that simpler **scripting languages** (like Python or Ruby) have on junior programmers. He argued that scripting languages engender sloppy coding techniques because beginners don't understand what is going on "under the hood". He also cited other examples of how scripting languages often cause the programmer to neglect concerns about efficiency, memory management, operational complexity, etc. I argued that lower level languages might be too much for some people and they might give up before they develop a passion for programming. When I started learning my first programming language (C), I got to pointers and gave up because the concepts were too hard (in my defense, I was only 14 years old). If it wasn't for Java, I might not have become a programmer! If I had started with a simpler language and then dug deep, I feel I wouldn't have given up and I would have learned just as much as I have starting with C. The class ended before either side was fully explored. * * * To this point, I have been preaching that beginners should start with scripting languages and then dig deep; but after that discussion, I began wondering if this was erroneous thinking. > So, what impact do scripting languages have on junior programmers?


What technology is needed to create a live video streaming service?

I am curious as to what technology is needed to create a service such as stageit.com and livestream.com. What hardware and software is involved, besides a camera and microphone, from the broadcaster's computer to a viewer's computer?


Approach for housekeeping production data

If you are going write a set of program to housekeep the production data, how can you ensure your program will work correctly? We cannot housekeep the data based on their creation time. We would delete the data only if it has a generation date older than 6 months. But the generation date is not equal to the timestamp of the file, instead we query the database for relavent generation date. If we implement a logic to compare the generation date and today's date, who can be sure of the logic won't fail on some special occasion? Maybe I am expressing too much concern over this, but when it comes to delete of production data, one needs to be cautious.