title: When not to use ORM and prefer stored procedures?

text: I am using PetaPoco micro-ORM. It is indeed very easy and secure to work with databases using ORM tools, but the only thing I hate is extra code. I used to put most of the code in the database itself and use all the RDBMS features like Stored Procedures, Triggers etc., which it is built to handle better. I want to know when not to use ORM over Stored Procedures/Triggers and vice- versa.


title: Where does paypal's 92233720368547800 number come from?

text: There has been a story in the news about a man whose Paypal account was accidentally credited with $92,233,720,368,547,800. Where does this number come from? What sort of programming bug is likely to give rise to this number?


title: Please help me give this principle a name

text: As a designer, I like providing interfaces that cater to a power/simplicity balance. For example, I think the LINQ designers followed that principle because they offered both dot-notation and query-notation. The first is more powerful, but the second is easier to read and follow. If you disagree with my assessment of LINQ, please try to see my point anyway; LINQ was just an example, my post is not about LINQ. I call this principle "dial-able power". But I'd like to know what other people call it. Certainly some will say "KISS" is the common term. But I see KISS as a superset, or a "consumerism" practice. Using LINQ as my example again, in my view, a team of programmers who always try to use query notation over dot-notation are practicing KISS. Thus the LINQ designers practiced "dial-able power", whereas the LINQ consumers practice KISS. The two make beautiful music together. I'll give another example. Imagine a C# logging tool that has two signatures allowing two uses:               void Write(string message);     void Write(Func<string> messageCallback);      The purpose of the two signatures is to fulfill these needs:               //Every-day "simple" usage, nothing special.     myLogger.Write("Something Happened" + error.ToString() );          //This is performance critical, do not call ToString() if logging is     //disabled.     myLogger.Write( () => { "Something Happened" + error.ToString() });      Having these overloads represents "dial-able power," because the consumer has the choice of a simple interface or a powerful interface. A KISS-loving consumer will use the simpler signature most of the time, and will allow the "busy" looking signature when the power is needed. This also helps self- documentation, because usage of the powerful signature tells the reader that the code is performance critical. If the logger had only the powerful signature, then there would be no "dial-able power." So this comes full-circle. I'm happy to keep my own "dial-able power" coinage if none yet exists, but I can't help think I'm missing an obvious industry- standard designation for this practice. What is that name? And if there is none, does "dial-able power" work? p.s. Another example that is related, **but is not the same** as "dial-able power", is Scott Meyer's principle "make interfaces easy to use correctly, and hard to use incorrectly."


title: Resources for bidding on projects successfully?

text: What are successful guidelines for bidding on programming projects on sites like guru.com? How do you write a bid that is likely to be accepted? Are there any examples of great bids? How do you compete with other programmers around the world who will underbid you? Please provide information and/or links to resources.


title: Protect Images in a Webpage

text: I want to build a website that will contain a lot of images. I don't want users who visit the website to be able to save the images. I have blocked the right click option, but is there any other way to keep users from saving the images?


title: How to quantify product work in Resume?

text: One of things I do in my Resume is try to quantify the impact my work has had in the particular company I was with at the time. The reason is it shows the value my work had added to the business. Is this what you guys do as well or am I the only one? In my previous job this was easy as I worked on short/medium internal applications and it was fairly easy to measure end result. For example, external consulting company quoted $50,000 for an application Business Services department wanted I completed it in 3 days so I say I saved the company $48,000. I have been in my current job for 3 years but all of it has been on 1 single well established product. About 30% work is maintenance and 70% work is on new modules. I have worked on various modules like API (WCF), Security (2 factor authentication), etc. How should I quantify work on modules?


title: How to include serious personal project in Resume?

text: My brother has come up with an interesting business idea that could be commercialised. For over a month I have been creating the foundation for SaaS. I have been treating this as commercial project so designing using patterns and best practices. One of the reasons I want to include this in my Resume is my full time job doesn't involve current trendy ASP.Net technologies (e.g Linq/Entity Relationships, jQuery, ASP.Net MVC 3, Silverlight, etc) so the resume lacks impact. In my full time job I work on a 7 year old well designed product and since our data and web layers work well it would be stupid to re-engineer them only because recruiters think Linq, ASP.Net MVC and jQuery are cool. How can I include my personal project in Resume so that it doesn't sound like experiment or quick'n'dirty pet project?


title: Should we hire one consultant for website design and another for development or find someone who will do both?

text: We've outsourced our app development, and they've created a DB hosted on Amazon-EC2. For the UI we're in talks with a web designer, but they don't do any of the coding to integrate the website with the DB created by the app developers. Is it a good idea to have one person do the website design, and another to do the DB integration coding? What issues or complications could come up? Should we instead go with a designer who provides the complete package?


title: What is Google's repository like?

text: I heard Google has a giant private (internal) repository of all of their code and their employees have access to it so that when they are developing things they don't have to reinvent the wheel. I'd like to know more about it! Is there anyone here from Google that can describe it in a bit more detail, or do you know a bit more about it? I'm interested in knowing mainly about how it's organized and how they can make it easy for an employee to find something in such a giant codebase as it must be.


title: How do you answer the question, "where do you see yourself in 5 years?"

text: What do recruiters expect you to answer when they ask, "Where do you see yourself in 5 years?" Something like: > I want to improve my technical skills ... blah-blah-blah ... architect? Is it just to check your ambitions and if you are not going to leave in a month?


title: Using algorithms in papers in my code

text: For example a new research paper comes out and it describes some algorithm, say this is a cutting edge algorithm and came out last week, is there anything stopping me from using that algorithm in my codebase that is for commercial purposes? What if the paper includes some code and I use that code? There does not seem to be any information about code licensing on the paper so I am not sure how this is meant to work.


title: Requirement Traceability matrix

text: What is a requirement traceability matrix? What are the differences between different requirement types and what are the advantages/disadvantages of using these matrices?


title: crash course in c++

text: I may have to give a crash course in c++ for a data structures class. Any suggestions on what would be essential for me to go over other than classes? thanks in advance * * * I forgot to mention I am not a teacher but a tutor and I need to help some fellow students get up to speed quickly so that they don't fall behind then I can hopefully fill in the gaps.


title: How to use the APIs for different platforms?

text: From what I know, learning a programming language consists of : 1- Learning the syntax 2- Learning how does the language handle\use\implement its "abilities" (Classes, delegates, structs, polymorphism.... etc) And What from what I found while researching a couple of programming languages, is that the "major" languages share almost all of these capabilities (OOP,delegation,polymorphism, and so on) I am learning C# at the moment, and as a "major" language , it offers all of the said capabilities and more. after learning C#, I should be able to learn other languages relatively easier, for example Objective-C ( for iOS development ) and java (for android development) the problem here, the Framework. for windows there is (.net), for Mac (Cocoa) for iOS (Cocoa Touch) how does one go about USING these frameworks, I am not looking for tutorials for a specific api, I can use google for that ;) I am talking about "understanding" the general idea of how one would easily use a framework ( even if its previously unknown to the programmer) to build an application. For example, we all heard of the Playstation Vita, the new handheld device of Playstation... now this device offers alot of new features not found in the PSP ... so the game developers for this device will need to get the API from sony and work their way through it to build a game for the PS Vita . How does that work? is there something you need to know besides the programming language used for the API (eg. C# for .NET and Objective-C for Cocoa) ? I know that there are books covering each major API out there, But again I am trying to get a general understanding not a tutorial. On a forum for game developers, someone said (once you know programming, the language is just a tool) That's what I want to achieve... Sorry for such a long post, And I would be grateful for your experience on the subject.


title: What are the steps required to ensure you've covered technical due diligence when purchasing a software product (and IP) created by another company?

text: If you were tasked with performing due diligence for a software product/IP you/your company was considering buying. What would be your steps to make sure the purchase was acceptable from a technical risk level? The scenario is one company has a product you or your company is interested in buying in it's entirety (IP and code) so that your company can now sell that product or it's services. The upfront assumption is the product has some value, but you want to assess the technical foundation of the product to ensure it's not a complete hack and nightmare to support. Examples of this might include   * Compile/Build and install the software on a clean computer to verify the build and deploy cycle.   * Run a code profiling tool against the code base to get an idea of overall code quality. What else? Are there any resources/checklists on the web which might help?


title: How do you deal with over-the-head APIs/technology

text: I guess most people have been in this situation. The initial project planning begins. The requirements are outlined. After architectural review and sorting through APIs/Frameworks the fitting technology is picked. The development starts. And then it starts. As soon as you need to do some supposedly simple supporting things, framework/API start to backfire, and instead of doing any work you end up fighting against the technology. The research time skyrockets, forums are silent, nothing seems to be done, and even when you get something to work, you're not really sure it's done right. How do you manage in these situations? Do you go for hacks, do you research further, what do you say to management?


title: Feature Driven Development in the work place?

text: **Question**   Please explain Feature Driven Development in a nutshell? **Situation**   My Business Analyst calls their documentation FDD, but it just seems overwhelmed by details. **In a Nutshell**   An 'in a nutshell' example would be good, since I'm trying to reduce unnecessary detail and confusion. I want to add clarity, and an Occam's' razor approach to the documentation. Thanks for your help, Here's what I found


title: Clustering Strings on the basis of Common Substrings

text: I have around 10000+ strings and have to identify and group all the strings which looks similar(I base the similarity on the number of common words between any two give strings). The more number of common words, more similar the strings would be. For instance:   1. How to make another layer from an existing layer   2. Unable to edit data on the network drive   3. Existing layers in the desktop   4. Assistance with network drive In this case, the strings 1 and 3 are similar with common words Existing, Layer and 2 and 4 are similar with common words Network Drive(eliminating stop word) The steps I'm following are:   1. Iterate through the data set   2. Do a row by row comparison   3. Find the common words between the strings   4. Form a cluster where number of common words is greater than or equal to 2(eliminating stop words)   5. If number of common words<2, put the string in a new cluster.   6. Assign the rows either to the existing clusters or form a new one depending upon the common words   7. Continue until all the strings are processed I am implementing the project in C#, and have got till step 3. However, I'm not sure how to proceed with the clustering. I have researched a lot about string clustering but could not find any solution that fits my problem. Your inputs would be highly appreciated.


title: Why can't I edit an SVN commit message?

text: I'm using SVN. Sometimes I miss something when I write a commit message. But once it's been committed, it cannot be reverted, and even I can't edit the message. Why they didn't put the edit function in it?


title: Learning potentially unrelated materials on company's dime, is it acceptable?

text: I am facing a similar problem as the OP of this question where my environment is good, but I feel like my learning is stagnating and I don't have the ability/resources to change positions/quit my job at this time nor am I sure I would want to if I did have the ability to. The day before yesterday, I was assigned to help fix a problem with an ASP.NET website (which I normally don't work with) that the customer was having and I needed to look up how to implement something. It only took me a couple of minutes to fix the problem and after that I ended up spending about four hours reading more about ASP.NET and implementing some of the exercises from the book. Then I spent another hour reading about networking and configuring routers which may be used when we need to change something in our lab, however, it is highly unlikely I would be the one to do it since we have a person dedicated to that task. Today I took off work just so I could learn more about configuring networks and to practice on my home network. Should I be billing the company for the time learning more about ASP.NET even though it is not a common part of my job or should I be charging like 1/2 rate? Is there a certain number of hours that you feel is acceptable to charge the company for time learning something or self-improvement?


title: Error Handling when no access to Visual Studio or application start point

text: I've recently joined a project where we are extending the functionality of an external application that our company has bought. It is an Office Add-In with an admin console that allows you to create Windows Forms style forms with code-behind files, and gives you a single place to store common code. This can be quite challenging when implementing code that would be simple in a 'normal' Windows Forms application. How do I implement global error handling so we can log all errors? We aren't using Visual Studio and have no access to csproj files so we can't use IL weaving / AOP. We don't have access to the starting point of the application so we can't subscribe to thread or application unhandled exception events. I suspect this is already being subscribed to in the external code, as unhandled exceptions are exposed in a custom error message box by default. I'm currently looking to see if we can extend the external dlls; however I don't see where I'm going to call our extended code. The alternative is to go through every method and add a try/catch block in just to log errors, which makes my skin crawl! This project has been running for a year without dealing with error handling yet so it will also take a long time to implement this approach too. Pseudo-Example class:               namespace Scriptlets     {       using System;       using System.Windows.Forms;            public partial class NewClient : FormScriptType       {         protected override void PageChanged(object sender, PageChangedEventArgs e)         {             ChangeAddressLabels();         }              ...       }     }


title: Is it possible to write an anti-virus like thing using C# or Python?

text: C# and Python can't compete with C and Assembly when writing such tools is the need. I left C many years back and I don't think I will be able to cope up so fast. Is it possible to write Anti-Virus and Intrusion-Detection tools using C# or Python? If yes, what things to learn along side and where I can find good resources on this?


title: Unified Team Dev Enviroment

text: Where I work we have a number of teams that are converting over to having a team dev environment. Basically a couple members of the team are putting together an image that is then installed on everyones computer. It includes an OS, an IDE (with source control managed from it), a couple of server systems they need for testing and a test server image. Ostensibly the imagine is being compiled based on everyones input, so everyone is, again, ostensibly, happy with the environment in question. The team leaders claim that this will be more efficient because whenever anyone has a problem everyone else on the team can help fix it (as opposed to, say, the other 2 who are still using `vim`.) But, at the same time, it seems like this approach would have a negative effect on people who don't excel at working in the majorities paradigm. So my question is this: is the trade off worthwhile? Are the "team support" gains likely to overcome the "individual efficiency" loses? Tangentially, is there a halfway point? Perhaps if everyone had the same OS and the same server image but were allowed different IDEs, that might be better?


title: What is richochet frames based hotspot jvm?

text: In order to implement JSR 292, a.k.a. invoke dynamic, something called richochet frames is introduced into the hotspot vm. I'd like to know more about it, such as invoke dynamic itself, how richochet frames implements it, where the name richochet comes from, etc. Google seems to be not very helpful here. Any pointers would be appreciated. Or better, someone please writes blogs about it :)


title: Applied Mathematics Degree For a Software Engineer (and Software Internships For Math Majors)

text: Here's the skinny: I love math. I think math is fun and exciting and that it teaches you to think analytically. I also love programming. The ability to create systems and apps that no one before me has been able to do is also a very exciting and empowering feelings. Here's the problem: I think that teaching myself higher order mathematics would be a whole lot harder than teaching myself anything that I could learn in a Computer Science program. From this I reason that I should major in Applied Math (with some Pure Math courses) and teach myself all the programming and development I care to learn. However, I plan on engineering software for a living. Here's the question(s): I believe that once I get an interview I will be prepared to blow minds, but of course the problem would be getting the interview. Will companies throw my resume in the NO pile because I don't have a Computer Science degree? Also, would I be at a disadvantage when it comes to getting an internship? I strongly believe that a good internship prior to graduation is something that all undergrads should take on and I would not be very happy if I couldn't get one myself.


title: Who first created or popularized the original XMLHTTPRequest / MSXML?

text: I'm trying to understand the origins of AJAX, and think MSXML and XMLHTTPRequest were the objects that started it all. Which came first, and/or became the defacto way to create dynamic pages?


title: Programming Language for Learning Several Programming Paradigms

text: Is there a programming language that can be used as a bridge for learning several programming paradigms? I am introduced to the Oz programming language but I think there are several more languages that could also be used in learning several paradigms and this thread can be a good survey of those. I think it is better to learn those paradigms first in order to learn several programming languages, especially if you are jumping from one paradigm to another every time you study a new language.


title: What repercussions a developer might expect after informing current employer that he is active in the job market?

text: A lot of developers, especially those that stay with the same company for many years and especially those working for large corporations with very healthy HR presence probably end up in this situation at one time or another. As the time progresses, you learn more, acquire new skills and end up with many more responsibilities, maybe even start leading development teams, and you start asking your self, how come I'm holding the same title and receiving the same pay (adjusted for inflation) that I was getting when I got hired? You ask your supervisor how much more you'd need to do to get promoted to next title level and your supervisor agrees that the time is long past. But after you are promoted, your pay increased is still "HR-capped" and you realize that you are making good 10-15k below what you think the market value is for your skills. You have two cards you can still play: 1) Look for a new job. Interview in a bunch of places and then either leave your current company, or see if they can match the pay (personally, if a company requires you to find a different job before they give you your fair value, I wouldn't stay with that company at that point) or 2) tell your current employer that your resume is posted and you are actively looking for offers. You may be happy with management, your work, people you work with, but 10k difference in salary is important and the only way to get your true market value is to put yourself on the market. So this is their chance to match your salary before you find something and leave. What are the likely repercussions of playing card #2? Is it ever advisable to openly tell your current company that you are looking to leave your current position?


title: Design For Asynchronous User Interface

text: I have been working on a integration that has posed an interesting user interface conundrum that I would like suggestions for. The user interface is displayed within a third party product. The state of the interface is supplied by calls to a service I have written. There can be small delays between the actual state changing the the user interface changing due to the polling for state by the third party. When a user interacts with the user interface, requests are sent back to my application. This then affects the state and the next state poll request will update the user interface. The problem is that the delay between pressing a button and seeing the user interface update is perhaps 1 or 2 seconds and in usability testing I can see that people are clicking again before the user interface updates, thinking that they haven't properly clicked the first time. Given the constraints (we can only update the user interface via the polling mechanism - if we updated it when they clicked, the polling might return and overwrite the change causing unpredictable / undesirable results)... what can we do to make the user experience better. My current idea is to show a message for a couple of seconds so people know their click was accepted, the message would not be affected by the state polling, so wouldn't be prematurely removed / overwritten etc. I'm sure there are other ideas out there and I'm also confident someone has a better idea that I have!


title: how should I change the representation (not mimetype) of a resource?

text: I'm looking at how I can change the representation of a payload at runtime for varied potential advantages, but I'm not sure how to do it. Specifically collections. Array of Pairs               [{ <resource_uri> : { <entity> }, ...}]      Array of Objects               [<entity>,...]      Array of Resources               [<resource_uri>]      Map of entities               { <resource_uri> : { <entity> }, ... }      My problem is, I'm not sure if I should put these different representations of the sets at different URI's, give them slightly varied mime types, e.g. `application/foomap+json` or perhaps use an optional query parameter `?format=map`, or resource `/entities/map`. The UI is going to hide this, this is for programmatic web service access only (which the "UI's JS will have to call).


title: Which interface allows you to use a design pattern that is characteristically changed with the instantiation of objects?

text: I am doing a research on this and can't find my answer to this question: > Which interface allows you to use a design pattern that is > characteristically changed with the instantiation of objects? \- in PHP I am studying for an exam on php programming and from the theoretic I can't find an exact answer. I found something related to `Creational Design Interface` and `Factory Interface`, but don't know which one.


title: Why are Python's package names not creative?

text: First, I LOVE Python, and Python is my first programming language. I'm just wondering why Python's packages got kinda ~~ugly~~ unmemorable and sometimes very long names? I find other languages (e.g. Node.js and Ruby) more creative and descriptive. I feel python package creators just try to throw the 'py' letters anywhere in the name (e.g. autopy, Boupy, IMDbPY, Pybooru, etc.). Not to mention abbreviating or even using all the words describing what the package can do (e.g. Matplotlib, virtualenvwrapper). **Is there any naming convention that had unintentionally constrained creativity?** _P.S. I by no means try to offend creators of the packages mentioned above. Nor is this question meant to be a this vs that._


title: Best way to relearn C++?

text: I've done Java for ten years, and stopped doing any C++ sometime in the mid-90's. What's the best way to quickly relearn C++? Near as I can figure, the language has changed significantly in 15 years; or, writing good 1995 C++ _isn't_ the same as writing modern good C++. RAII is one thing that keeps coming up, and I still don't quite know what it is.


title: user's requirements verification, howto?

text: My question is: How can you verify the users' requirements early in the software creation process? I show the user specifications, prototypes, demos... but still users forget to share some "insignificant details" about the process or business rules and data. Which pops up after the final test as some "really small and rare exceptions" - which are turned into change request and accumulate a lot of work. So how do you prototype (or verify) users requirements early in the project?


title: is This easy to learn Objective C in 1 month for beginner?

text: Hai Discuss about that we are all know about that Objective C iPhone application is very hard to learn quickly or in 1 month for beginner. I asked to know about that how they can train themselves within 1 month?


title: How to use Messagequeing in a distributed web application

text: I am curious for solutions to this problem: Assume we are going to build an online-store. To better scale parts of the architecture, it is broken into independend subsystems. The typical scenario would involve an application server (or something similar), where the requests from clients come in. The flow for a login would be something like this: Request comes in ->Authenticate user ->Get last products a user bought ->calculate appropriate ads ->deliver generated Page to client.  This is less efficient, because the queries of the subsystems happen in a serial/synchronous way. It would be better, to make calls in parallel. For example one could use a Node.JS server and call the subsystems asynchronously. On callback there is something like a "reduce function" called, which aggregates all data and, when all data is collected, it sends the generated page back to the client. So this system seems more efficient. Another step would include further decoupling and introduces message queues. So there is on the one side the application server, which gets the requests and serves the replys; and on the other hand, the independend components communicating over message queues. The flow would be the following: Incoming Request ->Message: "User with session key 1234567890 wants authentication" So with the session key, the user and according messages are identifyable. This message is taken by the user-service and produces the answer "User with session key 1234567890 is John Doe from New York". This message is published to all the other services in the application. So they can react and publish their results. My Problem is, how do I route the result back to the application server which has to wait an unknown amount of time? How does it know, when to collect all the results for its request? One solution could be, using an in memory database (e.g. Redis). All services could write their results into Redis, which is constantly polled by the application server while waiting for a result to deliver. But, is that the solution? Are there other solutions?


title: Why shouldn't I use the repository pattern with Entity Framework?

text: During a job interview, I was asked to explain why the repository pattern isn't a good pattern to work with ORMs like Entity Framework. Why is this the case?


title: How to maintain nearly identical internal/external programs without having separate codebase for each?

text: I have a program I'm working on that my company uses internally, but is also sent to vendors. The vendor version will be identical, except that it will be missing some features, and use an installer. I only have to remove 2 lines from an XML file, and it's good for external use. Is there some "typical" method to create a project like this without having to maintain separate codebases for each project? If it makes any difference, program is written in C#, developed using Visual Studio 2010, compiled as a dll, runs on Windows 7.


title: Can't understand example using continuations

text: I'm reading the r6rs Scheme report and am confused by the explanation of continuations (I find it to be too dense and lacking of examples for a beginner). What is this code doing and how does it evaluate to 4? Why does `call/cc` want an argument that's a function of one argument? How is `call/cc`'s argument used?               (+ 1 (call-with-current-continuation            (lambda (escape)              (+ 2 (escape 3)))))               =⇒ 4      This example is from section 1.11 - Continuations.


title: deciphering columnar transposition cipher

text: I am looking for an idea on how to decipher a columnar transposition cipher without knowing the key or the length of the key. When I take the cipher text as input to my algorithm I will guess the length of the key to be the factors of the length of the cipher text. I will take the first factor suppose the length was 20 letters so I will take 2*10 (2 rows and 10 columns). Now I want to arrange the cipher text in the columns and read it row wise to see if there is any word forming and match it with a dictionary if it is something sensible. If it matches the dictionary then it means it is in correct order or else I want to know how to make other combinations of the columns and read the string again row wise. Please suggest another approach that is more efficient.


title: How to Solve an Error?

text: I am novice developer. While development is going on, we come across different error issues. However for the novice of programming, it is always hard to directly understand them & solve them. I believe, errors are generally related to typing error OR data structure error OR run-time memory error - which is related to hardware OR else. How to elaborate and solve those errors very fast ?


title: Are writing research papers only for academics?

text: I have been noticing certain trends about writing research papers in India. They are written either by students or by academics. Do people working in day jobs (like me) in the software industry write research papers? I ask this question because, we are more likely to get interview calls from companies like Google and Facebook if the paper is worthwhile. Even if I decide to write one, how/where do I present it? Are there any places online where I can submit it and get reviewed?


title: Approach to cover all the cases in Unit Tests

text: I am new to Unit Testing and i am able to write them but my problem is I am not sure that I have covered everything in Unit Tests. What could be the approach for testing some functionality in a code?


title: Optimizing code by using registers, but what if they are not enough in number?

text: One way to optimize code is to minimize the access to arrays and use variables instead, because that way we use registers instead of loading data to cache memory. For example, if in a loop I'm going to use 3 times a data from an array, say radius[i], I'd better declare a variable tmp, and give it the value of radius[i]. Every time I need to call radius[i] I'll use tmp instead. The problem is, the number of registers is limited (to 8 in some cases, it depends on the architecture). What if I have more variables than the number of registers? Will the usage of variables in this case slow down my program more than having access to cache memory? I am coding in c language.


title: Does understanding history of a programming language help in understanding the language?

text: Sometimes, the syntax of a language seems weird, I often think, why would someone make something like that, but definitely there is a reason and a history behind every aspect of a programming language. Apart from being fascinating, It helps me remember the syntax and also the purpose that language solves. Does knowing the background of languages like HTML & CSS ( _Okay, these are not programming-languages but still_ ) JavaScript, C++, Objective C and even Java help in understanding the aspects of these languages?


title: Object schemas shared between web services

text: My question is about how to create a definition for an object that is handled by different web services. A brief description of my current scenario and why I think it's a problem: A PHP web application provides AJAX endpoints for populating various parts of my web app. The endpoint provides access to User and Project entities. A node.js application uses sockjs to deliver User and Project events in real time to my web app. Here's the problem: The schema of the JSON objects delivered by the node.js service is slightly different to the same objects provided by the PHP endpoints. This is bad because it makes much my client size code hard to re- use, and there's lots of "if it came from node, access this property; if it came from AJAX, access this other property" type logic. Ugh! The code base is too big to do a one time refactor and make sure all devs adhere to the new design. I want a way to share information between my node.js app and my php app so they both know how they should define certain objects. What is the most common way of solving this kind of problem?


title: What is a" feature envy" code and why is it considered a code smell?

text: This question on SO talks about correcting what the OP thought is _feature envy_ code. Another example where I saw this nifty phrase being quoted is in a recently given answer here in programmers.SE. Although I did drop in a comment to that answer asking for the information I thought it would of general help to programmers following Q&A to understand what is meant by the term _feature- envy_. Please feel free to edit additional tags if you think appropriate.


title: Good Procedure or Function Design

text: This is in reference to the question posted here. As I would judge it, the question there should be closed simply because it seems to ask why the Borland developers made one thing a function and another a procedure (function that returns a void result). Now the example was given there of some string manipulation functions that exist in Borland Pascal or Delphi: > >     S2 := Copy(S1,3,2); >   > > Copies into S2 from S1 the 2 characters starting from the 3rd position. >   >   >     Delete(S,3,2); >   > > Deletes from S the 2 characters starting from the 3rd position. Now I thought it might be a good discussion on what would be good design decisions regarding devising these things. I picked up a few rules of good design on what a function prototype should look like beyond the obvious (name reflects function, function result should be atomic, no extraneous variables), but are there any others that should govern a situation such as this one or others? I really didn't see a good case in Atwood's code book where it was discussed. Anyway, are there some good rules on how functions should be designed to work? Barring the specious naming, would it be better to have               S2 := Delete(S1,3,2);      as opposed to               Delete(S,3,2);      ? Are there any other useful considerations or examples to discuss of good and bad function design?


title: Is true multithreading really necessary?

text: So yeah, I'm creating a programming language. And the language allows multiple threads. But, all threads are synchronized with a global interpreter lock, which means only one thread is allowed to execute at a time. The only way to get the threads to switch off is to explicitly tell the current thread to wait, which allows another thread to execute. Parallel processing is of course possible by spawning multiple processes, but the variables and objects in one process cannot be accessed from another. However the language does have a fairly efficient IPC interface for communicating between processes. My question is: Would there ever be a reason to have multiple, unsynchronized threads within a single process (thus circumventing the GIL)? Why not just put thread.wait() statements in key positions in the program logic (presuming thread.wait() isn't a CPU hog, of course)? I understand that certain other languages that use a GIL have processor scheduling issues ( _cough_ Python), but they have all been resolved.


title: Optimal group room division algorithm with weights

text: I hope someone can help me with this, as I'm thoroughly stuck. I'm working with a group at my university, on a first semester research report that should end up as a finished program, solving the problem described below. We've been mulling over this issue for a few days now, and I promised I'd find a good place to ask for some help with the underlying algorithm. Any help received will naturally be credited in the report. I thought I could handle this as a linear assignment problem, but either I'm missing something, or (most likely) I have too many dimensions to work with it in this way. I'm not necessarily looking for a finished solution to the issue, as even hints that points me in the right direction would be very welcome. # Description of the problem   * There are group rooms, group clusters, and groups.      * A group room can hold a varying number of groups, between 1 and 12. They're placed on different wings, floors and even in different buildings, which brings a distance element into it.     * A group cluster holds a varying number of groups too. More details to follow.   * Groups need to be assigned to a group room with the following priorities that I've thought about implementing as weights:      1. Groups inside clusters should stay as close together as possible. This means that if possible, they should be in the same 'area', such as the same wing or floor.     2. For group rooms that supports more than one group; they should never contain groups from two different clusters.     3. Clusters can have bonds to other clusters, which means that the algorithm should favour them being near one another. Again, I'm thinking this has to be doable with weights.     4. If clusters need to be split up, then ideally they'd be split into as few parts as possible -and- be placed as close to the other part of the cluster (or parts), as possible.     5. Splitting up a cluster onto more than one building should incur a pretty large penalty.     6. Finally; in the event that there aren't enough group rooms for all the groups, it should incur a pretty high cost, so as to ensure that as few groups as possible are without a group room. # Need more information? Please do not hesitate to ask for clarifications, if need be. I'd love to get this solved in the best way possible.


title: adding array pointer in c

text: I am having problems understanding how this equation works in c:               char *sum(char *a, int b) {         return &a[b];     }          printf("%d", sum(5, 4));      I understand how arrays work, and I understand how to reference and de- reference a variable to a memory location, but I don't understand where the addition comes in to play here. It makes sense to me that `return &a[4]` for example would just return a de- referenced non-existent memory location and cause an error. Can someone explain this to me in easy terminology?


title: How can I gracefully handle a contractor who's trying to bypass a previous client?

text: I've been freelancing for a local game development shop. Most of the projects we worked on were brought in by an external contractor. This guy now wants to do business directly with me for some new projects which have nothing to do with games, and thus _wouldn't require the skills of my previous clients_. They heard about it though, and they are now pissed at the contractor for not going through them, but I suspect he doesn't really care and will pursue anyway. As an independent worker, should I even care ? If so can I make everyone happy ?


title: "Clean Code": How to organize named queries?

text: Few days ago I started to read Robert C. Martin "Clean Code" book and it encouraged me to look more detailed at my code. After I opened eclipse I saw this:               entityManager.createNamedQuery("CarriageRouteEntity.listCarriageDirections");      and I decided to move string `CarriageRouteEntity.listCarriageDirections` to constant string. After quick fix I created something like this:               @NamedQueries({             @NamedQuery(name = CarriageRouteEntity.LIST_CARRIAGE_DIRECTIONS, query = "just query ...") })     public class CarriageRouteEntity {         public static final String LIST_CARRIAGE_DIRECTIONS = "CarriageRouteEntity.listDirections";         // ...     }      so now I call it like this:               entityManager.createNamedQuery(CarriageRouteEntity.LIST_CARRIAGE_DIRECTIONS);      And here I started to wondering where should I put named queries constants. Is entity class good place for this? Maybe I should create new class with these constants like               public class CarriageRouteEntityNamedQuery {             public static final String LIST_CARRIAGE_DIRECTIONS = "CarriageRouteEntity.listDirections";     }      but if another programmer will try to create named query will he knew where to look at it? What are your opinions? How to organize these constants? Maybe instead of creating `CarriageRouteEntityNamedQuery` class I should create enum and add method to entity `CarriageRouteEntity` called `getNamedQuery()` which will tell another programmer in which enum he/she should look for constants?


title: Tips for planning a rewrite of a large PHP project?

text: I've decided to completely rewrite a PHP framework (Using MVC) that I've been working on, on and off, for years. My problem up until now was that I would just come up with ideas, throw them into Trac as tickets, and add them later - without worrying about the design of the framework itself. Over time this has caused some problems and I think a rewrite would be helpful, however I'm not sure where to begin with the planning of it - I know I don't want to use Trac, and I know I need more than just tickets and milestones - but what else would I need? I really want to thoroughly plan this rewrite out, I want to detail every feature I want, where it will go, and how it will connect to every other part - but I have no experience with this level of planning. Any advice? Any programs that will help? I'm getting tired of Trac, I've never really liked it. I know I'll need a design document, but is there any certain layout I should follow? I'll also need bug tracking, tickets, milestones, etc., but beyond Trac I don't know what's good for that either. I'm sure there's more I'll need but I have no idea what, so any help would be appreciated.


title: MD5 implementation notes

text: While going through RFC1321, I came across the following paragraph:                  This step uses a 64-element table T[1 ... 64] constructed from the        sine function. Let T[i] denote the i-th element of the table, which        is equal to the integer part of 4294967296 times abs(sin(i)), where i        is in radians. The elements of the table are given in the appendix.      From what I understood from paragraph, it means               T[i] = Integer_part(4294967296 times abs(sin(i)))      We know the following is true for all `x`:               0 <= sin(x) <= 1      Since `i` is an integer, `abs(sin(i))` may very well be `0` for all values of `i`. That means table will contain all zero values ( `4294967296` times `0` is `0`). In the implementation, this is not true. Why is this so?   Appendix contains just the raw values after calculation. It does not show how it is derived from the sine function.


title: STDOUT and its impurity

text: I've read a lot of books and articles about functional programming and still ashamed of not being able to understand for sure some very basic concepts. One of the main ideas of functional programming is that same input always should produce same output. Therefore, say, querying database or writing file could not be done in a pure functional style by definition. That's for example, is one of reasons we need monads. The question is - why we consider STDOUT output as something impure? Yes, any filehandler is risky - we never can be sure that data always will be written. But what about STDOUT? Why should we think of it as of something unreliable? Is it more unreliable that evaluation itself? I mean, we always can pull the trigger and thus, interrupt calculation.


title: Articles and Works by Developers

text: When I'm coming to home after the work, there left about 2-3 hours to work on my own projects. Some good programmers/developers also write books/articles/etc. I'm getting angry of to little time and interested how others can do so much - work in their main job, work on own projects and write articles/books? Do you know some formula or some technique to be able do all the mentioned?


title: Any languages use the '=>' and '=<' operators?

text: I'm just curious if there are any programming languages that use the '=>' and '=<' operators for something. I wonder why these are not commonly used when their variant '<=' and '>=' are so widely used by most languages. Is there a reason why? EDIT: I'm not asking why they aren't used for the same task as '<=', but why the operators go unused for anything.


title: common infrastructure for web apps using asp.net mvc

text: How to build a common infrastructure for my web apps using asp.net mvc, and efficiently manage it? The goal is to increase developer productivity. The common infrastructure stuff includes visual & interactive components like customizable menus, consistent web page layout, consistent navigation experience, breadcrumbs, etc. It will also have some api's for user & role management. So this platform/infrastructure will have its own database & tables (which can be deployed using entity framework). But there are other things which I don't have an answer to:   * The database will also have user defined types, stored procs, etc. How should these get "deployed" (or adopted) in the target application?   * There would be a set of controllers and views intended for user and role management. They need to be a part of the target project. What is the best way this can be included? Just to outline the kind of experience a developer should get:   1. He'd start an MVC project.   2. Run some command (suitably in the IDE itself - I am thinking powershell or NuGet)   3. And he should get working...   4. At some point later, there would have been some updates in the platform...how should they be updated...the problems he might face here...how to resolve them...etc...? How to design such a infrastructure project?


Why is the Scala Option type not called Maybe, just as in Haskell? Maybe makes a lot more "semantic sense" to me, but maybe Option has different behaviour I am not aware of. Is there any particular reason why Option in Scala was not called Maybe?


title: How do you keep track of what stage you are at in a program?

text: Like many, I'm developing a couple of applications on my own (not at the same time) to eventually sell. But I also have websites to run, college work and a social life etc., so often I can forgot what stage I am in programming, especially after holidays abroad. Are there any techniques that I can use to help me keep track of everything?


title: Where is the best place to store code on a Mac?

text: I've started toying with some Mac development and wonder where the best place to store the code is? Generally on my windows box, I'd store all my code in c:\Code\ On the Mac it's in /Users/Liam/Code/ Will this cause me any issue with permissions when running web code?


title: Do SAS coding "best practices" exist?

text: At work, we develop a lot of our applications in SAS, from start to finish. One of the problems with this approach is that SAS is a very verbose language with very few language constructs; there is limited support for variables, very limited support for basic functions, and no such thing as classes. They have a concept called "macros" which essentially text substitution; you define a macro, and on invocation, it simply drops in the content of the macro. My question is, is anyone familiar with "best coding practices" for use in developing SAS applications? Are there software design patterns for SAS? I've gone through Code Complete, and some of what he writes is applicable to SAS, but much of it is not, as the concepts don't exist in SAS. Can anyone give recommendations for writing maintainable, well-designed SAS code?


title: How do I transition to an area of development where I don't have experience?

text: I've been a Classic ASP web developer for the last 10 years and for the second time in two years I'm facing the possibility of being laid off. The biggest difference now is that the job market for someone with my limited skill set is actually worse than it was in 2008-2009. Years ago I took a diploma course in ASP.NET web development but was unable to translate that into a job; since then, I've kept up my .NET skills on my own but have never been able to break through the 'no work experience' barrier, and I haven't been given the opportunity to work with .NET at any of the jobs I've held (including my current position, where they broke the promise they made at my hiring to send me out for training). So, I'm wondering if it's even possible to self-teach and turn that knowledge into a paying position? Is the 'no work experience' catch-22 worse with Microsoft technologies than it is for others, or is it basically the same for all programming languages? I had considered joining open-source projects or doing volunteer work as a way to bootstrap myself in a new language, but the project listings I read all wanted experience with references. Is there any way to reboot my career at this point? **Edit:** I'm curious about the job market for open-source languages vs. MS languages. Is it easier to get a job as, say, a self-taught Ruby programmer than a self-taught C# programmer? The last time I scanned through Craigslist it seemed like all of the grassroots/startup opportunities were all PHP, Ruby, etc.


title: Whats the difference between an interpreted language and one compiled to a VM?

text: It occurs to me that there's not a heck of a lot of difference between `$>python module.py` And: `$>javac module.java`   `$>java module.class` The former compiles to an intermediate language (python bytecode) and executes the program. The latter breaks the steps up, first compiling to the intermediate language (jvm bytecode) and then executing on another line. In fact I can rewrite the python to break out the two steps, as in this SO question. It seems people make a big deal about the stark difference between compiled and interpreted languages. It seems the lines are entirely blured. Other popular interpreted languages havi similar features. Php "compiles" to its own opcodes which can be cached or stored for later use. Perl also is compiled to something. So... is there really any difference between these popular interpreted languages and popular compiled languages that compile to VMs? Perhaps in one case the VMs are typically more memory resident whereas with the "interpreted" languages they typically have their runtimes spun up? Yet this seems like it could be easily changed. Yet there still seems to be something of a difference. If they are more-or- less the same, then why is it that the performance of Java/C# seems to approach C++ while the "interpreted" languages are still an order of magnitude off? If its all truly bytecodes running in a VM, and all really the same, why the big difference in performance?


title: Is there an API I can use to get access to map data?

text: A customer would like me to build them an intranet web site with mapping information. For example, maps such as the ones on Google Maps. I looked at the Google Maps API, but their "free use" license agreement specifically prohibits use on intranets or web sites that charge a fee to obtain a username/password. [Source: https://developers.google.com/maps/terms#section_9_1_1 ] The other solution is to use Google's Enterprise/Business licensing for their map API, but the lowest base cost for that group of licenses starts at $10,000US **per year** , and the price goes up quickly from there! My question:   * Is there another similar programming API/service (HTTP, Javascript, JSON, ...?) to a different mapping company that works better for small single-person web developers without having to commit $10K/year per web site for a license?


title: Emacs and "self-reinforcing performance"

text: In short, my question for you hardcore Emacs users is this: have you achieved this "self-reinforcing performance" Steve Yegge talks about? > Emacs is self-hosting: writing things in it makes the environment itself > more powerful. It's a feedback loop: a recursive, self-reinforcing, > multiplicative effect that happens because you're enhancing the environment > you're using to create enhancements. Do you **really feel** that enhancing your Emacs eventually made you **10X times more productive** , and your productivity continues increasing exponentially, and so on and so forth?   Do you have some examples / experience to share? As for me, I was using both Emacs and Vim for development (currently stick with Vim), my `.emacs` and `.vimrc` are both quite configured to suite my needs and I appreciate power of both of these editors. But I didn't experience this Emacs' "self-reinforcing loop", neither met someone who did (of course, this could be because I'm not truly hardcore Emacser, and haven't met that many Emacsers yet). For example, at Facebook, the guy next to me was using Vim, and the guy next to him was using Emacs. Both of them were quick and productive as hell, and I attribute this not to the editor they were using, but to their own intelligence and attitude. But anyway, I'd be glad to see astounding examples from Emacs proponents that would turn me back to the Church of Emacs.


title: "Best fit" to avoid reuse of object instances in a collection

text: Imagine I have a collection of object instances which represent activities for a user to undertake. Dependent on user attributes, I have to randomly select instances to present activities to the user. For some users, I need to present more activities to them than there are available activities in which case, I want to use the following algorithm. If all available activities have already been presented to the user, then re- select a "used" activity, selecting the earliest presented activity ordered by frequency of use. In other words, try to reduce repetition and where repetition is unavoidable, use the instances which have been repeated less often and were presented furthest back in time. Before I go on to code that algorithm, I wondered if there is some existing pattern I can re-use? [EDIT] "Furthest back in time" is not relevant as I will pass the algorithm an ordered collection of used instances where the first entry is the first presented.


title: Can someone explain the V Model process? Why is it different than the Waterfall model?

text: It seems the V Model is just the Waterfall Model with the bottom half of the Waterfall bent upwards to form a V. I don't see how it adds anything new. From the diagrams, I also don't understand the flow. There are arrows pointing in all directions and I can't understand what comes first. Do we follow the V from the upper left, down to the bottom center then back up to the upper right? Or do we progress down the V doing everything higher before the item lower? The internet is lacking a sufficient explanation of this model. It would be awesome if someone can explain it in true StackExchange form :) ![V Model](http://i.stack.imgur.com/N9Hm4.jpg)


title: What technical details should be included in a presentation of software project to senior management?

text: We have created a web application. We need to demo this application to our senior management. They don't understand the technology. We are creating a power point presentation for this. How much technical details should we include in the presentation? What should be those details (for example, what the front end is used, which db is used, etc.)?


title: How do you write scalable Java?

text: I like to think I write good maintainable Java code, using best practices, design patterns and try and get good test coverage with unit tests. Recently whilst looking for a job, I came across a couple of job adverts that have references to "scalable" code. So, my question is, what is considered to be "scalable" code?


title: What makes an application scalable?

text: I keep seeing in job postings that the applicant must have experience writing "scalable" applications. What makes an application scalable, and how do I know that my code can scale to millions of users? * * * I guess a better way of phrasing this question is: How can I write my code with scalability in mind? So that the code is scalable from the get-go as opposed to an afterthought. Are there certain design methodologies? Or is it simply a matter of picking the correct algorithms for the job?


title: Quickly compute added and removed lines

text: I'm trying to compare two text files. I want to compute how many lines were added and removed. Basically what `git diff --stat` is doing. Bonus points for not having to store the entire file contents in memory. The approach I'm currently having in mind is:   1. read each line of the old file   2. compute a hash (probably MD5 or SHA-1) for each line   3. store the hashes in a set   4. do the same for each line in the new file   5. every hash from the old file set that's missing in the new file set was removed   6. every hash from the new file set that's missing in the old file set was added I'll probably want to exclude empty and all white space lines. There is a small issue with duplicated lines. This can either be solved by additionally storing how often a hash appears or comparing the number of lines in the old and new file and adjust either the added or removed lines so that the numbers add up. Do you see room for improvements or a better approach? **Edit** I'm currently using Java and the SVNKit library.


title: Are these SQL concepts for beginners, intermediate, or advanced developers?

text: I've been learning SQL recently and practicing with MySQL/Postgres and soon Oracle DB. I've also search the web for a 'road map' study of databases but couldn't find one, unfortunately. I want to understand where and why particular database concepts fall on the scale from beginner to intermediate and advanced. I'm thinking about relational databases for the most part. Please explain how to lay out skills listed below in a progression of Beginner -> Intermediate -> Advanced for what level of developer should know them:   * Where clauses   * Update syntax   * Joins   * Alter and Create statements   * Temp tables   * Cursors   * Indexes   * Foreign keys   * Constraints   * Transactions   * Subqueries   * Pivots   * Aggregate functions   * Profiling   * OLAP and OLTP   * Triggers   * Execution plans   * Execution hints   * Performance counters   * Normalization


title: Algorithm in undirected BFS graph

text: I'm trying to put together an algorithm that will display the node degree for every node in a breadth first tree graph (assume BFS was called). Assume it's an undirected graph. I'm not sure how to get the node degree of a node when going through the graph. I was thinking about adding up every occurrence of the node in every list, then adding up all the occurrences within that node's list (all of them since it's undirected), but I'm not sure not how to implement. Just answer with pseudocode. I just need the algorithm, then I'll implement later in a language.               BFS-get-all-degrees         occurr[v] = 0         for each v in G.v             for each u in adj[v] //loop through each adjacency list                 if v==u                     occurr[v]++             print occurr[v]++      I think that's on the right track. It's definitely not right, but not sure where to go from there. EDIT: I came up with some better code. I think it runs in O(V+E) but not sure.               BFS_Node_Degree         for each vertex v in V             count = 0             for each vertex u in adj[v]                 count++             print "the node ",v," has degree ", count


title: Stuff every programmer needs while working

text: I've been tasked with creating a fun and relaxing environment, one thing I know that I want is ergonomic mice and keyboards, others have suggested exercise balls and bands. What is it that every programmer needs while working? What might not be necessary but would be nice to have anyway? Note: this question was asked previously, but has been recommended to be posted here. See this link for the previous responses: http://stackoverflow.com/questions/3911911/stuff-every-programmer-needs-while- working-closed


title: Checking negative of a condition

text: What is the (slightly pejorative) term for checking the negative of a condition (rather than the positive which is often more readable): e.g.               if(!someVar) {       return null;     } else {       return doSomethingInteresting();     }      instead of doing this (which is arguably more readable)               if(someVar) {       return doSomethingInteresting();     } else {       return null;     }      I vaguely remember there being a term for this; something in the same spirit as the term Yoda conditions.


title: Changelog Management

text: I'm currently developing a WinForm application. In order to inform the client about the improvements and corrections made during the last version, I would like to manage and display a changelog. I mostly found existing changelog on website (the term `changelog` is pretty used) or explanation on how to manage the release numbers, which I don't care. So, these are my questions:   1. How do I manage a changelog (using XML, pure text in the app, etc.) in a desktop application?   2. How do I present it to the user (external website, inside the winform application)?


title: CMS and Databases vs. DIY

text: I have been programming for many years now, primarily in PHP and the like and would consider myself an intermediate programmer. Some of my online projects have now gone global and very widely used, i am now in deep thought about scalability etc. All of my systems so far are written in PHP, no known database structure such as MySQL etc. Instead our databases use an 'operating system style' method of storing information, files and folders if you will. We also do not use any outside/third-party software or CMS, so far this has work out extremely well. Most people, when they hear about the way we do things, criticize and say that is an idiotic idea but normally after seeing our systems in more dept are converted to our way of doing things. Is it really that bad to not use a standard databasing systems and only using the one (slightly heavier than others) language of PHP? How well on the face of it will this kind of setup scale? N.B. Our systems include things such as account and user management, documentation development and task/project managing.


title: Why does Haskell have built-in "if/then/else" instead of defining it as a simple library function?

text: Why does Haskell have a built-in `if/then/else`, which is dependent on the `Bool` type, instead of having a simple library function? Such as               if :: Bool -> a -> a -> a     if True  x _ = x     if False _ y = y


title: Should methods that return boolean be named after a question or an assertion?

text: Many naming conventions recommend that methods returning a boolean (also called _predicate methods_ ) should be named after **a question**. My question is: don't they really mean the methods should be named after **an assertion**? The difference may be subtle, but you end up with different names in some cases:   * _question_ : is_pixel_transparent(...)   * _assertion_ : pixel_is_transparent(...) Sometimes, this makes no difference and the phrasing is the same:   * _question_ : end_of_file(...)    * _assertion_ : end_of_file(...) Besides, it seems like most of the time, what people call "questions" are actually _assertions_.   * key_exists(...) --> this is not a question, this is an assertion.    Example usage: if (key_exists(...)) ...   * array_contains_element(...) --> this is not a question, this is an assertion.    Example usage: if (array_contains_element(...)) ... So, to restate the question, is everyone meaning _assertion_ when they say _question_?


title: Development Patterns for dealing with Data Import / Export

text: I have a ASP.NET web based application that allows the end user to export data to a flat file format. (essentially taking a point-in-time backup of their work) At a later date they can re-upload (import) that data back into the web application. The actual format of the backup is pretty trivial. An object graph is serialized using the WCF DataContractSerializer to xml, and then the resultant xml document is compressed. Importing, unzips it and deserializes the data. There's one small problem I see with this approach. versioning... as time moves on and the data structures change (properties / child-collections are added/removed or renamed) then previously exported versions of a users data will no longer map to the object graph in the application. Are there any specifici patterns or practices that address this issue? or any other reading material you could recommend.


title: Structuring database for multi-object "activity" and "following" functionalities

text: I am working on a web application which operate with different types of objects such as user, profiles, pages etc. All objects have unique `object_id`. When objects interact it may produce "activity", such as user posting on the page or profile. Activity may be related to multiple objects through their `object_id`. Users may also follow "objects" and they need to be able to see stream of relevant activity. **Could you provide me with some data structure suggestions which would be efficient and scalable? My goal is to show activity limited to the objects which user is following** I am not limited by relational databases. ## Update As I'm getting advices on ORM and how index things, I'd like to again, stress my question. According to my current design model the database structure looks like this: ![enter image description here](http://i.stack.imgur.com/kumN8.png) As you can see - it's quite easy to implement database like that. Activity and Follower tables do contain much larger amount of records than the upper level but it's tolerable. But when it comes for me to create a "timeline" table, it becomes a nightmare. For every user I need to reference all the object activities which he follows. In terms of records it easily gets out of control. Please suggest me how to change this structure to avoid timeline creation and also be abel to quickly retrieve activity for any given user. Thanks.


title: Two or one git repo for Android app + web service backend?

text: I'm wondering what the best practice is for my git repository structure where I have an Android application + a web service backend. In general, I'd like to release these two independently (e.g., perf fixes to the backend with no changes to the front-end), but I am worried that if I keep these in two separate repos I'll lose the ability to see combined app + web service changes (e.g., there's a change in the APIs on the server). What are other Android developers doing to manage their source code + release process? Should I use one git repo with separate folders or two git repos? I should note that I'd like to set this up as push-to-deploy -- any changes to my master branch will trigger a tag and deploy.


title: Whose responsibility is a bug fix patch?

text: A situation that has arisen several times in open source projects goes like this:   1. I notice a bug in our deployment, and figure out a quick hack patch. (For example, simply commenting out code that we don't actually need.)   2. I spend a little bit of extra effort to figure out the real bug, come up with a patch, and submit it via a Git pull request, or similar.   3. My pull request is rejected. Perhaps the patch was imperfect (eg, included lines it shouldn't have), perhaps it violated coding style, perhaps it had other ramifications. Or maybe I did something wrong in Git - the pull request should have been rebased or something. A maintainer provides feedback about how to improve the patch, and requests that I resubmit it. At this point I'm confused about how far I should proceed. As far as I'm concerned, I don't have a problem: I fixed it back in step 1. I've reported the issue, I've even taken steps to fix it for others. But I don't feel that it's "my" pull request, so I don't feel that responsibility for improving the patch should come to me. One particular situation that irks me is after discussion about the failings of my patch, we reach agreement on a mailing list about what the correct patch would be (ie, how it should behave, sometimes including every line of code spelt out). Then, it is still presumed to be my responsibility to actually generate and submit the patch. Is there a standard etiquette in these situations? How are they resolved? Is my reaction unusual? How far are you expected to go to get your bug fix accepted? (Note when I say "open source project", some of these are very small, but may not be hobbies - simply small software projects which are of use to several organisations, who commit developer resources to working on them. In case the obvious answer is "fix the patch and resubmit", understand that I have responsibilities to my employer to work on stuff that is of benefit to them. Spending time fixing a bug that doesn't affect us would be wrong...)


title: How concerned should a new programmer be with the various licenses (GPL, Apache, etc)

text: I'm pretty new to programming, and I've just started using GitHub to store and hold my source code (I keep losing stuff stored locally). As it stands all that's in there right now are source code files, nothing more, but I expect that to change as time goes on and I get better at this. Given that all the repositories in the free accounts are public, how much do I need to worry about licensing? Would I be fine with just downloading a copy of the GPL, placing a copyright notice in the Readme and calling it a day? I'm fully aware that people can download and modify my stuff, and I'm OK with that, but I at least want to ensure that I get credit for my work should they decide to do so.


title: Improving the speed of writing code in C#

text: Laugh if you want, but I used to develop substantial line-of-business applications in VB6, long before the .NET framework came along. Why, when I was your age, we used to walk two miles in the snow, uphill. Both ways... Love it or hate it, VB6 had a REPL-like feel, and a very rapid development cycle. I would like to know how to come closer to that process in C#. In VB6, I could write a function, execute it, debug it and have it fully functional in a few minutes. I am told this is how the Lisp crowd works. It's a very rapid- fire style of programming. In C# I write a function, then I write a unit test for that function (which is OK, I understand the value of that), then I right-click, run test, wait for the project to compile (takes about 10 seconds right now, which would be an eternity for a REPL loop), and get an exception. Honestly, this feels more like my junior college days, when I used to feed punch cards into a hopper and wait for a printout (exaggerating only slightly for effect). Additionally, my tendency nowadays is to make everything `public` while I'm testing it. Unit testing with private accessors works fine, but you can't trace through the code (unless, of course, I'm doing something wrong) while you're using them. So what I'd like to know is, what adjustments have you made to your development process in C# to streamline it, and make it possible to write and verify your code very rapidly?


title: Web development for people who mainly do client side

text: Okay, I'm sure there are a lot of us that has plenty of experience developing c++/opengl/objective C on the iPhone, java development on android, python games, etc (any client side stuff) while having little to no experience on web-based development. So what skillset should one learn in order to be able to work on web projects, say, to make a facebook clone (I kid), or maybe a startup that specializes on connecting random fashionistas with pics etc. I actualy do have some experience with C#/VB.net back-end development a while back, but as part of a team, I had a lot of support from the senior devs. Is C# considered a decent web development language?


title: Coding convention question about AS3 duplicate variable definition

text: AS3's got some awkward rules about variable scope, due to its use of hoisting. I don't like pointlessly leaving a bunch of compiler warnings lying around, but it's more important to me for my code to readable and properly written, regardless. This produces a couple of duplicate variable definition warnings:                   private function arrangeElementsLine(pElementSize:Dimensions):void         {             if (m_eOrientation == HORIZONTAL)             {                 for (var i:uint = 0; i < target.numElements; i++)                 {                     var layoutElement:ILayoutElement = target.getElementAt(i);                     layoutElement.setLayoutBoundsSize(pElementSize.x, pElementSize.y);                     layoutElement.setLayoutBoundsPosition(pElementSize.x * i, 0);                 }             }             else             {                 for (var i:uint = 0; i < target.numElements; i++)                 {                     var layoutElement:ILayoutElement = target.getElementAt(i);                     layoutElement.setLayoutBoundsSize(pElementSize.x, pElementSize.y);                     layoutElement.setLayoutBoundsPosition(0, pElementSize.y * i);                 }             }         }      Is it generally considered to be better and more conventional to remove the redundant `var` and `:<type>` syntax for i and layoutElement in the second for loop, or is it more proper to just leave them in there (due to the way their usage is isolated to those two for loops)? Thanks!


title: Java UDP Multithread Server

text: I have multiple threads. Each thread receives data and sends to client an acknowledge packet. Each thread takes aprox. 531ms from start to finish. While capturing packets with wireshark. I was expecting to see a lesser than 1 sec interval between receiving packet and sending packet. The problem is that I see packets from other communications between other devices that are communicating with the same socket but with a different virtual socket number. Because of this in-between communications the interval between receive and sending packet is aprox 15 seconds. ![enter image description here](http://i.stack.imgur.com/SfqCj.png) [16:44:18]No.1073 - when device connects to server on port 7300 and sends data [16:44:27]No.7535 - when acknowledge is sent to device elapsed time = 9 seconds. In those 9 seconds I see in wireshark other communications with other devices. I have timed the thread code that reads and sends ack and it takes less that one second. Why does it take 9 seconds and not only the time of thread code(milliseconds)? The other threads have impact in this time?


title: Extension method naming convention

text: We are using some utility methods in our company to simplify programming. So we have following string extension:               public static bool IsNoE(this string s)     {         return string.IsNullOrEmpty(s);     }      This is just for convenience and the intention of this question is not to discuss the sense or senseless of such methods (maintaining, ...) The question is about the naming. Some people think the method should be named in this way:               public static bool IsNullOrEmpty(this string s)     {         return string.IsNullOrEmpty(s);     }      The argument for the first naming is:   * It would not make sense to make extensions if they are not shorter to write. The argument for the second naming is:   * The only reason to add such extensions is just to support programming flow. (Writing a variable and then set the cursor back to the start to surround the variable with `string.IsNull`) So why should I prefer one version over the other? Are there any naming conventions we can refer to?


title: Android Design - Service vs Thread for Networking

text: I am writing an Android app, finally (yay me) and for this app I need persistant, but user closeable, network sockets (yes, more than one). I decided to try my hand at writing my own version of an IRC Client. My design issue however, is I'm not sure how to run the Socket connectivity itself. If I put the sockets at the Activity level, they keeps getting closed shortly after the Activity becomes non-visible (also a problem that needs solving...but I think i figured that one out)...but if I run a "connectivity service", I need to find out if I can have multiple instances of it running (the service, that is...one per server/socket). Either that or a I need a way to Thread the sockets themselves and have multiple threads running that I can still communicate with directly (ID system of some sort). Thus the question: Is it a 'better', or at least more "proper" design pattern, to put the Socket and networking in a service, and have the Activities consume said service...or should I tie the sockets directly to some Threaded Process owned by the UI Activity and not bother with the service implementation at all? I do know better than to put the networking directly on the UI thread, but that's as far as I've managed to get.


title: Law of Demeter in MVC regarding Controller-View communication

text: The scenario: Having a Controller that controls a view composed of complex subviews. Each one of those subviews is a separated class in a separate file. For example, one of those subviews is called ButtonsView, and has a bunch of buttons. The Controller has to access those buttons. Would accessing those buttons like this:               controllerMainView.buttonsView.firstButton.state();      be a violation of the LOD? On one hand, it could be yes because the controller is accessing the inner hierarchy of the view. On the other, a Controller should be aware of what happens inside the view and how is composed. Any thoughts?


title: When is it ever ok to write your own development tools? (editor into IDE)

text: So I'm foremost using a text editor for coding. It's a very bare bones editor; provides mostly just syntax highlighting. But on rare occasions I also need to debug something. And that's when I have to resort to an IDE (mostly Netbeans, but got fiddly Eclipse/Aptana working as second fallback). For general use however IDEs _feel_ not workable to me. It's a visual thing, being used to console UIs etc. And switching back and forth between a text editor and an IDE is slightly cumbersome too. That's why I'm considering extending the editor, not really into a full-fledged IDE - but at the very least integrate a debug feature. Since I'm working on PHP, it seems not that much effort. The DBGp allows to externalize a debug handler from the editor, so it's just minor integration work and figuring out how to shoehorn a breakpoint feature into the editor (`joe` btw).   And while I've also got time to do that, I'm wondering if this is really worthwhile.   * In this case it's not a needed development tool. It's just for convenience.   * And the cause for doing it is basically just _not liking_ the existing solution.   * While over time I might extend and adapt this debugger thing, it initially will be as circumstantial as Eclipse. It inevitably starts out as poor development tool.   * Furthermore there is likely not much reuse. (Okay, this is not an important point. Most such software exists sans much of a use case. And also obviously, similar extensions already exist for emacs and vim, so it cannot be completely pointless.) But what's a general guideline on attempting to conoct custom development tools, particularily if they are not really needed but satisfy personal preferences? (Usability enhancement not certain.)


title: Why bother differentiating between functional and nonfunctional requirements?

text: I understand the difference between the two, but I get questioned by my colleagues of the benefit of labeling requirements as functional or nonfunctional (or transitional). Why bother to do so? He spent what he said was two days going through a list of requirements for one project, and saw no benefit to it, because the end result was to submit the document to another business entity with the edict, "Do it all." What I fear is requirements lumped together in one document. I tried to explain the benefit in practical terms, but couldn't sell it. How do I sell the benefit of documenting which requirements are functional and which are nonfunctional.


title: Best/ most efficient way to learn a programming language as a beginner

text: I am a student and have obtained a one year placement at a business that develops an e-commerce system using C#, HTML, WPF, javascript, ASP and more. Although I do have a little bit of knowledge, I find myself being assigned a lot of tasks that are beyond me and even when I ask for help, the response I get is often cryptic to me. I stare at as much code as possible to just try and _"throw myself into it"_ but I often just get lost in the code I like to consider myself a fast learner and I am damn determined to be a good programmer. I would just like to ask if there are some tips for me to catch up as quick as possible? I don't want to be a nuisance and sit here and ask for help 24/7. I just want to crack on!


title: Calculating last Sprint's Focus Factor

text: We have finished our Sprint in half the expected time and now we want to compute our focus factor to use in the next Sprint. Though, by doing the math by the book, we get an awful number. How are we calculating it wrong? Please take a look bellow:   * Team composition: 3    * Sprint length: 2 weeks   * Team availability: 28 days (discounting team members shared with other teams)   * Estimated focus factor: 70%   * Estimated velocity: 19 ideal days (derived from: 28 days * 0.7 focus factor)   * Actual velocity: 9.8 days (we finished the whole Sprint in half the expected time, clearly overestimated) which gives us a focus factor of...   * Actual focus factor (to be used in the next Sprint): 35% (9.8 actual velocity / 28 available man-days) Acording to Scrum And Xp From The Trenches we calculate Focus Factor as "(actual velocity) / (available man-days)". Though, by finishing the Sprint in half time and doing the math, we get a focus factor of 35%! What are we doing wrong?


title: Test Doubles, Mocks and Stubs - when not to use & why, for Ruby, Rspec

text: I've learned about mocking and stubbing and I've seen how they can help me create great test suites that run blindingly fast and thus speed up my development process hugely. However I've also seen the downside when there is an issue that is database centred and wasn't tested for (test doubles or not). So should I have a subset of tests that do test such connectivity at least and some simple operations, for example creating a record in the primary transaction detail table, even if most of the foreign keys are stubbed out? What experience have people found with this issue and what balance has worked in various situations? I normally post on Stack Overflow but this seemed much more conceptual. It might still be a bit subjective so maybe the question can be improved. The closest similar question I could find was When should I use mock objects? but it didn't feel like it was really the same question and the answers felt further off. Perhaps my question is more about when NOT to mock. ...yeah, so I've updated my title. I also found this helpful: TDD: Mocking out tightly coupled objects


title: WCF an Entity Framework connection

text: I have a 100+ users on a Silverlight application that uses WCF and entity framework. Everyone has their own database and here comes my problem. How do I make sure that only the user gets access to his database via WCF. Do I have to send the connectionstring every time I make a call to the service, or?


title: Difference between incremental and iterative approach

text: The Incremental approach is a method of software development where the model is designed, implemented and tested incrementally (a little more is added each time) until the product is finished. It involves both development and maintenance. The product is defined as finished when it satisfies all of its requirements The Iterative Design is a design methodology based on a cyclic process of prototyping, testing, analyzing, and refining a product or process. Based on the results of testing the most recent iteration of a design, changes and refinements are made. This process is intended to ultimately improve the quality and functionality of a design. In iterative design, interaction with the designed system is used as a form of research for informing and evolving a project, as successive versions, or iterations of a design are implemented. It seems both methods are about creating a part of the system , refining it to pass all the test cases , adding another component of the system and refining it again , these gets repeated untill the system is finished. What is the actual difference between these two ways of designing software How is it possible to combine these two methods to form iterative and incremental design approach


title: Size of objects during Multilevel inheritance

text: Below is a pseudo declaration for a multilevel inheritance.               Base class ( protected int data)          derived1 : virtual public base ( protected int data1 )          derived2 : virtual public base ( protected int data2)          derived3 : derived1,derived2 ( private int data3 )          Main(){ base b;    derived1 d1;   derived2 d2;   derived3 d3; }              sizeof(b) // 4 which is correct as only int (4bytes)         sizeof(d1) // 12 why not 8 -> 4(base) + 4(derived)         sizeof(d2) // ??? whatever applies above should apply here         sizeof(d3) // 24 why not 12 -> 4(base) + 4(derived1/derived2) + 4(d3).      Does size also include virtual tables also. Again here there cannot be virtual table as no virtual function defined. Please help in clarifying my doubt. PS: What I have understood till now: > Unless the function is declared virtual in base class, >   >   >     base *bptr; >      derived d; >      bptr = &d; >      bptr->fun();  // will call the base class function. >   > > But if the fun() is declared virtual then the above code will call derived > class fun().


title: <!-- open --> Why do so many developers do this in their HTML? <!-- /close -->

text:
                       <form action="thankyou.php" method="POST">                   </form>

                   I can almost understand the `<!-- /wrapper -->` at the end, because it's so far from the start of the tag/pair... but seriously, what's the point of the opening comment lines? I wouldn't ask the question if I didn't see this _all the time_. I feel as if I'm missing something. Maybe there's some unwritten best-practice involved, though I fail to comprehend what it could possibly be. More than likely it's just obsessive-compulsive behavior. How do you guys normally comment your markup, if at all?


title: I need help deciding between silverlight/silverlight out-of-browser/wpf

text: I'm in the initial planning phase of a re-write project and I'm deciding between silverlight/silverlight oob/wpf. TL;DR at the end. It's a LOB app that handles leads/customers/appointment calendars. Not too complicated. I'm independently researching these options elsewhere, but I thought I'd ask around. Some rough initial requirements/foreseeable problems are: I have to be able to call an exe on the system with commandline args (sip phone). > Makes SL a problem The userbase is distributed and I want to limit the traffic that goes over the wire as much as possible and avoid some nasty concurrency issues > I can see this being a problem using WPF Software deployment/updating has to be _dead simple_. Some users are highly non-technical (see: 70 years old, on a computer for the first time) > This isn't a huge problem now with the ClickOnce app we are replacing, and I > have control over the machines that it gets used on. However, it's simpler > for users if they don't even have to click the clickonce "Install" button. I > don't know how this is handled with Silverlight OOB. The company is planning a hard expansion in 12 months so hardware deployment should be fast/easy. The idea is to get an internet connection at a new location, plug in some computers and be able to work without the need for dedicated IT people or server setup. > Makes SL appealing Integration with other services (financial software, asterix server) isn't an immediate goal, but it is an eventual goal to be part of the system. This is made much simpler/more efficient if a single service is setup to integrate with those secondary services and doesn't have to transfer all of that data over the wire > Makes SL appealing Making multiple 'versions' is out the window. I don't know what it's like maintaining a silverlight + silverlight oob version (if there's even any problems) > Might make WPF a better option. TL;DR: From my vantage point, a silverlight app makes the best sense for 90% of the users - the other 10% can't use it because they need to run an exe. Silverlight OOB might be a happy middleground but I don't know at the moment what the execution model for it is like (is there still a concept of server- side code? If so, that would possibly be ideal) and I don't know how deployment/updating works for it.


title: PHP high traffic default page

text: I have a php website that will be experiencing high levels of traffic in a few weeks. We scaled the servers to accept the traffic, but want some sort of fallback page in the event that something happens. Does anyone know of an easy way to implement this? My initial thought is to check for the headers when the page is requested, but don't quite understand if that will even matter. Does the user even receive the initial http headers, if they get a `504 Gateway Timeout` error? Would something like checking the result of: `var_dump(http_response_code());` in a conditional even reach the client?


title: Graph theory problem (name unknown)

text: I am trying to solve the following kind of problem. I do not know if there is already a name for this, or a solution; however, I'm willing to bet there is. I was hoping someone could point me in the direction of implementing a solution for it, or at least tell me the name of the problem? Suppose a traveler has a certain amount of Gold coins, and some Bronze coins. He must start a city A, and go to city B, then city C, and finally city D. There are two (or more) roads that pass from A to B, labeled AB1, and AB2 (etc.). Road AB1 has a toll of 5 gold coins, and AB2 has a toll of 5 bronze coins. Roads from city B to C: BC1 has a toll of 10 coins, which can be either currency. BC2 requires 8 gold coins. Roads from C to D have some sort of similar setup. Assuming that we know how much money the traveler has, and that there is no possible exchange between bronze and gold coins: is there a method to determine if the traveler has enough money to pass through from A to B, to C, and finally to D? This is the kind of problem I need a solution to... Is there a name for this problem? Is there a solution to this problem (other than brute force)? I'm assuming this is a similar problem to flow problems, but I don't know quite how to approach it.


title: How can I be certain that my code is flawless?

text: I have just completed an exercise from my textbook which wanted me to write a program to check if a number is prime or not. I have tested it and seems to work fine, but how can I be certain that it will work for every prime number?               public boolean isPrime(int n)         {            int divisor = 2;            int limit = n-1 ;                       if (n == 2)                 {                                       return true;                 }                 else                 {                     int mod = 0;                     while (divisor <= limit)                     {                           mod = n % divisor;                           if (mod == 0)                           {                               return false;                           }                         divisor++;                     }                          if (mod > 0)                     {                         return true;                     }                 }                return false;     }      Note that this question is not a duplicate of Theoretically Bug Free Programs because that question asks about _whether_ one can write bug free programs in the face of the the limitative results such as Turing's proof of the incomputability of halting, Rice's theorem and Godel's incompleteness theorems. This question asks _how_ a program can be shown to be bug free.


title: How to recognize people with potential to become a coder

text: I work in finance and we have the habit to hire young people out of college, most of them with little-to-non coding experience. We are not looking for future quants, just business analysts with an analytical bias. Its happens that we have lots of spreadsheets with quite some VBA + some SQL. So if you want to be really good at your job you have to eventually learn to like to code. It is true that everyone can learn how to code. And it is true that in some circumstances people with potential can end up 'blocked' for whatever reason. Still, it's just my experience that some people seem to naturally get into stuff, while others not. And contrary to the general idea, its not that simple that if someone loves math, it should love to code. I worked with more then one quite smart quant that I just could feel coding was not the part they enjoyed. In my view some people just feel that attraction to 'build stuff' and very soon they are coming with their own ideas on what they want to build, others will end up always somewhat afraid of all those line of code in the back of the files they are using. I don't relate it people's overall professional qualities, its just the computer code part that scares them. Am I alone in this view? Does anyone has some ideas on how to identify people 'with the virus' when it is still in its latency stage?


title: Is this a good idea to use humour during a job interview?

text: I wonder if it's a good idea to be slightly funny during a job interview. I don't mean to try to tell a joke, but just to insert a humourous thought, related to the question or the theme we talk about. I often use humour when I feel that there is too much stress or when people are not "connected" and the ambiance is frozen. I don't know if I can use this trick to have the thing going smoothly. Is this something to avoid at all cost ? _PS / This is more a question asked to "heavy-duty" interviewers than to job seekers._


title: Why do .Net books talk about stack vs heap memory allocation?

text: It seems like every .net book talks about value types vs reference types and makes it a point to (often incorrectly) state where each type is stored - the heap or the stack. Usually it's in the first few chapters and presented as some all-important fact. I think it's even covered on certification exams. Why does stack vs heap even matter to (beginner) .Net developers? You allocate stuff and it just works, right?


title: Writing a lexer in C++

text: What are good resources on how to write a lexer in C++ (books, tutorials, documents), what are some good techniques and practices? I have looked on the internet and everyone says to use a lexer generator like lex. I don't want to do that, I want to write a lexer by hand.