Designing a SQL-like encapsulation object for programmatic use

In the last few weeks, I have been working on a Data Mapping Library, which has involved lots of research, experimentation, crying, blaming the whiteboard for not being big enough, and more research. But now I have a full idea of what I'm trying to do. I have decided that before working on any data source adapters, I need to build a SQL expression library. The queries are not assembled with a string of text, but in the form of an instantiated object, containing multiple other objects associated with which part of the query it pertains to. As such, a `SELECT` query object will have objects for the `columns`, `table from`, `joins`, `where clause`, `group bys`, `having clause`, `order bys`, and `limit`. These objects are then passed to the data source adapter, which will take the input and turn it into a query (or use it in other ways) so that it can fetch the data in a common fashion. Although this is good enough for simple queries, when it comes to more complex queries, where the join reference, or a condition within the where clause is a nested select query (i.e. `SELECT * FROM tblA INNER JOIN (SELECT * FROM tblB WHERE foo = 'bar')`, or `SELECT * FROM tblA WHERE alice IN (SELECT * FROM tblB WHERE foo = 'bar')`), I am having trouble designing an interface where such a thing could be defined, which would later be passed to the adapter that could use it in whatever way it needs to. So, can anyone propose a design that would allow for such queries to be defined in abstract which could be interpreted into a sql query, or into a nosql programmatic interface function call? **EDIT** The design of the system is such that all the tables and columns are defined as objects (separately, but with named associations for linking). Here is an example of the coding I am hoping to be able to execute:               tblA::select()         ->where(new inCondition(                                'tblAfooCol',                                 tblB::select()->where(new isNullCondition('tblBbarCol'))                                )                )         ->fetch();      Now, instead of this being directly translated into SQL (which is very easy), I am trying to plan a way that this can be returned to the data source adapter (internally through the `fetch` function). So far, the system I have built can handle the commands for a single `SELECT` query being parsed, but it is when sub queries are used in conjunction with the query that will be passed to the adapter. I am having problems determining how to encapsulate the sub query so the adapter can process it itself. As said before, converting it directly into SQL works great, but if I want to use it with a special adapter that does not use SQL (i.e. an XML or MongoDB adapter), without a function to convert the SQL into commands (or if it is SQL, converting some of the syntax to a valid specification for that rmdbs) that can be used may become very processor intensive (only for certain queries) and cost quite a lot of performance.


Encryption Cannot Be Reversed?

I am under the impression that an encrypted string cannot be decrypted so the original value is lost forever. However, if the following string **always equals** "dominic" (my name), then can't there be some logical way to reverse it; being as it's not random nor is it based on the date/time, but there is a logical method to it?               0WrtCkg6IdaV/l4hDaYq3seMIWMbW+X/g36fvt8uYkE=      No matter what or how many times I encrypt "dominic" (string), it always equals as above. So, shouldn't there be some way to decrypt a string like that? Example of what I'm talking about:               public string EncryptPassword(string password)     {         return Convert.ToBase64String(             System.Security.Cryptography.SHA256.Create()             .ComputeHash(Encoding.UTF8.GetBytes(password)));     }


Recompiling dll's and adding more during run time - what are my options?

I want to compile custom functions during run time based on user written scripts. I'll give a hypothetical example that should demonstrate exactly what I need to do. This is the best way for me to describe the problem. I'd like a little input/ideas in how I can solve this. At the bottom I give you my ideas. I have 2 classes, one with public int x and y. Another with public int x,y,z. There can be more than one instance of each class running. The thing with these classes though (and here comes my problem) is that they need to be updatable via a user written and then compiled function during run time, that then gets added to a list of update functions that gets run once per cycle/event. Which could be at the touch of some button or something. Example: The user has written a script to update the public members of Class A. He has written A.X = B.Y + C.Z. The variables here are public, never private. This method needs to be compiled, and added to some list of functions to call each cycle. Obviously this method needs access to class B and C, as well as A. So pointers to those need to be passed in. The function returns nothing. When I say class A, B, and C. I mean these as some instances of any classes. 'A' could be class Q, while both B and C could be from class T. Or any other variation. These classes do not need recompilation/user written or anything like that. I just need help with coming up with options and how to compile a function that gets passed in some pointers and does something with them. But with all of that defined run time, what the function does, what gets passed into it, ect. \---- What I think I can do --- I'm jumping extremely far in knowledge but it is what I always do. So I am just switching from C# to C++ and have little to go on for now while I know little. So all i can do is guess solutions and research them. I'm guessing I could compile a late loading dll for each function, and I'm guessing the dll has to know something about the data structures passed into it so I think it could work to have them in a separate normal dll usable by any program. (The A,B, and C class thingies, or rather Q, and T classes which A,B,and C were instances of in my little demo). So now both the normal program and the dll functions knows all about the classes, and all I have to do is compile the dlls during runtime, load them, and somehow get a pointer to them that my main application has and can call with the appropriate arguments. Then if the user changes the script, the dll unloads, recompiles, loads again, and a new pointer is gotten? Any help is greatly appreciated. If you can help direct my learning/research I'll learn a lot faster and be able to implement this. Thank you so much!


Algorithm, AI, or intelligent agent suggestions for ingesting poorly-formatted & variable data from different document types

Thanks for looking! # Background I have been tasked with writing a program to normalize and ingest data from various sources to a common database. For the sake of simplicity, let's say that the program is for a public library system, and that they are wanting to maintain a database of all books currently lent out of their various branches. Let's further assume that the branches are not linked to a common network or database (silly, I know, but please bear with me). The task is to accept submitted data from the various branch managers, and then automate the process of normalizing that data and storing it into the common database. ## Variable raw data formats The **raw data** may be submitted in the form of a MS Excel file, a .csv, a tab-delimited file, a plain text file, possibly even just a simple email, a field delimited file, etc. ## Loosely related data contents The contents of the raw data files will _generally_ contain these fields:   1. Book ID   2. Book Title   3. Author   4. Is Checked Out?   5. Days Overdue   6. ISBN   7. Due date . . .and so on. The problem is that some of the submitted data files will have these fields in column headers and some will not (so will need to infer from data what the field is). Further, the field names will not always be consistent. One library branch may call the boolean field for whether a book is checked out "OnLoan", while another branch calls it "IsCheckedOut". ## Common data repository All of this data will be ingested to a common database with normalized data that has been cleaned up during the ingest process. So, hopefully, we have something like this in the final DB:   1. BranchId   2. BookId   3. Title   4. CheckedOut   5. ISBN   6. DueDate   7. DaysOverdue . . .and so on. ## Automation of Ingest Process Let's assume that there are thousands of branches and that they must each issue this report to the Library HQ once monthly. Obviously, my client can hire a bunch of data-entry people to do this job (in fact, that is how it is done today). The request from them however, is to automate as much of this as possible to cut data-entry costs. ## So here is my plan, please suggest or criticize away:   1. **Standardize the file submission process.** This will be handled by creating a web page with a file upload dialog, DONE!   2. **Determine the file type.** I will be using C# (not that language matters) and it has a pretty easy way of getting the file type but sometimes I will simply get a `.txt` that turns out to be tab or pipe-delimited _so I need an algorithm to detect this_. I am thinking of using a _Bayes Classifier_ or _Artificial Neural Network_ for this.   3. **Attempt to parse the data into memory.** Now I have hopefully determined if I have an excel file, a tab-delimited, a csv, etc. I will run the file through the correct parser to get it into memory but now need to determine if the **file has headers** or if I can **infer what the headers should be by the value**. For this I hope to again use a **Bayes Classification system** and perhaps calculate a **Levenshtein Distance** from the value to items in an array of known/standardized header names. But what about header inference from the data? How would I identify one column as containing due dates and one as containing ISBN numbers?   4. **Glean, clean and submit the values in each column.** If I am lucky enough to have gotten this far (I know what the headers are), then I need to loop through the values in each column and clean/normalize them. For example, some library branches may enter an ISBN value as "ISBN12-345-67-89" whereas another branch enters "123456789". I need to catch that difference and normalize them. Is this a case for just a plain ol' expert system or `if. . .then`? Is there a better way?   5. **Submit normalized data to database.** This step is not as trivial as it sounds because some library branches may report a book title as "Algorithms for Dummies" while another reports it as "Algorithms for Dummies, 1st Edition". Let's assume for a second that I don't have an ISBN to tie the two books together (though they are the same), **what method might be suitable for deducing that these books are the same and assigning them a common primary key int the related`Books` table**? # Many, Many thanks for your suggestions!!!


Is there any real-world practical problem where only the best (exact) solution algorithm or program will do?

_Please, if you feel that question is big and does not deserve your attention (tl;dr) do not downvote it or ask for closing it being based on that._ The problem 1.1-5 in the book of Thomas Cormen et al Introduction to algorithms is: "Come up with a real-world problem in which only the best solution will do. Then come up with one in which a solution that is “approximately” the best is good enough." I'm interested in its first statement. And I would like to develop my (mis)understanding of the question and ask to name a real-world problem where only the **exact** solution will work as opposed to a real-world problem where good-enough solution will be ok. So what is the difference between the exact and good enough solution. Consider some physics problem for example the simulation of the fulid flow in the permeable medium. To make the computer simulation happen some simplyfing assumptions have to be made when deriving a mathematical model. Otherwise the model becomes at least complex and unsolvable. Virtually any particle in the universe has its influence on the fluid flow. But not all particles are equal. Those that form the permeable medium are much more influental than the ones located light years away. Then the mathematical model needs to be solved and an exact solution can rarely be found unless the mathematical model is simple enough (wich probably means the model isn't close to reality). We take an approximate numerical method and after hours of coding and days of verification come up with the program or algorithm which is a solution. And if the model and an algorithm give results close to a real problem by some degree that is good enough soultion. Its worth noting the difference between exact solution algorithm and exact computation result. When considering real-world problems and real-world computation machines I believe all physical problems solutions where any calculations are taken can not be exact because universal physical constants are represented approximately in the computer. Any numbers are represented with the limited precision, at least limited by amount of memory available to computing machine. I can imagine plenty of problems where good-enough, good to some degree solution will work, like train scheduling, automated trading, satellite orbit calculation, health care expert systems. In that cases exact solutions can't be derived due to constraints on computation time, limitations in computer memory or due to the nature of problems. I googled this question and like what this guy suggests: there're kinds of mathematical problems that need exact solutions (little note here: because originally the question is taken from the book "Introduction to algorithms" the term "solution" means an algorithm or a program, which in this case gives exact answer on each input). But that's probably more of theoretical interest. So I would like to narrow down the question to: **Are there any real-world practical problems where only the best (exact) solution algorithm or program will do (but not the good-enough, suboptimal, you call it solution)?** I want to clarify my understanding of _"good enough"_. The _best_ solution **is** _good enough_ **but not every** _good enough_ solution **is** the _best_ (exact, fastest, etc..) one. So I’m asking for a kind of a problem for which no solutions can be considered good-enough unless the solution is the best. There are problems like breaking of cryptographic ciphers where only exact solution matters in practice and again in practice the process of deciphering without knowing a secret should take reasonable amount of time. Returning to the original question this is the problem where good-enough (fast-enough) solution will do. There's no practical need in instant crack though it's desired. So the quality of "best" can be understood in any sense: exact, fastest, requiring least memory, having minimal possible network traffic etc. And still I want this question to be theoretical if possible. In a sense that there may be example of computer X that has limited resource R of amount Y where the best solution to problem P is the one that takes not more than available Y for inputs of size N. But that's the problem of finding the particular solution for P on computer X which is... well, good enough. During formulation of this question I came to conclusion that we live in a world where it is required from programming solutions to practical purposes to be good enough. In rare cases (like shuttle maneuvering) very very good ones. I could not find any problems that require only the best solution. If there is such problem of practical interest solved or unsolved can you provide any example of it? Or does there exist any proof that no such problem can exist?


Dynamic form builder forms and database design?

Say your users can create their own web-based forms (textboxes, selects, etc) and publish them on the web for their users to fill out. Does anyone have a resource or any advice on how to architect the database to tie into the dynamic forms? For example, would you create a child table for each form, or different versions of a given form?


Should the domain model  include all the domain entities in my project?

I have currently reading Grails and I love it. In order to get hands on experience with Grails I decided to create a web application for some Management System. Ya as you can guess there are plenty of entities that goes into the domain model for my web application. Any how as a novice in Web development, I just thought of creating a homepage first of all. Now here comes the problem, I sat for an hour and drawn my domain model(for my homepage alone!). After that I had a doubt that whether we have to enter all the entities(i.e my whole web app entities like user, profile, tasks and their relationships etc) in Domain model first and then start coding or draw domain models for each page in our web app and at last connect all the domain models? Well, what I do is wrong? This is my first project that ever started in my life. Thanks for your advices.


is it realistic to make use of HTML5 local storage to store CSS, and JavaScript

The idea is to make use of HTML5 local storage to store frequently accessed CSS and JavaScript. For example (pseudo-code):               var load_from_cdn = true;     if (detect local storage)       {       if (cache of css, js found)       {          load the local storage cache          load_from_cdn = false;       }     }     if (load_from_cdn)     {        document.write('<script>...');     }      Is this possible or realistic? I do aware browser cache, there will be still some header access checking,   I assuming no HTTP access is better (in my _thinking_ ) PS : It seems that local storage only support **key-value pair** , can someone prove it ?   (best with some examples)


What is the correct definition of Moore's law

I see different sources that say the number of transistors will double every 24 months or every 18 months. Does anyone have a credible source?


Is it better to develop apps using a platform specific technology or web technologies?

I happened to read an interesting article the other day that talked about building mobile applications using Javascript and HTML5. One interesting point they brought out was how this approach worked across multiple platforms, different hardware (ex. screen size) and software (ex. iPhone, WP7, Mac, Windows). I also noticed something interesting posted on Microsoft's Build Website for their upcoming conference. They seem to put a lot of emphasis on HTML5 and JavaScript. It does seem ideal to develop a single application (of course it would still require minor modifications) and have it work on tablets, PCs, mobile devices, TVs or pretty much any internet-capable device. Is this a shifting trend? Obviously it's no fun learning a technology just to find out a year later that it's getting shut down. In my opinion it seems rather difficult as it stands to do certain functionality like animations or data-binding (my favorite!) with HTML5 and JavaScript when compared to Silverlight. In this case the tools alone make it a better choice (Expression Blend and Visual Studio 2010). I am concerned though because it has been getting easier to do things on the web that just a few years ago didn't seem possible. Is there still a place for technologies like Flash and Silverlight when it comes to developing applications or should we be aiming to gear our apps toward web-specific technologies such as HTML5, CSS3, and JavaScript?


Using a “spherical frustum” for 3D projection

I am currently writing a transformation from model space to clip space for use in OpenGL. From what i have seen, programmers typically use a traditional rectangular frustum to define the clipping boundaries in their model space. I personally had in mind a shape like a frustum, except the near and far planes are spheres centered at the apex of the frustum (the camera). So something that looks like this: ![Circular sector](http://i.stack.imgur.com/i05pA.png) The yellow region corresponds to OpenGL's clip space, and the two spheres (depicted as circles in this cross-section image) correspond to OpenGL's z=-1 (inner sphere) and z=1 (outer sphere). Is this a more realistic way to model the projection, or should i stick with the traditional rectangular frustum when designing my projection matrix?


Should internal code be shared with non-developers in an organisation?

Where I work, we have a lot of developers and an awful lot of code running our proprietary applications used by staff & customers alike. We also have a lot of smart support staff that like to understand the inner workings of our systems to better support our customers, and perhaps even submit a patch from time to time. Should we open up our code for our non-development staff to be able to read? What factors should we take into account when making this decision? I have come across a bunch of arguments and counter-arguments each way & would like to make a decision based on the experience of others as well as well- understood risks. Some arguments thus far:   * Passwords in VCS are exposed (solution: get rid of the passwords - they shouldn't be there to begin with)   * Code is open to white-box security attacks (counter-argument: this only keeps out the honest/lazy attackers)   * Support staff can ask developers "how" things work (counter: teach a man to fish, etc) Does anyone open their code to staff at their organisation? Has it caused any problems?


Guidance for Web XML Api's

I have to create an API for our application that is accessible over HTTP. I envision the API's responses to be simple XML documents. It won't be a REST API (not in the strict sense of REST). I am fairly new to this space - of course I've had to consume some Web API's in my work, but often they are already wrapped in language native libraries (i.e., TweetSharp). I'm looking for information to guide the design of an API. Are there any articles, blog posts, etc. that review and expound upon the design choices to be made in a Web API? Design choices would be things like how to authenticate, URL structure, when users submit should the URL they POST to determine the action being performed or should all requests go to a common URL and some part of the POST'd data is responsible for routing to a command, should all responses have the same document root or should errors have a different root, etc., etc. Ideally, such articles or blog posts would enumerate through the common variations for any given point of design and expound on the advantages and disadvantages, such that they would inform me to make my own decision (as opposed to articles that simply explain one single way to do something). Does anyone have any links or wisdom they can share?


Is it normal for a manager/developer to feel technically lesser than the architect or senior developers?

I am an average coder in my eyes but a good developer, in the past year I've felt that my technical knowledge of our products design is being questioned by our senior developers/architects, is this normal? should I focus more on the technical nitty gritty and design? I've been working with the same team and much the same project for the past 7 yrs, in the last 4 I was appointed manager/scrummaster. I spend 30% of my time managing the project tasks and quality, the rest I spend bug fixing, I usually leave the design tasks to our architect. Should I focus more on the design of the product? it does feel like I would gain more respect if I had the architects knowledge, however I doubt if this is even achievable in the long run. Is this a general issue for developers with all architects? And should senior developers be outstanding coders?


Is it inefficient to concatenate strings one at a time?

I recall back from my days of programming in C that when two strings are joined, the OS must allocate memory for the joined string, then the program can copy all the string text over to the new area in memory, then the old memory must manually be released. So if this is done multiple times as in the case of joining a list, the OS has to constantly allocate more and more memory, just to have it released after the next concatenation. A much better way to do this in C would be to determine the total size of the combined strings and allocate the necessary memory for the entire joined list of strings. Now in modern programming languages (C# for instance), I commonly see the contents of collections being joined together by iterating through the collection and adding all the strings, one at a time, to a single string reference. Is this not inefficient, even with modern computing power?


Constructive ways to answer "What was your most challenging project? and why?"

I am asked this question many times in the interviews. > What was your most challenging project -- and why? I get confused about which project to tell them and why some project would look challenging or non-challenging. What are they looking for in the answer? Any software is a challenge before it gets started and it becomes a normal software engineering task after it has finished. All softwares I made were challenging until they got finished. Do I misunderstood the word "challenge"? What's wrong in my thinking? What's an appropriate and constructive way to approach this question?


A single language to learn to develop desktop and mobile phone applications?

Is there a language that is capable of developing apps to cross platform OSs (win,*nix) and mobile apps (IOS, android) .. I'm a pro web developer but want to explore more environment to deploy my code into... Python ? Ruby ?


What is Object Services class purpose?

I'm reading a book on TDD: (btw this question has nothing to to with TDD) link to the book on amazon   Author often mentions/uses Service Classes For example we would have a Person Object Person would would have:   \- a "regular" class for deifining the entity **Person**   \- a data access class (lets say we have a db for data persistance) using for example a repository patter **PersonRepository**   \- a "service" class (PersonServices) **PersonServices** as author himself explains: > A PersonService class serves as the business domain class that works with > Person objects from a standpoint of enforcing business rules and using > Person in business work fl ows. My question would be is that a way to go with your classes? In the past I would put everything from **Person** class and **PersonServices** into one class. What type of functionality would go into **Servieces** classes for my objects? I'm not sure if I understand the quote above (maybe I'm missing the point?)


Design of active or passive class domain

Sorry if my (simplified) example is too broad. Given this model (written in C#):               class Ball     {     }      Let's assume that a ball can be launched. To implement this feature, I can define something like:               class Ball     {         void Launch();     }      or something like:               class BallLauncher     {         void Launch(Ball ball);     }      In which situations is better use first approach and which the second one? In fact, this example tries to simplify an actual real underlying model. In that model, I need to upload files (`Package`) to a repository. Then, I don't know if the repository should upload (physical copy) a package (files) to itself or it is the package who should upload itself to a repository.


Agile - Learning & Practicing Agile alone

I am learning new technologies and doing some small projects to practice these technologies alone. And I want to learn the agile methodolgy along the way but don't know if it's a good or bad idea to learn it alone and how far I can go with it. Another thing what good resources to learn it (books/articles)?


What is the best path for a CS graduate who wants to end up doing creative research-like development?

## Background: This question came to mind after I ignorantly came to the conclusion that I was driven to go into game development, because it is the only place I can do creative development without the hinderance of clients wanting things tweaked, or security needing to be extreme, or deadlines pushing away research. I'm not talking about all cases, I'm talking about "in the end", where I've found my "final" kind of job. Game development I speak of here is indie development, where original intuitive design is important. As far as I know, this form of game development is the only way a person with only a bachelors can do research level development [AI, original UI (like voice commands / NLP), advanced graphical development]. With a phD I understand i could do any research, but I'm still unsure that is the path I wish to take. ## Question: What type of jobs or industry can allow someone with only a bachelors degree to do virtually unhindered creative research and development? This is subjective, so I'm mainly looking for opinions and RL accounts.


Self Debuggable systems

For example, in case of GDB it is possible to debug itself by itself. I have not been able to find any JVM that can debug itself or even allows debugging on source level. I was just wondering if someone can suggest on how the systems are made self debuggable. If you have references, please paste it here. I wanted to read on it in detail.


Where to put Administrative Features

Right now we have our administrative features located at www.mysite.com/admin. It is locked down by UN/PW but it still seems like an insecure place to have it. Is there a better place to put it? Perhaps at another domain?


Deprecation considered harmful?

I've just been compiling some of my own code with the `-std=c++0x` flag in GCC, as I want to vaguely keep up with what all the young folks are doing (provided they stay of my lawn), and I ended up with a load of warnings about `auto_ptr` being deprecated. Of course, I knew that `auto_ptr` was deprecated in C++0x, but... Isn't deprecation a waste of time and effort? Reasons for not deprecating (with auto_ptr as an example):   * there is an ocean of code out there that still needs to be supported, producing millions of warnings will only tempt people to turn warnings off.   * `auto_ptr` is a bit naff, but it does actually do what it says on the tin.   * if we really want to deprecate things, I nominate `printf()`. But just imagine the squeals that would ensue. `auto_ptr` doesn't have too many friends, but in at least my C++ code it is used more than `printf`, which isn't used at all.   * the committee have a bad record of getting this right - they deprecated static at namespace scope, and now it seems to have been undeprecated - I wouldn't be surprised if `auto_ptr` made a similar come-back   * lastly, whatever the committee say, the compiler implementers ignore them - they simply can't risk breaking their customers code, all they can do is issue irritating warnings. So my question - do you consider deprecation (of anything, not just auto_ptrs, and not just in C++) a good idea, and if so, why?


What defines a software architect?

At what point does a developer stops being simply a developer and turns into a software architect. Or in other words , whats the minimum job description of a software architect?


What Is The Relationship Between Software Architect and Team Member

I work for a small company which has less than 100 persons. Several months ago, this company offered me position of SA and I accepted. There are three teams in this company, and I work for one of them. This is the first time I work as a SA. During the past months, I find I don't have any power of management, I even can't let the team member do things (coding-related) in the way which is correct and more efficient. The team members argue with me on very very basic technical questions and I have to explain to them again and again. Though some members did take my advice, other members stubbornly program in their way which frequently proved wrong finally. Recently I feel a little tired and confused. I wonder what is correct relationship between a Software Architect and team members including the team leader? Besides, is software architect also leaded by the Team Leader?


Has there been any formal work comparing ease of maintenance at the programming language level?

Is there any formal work attempting to measure ease of maintenance for complex programs, comparing at the programming language level? Are there any formal measures for ease of maintenance, at any level? I'm looking for a method to obtain formal measurements of ease of maintenance (or any related work) for a pet project.


What is the name of λx.λf.fx (like reverse apply) in lambda calculus? Does the corresponding function have a standard name in programming?

What is the name of λx.λf.fx in lambda calculus? Does the corresponding function have a standard name in functional programming languages, like Haskell? In object oriented programming, is there a usual name for a method `foo` which takes a function as an argument, such that `x.foo(f)` returns `f(x)`?


Legal Requirements for Software Makers

Since the Legal site of Stack Exchange isn't ready quite yet, I figured this would be the best place to ask this question. What are, if any, the legal requirements (or online resources for finding this info out) that I must uphold if I wish to sell an application that acts as a Personal Account/Information Manager, which:   1. Stores (optionally, but preferably) personally identifiable information, and;    2. Stores (optionally) bank account information, such as existing and current balance, and transaction history, entered by the user. With regards to encryption, is there a legal standard of encryption that we as developers must use for securing this type of information?


What is upcasting/downcasting?

When learning about polymorphism you commonly see something like this               class Base { int prv_member; virtual void fn(){} }     class Derived : Base { int more_data;  virtual void fn(){} }      What is upcasting or downcasting? Is `(Derived*)base_ptr;` an upcast or downcast? I call it upcast because you are going away from the base into something more specific. Other people told me it is a downcast because you are going down a hierarchy into something specific with the top being the root. But other people seem to call it what i call it. When converting a base ptr to a derived ptr is it called upcasting or downcasting? and if someone can link to an official source or explain why its called that than great.


How do you handle ever-growing piles of issues to be resolved "somewhen"?

We're using JIRA to keep track of issues in our software projects. One effect we noticed is that we often create a new issue but we don't knw yet when/if the problem is going to be fixed at all. So we invented a fake 'Distant Future' milestone which such issues get assigned to. As it happens, the pile of issues assigned to this milestone keeps growing all the time so it seems this is not a good approach. There are so many of them by now that it became quite a lot of work to review all of them for validity. Some of them became invalid since the component they are related to you was removed. Some of them were duplicated by other issues. Some of them have such a poorly phrased description that nobody really knows what they are about anymore. How do other software development teams deal with issues which are valid, but which might not get fixed anytime. Do you bother recording them at all? Do you assign them to the next planned version and then look at them again as the next release approaches? Something else?


async & await - poll for alternatives

Now that we know what is in store for c#5, there is apparently still an opening for us to influence the choice of the two new keywords for 'Asynchrony' that were announced by Anders Heijsberg yesterday at PDC10.               async void ArchiveDocuments(List<Url> urls) {         Task archive = null;         for(int i = 0; i < urls.Count; ++i) {             var document = await FetchAsync(urls[i]);             if (archive != null)                 await archive;             archive = ArchiveAsync(document);         }     }      Eric Lippert has an explanation of the choice of the current two keywords, and the way in which they have been misunderstood in usability studies. The comments have several other propositions. _Please - one suggestion per answer, duplicates will be nuked._


Is 37Signals Basecamp a hype?

What's so unique about it? Heard great things about it, used it, found that beside the Google Apps Integration there's nothing really special about it. Maybe I just don't get it? So, what's your reason to use basecamp?


What's a good javascript library for drawing shapes and connections

What is a good javascript library (for use with Ruby on Rails) for drawing shapes and dynamic connections (lines connecting shapes that adjust as you move the shapes)?


What are some fun (and very easy) C++ programs for a 10 year old kid to write?

It might be a bit young to be learning C++, but I've been hired to tutor a ten year old and I will happily oblige! I'm struggling to think of some fun but easy programs to work on. Ideally, I'm looking for something that can be done with a basic understanding of if statements, while loops, variables, vectors, input, and output. I came up with the idea of writing a "Mad Libs" style program, where it asks the user for input (adjectives, nouns, etc) and then outputs a story with that input filled in. However, he didn't seem very interested in this idea since he does not like "Mad Libs". I feel like he might be particularly interested in writing a program that has a visible effect on his computer. For example, he loves figuring out key presses to do things like invert his computers color, etc. Any ideas for a fun/easy C++ program for a 10 year old?


What is your go-to application when you start learning a new language?

What "application" do you write to understand a programming language? I have used a calculator (regular + equation solver). But I think it's too easy. I am planning to learn Haskell and was curious, what is your "go-to application" when you start to learn a new programming language? One of my friend uses XML parser as his go-to application. Any other suggestions which will include comprehensive use of data structures and other important constructs?


Optimal buffer size for fread/fwrite

What buffer size should I choose for read/write files via POSIX fread/fwrite functions?


How to design a system that allows for multiple parallel extensions of the same "component"?

As a player, I found the following problems about creating and using "extensions" (aka mods) for games: > 1) Whenever the game is updated, all the mods break. > > 2) Most mods don't work with each other, so the player "has to choose" > > 3) If you ever de-install a mod, your "saved games" almost always become > unusable. I want to design a game in Scala/Java that does NOT exhibit those issues. I need help with point 2. I want to write it such that it is maximally extensible. My problem is I cannot nail down properly how I should do this, and since the whole design reside on top of the component/service/plugin architecture, than I can't move forward until I solved this problem. The design qualities I want to achieve are: > 1) For any "service", there should be a single object (at any given time) > that implements it. Since it is a cycle-based simulation, I can safely "swap > implementation" between the cycles. > > 2) It should be possible for a "third party" to create a "bundle" which > either modifies or more likely extends the functionality of a "service", and > "bind" it into the existing application at runtime, _without recompilation_. > > 3) It should be possible to load and unload those bundles at runtime, > because they will be used in a long-running server. > > 4) Developing extensions should be easily possible, even for a "junior" > programmer, without requiring extensive knowledge of some complex framework. > > 5) It should be possible for _several_ bundles to extend/modify the same > service at the same time, as long as they follow a certain set of rules > preventing most conflicts. I was first planning to use OSGi, but I can't really see how to get this to work. OSGi solution is to let many bundles register the same service and use a "filter" to choose one in the client code. Making the code aware that at any given time, there can be several objects that implements different variations of the same service, and that those instances can come and go, would make everything much too complicated and brittle. My plan was to register every service as a generic "handle", which the user of the service can use to get the real instance and cast to what they want. The handle content could change over time, but the handle object itself would be valid for the duration of the program, therefore bypassing the constant querying of the registry, with associated filtering. I think OSGi can solve 2 to 5, but only by using multiple instances of the same service, which is in contradiction to 1. I think that 1 an be achieved either by using composition, or by fusing all the different implementation of a service into a single object through byte-code manipulation. A look at Javaassist showed me that "rebasing" a class does not seem too difficult, if they all extend the same base-class and take the same constructor parameters. Composition, on the other hand, seem to put much more work on the hands of the third-party extensions developers, which is in contradiction to 4, and generally is a clunky solution at best. If I implement the byte-code manipulation strategy, than I have to basically do almost everything myself, and loose most of the benefits of OSGi. Also, I cannot really create the fused service until _all bundles_ have been activated, so they cannot register a "real" service instance at activation time, which is what OSGi is about (?). Do I even know from OSGi when it's "done"? Is the only way of achieving those designs goal to create my own component framework, or can I still do it using OSGi, or some other system? Reinventing the wheel at that level sound like a stupid (and time consuming) idea, but I can't see how to solve those problems with OSGi. Maybe another service/plugin framework can do it? Or by using a specific well-defined design strategy? UPDATE: It will a be an Internet Client-Server (Cluster) model running on OpenGL. I am mostly "framework unencumbered", that is, I can choose whatever fits my needs, but I want to stick to the JVM. OSGi is an attempt at standardizing "components" (called bundles) for the JVM.


two ways of doing the same thing, what is preferred?

I have some `context`   then I can do:   with `context.getError(Object): ErrorHolder` `holder.addError(error)` OR `context.setError(Object, error)` `setError` will probably have this implementation:   `context.getError(Object).addError(error)` what approach should I choose and why?


What is the difference between artificial intelligence (AI) and swarm intelligence?

I understand that when we try to implement swarm intelligence, it basically has multiple independent units communicating and with each other. What I am unsure of is if swarm intelligence an extension of artificial intelligence or if it is a discipline in and of itself.


Dividing database between MySQL and NoSQL

Mine is a typical website developed with LAMP stack. Due to scalability issues we are planning to incorporate NoSQL for the application. For the implementation, we are planning to implement hybrid solution: using NoSQL only for few of the high volume tables in database and keep on using MySQL for all the other. So, we are splitting the database in two with two different servers which use different database technology. We are weighing pros and cons for this approach. For example, with this approach we will have to depend on the web application to maintain data integrity. There will be 2 points of failure due to 2 DB servers, instead of one. Is it a usual practice? What are the pros and cons?


Can I build a closed source plugin for a LGPL library?

If I link a program dynamically to a LGPL library (here GTK+/GLib), I'm allowed to distribute the program on my own terms (non-copyleft). Now, the LGPL library provides loadable modules. Place a shared library (.so, .dll, .dylib) in a certain directory, and it will attempt to load it, using a well-defined interface. **Am I allowed to distribute the plugin module (dynamically loaded by the LGPL library) as closed-source, according to the terms of LGPL?** I'd take care that I don't use code from the LGPLed library in my plugin, and only include such headers that would be permitted by the license, and which I could as well use in a closed-source program ("3. Object Code Incorporating Material from Library Header Files."). * * * Disclaimer:   I am well aware that you shouldn't take legal advice from strangers on the internet. I am asking this mainly because I'm curious. No code has been written, and no business commitments have been made at this point. Before I do anything real I probably should ask a lawyer (but they're quite expensive for just satisfying your curiosity!). I do have confidence though that I can get a good answer - maybe someone has done exactly this thing and can report on their experience. Maybe there is a definite answer from the horse's mouth (FSF) that I overlooked. I'm writing this disclaimer so that you don't have to, so please don't tell me to ask my legal department (which I don't have as an individual). And if this rather belongs on Programmers.SE, please feel free to move. I posted this here because there might be some technical (linking) issues that are important.


Visual Studio Load Tests Virtual Users Simulation

I'm currently working on writing a load testing application that takes advantage of Load Test using Visual Studio 2010. The load test will simulate 20 users on the same machine, and I need some data to be shared in-memory between all simulated users. I was suprised I couldn't find documentation answering the following question: What seperates each virtual user's running context from the other? Does each virtual user runs the tests in its own process? Maybe in its own app domain? Or just on its own thread? I need to know because if each user is running tests in its own process then all the in-memory cache isn't shared and is created for each user instead of one time for all of them, which is bad for me.


English term for "Naive user test" or "idiot test"

In usability testing, it's common to select a set of users who have never used the software before. I've heard this process described by programmers as the "idiot test", or sometimes "naive user test" or "ignorant user test". Unfortunately all these terms have insulting connotations in English. Is there a term to describe this type of usability test that does not insult?


SOA Release management strategy

Currently I have been asked to propose an automated release management solution for a large oracle SOA project. All code is stored on SVN repository and it would be nice if I could suggest something that would build, deploy, run test cases and produced reports for all projects on trunk. I know that I could do that by creating ant or maven scripts, but I would like to know if there is an open source alternative that handles all these complex stuff, without the need of so much coding.


How do you effectively compete with an open source project?

A company with a solid open source project competing against a traditional closed-source product seems impossible to beat. I read this article wherein the author lays out this scenario: > Suppose one could divide a software market—say network management—between > two products. One did everything possible and cost $1 million, and the other > only did 10% as much, but was free and open. > > The price tag of the commercial solution would automatically filter out a > large number of users, and those people would have to turn to open source. > But some users would be satisfied with the 10% functionality and choose it > outright. > > For example, I have an original Macintosh computer on my desk. It runs a > word processor called MacWrite. It does everything, with the exception of > spell check, that I need a word processor to do. I can format paragraphs, > choose fonts, make text bold or italic, and even paste in pictures and > graphs. All in a "what you see is what you get" user interface. > > It takes up 76K of disk space. That's "K" as in "kilobyte." > > Compare that to Microsoft Word. I think the last time I installed just Word > it was around 30MB, many times larger than MacWrite, but I don't use it for > much more than I use MacWrite. Like me, many users are happy with basic > functionality. They don’t need all the bells and whistles. > > But back to my analogy. In the beginning, the commercial company would > probably ignore the open source project. It represents no threat to their > revenue stream, so why should they pay attention to an upstart? > > If this project is healthy and sustainable, however, in a year or so perhaps > it does 15%-20% of what the commercial product does. This should bleed a few > more users from their business, and maybe now they start to pay attention. > > Most likely, this attention would take the form of marketing against the > project. They would claim it is too small or too underpowered to take > seriously. And in the short run this would probably work. But the mere fact > that they acknowledged the project would pique interest. Some people would > determine for themselves that it was neither too small nor too underpowered > and would start using it. > > Another year or two goes by and now the project is up to 50% of the > functionality of the commercial product. People start joining the project in > droves. The commercial company now has to do something. What do they do? > They add more features. > > Remember, the commercial product already did 100% of what people needed. So > what kind of features could they add? Unnecessary ones. They might change > the look of the user interface or add features outside of network > management. In any case, this development will cost money, and that will > start to eat into the company's margins. > > Finally, with a healthy community and this influx of new users, the open > source project will eventually approach 80%-90% of what the commercial > product does. Having exhausted all avenues of generating revenue, the > commercial company still has one final option: put the screws to their > remaining customers. Find ways to charge them more, to eek out what they can > from their investment, which ultimately will drive their clients away. > > Farfetched? I don't think so. There are only two main requirements: > > First, find a market where open source provides a compelling alternative, > such as network management. > > Second, build a sustainable community around the open source project. It seems very plausible. If you were the closed-source company, how would you compete??


Why should I know concurrent programming?

Concurrent programming is quite difficult to me: even looking at a basic slide seems challenging to me. It seems so abstract. What are the benefits to knowing Concurrent programming concepts well? Will it help me in regular, sequential programming? I know there is a satisfaction to understanding how our programs work, but what else?


Objects as parameters: Is there a simple way that explain this?

I tried to understand how objects can be passed as parameters but it was difficult for me. How can we pass an object as a parameter to a method of another object? I need to understand the idea behind this. **updated:**               public class Student {}          public class Admin {              private ArrayList<Student> students;               public void enrollStudent(Student newStudent)           {            students.add(newStudent);         }     }


Using an issue tracker as a single programmer

If this is tl;dr, scroll down to "The Question" ### Why this is not a duplicate: The linked question talks about version control (which I have), a one step build script (which I have) and to "have an issue tracker at all" (which I have, but I'm having trouble optimizing), none of the answers to that question answer any of my questions. This question is not about "minimum subset", it is about practical issues in a specific real world situation. ### Background: I am the sole developer at my company, which is only 5 people. Only one of my coworkers has any development experience, and he is not working on any of the production code. He is my boss, but he doesn't have any interest in the details in specific issues. My job is honestly more of a side project of one of the partners (my boss's boss), the company already makes money from things that have nothing to do with me. He is reluctant to give me more resources until I can prove that this project has viability; once I do, he plans to give me a lot more resources, but until then this is my situation. ### The issue: As a result, I am finding it challenging to use my project management platform (currently Redmine). I think that if there were more programmers or even testers, it would be a great communication tool. However, because I am doing 100% of the development work and 95% of the testing, it just seems like a massive time sink to keep the cases up to date, and sometimes even to create them! Most of the time, when I find a bug, I just fix it immediately. The only time it ever makes it into the issue tracker is if it's not something I can fix and test in less than half an hour. As the only programmer, there is no code review. No one who works here is interested in using my redmine server; I'm lucky if I get a bug report via email, usually they just walk over to my desk and tell me - and even that is rare. I have tried to get my boss to use the server by making him watcher of many of the cases, and having it email him when I make changes, but he hasn't even logged onto it in the last 3.5 months. Before I was using redmine, I was using Wunderlist - and honestly that seemed to be a much better fit. It was definitely inferior from a features standpoint, but it did the job - I could make notes of things much more quickly. Note: I am comfortable with my version control routines, most of the time; this is much more about issue tracking and communication with the non- developers. ### The Question: I would appreciate input on any of these questions:   * As a lone programmer, do you prefer a full featured issue tracker like redmine or a simpler personal organization system like Wunderlist or Evernote? \-- If you use redmine or similar, do you use most of the features?   * Any tips for getting YOUR BOSS who has had zero interest in using an issue tracker in the past to start using it?   * When testing existing code (assume code that was not written with TDD), if you find a bug, in what situations to you add the issue to the issue tracker?   * Any other advice that seems relevant for me.


Recently I heard someone say they built a "SaaS" application. At first I thought "this guy knows something new", and I figured SaaS was some hyped enterprise framework or design pattern, but after looking up the SaaS Wikipedia page I realized it's similar in meaning to "web app". What is the origin of the phrase "SaaS"? When was it first used?


Should you implement a repository pattern with an MVVM javascript framework?

When coding a MVVM pattern I use Dependency Injection (DI) and try and code against interfaces. One of the common patterns is a Repository pattern, so I can swap my data storage provider. If I'm creating a web server side REST/ODATA API to server data to a MVVM/JavaScript/HTML UI, should I need to include a repository pattern in my MVVM JavaScript client code or just leave the repository pattern at the Web Server API level? I just can think of a 'Use Case' which would have me swapping out the Web Server API for another API at this stage. What do others do? In my case I've chosen to implement AngularJS as the HTML/JavaScript MVVM client framework and Microsoft MVC WebAPI as the data/business logic service for Angular.


Is there an easy way to map directory structure to a MongoDB schema?

I'm trying to store a directory structure, including files and their content, in MongoDB. The work is part of a synching app, and is using in Node/Mongoose. Now, I'm new to Mongo, and it's late here - is the idiomatic implementation as easy as it looks - ie, something like this?               var FileStoreSchema = new Schema({       fullPath: {         type: String,         index: { unique: true }       },       filename: String,       [Metadata and other useful fields]       });


Losing a lot of motivation at work. Help?

For the longest time (about 5 years out of school now), I've been fairly motivated enough to go to work each day and do actual quality work. Lately I've been losing a ton of motivation. I'm starting to realize that this is really affecting my performance at work for the last several months now. I just don't enjoy doing this anymore. It's just too tedious (especially my current project). I think I might be able to work on easier projects or just do maintenance type work (like fixing bugs or things that don't require an elaborate design document). I think I could be fine doing that sort of thing instead. I really have no idea what is causing my loss of motivation. It just sort of happened recently and now I find myself really struggling to even work on my current task. Help? Maybe I should finally just quit and start working on an iPhone app or something. lol.


Getting to the big leagues & managing time as a novice game developer?

I'm a 23-year-old novice game developer who just got his first job in the industry a year ago. Unlike most programmers I know, I started programming pretty late, during my second year in college, and I didn't work on any projects of my own until a couple of months ago. I feel like I'm doing quite well and picking things up quickly, but what intimidates me the most is just how many "prodigies" there are in the industry. If you read the biographies of any set of randomly-picked indie developers, you'll almost certainly find that they started programming at the age of 8, that they made 20 games before starting their latest successful venture, that they got together with a group of friends to start a company straight out of college, that they do music and art in addition to programming, etc. Especially now that I no longer have the free time afforded by a lack of responsibilities, I'm starting to get scared that I'm running out of time. So my question is this: how important, really, is this time differential? Does it actually take 10 years to "catch up" to a developer who's been programming since they were a kid, or does that difference matter less when you're programming professionally? And more generally, if you're less experienced than your peers, how on earth do you juggle expanding your technical knowledge, networking with fellow developers, working on side projects, planning a business, maintaining a social life, and retaining a job while at the same time not dying of exhaustion? Apologies if this isn't a good question — I'll delete if I see downvotes.


Teaching programming by solving puzzles?

I'm going to teach the basics of programming to a group of young kids (c.a. 10 year old) and was wondering if asking them to solve puzzles or play simple games with programming might be a clever thing to do? For example by asking them to write down the though process behind playing Tic-Tac-Toe. (1. Can I make a line? Then put a marker there 2. Can the enemy make a line? Then put a marker on that line. 3. Otherwise just put a marker anywhere.) Or something like that? If so are there any specific puzzles or simple games that are more suited to simple algorithms? Or should I just do it the traditional way by explaining variables, conditionals, etc. using examples and a console program?


Outline for technical software documentation

Say I have a software project for which the technical documentation should include   * A license document   * A list of used terminology   * An introduction about what the software does   * A short quick-start guide   * Complete documentation of tools covered by the project   * Documentation of file formats and protocols   * An API Reference   * A list of known bugs   * A todo list   * A set of examples What is a good order of these points? How can these points be organized into chapters, sections, subsections, and subsubsections? One of the tools has an hierarchical configuration structure. Should this structure be represented in the documentation outline (this will result in a really deep outline) or should it be flatted in some way?


Trying to get a better understanding of object-oriented design's performance pitfalls

I'm currently in a high-performance computing class taught in C++. Usually, I do work in C#, meaning everything is taken care of for me, and optimization comes behind maintainability and higher-level features. It's like... a nice productivity furnace that keeps me nice and warm in the programming project winter at the expense of my CPU cycle/cache miss electricity bill. However, now that I'm in C++ and efficient algorithm land, that stuff takes a back seat to optimization. Since most of my work has been in C#, object-oriented programming is sort of my style. However, I have been reading/hearing more and more about how object- oriented code is an enemy of performance. As my understanding of software architecture shifts from being exclusively about class structure and encapsulation to understanding how things are disposed of from L1 cache and pipelining, I'm trying to understand the real reasons why object-oriented design (especially as it applies to C++) causes waste of hardware resources. Can you guys give me a few basic reasons why it impacts computer performance? I know there are other debates about OOP, but I'd like to just keep it to performance on a hardware and algorithmic level.


Custom class for monetary amount (money value) instead of BigDecimal

On StackOverflow I found multiple advices to stick with `BigDecimal` in Java instead of reinventing the wheel. Despite that, I decided to create my custom class, and I would ask if that was a good idea and pros or cons about my design in comparsion to BigDecimal. The reasons to choose custom implementation and characteristic of my design are:   * no double/float constructors like in BigDecimal (risk of mistake) - **`long` internally with 8 decimal places** \- this restrics min/max to ~10 bilion but system is cryptocurrency-targeted so typical values are small.   * no difference in "0.0" and "0.00" as BigDecimal have   * simple SQL compatibility by BIGINT column   * hard connection to currency object/code - cannot create amount wihtout currency and also cannot do arthimethic/comparsion of two values in different currencies   * Control of creation possible values to not overflow long (-10 bilion to 10 bilion)   * internal overflow protection on computations **Do you think that those reasons as good to choose custem implementation instead of BigDecimal?** To minimize risks I have cover very lot of situations by unit test and also use BigDecimal for initial conversion from string:               BigDecimal decimal = new BigDecimal(value);     ... check MIN/MAX allowed values ...     BigDecimal multiplied = decimal.multiply(new BigDecimal(String.valueOf(DECIMAL_DIVIDER)));     long internalResult = multiplied.toBigInteger().longValue();     return new Amount(internalResult, cryptoCurrency.getInternalCode());


What is the best way to learn programming if you've never done so before?

Like the title says, what is the best way to learn programming if you've never done so before? Should one start explaining variables, sequential execution, objects, algorithms; where does one start? Of course, this may differ from person to person, but maybe there is a best "average" way which helps the most amount of people on average. I myself don't actually remember the time when I started programming, which is why I'm interested of this. Also, I've often wondered how programmering to newcomers should be taught in the best way.


Is there such a thing as having too many private functions/methods?

I understand the importance of well documented code. But I also understand the importance of _self-documenting_ code. The easier it is to visually read a particular function, the faster we can move on during software maintenance. With that said, I like to separate _big_ functions into other smaller ones. But I do so to a point where a class can have upwards of five of them just to serve one public method. Now multiply five private methods by five public ones, and you get around twenty-five hidden methods that are probably going to be called only once by those public ones. Sure, it's now easier to read those public methods, but I can't help but think that having too many functions is bad practice. **[Edit]** People have been asking me why I think having too many functions is bad practice. The simple answer: it's a gut feeling. My belief is not, for one bit, backed by any hours of software engineering experience. It's just an uncertainty that gave me a "writer's block", but for a programmer. In the past, I have only been programming personal projects. It's just recently that I moved on to team-based projects. Now, I want to ensure that others can read and understand my code. I wasn't sure what will improve legibility. On one hand, I was thinking of separating one big function into other smaller ones with intelligible names. But there was another side of me saying that it's just redundant. So, I'm asking this to enlighten myself in order to pick the correct path. **[Edit]** Below, I included two versions of how I _could_ solve my problem. The first one solves it by _not_ separating big chunks of code. The second one _does_ separate things. First version:               public static int Main()     {         // Displays the menu.         Console.WriteLine("Pick your option");         Console.Writeline("[1] Input and display a polynomial");         Console.WriteLine("[2] Add two polynomials");         Console.WriteLine("[3] Subtract two polynomials");         Console.WriteLine("[4] Differentiate two polynomials");         Console.WriteLine("[0] Quit");     }      Second version:               public static int Main()     {         DisplayMenu();     }          private static void DisplayMenu()     {         Console.WriteLine("Pick your option");         Console.Writeline("[1] Input and display a polynomial");         Console.WriteLine("[2] Add two polynomials");         Console.WriteLine("[3] Subtract two polynomials");         Console.WriteLine("[4] Differentiate two polynomials");         Console.WriteLine("[0] Quit");     }      In the above examples, the latter calls a function that will only be used once throughout the program's entire runtime. Note: the code above is generalized, but it's of the same nature as my problem. Now, here's my question: which one? Do I pick the first one, or the second one?


Design pattern for sharing Social Authentication across subdomains?

Right now building an app that authenticates using either email or different social accounts. Because it is going to function on multiple subdomains and domains, I'm wondering if there's a design pattern that's been used in the past to accomplish this without issue. Basically, it's for authentication only as we are using profile information stored locally. I was originally thinking of doing something like an iframe pointed to `accounts.domain.com` that could always check login status of social accounts. Thanks!


What process should I follow to implement (code) a web site in HTML5/CSS?

The title question is unfortunately pretty vague (or at least may be asking differently than what I intend)... but let me elaborate. I know basic HTML5 and CSS. I don't need to learn the tags and how they work. What I'm looking for is some information on what sort of process to follow when actually coding a professional style website. I want to make a portfolio website for myself from scratch (that is, not to use turnkey software such as Wordpress and such) but I don't know what to do as a process to making a clean site from the start. I'm a CS student and my skill set is in Java/C#, but I do want to learn web development as well. I know that HTML is for the content of the site, CSS is for the look, and Javascript is for the behavior. Do I need to have an idea of what the site is ultimately going to look like before I start the HTML? Can I just write the HTML to describe the content and worry about the look of the site afterward, or do I have to write the HTML knowing what I want the site to look like as I write it? If I want a horizontal nav bar at the top, do the links have to be side by side in the HTML code? These are all things I don't know... how to actually **build** a proper website. I know how to make basic pages with text and links and headers and all that, but to make a professional website is foreign to me. Every page I find on Google is either too high level (giving a design and implementation process without giving examples of how to implement once you know what you want) or is too beginner (trying to teach me HTML and CSS when I already know what I need to know in that regard).


Why were frames deprecated in HTML5, but not iFrames? After all, there is almost no difference between the two. In many instances using either of them would give the same output (pardon me if I am wrong)?


Preventing override of methods in Objective-C

Objective-C lacks private methods or java-esque final methods. This means that it is possible for a subclass to (accidentally) override some of the internals of a superclass. How does one prevent overriding methods in Objective-C?


Is it alright to create another reference to a javascript object just for ease of access

I have a use case where I need to create say two javascript objects & use their properties in one another. eg -               var Object1 = {       settings: {        property1: 'someValue',        property2: 'someValue'       }     }          var Object2 = {       foreignProperty: Object1.settings.property1;     }      I wanted to know if its alright to use a reference object for settings if I know that I will be using the settings property a lot. eg-               var Object1Settings,         Object1 = {           settings: {           property1: 'someValue',           property2: 'someValue'         }     }     var Object1Settings = Object1.settings;          var Object2 = {       foreignProperty: Object1Settings.property1;     }      Is this approach acceptable in terms of right ways of coding & performance? Thanks


OSS dual licensing / market segregation

I have an open-source project, which I would like to commercially license to various types of businesses. xGPL licenses do not work for me since they don't allow any conditional addenda. What I'm seeking to achieve is:   * require commercial licensing for businesses   * allow use and changes under some OSS license for individuals   * allow free use (same as above) to specific business branches on individual selection basis (e.g. educational institutions). I'm really confused about how to achieve this and don't violate the terms of the OSS part of license at the same time. **Edit** : I'm looking for an existing free license, which doesn't explicitly forbid dual licensing like GPL family does.


why do some job posts say "high pressure environment"?

Why would there be any pressure if everyone knows what they are doing and the projects are accurately estimated? If there's pressure, or even high pressure, then it implies what they are currently doing is not working, why would any good programmer want to join a team like that? Are these kind of job posting failed at trying to show off or are they really just being honest? Or is there really some good reasons for having pressure?


The best method to get personal projects done

I have numerous personal projects I've begun and never seem to finish because I get sidetracked with other ideas. I was wondering what the best method to get personal projects done is? Any tricks or tips to it? The problem is I get a spurt of inspiration on some projects, and I don't wanna lose track of my ideas and right now my method of "saving my ideas" is to just get as much stuff done on the ideas as possible in one night and then store some GitHub issues as to dos. I find that this makes me never get back to older projects tho.


I want to sell my software [C# desktop application] but I was Stuck in licencing

> **Possible Duplicate:**   >  if I use .NET Framework for my application, do I have to pay anything to > Microsoft? I have developed a desktop application called "Institute Management System" which has modules like Class manager, Subject manager, Topics manager, Student inquiry manager Student admission manager, Fees manager, Exam manager etc. using C# for the front end and MS Access for the back end. The main problem is that I want to sell it and earn some money but I heard that my application needs to be registered at Microsoft, and I would have to get a license from them for selling, and have to pay them money too. I have spent four months developing it at my own expense, and worked very hard to develop it. So I want some tips, advice, any suggestion for the same. Please also tell me the procedure for all of the required registrations and payment issues. And I also want to ask you if you **Can you suggest any other technology where I develop my application and sell it without worrying about licencing and related issues?** I am now more confused about that "MS technology is open source or not? "


Intermediate to advanced book for improving VIM knowledge and understanding

I use `vim` already for quite a while and every day try to learn new things. But, somehow I yet don't feel that I own it. I'm looking for some intermediate to advanced books on `vim` which may be used as a reference as well in every day development. What I look for in the book is more explanations of concepts and general background philosophies than cheat sheet style lists of actions. Maybe it could cover some commonly used plugins and plugin development as well.


Where did the convention of naming command line arguments as 'argv' come from?

It seems like Python, PHP, and Ruby all use the name "argv" to refer to the list of command line arguments. Where does the name "argv" come from? Why not something like "args"? My guess is that it comes from C, where the v would stand for "vector". Wikipedia has a footnote that says: > the vector term in this variable's name is used in traditional sense to > refer to strings. However, there isn't any source for this info. Really, I'm curious if it has roots that trace even farther back. Did C use it because something before that used it?


How to find people to help translate my open source project?

I'm a big StackOverflow fan, but I think this question belongs here, correct me if I'm wrong. So basically I'm trying to localize my plugin in as many languages as possible. I posted a section on the docs to reach people that wants to help translating but I only got one contributor that attached a German translation. So far I got 4 languages, English, Spanish, French and German. So my question is, how do you guys translate your projects? Where do you find people interested in contributing? Does anybody use Google translate to do the job?


Useful Pre-requisites for Operating Systems course?

How important is knowledge of data structures and algorithms for an Operating Systems and Systems Programming course where we will be required to design and implement a kernel of a real-time operating system (done using C and 68K)? How useful will programming experience implementing data structures like linked lists, queues, binary trees etc. in C++ be for this type of course? thanks!


When do rounding problems become a real problem? Is the least significant digit being one off really a big deal?

If I do `.1 + .1 + .1` in Python, I get `0.30000000000000004`. (I am not asking about Python in particular, and do not want Python specific answers.) The only problem I can see with this is `0.30000000000000004 != 0.3`, so I need to take care in how I compare floats. Are there any other problems I need to be aware of with float rounding? I can't imagine that last digit being much of a problem in real life. For example, if I ask for a "0.30000000000000004 meter metal rod", I'm not going to later complain that "this rod is 0.00000000000000004 meters too long!" (I can just cut the extra off, right? :) Even with a lot of float calculations going on, I can't imagine the rounding getting so far off that it matters. Am I missing something? When do floating point rounding errors really matter?


What can be done to programming languages to avoid floating point pitfalls?

The misunderstanding of floating point arithmetic and its short-comings is a major cause of surprise and confusion in programming (consider the number of questions on Stack Overflow pertaining to "numbers not adding correctly"). Considering many programmers have yet to understand its implications, it has the potential to introduce many subtle bugs (especially into financial software). What can programming languages do to avoid its pitfalls for those that are unfamiliar with the concepts, while still offering its speed when accuracy is not critical for those that _do_ understand the concepts?


Python Class Layout - Conventions

What is the proper or standard way to layout a class. If a class where to have attributes, methods, private attributes, private methods, class property (methods), and class methods. I am done 99% of my coding procedurely and beyond working with ORM haven't focused to much on OOP. I am changing that in a current project and was just curios what the standard way of organizing your classes was.               Class MyClass():        attr1 = value1        attr2 = value2        _attr3 = value3        def __init__(self):           do some stuff        def do_something(self):           do some more stuff             def __do_something_else(self):           more stuff        @property()        def attr4(self):            return do_some_stuff_else()             @classmethod()        def generator_a_bunch_of_these(cls):            do_some_more_things


Can I use machine learning for screening experimental data?

I am a experimental physicist. In our research, we have our experimental data in a 400*400*400 matrix(x, y, z axis of a 3d space), each entry is associated with a value("brightness"). We expect the brightest entries will form a closed path in the 3d space. But some portion of the path is always too dark to identify, also there are some noise in the space(random bright lines). Our current algorithm generates random seed points into the space, they are attracted by the brightness of the data. After certain amount of time, they will be trapped in the path. If we record the seed points position we can get the path. Our current algorithm does a fairly good job while I still need to manually add those relatively dark points to the path. I am not familiar with machine learning, but I am wondering if it can be used on this case? For example, is it possible that I tell the program which data points are on the path, the program will know how to choose the data points for the path in the future. Or if there is some other method we can use? Thanks!


Question/Answer for multiple Users - How should I design it?

I'm wondering about a good way to deal with a Question/Answer - Model for multiple Users. My goal is to have an efficient and readable model where all the results of my users are stored. Every user has the same questions/answers! At the moment I have three classes, `Question`,`Answer` and `User`. A `user` has a `Set of Questions`. A `question` has a `Set of Answers` and an extra field `selected_value` which is the answer the user clicked. Every user has a copy of the same set of questions. Therefore I can easily see what a user has clicked. This is an unnecessary overload because I need to store the questions/answers more than once. But the good thing about this approach is the availability of my questions/answers in my user-model as I need to see what every user clicked. It's also easy to extract this information (e.g. via xml) doing just a loop around every user and his questions. But what kind of approach would you recommend to use? Should I create a model "result" inside of my User-Model where I simply store a list of pairs like "QuestionId, AnswerId"? Is there any more accepted way to do so?


Github Workflow: Pushing small fix branches to remote, or keep them local?

In Scott Chacon's workflow (explained eg in this SO answer), with essentially two silos (`development`, and `master`), if, say I have a small bug to fix (e.g. can be fixed with a few characters) is the optimal way of doing that: a) branch off of `development` a branch called e.g. `fix_123`. Push this branch to origin as I work on it. When it's done, code-reviewed, whatever, merge into `development` and push `development` to origin. b) Same as above, but without pushing `fix_123` to origin.


Help with algorithmic complexity in custom merge sort implementation

I've got an implementation of the merge sort in C++ using a custom doubly linked list. I'm coming up with a big O complexity of n^2, based on the `merge_sort()` > `slice` operation. But, from what I've read, this algorithm _should_ be `n*log(n)`, where the log has a base of two. Can someone help me determine if I'm just determining the complexity incorrectly, or if the implementation can/should be improved to achieve `n*log(n)` complexity? If you would like some background on my goals for this project, see my blog. I've added comments in the code outlining what I understand the complexity of each method to be. _Clarification_ \- I'm focusing on the C++ implementation with this question. I've got another implementation written in Python, but that was something that was added in addition to my original goal(s).


Best way to use GIT to maintain web application template

I am a sole developer and I have a web application template that I have created in Visual Studio. I am using GIT for source control, but only on my development machine. Presently I have a master and I create branches for new features, merging them back in to the master as I complete the features. I am at a point now where I am ready to use the template for deployments, and of course I want to continue adding new features via branching/merging. My question is: what would be the typical/recommended way for me to create application deployments based on the master? Should I clone the repository into a new directory that is for a particular web application? Or should I also use branching to do project development based on the main project? The projects would never be merged back into the master. However, it would be nice if I could merge future features into the master and have the ability to incorporate them into previously completed projects if desired. For more specific details of my environment: I am using TortoiseGIT in Windows 7, Visual Studio 2012, ASP.NET Web Pages. Obviously the main differences between deployments would simply be differing pages, CSS files and jQuery scripts. * * * I found this post as I was writing this one. In order to do this should I clone the master repository and checkout from it?


map data structure in pacman

I am trying to make a pacman game in c#. I have done some basic work and have previously replicated games like copter-it and minesweeper. I am confused about how to implement the map in pacman. Which datastructure to use, so it can be used for moving AI controlled objects and check collisions with walls? I thought of a 2d array of ints but that didn't make sense to me.


How much time should you allow for clock skew?

We are writing a B2B application that uses OAuth 2.0. Before a token expires we want to refresh it since it faster to refresh a token, than request a new one. However, we want to build in some resilience in the system to clock skew so we want to consider a token expired a few seconds/minutes before it would actually expire. How many seconds/minutes is it reseasonable to expect two servers connected to the internet, in different locations, to be?


Why did the Microsoft developers did not put T4MVC (or its working) in the core MVC?

What T4MVC does makes complete sense to us. It converts the simple string input into strongly typed input, which eases things for the developer. Like this -               return View("foo");       to               return View(Views.foo);  // better (T4MVC)      What could be a reason as to why the MS people are NOT doing it this way?


Confused about the definition of 'abstraction' in OOP

I am trying to understand the definition of 'abstraction' in OOP. I have come across a few main definitions. Are they all valid? Is one of them wrong? I'm confused. (I re-wrote the definition with my own words). **Definition 1:** Abstraction is the concept of taking some object from the real world, and converting it to programming terms. Such as creating a `Human` class and giving it `int health`, `int age`, `String name`, etc. properties, and `eat()` etc. methods. **Definition 2:** A more general definition. Abstraction is a concept that takes place **anywhere** in a software system where **_'making things more general/simpler/abstract'_** is involved. A few examples:   * An inheritance hierarchy, where the higher classes are simpler or more general, and define more general and abstract implementation. While the lower classes in the hierarchy are more concrete and define more detailed implementations.   * Using encapsulation to hide the details of implementation of a class from other classes, thus making the class more 'abstract' (simpler) to the outside software world. **Definition 3** Another general definition: Abstraction is the concept of moving the focus from the details and concrete implementation of things, to the types of things (i.e. classes), the operations available (i.e. methods), etc, thus making the programming simpler, more general, and more abstract. (This can take place anywhere and in any context in the software system). It takes place for example when encapsulating, because encapsulation means to hide the details of implementation and only show the types of things and their more general and abstract definitions. Anotehr example would be using a `List` object in Java. this object actually uses the implementation details of an `ArrayList` or a `LinkedList`, but this information is abstracted using the more general name `List`. Is any of these definitions correct? (I am referring to the **most conventional and accepted** definition).


MVC exposes database primary keys?

I'm going through a MVC tutorial, and I notice that convention seems to be to expose a tables primary key on detail pages/urls (ie. /Movies/Details/5 as an example from the tutorial). It's obviously not a problem for things like a movie record or a SO post, but it might be a bit different for an invoice or transaction with confidential information on it if the key was sequential or guessable. So, is it just this tutorial or do MVC apps typically expose a tables primary key? Is there a common library or pattern for hiding the key if you don't want to expose it?


DB connection Dependency Injection and static creator methods

I often use static "factory" methods to create objects from database.               class Job {       protected $objDb;       public function __construct($objDb) {         $this->objDb = $objDb;      }           public static function LoadArrayByProjectId($intProjectId, $objDd) {        //some code that loads the jobs        $objJob = new Job($objDb);        $arr[] = $objJob;        //end of loop        return $arr;      }           public static function LoadArrayByUserId($intUserId, $objDb) {        //similar code      }      } So I try to use Dependency Injection by passing into the constructor the $objDb. The problem is the $objDb param in the static functions. It's very annoying to pass the param around. How do you handle this case? Are there better solutions?


What's it like to work in a large programming team?

I've always felt lucky to work in a small programming team. I think the most I've worked with is 11 programmers. What is it like working on a project with hundreds of developers? Thousands? What does scale and what doesn't? EDIT: Thanks for all the responses! There seem to be very few positives:   * possible to work on mega-large codebases   * better internal career development   * employee protection against abusive management (this is more -ve on small than +ve on large) Is there any other benefit to large teams?


Subscript/assignment binary operator in C++

I was designing a kind of a parser when I thought that it would be nice to have an operator overload like this: `operator[]=(subscipt_type s, rvalue_type val)`. For example we have a class:               //collection of Foos     class FooCollection     {     public:              //assume class Foo is defined         Foo& operator[]=(int i, const Foo& val);         //.....     };      And we need to assign a subscripted value:               Foo value;     FooCollection c;     c[42] = value;      then the last line of this code will resolve into               c.operator[]=(42,value);      The advantage of this operator in comparison to existing `Foo& operator[](int i)` is that we know the rvalue of assignment during the subscripting, so we can do something that could be unwished in ordinary `operator=`. For example, I tried to design a parse tree consisting of polymorphic nodes with minimal interface. This is the basic node class, all other node types are inherited from it:               class AnyNode     {     public:         virtual AnyNode& operator=(const AnyNode& op)         {             //Takes almost no actions here.             //Overloaded in each subclass to take some sensible actions         }              virtual AnyNode& operator[](int i)         {             //Returns special null value of AnyNode type.         }     };      The AnyNode class is not pure virtual, so it's possible to construct `AnyNode` objects. One of the syntax elements that I try to parse is a python-like list, which may contain heterogenous values and may be subscripted with an integer. A class for it:               class ArrayNode : public AnyNode     {     public:          AnyNode& operator[](int i)         {             //Returns a reference to i-th element         }     };      So what will happen when we try to assign something to the array cell, which was not assigned before and it's concrete type was not defined? `AnyNode& operator=(const AnyNode& op)` from `class AnyNode` will be called and no actions will be taken. But I want to know the `AnyNode&` rvalue just after subscripting, so that it could be possible to deduce it's concrete type with RTTI and take some sensible actions. Subscript/assignment operator could look like this:               AnyNode& operator[]=(int i, const AnyNode& val)     {         //AnyNode::getType() is provided and it returns a value of the predefined enum.         //stor is an underlying container that holds pointers to AnyNode,          //assume it's possible to reference stor[i].         //NodeNumber is another subclass of AnyNode.         switch(val->getType())         {         case nodetypeNumber:             stor[i] = new NodeNumber();//Also we may need to delete stor[i] before new allocation.             //Process further specific initialization of stor[i].             break;         //................         }         //Or we could use dynamic_cast instead of switch(val->getType())     }      I suppose, such kind of subscipt/assignment operator can be easily and consistently built into language. Moreover, it delimits the pieces of code which execute when the subscripted expression is an lvalue and when it's an rvalue: with it the usual subscript operator should be called only when the subscription is rvalue. Of course, if the proposed operator is not defined, but a `operator[]` is defined, the code should execute in a usual way. So my questions are: what pitfalls could I miss about this operator and why does it not included into the language? Can it break language consistency in any way or can it bring up any ambiguity into the language?


Versioning an API

I'm starting a side project, the first stage will be a building a web application with MVC, in later stages we will be adding clients for mobile platforms. My thought was to create one API that all of the applications (web and mobile) go through to get/save data. Because these different platforms will be on different release cycles I'll need a way for, say IPhone, to work with one version of the API while the website is using an updated version. What's the best way to do that? My ideas so far are:   * Create a separate project to host the MVC Web API and host that in a subdomain or in a subfolder of the root site. Then either reference the DLL directly or reference it through the web (seems like an unnecessary http call)   * House the API within the MVC project that will be the website and try to version it based on url in there. I did some quick testing with that this morning and wasn't able to get it to work, it always resided at \api (I couldn't get it to reside at \api_v2)


Is it true that websites don't need to use an event driven framework given the stateless nature of the web?

I feel like it's critical to use an event driven architecture with a lot of application types that aren't web sites. However, when coding web sites(which are stateless at the most basic level) it seems like it isn't really necessary to use an event driven architecture. Is this true? Do most web frameworks not use events to communicate between objects?


Entity Framework and distributed Systems

I need some help or maybe only a hint for the right direction. I've got a system that is separated into two applications. An existing VB.NET desktop client using Entity Framework 5 with code first approach and an ASP.NET Web Api client in C# that will be re-factored. It should be possible to deliver OData. The system and the datamodel is still evolving and so migrations will happen in undefined intervals. I'm struggling how to manage my database access on the web api system. My favoured approach would be use Entity Framework on both systems but I'm running into trouble while creating new migrations. Two solutions I've thought about: Shared Data Access dll The first idea was to separate the data access layer into a separate project and reference from each of the systems. The context would be the same as long as the dll is up to date in each system. This way both soulutions would be able to make a migration. The main problem is that it is much more complicated to update a web api system than it is with the client Click Once Update Solution and not every migration is important for the web api. This would cause more update trouble and out of sync libraries Database First on Web Api The second idea was just to use the database first approach an on the web api side. But it seems that all annotations will be lost by each model update. Other solutions with stored procedures have been discarded because of missing OData support and maintainability. Has anyone ran into similar conflicts or has any advice oon how such a problem can be solved!


Can I charge for closed source J2EE .ear module relying on GPLed EJBs?

A customer asked me to add a (fairly generic monitoring and notifications) functionality to the in-house solution he has assembled on top of JBoss and couple of GPL-licensed components (downloadable from the open source vendor as EARs). I am using JMS and JMX to communicate with these components. Do I have to provide the source and redistribution rights to my customer to satisfy GPL restrictions? In other words, does configurable code that uses JMX and JMS mechanisms constitutes a derivative work? I would actually prefer to open source my code, but part of it relies on a patented third party logic that is unwilling to GPL it, but would gladly supply it to this customer. I am not asking for a legal advice, just for the opinion in terms of best practices / fair use.


How can I inspire engineers to positively conduct telephone interviews

Our (mid-size) company (with 150 employees) has witnessed considerable growth since last year, and as a result we have been conducting lots of interviews to hire more and more engineers to bring new projects in motion. To begin with, following is our interview process   1. Screening resume by HR   2. Telephone technical interview (conducted by senior engg)   3. Final technical + HR interview (conducted by team-lead/PM) After some analysis we found that telephone interviews are not really becoming effective, due to which we are not able to find good number of engineers in final interview. My analysis revealed that engineers don't consider interviewing as important/serious activity, since it's internal and non- billable. Also I see that engineers don't find it really prestigious to carry a label of "interviewer" (at-least telephone interviewer). We do have set of good experienced engineers in company who can take any interview very effectively, but since number of telephonic interviews is large, this pool is not sufficient. Hence we try to use other engineers as well. What can be done to inspire engineers to conduct telephone interviews seriously and positively (not treating this as mundane job)? * * * [Update-2011/12/28] Thanks for sharing your valuable opinions. It really helped me to look at problem from variety of different angles. Alongside I was discussing issues with few colleagues as well and I personally feel that there is no single silver bullet for such issue. I will need to think recruitment process as a whole unit and plan to improve different areas/stages in it.