Programming logic to group a users activities like Facebook

So I am trying to develop an activity feed for my site. Basically If I `UNION` a bunch of activities into a feed I would end up with something like the following. > **Chris** is now friends with **Mark** > > **Chris** is now friends with **Dave** What I want though is a neater way of grouping these similar posts so the feed doesn't give information overload... E.g. > **Chris** is now friends with **Mark** , **Dave** and **4 Others** Any ideas on how I can approach this logically? I am using Classic ASP on SQL server. Here is the `UNION` statement I have so far:               SELECT          U.UserID As UserID, L.UN As UN,Left(U.UID,13) As ProfilePic,U.Fname          + ' '          + U.Sname As FullName, 'said '          + WP.Post AS Activity, WP.Ctime     FROM         Users AS U LEFT JOIN Logins L ON L.userID = U.UserID      LEFT OUTER JOIN          WallPosts AS WP ON WP.userID = U.userID WHERE WP.Ctime IS NOT NULL     UNION SELECT         U.UserID As UserID, L.UN As UN,Left(U.UID,13) As ProfilePic,U.Fname          + ' '          + U.Sname As FullName, 'commented '          + C.Comment AS Activity, C.Ctime     FROM Users AS U      LEFT JOIN Logins L ON L.userID = U.UserID      LEFT OUTER JOIN         Comments AS C ON C.UserID = U.userID WHERE C.Ctime IS NOT NULL     UNION SELECT          U.UserID As UserID, L.UN As UN,Left(U.UID,13) As ProfilePic, U.Fname          + ' '          + U.Sname As FullName, 'connected with '          + (SELECT Users.Fname          + ' '          + Users.Sname FROM Users WHERE userID = Cn.ToUserID)          + '' AS Activity, Cn.Ctime     FROM          Users AS U      LEFT JOIN          Logins L ON L.userID = U.UserID      LEFT OUTER JOIN         Connections AS Cn ON Cn.UserID = U.userID WHERE CN.Ctime IS NOT NULL


How to diagram custom programming languages, non textual?

I've used and created domain-specific languages before, plenty of times (e.g. using yacc/lex). Normally we'd start with grammar written in BNF, and a bunch of keywords. This is easy to do, easy to share. Recently, I've started working with diagrammatic programming languages - closest parallel is circuit-diagrams in electronics, where it's very difficult to express ideas in text, but very easy to express them in wiring-diagrams. This is a new and novel problem for me: how to efficiently express these mini- languages, and share concepts in them with colleagues? (i.e. how to whiteboard-program within them. Actual programming is easy - you have physical components to hand) Are there tools for this? Or good/best practices (e.g. equivalent of "always use BNF as starting point for your new DSL, and use tools like yacc to generate the parser, compiler, etc"). My googlefu is proving weak - all I get is false positives for wiring diagrams, and UML editors (since these are custom languages, UML doesn't seem to help)


"bug" in C++11 text by Stroustrup?

I found an apparent contradiction in the c++ text having to do with the result of the `c_str()` function operating on `std:strings` (in my copy, the definition and contradiction are on p1040). First it defines the `c_str()` function as something that produces a 'C-style' (zero-terminated) string, but later it talks about how a C++ c_str value can have embed a 'C'-style, end-of-string terminators (i.e. NUL's) embedded in the string (that is defined by being NUL terminated). Um... does anyone else feel that this is a 'stretching' of the definition of a C-string beyond it's definition? I.e. I think what it means, is that if you were to look at the `length()` function as applied to the `string`, it will show a different end of string than using the C-definition of a z-string -- one that can contain any character except NUL, and is terminated by NUL. I likely don't have to worry about it in my of my programs, but it seems like a subtle distinction that makes a C++ `c_str`, not really a **'C'** -string. Am I misunderstanding this issue? Thanks!


Iphone/Android app – chatroom development – what framework & hosting needs?

I have some experience regarding IPhone and Android development but I am now struggling to solve a new class of problem: apps that involve a client/server chatroom feature. That is, an app when people can exchange text over the internet, and without having the app to constantly “pull” content from the server. So that problem can’t be solved with a normal php/mysql website, there must be some kind of application running on a server that is able to send message from the server to the phone, rather than having the phone to check for new messages every 10 seconds. So I’m looking for ways to solve the different problems here:   * What framework should I use on the two sides (phone / server)? It should be some kind of library that doesn’t prevent me to write paid apps. It should also be possible to have the same server for the Iphone and android version of the app.   * What server / hosting solution do I need with what sort of features, I just have no experience regarding server application that can handle and initiate multiple connections and are hosted on hardware that is always online I tried to find resources online but couldn’t so far, either the libraries had the wrong kind of license/language or I just didn’t understand. Sometimes there were nice tutorial but for different needs such as peer2peer chat over local network. Same with the server and the hosting problem, not sure where to start really, I’m calling for help and I promise I will complete this page with notes about the experience I will get. Obviously the ideal would be to find a tutorial I missed that include client code, server code and a free scalable server. That being said, If I see something as good, it probably means that I have eaten the wrong kind of mushroom again. So, failing that, any pointer which might help me toward that quest, would be greatly appreciated.


What are good dynamics that can improve learning in a web programming course?

~~At my company we are starting a course for free that will cover 4 modules (`HTML / CSS and W3C Standards, Javascript and jQuery, PHP, MySQL`) during 7 months. The main goal is to be able to train new possible employees and at the same time share knowledge with programming enthusiasts, although it is very personalized (8 - 10 people). The dynamic is: one 4 hours class (with a break) every week, and a big homework that includes investigation and practice. Also once a week students come to the office to work on real life examples and get help with their homework. This would be the third time we do this. We were no teachers when we started but feel satisfied in general with the results. However there is always room for improvement, we have noticed for instance some difficulty when trying to introduce programming for the first time (`javascript`) also when switching from event based to procedural (`php`) programming. My question is , are there any advices or guidelines based on experience that you can give us in order to improve the learning experience? What are resources that we should take into account for teaching web development from scratch?~~ > **UPDATE** : To make it a wider question, what are good dynamics (or > advices) that can improve the learning process in a web programming course?


Abstracting user interface from domain

My course text suggests creating a 'facade' class to completely abstract the user interface from the domain layer. That is, the UI uses only basic types, and if it needs a reference to a domain object, it only knows it as an `Object`. To give you an idea, this is what it might look like (example in Java but could equally apply to other languages):               public class Facade     {         ...         public Object getLastOrder(Object customer)         {             Customer castCustomer = (Customer)customer;             Order lastOrder = domainController.getLastOrder(castCustomer);             return lastOrder;         }     }      Note: I'm not sure whether this is in fact a type of facade pattern (I've heard it defined differently elsewhere), but I don't want to get _too_ bogged down in terminology. Compared to nothing (having the UI call the domain controller directly), I can see that this has the advantage that the UI is much more independent of changes to the domain model implementation. There's always a risk that very major changes (such as not having anything representing an order any more) will break things, but this seems to be able to absorb anything else. However, it seems to sacrifice type checking, and it means that getting even simple properties of domain objects more convoluted than it needs to be (`anOrder.getNumber()` vs `facade.getOrderNumber(anOrder)`). * * * My own thought was that it would be better for the UI to reference domain objects in terms of interfaces, rather than plain Objects. For example:               public class Facade     {         ...         public IOrder getLastOrder(ICustomer customer)         {             Customer castCustomer = (Customer)customer;             Order lastOrder = domainController.getLastOrder(castCustomer);             return lastOrder;         }     }      or even if the domain controller itself exposed only the interface types, forgetting the 'facade' altogether. As far as I can see, this is better from a type checking point of view. Major changes (e.g. removing `Order` from the system) can break things, but that was true of the 'plain `Object`' solution. And any methods that are stable (e.g. `anOrder.getNumber()`) can be specified in the interfaces, so calling them from the UI is simpler and more object- orientated. Obviously this only applies to methods whose signatures are stable, to avoid breaking the UI, but the implementation is still free to change. Is there something I'm missing? Does my 'interface' solution have any drawbacks I haven't spotted? Or is there a completely different, better solution that I haven't though of?


Properly structure an existing project into the MVC architecture

I'm taking a legacy classic asp project up to more modern technology (I've been working with ASP.NET MVC lately so using this concept is stuck in my mind), but I'm trying to think of how to structure the project. The idea is that the company provides a service to clients, but the service is housed on the company's website (instead of the client's) and has some branding/specifics to the client. Let's say there are 4 or 5 pages/steps for the service, but a few of those pages/steps can be customized for each client. So, what I'd prefer is: `*/step1` `*/step2` `*/step3` `*/step4` `*/step5` Where `*` is the `client` name but the steps are reusable. This doesn't seem to lend itself to the standard MVC structure, or I can't seem to see the forest for the trees. I wouldn't want a controller for each `client` and repeat the steps for `n` clients. I'd rather have 5 steps where `step2` or `step3` could be expanded upon for client X, expanded upon more for client Y and left alone for client Z. If the company has 100 clients that want the standard 5 steps (no customization), you wouldn't want 100 controllers serving up 5 steps (500 `.cshtml` pages in the project)...right? How would one design this properly?


What should I call the less-than and similar operators?

Most programming languages support operators similar to the following 6, which are spelled here as in C.               ==  !=  <   <=  >   >=      I'm aware of several terms used to include all of these operators. In approximately my perceived best-first order, these are... **EDIT** list fixed after Jerry Coffins answer...   * Relational operators   * Comparison operators   * Conditional operators   * Relative operators What are the reasons to prefer/avoid each particular term.


Different customers in the same ASP.NET solution?

I'm having a asp.net website running live with its specific style and specific content. From that site we've built another site with the same logic (in other projects) but with different style and different content (and different files) in the same solution. We've changed the start options from Default.aspx to the root folder for that second site. Now I want to build a more general site which works for several customers, using the same logic and data layers - but with different style and content. The current site(s) relies heavily on SQL Server 2008 R2, where most of the content resides - but not all. All of the content could be placed in the database with some work if we need to - especially if we get a more general site. My idea is to use a different start file for every new customer, such as: Default_Customer1.aspx, Default_Customer2.aspx e t c but I'm far from sure if this is the right way to do it. I don't want to have different solutions for every customer. I know that all of the customers will get all of the compiled code, even if some of the code never will be used by that specific customer (who has its specific needs). So what do I do? Should I try to use different start options (files) for every customer, as mentioned above, or is there a better way handling different customers in the same solution?


Japanese Multiplication simulation - is a program actually capable of improving calculation speed?

On SuperUser, I asked a (possibly silly) question about processors using mathematical shortcuts and would like to have a look at the possibility at the **software application** of that concept. I'd like to write a simulation of Japanese Multiplication to get benchmarks on large calculations utilizing the shortcut vs traditional CPU multiplication. **I'm curious as to whether it makes sense to try this.** ![enter image description here](http://i.stack.imgur.com/swF5p.png) **My Question:** I'd like to know whether or not a software math shortcut, as described above is actually a shortcut at all. This is a question of programming concept. By utilizing the simulation of Japanese Multiplication, **is a program actually capable of improving calculation speed? Or am I doomed from the start?** * * * **The answer to this question isn't _required_ to determine whether or not the experiment will succeed**, but rather whether or not it's logically possible for such a thing to occur in any program, using this concept as an example. * * * **My theory** is that since addition is computed faster than multiplication, a simulation of Japanese multiplication may actually allow a program to multiply (large) numbers faster than the CPU arithmetic unit can. I think this would be a very interesting finding, if it proves to be true. If, in the multiplication of numbers of **any immense size** , the shortcut were to calculate the result via less instructions (or faster) than traditional ALU multiplication, I would consider the experiment a success.


Terms in conditions in installer or is on website ok

I am currently in the process of packing my first c# wpf app. The app will be paid so it requires the user to agree to some terms and conditions. Is it best to have these built into the installer? Or can I get away with having the user accept them on the website they buy them from during the purchase and before download the app?


Ideal data structure/techniques for storing generic scheduler data in C#

I am trying to implement a generic scheduler object in C# 4 which will output a table in HTML. Basic aim is to show some object along with various attributes, and whether it was doing something in a given time period. The scheduler will output a table displaying the headers: `Detail Field 1 ....N| Date1.........N` I want to initialise the table with a start date and an end date to create the date range (ideally could also do other time periods e.g. hours but that isn't vital). I then want to provide a generic object which will have associated events. Where an object has events within the period I want a table cell to be marked E.g.               Name Height Weight 1/1/2011 2/1/2011 3/1/20011...... 31/1/2011     Ben  5.11    75       X        X                       X     Bill 5.7     83                X        X      So I created scheduler with Start Date=1/1/2011 and end date 31/1/2011 I'd like to give it my person object (already sorted) and tell it which fields I want displayed (Name, Height, Weight) Each person has events which have a start date and end date. Some events will start and end outwith but they should still be shown on the relevant date etc. Ideally I'd like to have been able to provide it with say a class booking object as well. So I'm trying to keep it generic. I have seen Javasript implementations etc of similar. What would a good data structure be for this? Any thoughts on techniques I could use to make it generic. I am not great with generics so any tips appreciated.


Development environment to manage multiple Oracle databases

I am in an enterprise environment where we have applications that need to run against multiple Oracle databases. Developers may need to manage multiple vintages of these databases to support different test data or diagnose bugs against different versions of the code. Right now, we have a limited set of test environments set up on "real" Oracle servers within the data center. We juggle these among development and QA groups and there is a lot of conflicts and inefficiencies that arise because of it. I am taking a look at Oracle Express Edition which would allow me to spin up a local Oracle database. This is similar to the workflow I most often see with SQL Server. Devs work on their location machine until they are ready to integration and then they push their DB changes to integration / QA environments. However, from what I read it seems that Oracle XE only supports one database instance at a time. So if I have an application that utilizes two different databases, I can't have both of them running on my local machine. Is that correct? Does Oracle Standard or Personal editions get around this limitation? If I had one of those installed locally, how difficult would it be to get multiple databases working on the same development machine? How do dev shops handle developing against Oracle where they need to be using several different Oracle instances for their applications?


Is Silverlight suitable for an enterprise class web-based product UI?

Our team is currently working on building our next generation HIS (Hospital Information System) comprising of over 30 modules (currently estimated at 400 man months), to be possibly hosted in a central location and accessed across geographies. Hence the primary UI NFRs (Non Functional Requirements) would be   * Multi browser compatibility   * Fast loading pages with rich GUI   * Ability to integrate with hardware devices like biometric scanners, biometric readers etc.   * Ease of development, maintenance (incorporating changes), shorter development cycle   * Ability to open multiple forms within the same browser window (without launching additional windows) **Pros:**   1. **UI would be browser agnostic** , we do not have to worry about ensuring that our web pages work with IE 7, 8, 9++/ Chrome 8, 9, 18++/ Mozilla Firefox (currently a lot of development effort goes into this compatibility check and fixing)   2. We could possibly make our application more modular, unlike a monolithic ASP.Net application   3. Usage of isolated storage on the client PC **Cons:**   1. Silverlight memory leak issues. We faced them in a few samples that we built using SL and have the same problem in a legacy XBAP application. The following links, substantiate the fear http://davybrion.com/blog/2010/08/silverlight-getting-worse-when-it-comes-to-memory-leaks/ http://stackoverflow.com/questions/5091636/silverlight-4-memory-leaks   2. Microsoft does not appear very gung ho about SL future. They seem to be investing more on HTML 5. The future releases of a SL 5 or 6 is also uncertain. http://support.microsoft.com/gp/lifean45 http://www.zdnet.com/blog/microsoft/microsoft-our-strategy-with-silverlight-has-shifted/7834 http://www.zdnet.com/blog/microsoft/will-there-be-a-silverlight-6-and-does-it-matter/11180   3. The HIS modules would open as multiple tabs within the same browser window (we are talking about a maximum of 8 tabs open simultaneously). How much of a load would it put on that browser instance and how would that effect the memory leak problem?   4. Learning curve for ASP.Net developers   5. Another Stack link on SL Silverlight, Wpf Web App (xbap) or Click Once? Pros and Cons **Neutral**   1. SEO compatibility is not a concern _**My queries are?_**   1. Would you use SL, knowing the above (and other) Pros and Cons   2. In case we use the MVVM pattern to build a product with SL as the front end, would it possible to replace the UI tomorrow with another UI (ASP.Net or something else). My understanding is that the rework would be substantial. What does the community think?   3. We have spent a considerable time in the above analysis (and in creating proof of concepts). Is there an important fact / decisive factor that we are overlooking? _Please do not mark this as a duplicate, as a lot of research and effort has gone into this exercise._ PS: We have spent the past 6 months in building the product using ASP.Net web forms (using MVP pattern) and now are looking at a technology shift due to the above reasons.


Test case design - do for all positive tests exist also negative ones?

There is ambiguity in all papers I have read so I would like to ask about the following requirement: **Requirement: Being a Game master, I can access the GM menu by typing "menuInvoke".** Trying to do that as a regular player - is **that a negative test or still positive in terms of verifying the requirement?** Because some authors say negative testing means dealing with inputs unknown to specification, which would not be this case as the spec does say you need to be a Game master, implying it is not allowed for the other ones. However if you think like that, it is always implicit: range 1-1000 implies that nothing else can be entered, yet we test it as a negative test. An example of ambiguity: Login system. Some say that providing incorrect password to receive Login error is negative test but I agree with the others - it is plain positive test as the requirement definitely specifies that only a user with valid password can login.


How do you handle your marginalized talent?

I've felt frustrated in the past with some jobs due to management marginalizing my talent, even after "proving" it to them for several years. Things like choosing to rewrite a single method from scratch (just building command parameters and executing a stored procedure, returning the result), instead of using code I wrote, that is in production in multiple apps, just because I wrote it. And the flimsy BS excuses they used to justify it. The funny thing is, I'm the ONLY ONE at the company that complies with coding standards, patterns and practices, analysis, unit testing and code coverage! How do you handle a job that is making you feel like you are wasting your talent and marginalized?


Licensing & EULAs

First off, is there any difference between a license and a EULA? Second, can a developer write his own license or is there some special legal crap you have to do. Finally is there some kind of lawyer that specializes in writing licenses for software? What kind of legal professional would you hire to do something like this?


I'm the .1x programmer at my company. How can I best contribute?

I work at a newly-minted startup of five people. We have a Ph. D in machine learning, a former member of the RSpec core team, and the guy who compiles the Git binary for OS X. That's just the employees; the founder has a Ph. D and was CTO for a multi-billion-dollar corporation before leaving to start a (successful) startup, and has now left that to start this one. We also might get a guy with a Ph. D in math. Aaaaaaaaand then there's me, college-dropout intern. I think I'm pretty smart and I'm reading non-stop, but the delta of experience, skill, and knowledge between me and my co-workers is just breathtaking. So put yourself in their shoes: you've got a bright young intern who has a lot to learn but is at least energetic. What would be annoying? What use would you hope to get out of him in the here and now? What would be pleasantly surprising if it happened?


What do I need to do, to get placed in any software company?

I'm doing my 3rd year CSE Engineering. I guess this is the right time to ask this question! As in the next year, I'm going to do projects, "get my hands dirty". And there is only few days left out, as I know many people in Stack Overflow are working in Software field, I thought to ask these question.   1. Does the project that I'm doing in my final year need to be excellent? If so, what kind of project to do? And how do you say that the project is excellent or not?   2. Writing the code is very fun and serious at times. But the code should have a good algorithm?   3. And mostly in any software companies interview, what kind of question they ask?   4. Not but not the least, mastering in any particular language speaks in interviews?


ssl requirement -is this just initial handshaking so that subsequent socket communication can commence as normal

I am new to SSL/HTTPS so uncertain on the basics. PROBLEM: A Java applet must communicate with a socket server listening on a port on the web server. Also communication must be secure. Without SSL, the Java applet can make a direct socket communication to the server port (running on the web server). But if communication must be encrypted using SSL, then how will the Java client communicate with the socket server? My confusion is that the Java client will need to communicate with the HTTPS port (which is presumably connecting to a web server). But then how does the communication channel get 'split off' to communicate with the custom socket server? How would the ssl client specify the custom port in the message?


Inheritance and constricted referencing

Let's say I have `BaseA` and `BaseB` classes. `BaseB` can have to several references of `BaseA` instances. Now, we have two other classes, `DerivedA` and `DerivedB` that respectively inherit from `BaseA` and `BaseB`. ![enter image description here](http://i.stack.imgur.com/rnlRx.png) How can I show in such a diagram that `DerivedB` should only store instances of `DerivedA` and not instances of `BaseA`? It seemed pretty simple before I tried to draw it, but now I'm confused. One obvious answer would be "redesign your code"; if there is no alternative, I will probably try to do so.


What are some interesting masters degrees to take a programming career in an unusual and interesting direction?

So I'm thinking about doing a masters, or some other form of degree to add to my Bsc in Computer Science - and am looking for ideas on some of the more unusual options out there. It seems to be fairly easy to understand "typical" career paths for programmers (and indeed, I may take one of those) - but I also want to explore what other possibilities exist. So - What is this question: I am looking for people who have taken their programming careers into more unusual directions, specifically with a focus on the education to get there:   * Politics   * Law   * Psychology   * Business (ok, not that unsual, but I'll include it)   * Other sciences (biology, etc)   * Anything else you can think of I suspect the science option will not be the one for me - but for completness on the question I will include it. Likewise if there are some really interesting offshoots that I have not thought of lets add them in. What this question is not: There are quite a few other questions on this and other stackexchange sites dealing with similar questions - and there are quite a few answers from people detailing why they advocate staying in computers forever. I love programming. And I may continue looking for ways to grow in this industry (team lead, architect, etc). But those answers have been _well and truly_ covered. So for this question I would really like to hear from people who have gone through different routes, the career paths they ended up on, and their thoughts on it. Thanks!


Should classes that define settings and application configuration follow SOLID?

I'm just wondering if you have an application where you define a class that defines some user configurable settings (from an xml file, or a GUI), should you design it so that it follows SOLID as much as possible like the rest of the application? More specifically, how do you change the available settings without violating the **Open Closed Principle?** Because I'm having trouble picturing this. I can see the addition of settings you can extend the class, but with the removal of settings, or change of a setting there would be no way to modify the configuration class so that it follows SOLID. Or is it possible somehow? I can also imagine trickle down effect from those settings changes, that require classes that depend on them to be modified as well.


JavaScript static methods retrieval

I have been thinking about it and wanted some feedback, recently I thought about doing it like this:               function foo(){        if ( !foo.prototype.statics ){            foo.prototype.statics = {               // declare static functions/vars here            }        }        if ( !(this instanceof foo) ){             return foo.prototype.statics;        }             var statics = foo.prototype.statics; // shortcut        // if it reaches here then it's an instance (new foo())     }          foo().callStaticMethod();     (new Foo()).callInstanceMethod();      Is this a good way to do it or do you think of any reason why this can be an anti-patern?


How to keep my Activity code readable and maintainable?

I have written a rather small App with only one activity. From my understanding an activity has to be seen as kind of a view and controller in one class. But even for a little app, with 3 dialogs (made with AlertDialogBuilder and all those anonymous inner classes that come with it) my activity has 500+ LOC and became very hard to maintain. The activity houses mainly android lifecycle handlers and view handling. Business logic is very little. How to handle activity classes to keep them readable and maintainable?


Keeping git repositories on different hosts in sync

I am thinking about starting a small project and I want to make its versioning with git. Bitbucket seems a good option for me with their free plan. I want to use it as the main tool for working with git since they nice tools, like web-interface, Mac OS client, and so on. But in order to have higher protection from any accidental damages that can be caused by using third-party service I want also to install git on my NAS as a second back-up copy of the repository. Now my question is, whether it is possible to create a repository on two different hosts and then keep them in sync? For example once per week I update the repository on my NAS to what is on the Butbucket. And in case something happens with Bitbucket, I still have full repository with full history of development on my local NAS storage. And is there a way to import existing repository with full history to another git-service?


How do you protect your WCF service?

sometimes a programmer comes up with a brilliant idea to protect his/her webservice created with Windows Communication Foundation. I would like to hear from you guys, which techniques do you use to protect your WCF service and avoid unauthorized users to consume it? For example, you would:   * avoid Impersonate, use it only if necessary    * publish metadata information to prevent tampering   * avoid memory consuption enforcing a maximum size quota    * create a security context token to control number of sessions


How to morph from a programmer noob to a guru?

I have been a programmer for two years, and i am getting hard to level up my skill especially working at legacy code maintenance right now. I think working hard is not enough to elevate my skill, because there are ton of opensource around us, the preoject i have been involved are all mixture of opensources --- from front end to back end from presentation tier to business logic tier. My work is just gluing all these together or something fewer complex which is to collect data from UI to logic module then retrieve the data processed and put it to UI. Sometime there is a need to add some simple logic(like assembling the data to a form that fit business logic interface) while transport data. Could you please give me any suggestion what should i do on the side to improve my skill? Thanks!


GPLv2 and formats

Do you think a re-distributor providing full source in a weird archive format is complying with the GPL? This project http://sourceforge.net/projects/minivmac/ is GPLv2 based on the earlier vMac emulator but it provides the source exclusively in mac disk images. While after jumping through some hoops you can eventually access it on most platforms or use a Linux LiveCD to extract it and translate it to some open format it seems to go against the requirement of providing usable source code. Even if this particular example was fine. Where does one draw the line? What's to stop a malicious vendor from distributing their modifications to busybox in WordPerfect format? Photographs of ENIAC punchcards in Deluxe Paint format? Or, ultimately, some ad-hoc format nobody can read?


What is the difference in a developer's years of experience with a language?

As stated by the title, what is the difference in years of experience in given language in terms of developers? For example, if one developer has had five years working with language A and the other developer has had two years working with language B followed by three years working with language A, would there be perceivable difference between them?


How do you manage your reading list?

How do you manage your reading list? Like me, you probably have 12 technical books on the go at once, and that's not including the non-technical books :) Any tips? Regard TDG


Documents of requirement specification

I need to work with IT projects in system or web development in order to improve my skills by following the requirement specification. Is there any available requirement specfication to download in order to create an application?


Is the .NET/Microsoft technology stack a financially viable option for a startup with limited finances?

I have an unpaid internship for a very new startup company with little tech experience that's trying to be a Groupon clone. They're currently using Wordpress and I've been trying to decide what web framework to push them towards, since I'll have to learn that language and implement it as well. Is ASP.Net MVC a realistic option for a web based startup company with little financial backing? For example, I know in the Rails hosting is slightly cheaper because of the whole free OS thing and there are free "gems" available to do things like a mailers, but how much more expensive can it get if I go with ASP.Net MVC since such add-ons stop being open source? How much does the cost of hosting for .NET applications add to the equation?


Why would I want a UnitOfWork layer if my service/business logic layer is specific enough?

I'm getting into the Repository pattern (which I love), and as I read up on it I see this UnitOfWork pattern in many articles. Before I knew anything about UnitOfWork I was just using my Repository pattern inside my service layer (business logic). This seems to work great so I'm wondering why having another layer (ie. UnitOfWork) may be beneficial? Why would I want a UnitOfWork layer in my service/business logic layer? If your service layer is specific enough and doesn't cover everything under the sun then it doesn't seem like it's needed. Note that I'm looking at this from an EF perspective. I've even read articles where people mention that EF's DbContext is a UnitOfWork. So why make my own UnitOfWork if EF's DbContext already does this for me? Why not create my DbContext in my service layer and then pull in the repositories I need and do all good? The Repository I get because it makes testing my services easier, but I don't see the benefit of a UnitOfWork especially if you are using an ORM.


How to do an effective code review of library changes?

One of my projects just changed the version number of a supporting third-party library. Specifically, we changed a J2EE app from JPA 1.x to JPA 2.0. Our CI system has had this change for a week and the tests are passing. In general, how can I do an effective code review and QA check when another developer changes the version of a third-party library? I have already done the following:   * reviewed the changelogs for the library, watching for things that would affect my application   * checked the dependency declarations (Maven POMs) for mistakes   * searched our ticketing system for prior attempts or upgrades of the same libraries, did we try this before and fail or find a blocker


What Pattern will solve this - fetching dependent record from database

I have these classes               class Match     {       int MatchID,       int Team1ID, //used to reference Team       int Team2ID,       ... other fields     }      Note: Match actually have 2 teams which means 2 TeamID               class Team     {        int TeamID,        string TeamName     }      In my view I need to display `List<Match>` showing the TeamName. So I added another field               class Match     {       int MatchID,       int TeamID, //used to reference Team       ... other fields            string TeamName;     }      I can now do               Match m = getMatch(id);     m.TeamName = getTeamName(m.TeamId); //get name from database      But for a `List<Match>`, `getTeamName(TeamId)` will go to the database to fetch TeamName for each TeamID. For a page of 10 Matches per page, that could be `(10x2Teams)=20` trip to database. Example:               for(1..10)     {        Match m[i] = getMatch(i);             //the team are never going to be repeated, 20 teams spread over ten matches         m[i].Team1Name = getTeamName(m.Team2Id);        m[i].Team2Name = getTeamName(m.Team2Id);     }      To avoid this, I had the idea of loading everything once, store it in memory and only lookup the TeamName in memory. This made me have a rethink that what if the records are 5000 or more. What pattern is used to solve this and how?


How to be an agile programmer?

I am a trainee in development sector. My Boss says that i should be an agile programmer. I went through through the net and found some interesting things about agile programming. Being a newbee how should I start with agile? What should be my first step in Agile programming? At present I am in pair programming. But it's not exactly pair programming as I am just watching what my co-developer is doing. I also wish to be an agile developer. Can you suggest a way for me stepwise? I wish to develop myself and also my programming skills.


Sites with overlapping code-bases. Developing multiple sites with little changes

I have to develop 3 different sites   1. video.com for hosting video    2. audio.com for hosting audio    3. docs.com for hosting docs. _domain names for example only_ Almost 80% of the functionality is the same for all the three, with remaining 20% being completely different features... How do I handle this? How does sites like SO handle this? I am developing this in YII framework and was thinking of having these different features as modules but in this case the menu/code links in html code can become difficult.


What's the easiest (quickest) way to share one dataset in my app with someone else

I have some javascript that creates a canvas image that I want users to be able to share. I simply need to save the image somehow. Nothing else. I've been contemplating using bits and pieces of ruby and activerecord, or perhaps sinatra but I feel like both would be over kill for this simple task. Ideally I'd like to do it with JavaScript but I don't feel like including all of node. Any suggestions?


Is file system one of the NoSQL? What's the main difference?

I am confused about it. I can use lucene to create index and run query against file system. I can find any particular file very fast, if I can provide a primary key, in this case, directory path and filename act as primary key. It looks very much like a NoSQL.


What do you do to improve your speech communication skills?

Being a programmer is not just grokking the latest cool technology or debugging a sneaky code error , we have to speak to our coworkers, project manager or boss, in the most effective way possibly; we have demos, interviews, code reviews and so on where this skill is pretty crucial. Personally, as a solo programmer (since 2008) I have not invested much time on improving this skill and I would like to know whay you are doing to improve it.


Integrate MS Dynamics AX with Play Framework

In my company we use MS Dynamics AX 2009. This is the ERP of the company. We have around 100 users. The servers of MS Dynamics AX are in the headquarters company. We are developping a new website using Play Framework and Scala language. However, the website server isn't in the headquarters company, the dedicated server is hosted in OVH, an European ISP. The website needs the ERP data in real time, but the MS Dynamics AX Database is located in the headquarters company and the internet connection is very unstable. That's the problem! We need bidirectional comunication between the website and the ERP, but the internet connection of the ERP Servers are very unstable. We've thought two solutions:   * Use RabbitMQ in the headquarters and website. When an event occurs in the ERP, the ERP puts a message in RabbitMQ and the website gets this message when the internet connection works. When an event occurs in the website, the website puts a message in RabbitMQ and the ERP gets this message when the internet connections works. So, we have 2 RabbitMQ, one in the headquarters and another one in the website server.   * Use MS SQL Server Replication to replicate the database from headquarters to ISP, we would need two servers in the ISP: the website (Linux, Apache, MySQL, Play Framework) and the SQL Replica (Windows, SQL Server). When an event occurs in ERP, the SQL Server replication propagate these changes to the SQL Replication server in the ISP, and the website always reads the data in the SQL Replication Server. When an event occurs in website, we also need a RabbitMQ queue like before. What do you think about this architecture? What is the best solution? Could MS SQL Server replicate ussing an unstable internet conecction? Thank you in advance.


Is it a good practice to declare instance variables as None in a class in Python?

Consider the following class:               class Person:         def __init__(self, name, age):             self.name = name             self.age = age      My coworkers tend to define it like this:               class Person:         name = None         age = None              def __init__(self, name, age):             self.name = name             self.age = age      The main reason for this is that their editor of choice shows the properties for autocompletion. Personally, I dislike the latter one, because it makes no sense that a class has those properties set to `None`. Which one would be better practice and for what reasons?


Refactor an old model of a LastUser Modification on every Object?

I have a software requirement, that needs to store the user that made the last modification to another object, for every object (assume that all objects are already mapped and into a BD). So we have the ParamBase an object that holds the basic data for every object, this will be a super class, every other parameter in the system will Inherit this class, (Using @MappedSuperClass)               @MappedSuperclass     ParamBase {         @Id         @GeneratedValue(strategy = GenerationType.AUTO)         private Long id;              @Version         private Long version;              @Temporal(value = TemporalType.TIMESTAMP)         private Date timeStampLastModification;              @Column         private User userOfLastModification;         //constructors, getter setters, other stuff, etc     }       The User object, this will represent the user, also mapped into a BD, for now is just simple Object mapped as Entity, all other Parameters will have to store this User into a field.               @Entity     User {        //User stuff, cons, get, seters, etc     }          @Entity     Country extends ParamBase {         //This class extends ParamBase so will have a field to hold the          //userOfLastModification     }      In an EJB I have business logic that will work with several operations and objects, when in this case a parameter is updated, the userSession (assigned at login) will update the userOfLastModification field. THE PROBLEM: All of the objects will have a relation with User, so all other Objects have a mapped field userOfLastModification_id, this creates a massive dependency of all clases to User. To give you an idea, just picture on an Entity Relation diagram ER, all tables related to one single User Table, it's a mess!!! THE REFACTOR!: I think this model is wrong, I think breaks the equilibrium of software design I don't think you need to create a relation between all the tables/object to one table (User) to accomplish this requirement, I will like some feedback or ides on how to: 1\. Explain the design error, if there is one? (I always think that I can be wrong, and there's no problem with that)   1. Is there a better way to do this? Thanks for your help!


What are the major challenges you face as a one-person ISV?

As a one-person ISV, what are the major challenges you faced? How did you overcome these challenges?


What is the best way to design a table with an arbitrary id?

I have the need to create a table with a unique id as the PK. The ID is a surrogate key. Originally, I had a natural key, but requirement changes have undermined this idea. Then, I considered adding an auto incrementing identity. But, this presents problems. A. I can't specify my own ID.   B. The ID's are difficult to reset. Both of these together make it difficult to copy over this table with new data or move the table across domains, e.g. Dev to QA. I need to refer to these ID's from the front end, JavaScript...so they must not change. So, the only way I am aware of to meet all these challenges is to make a GUID ID. This way, I can overwrite the ID's when I need to or I can generate a new one without concern for order (E.G. an `int` based id would require I know the last inserted ID). Is a GUID the best way to accomplish my goals? Considering that a GUID is a string and joining on a string is an expensive task, is there a better way?


Method to remove logic from UI

In my less experienced days I added a lot of business logic in the code behind of my .aspx. Now I'm revisiting it I would like to refactor the mess and get it all sorted out. How do I go about this? If I am to move my logic, where do I put it? Do I have a seperate class for each page?


MVC Models instantiation

Where should the Models be instatiated in a MVC arhitecture? I understand the preferred way would be outside controllers, in a bootstrap file and injected using a Dependecy Injection Container. But most of the models I'm working with depend on run time parameters.               //PHP Example     class UserController {        protected $objUser;        protected $objDictionary;             public function Show() {            $objUserMapper = new UserMapper();            $this->objUser = $objUserMapper->FindById($_GET['id']);            $this->objDictionary = new Dictionary($this->objUser->Language);        }     }


What is the best way to handle last minute changes to product scope?

What is the best way to handle changes to product requirements or scope during or after User Acceptance Testing (UAT)? How dangerous is it to make those changes, and how can the danger be mitigated?


.Net Language Interoperability Gotchas

I hope this is the appropriate forum to ask this question. A group of colleagues and I just starting learning C# a few weeks ago and we are planning on having a discussion about language interoperability. So, I am looking for known/classical examples of .Net language interoperability issues. Like this one, where the case-insensitiveness of VB.Net makes an overloaded C# method incompatible. **In C#**               public class Foo     {         public void foo() { }         public void fOO() { }     }      **In VB.Net**               Public Class Bar        Sub Bar()           Dim foo As Foo           foo = New Foo()           foo.foo(); //compiler error        End Sub     End Class      Or this one in which a VB.Net keyword is used in a C# method name: **In C#**               public class Foo     {        public virtual void Stop() { }     }      **In VB.Net**               Public Class Bar         Inherits Foo              Public Overrides Sub Stop() 'compiler error         End Sub          End Class      I would love to gather a few more examples of this type of issues. Does anyone know any other interesting cases of language interoperability gotchas? I used C# and VB.Net in these examples, but any .Net language interoperability issue will be just as good to enrich a discussion on the subject.


Are there any valid uses for the System.Collections.Specialized classes any more?

Are there any valid uses for the classes in the System.Collections.Specialized namespace any more or are they all superseded by the classes in the System.Collections.Generic, System.Collections.Concurrent and System.Collections.ObjectModel namespace now? The classes in the namespace are:               HybridDictionary     ListDictionary     NameValueCollection     OrderedDictionary     StringCollection     StringDictionary     StringEnumerator      Similarly, are there any real reasons why one might use the non-generic System.Collections namespace classes such as:               ArrayList     BitArray     Hashtable     Queue     SortedList     Stack


Algorithms for pairing a rating system to an assignment queue

Attempting to research how to allow a group of people to effectively rank a set of objects (each group member will have contributed one object to the group), and then assign each member an object that's not their own based on:   * Their ratings of the objects,   * Their objects rating, and    * The object remaining to be assigned. Idea is to attempt to assign objects to people based on the groups rating of their contribution to the group relative to other member's contribution, the the personal preferences expressed via the ratings. Any suggestions for:   * Further research,   * Refining the statement of the problem/solution, or   * A solution.


How to make my code decide which class to instantiate based on a parameter?

I have a system in which I will perform queries to a database. I want Query1, Query2 and Query3 to use the same methods in their way to the data source layer. To do that I would like to make something similar to Strategy or Template Patterns, where I have a part of the code which is a default behavior for all queries (getting to the database layer, connection, executing the query and so on) and a variable part (building the query itself). I think this idea is good and feasible. I would receive a parameter from the client specifying the query to be built, build it and run. The only question is: given this parameter, how can I decide which method to call to build the query? This is my current solution: (is this solution a pattern?)               public Query QueryFactory(string queryIdentifier){        if(queryIdentifier == "query1")           return BuildQuery1();        else if(queryIdentifier == "query2")           return BuildQuery2();      }      It works, but I don't think this is "pretty enough", I would like something nicer. It would be perfect if it didn't require the developer to add a new if statement when he created a new query. **Is there any way to improve this if/else chain? And to make this decision automatic?** Edit: The problem I want to solve is: I have queries that are going to be called against a database. I want to have the same flow so I don't have duplicated code for the queries that do not have any business logic applied to it (ex: get all users, get all students, and so on)


How do you use JavaScript?

I'm not a professional programmer, but having a PhD in an engineering field, I've taught myself many programming languages over the years. The past few years I've been using primarily Ruby, and now I'm trying to learn JavaScript so I can do a bit of web programming. I guess like a lot of people, I had a mostly negative impression of JavaScript going in, but as I'm studying the language (through the book JavaScript: The Good Parts by Crockford), I find that the functional part of the language is really neat. I dabbled in Haskell a few years ago, so I had some idea about functional programming. I'm wondering how professional programmers tend to use the language. Do you stick to one paradigm when writing in JavaScript, or do you use it like a swiss army knife, and used different paradigms for different problems? Is there a "most popular" way to use it these days, or does it simply depend on the programmer, problem, company, etc.?


TCP and UDP basics: connecting to a website

I am just learning computer networks so please forgive me if this question is naive. I know the TCP protocol binds itself to a port till the transfer of messages is over (port 80) and UDP is best effort (ie no binding). My question is if I try and access two websites at the same time (multiple tabs on my browser), assuming both websites are web servers, my questions are   1. Does my computer communicate with one webservice (website) first and then communicate with the other (serially). Also if this is the case is the time difference so small that I feel it loads simultaneously?   2. Suppose I have my own web server (tomcat) running on port 80, how can I communicate with other websites if it happens on the same port?   3. Do websites decide which protocol to use TCP or UDP?


Is the HL7 membership model normal?

To me, it's a little odd that HL7 requires you to be a member to distribute the standard within your organization and in that sense implement the standard and tell others who have implemented the standard what parts you'll be implementing, especially when it's nothing classier than a few pipes and carets for 2.x and some sort of XML for 3.0. I can understand paying money to use a library to utilize HL7 or even the source code to build the library to utilize HL7. But what's the point of requiring membership to see the spec to write the sourcecode to build the library to utilize HL7?


What would the register-machine bytecode for this code look like?

I hope this kind of question isn't off-topic on this site. I'm finally getting the hang of what a stack based machine is, and how to compile code for it. For example, the following code: `2 * 5 + 1` would compile to this bytecode:               push 2     push 5     mult     push 1     add      However what I want to understand is, the fundamental differences between compiling for a stack based machine and compiling for a register based machine. Basically I want to see what a register-machine's bytecode would look like, as opposed to a stack-machine's bytecode. To understand this, I'd like to ask you to show me what the bytecode for the above expression would look like, for a register machine. I.e. what this: `2 * 5 + 1` would compile to.


Passing Anonymous Type to a Bound Control

Generally speaking, I'm fairly opposed to the use of anonymous types in real- world code (except in LINQ and some other specific scenarios), but I'm looking right now at a situation where I need to bind an ASP `GridView` control with a collection of tuple values and they're looking pretty tempting. Basically, I need to show a list of proprietary accounts that are associated with different computer names. I don't currently have a type that contains those two properties because I don't use them together like this anywhere else. What I would normally do in a situation like this is just create a new class that has the properties, set the `ItemType` on the `GridView` to reference that type, then build objects of that type in my `Select` method (I use `ObjectDataSource` much of the time). But I'm thinking now that there's really no benefit to throwing in that extra class, since no matter what it's getting bound via reflection. **Is there any reason to shy away from using anonymous types in data-binding situations like this?** I'd accept anything: performance, readability, maintainability, principle, or whatever else you can throw at me. But the only disadvantage I can think of is if I wanted to use the `Item` property to strong-type my data-binding, but in this particular case I have no use for anything more than `BoundField`s. Of course, this is all based on the assumption that it even works, admittedly I haven't tried it yet with anonymous types, so it might just not be supported for one reason or another.


How can I figure out if another project is mostly maintenance and bugs?

I started working in a relatively big company that unfortunately has its share of quite a lot of legacy code and I ended up spending an extra ordinary amount of time in maintainance and bug fixes. I would like to switch project as on the surface there are other project that "seem" interesting. The issue is I am not really sure if it is any better there either. I have asked some colleagues to see what's going on and they "claim" that they are involved in cool things but I don't really believe them as in one of the cases I know for sure he is the same situation as I am. So my question is the following: If I don't have someone I can really trust to make a good choice about swapping to another project is there a way I could find out myself (I mean if it is the same everywhere)? One idea would be to do some "reverse" engineering i.e. start tracking each persons commit in the repository to figure out what he's been up to. But this approach seems to me irrational. Surely there must be a better way?


creating a clone of a site is good idea for project?

I am trying my hand in python, Django, JQuery.. etc to make a clone of imdb site. Currently I'm in web-development from past 10 months on same technologies. In my spare time I want to develop a side-project which may look good on resume. I came up with an _idea_ , to make a clone of imdb.com. But after 2 weeks of development I stopped. reasons: _its not different_   1. Why create another imdb?   2. I'm not improving it?   3. Face it, it will be sub standard of original one. The need for the project is to showcase my skills in above technologies but at same time I want it to be useful.


I am a git user confused by mercurial's branching. How am I supposed to track small changes?

I've always used git before, but I want to contribute to python so now I have to learn mercurial and I find it very frustrating. So, I've made a couple of small patches and I wanted to track them as commits in my local mercurial repository. Apparently there are 4 ways to handle branching in mercurial. 1 and 4 looked completely ridiculous to me, named branches seem to be heavyweight and I feel that I'm not supposed to use them for quick 1-commit fixes, so I used bookmarks. Now, my patch gets rejected and I want to remove one of my bookmark-branches from my repository. OK, in git I would just force-delete my branch and forget about it, so I delete my bookmark and now I have following problems:   * TortoiseHG and `hg log` still show that commit and `default` branch has 2 heads. And if I understand correctly, you can't delete commits in hg without additional plugins.   * Mercurial has not only hashes, but also revision numbers. As I've added a couple of my own commits, all commits pulled after that have different revision numbers from the main central repo.   * I do `hg update` after pulling to move my `master` bookmark to the latest commit automatically, but I couldn't find a way to do that in TortoiseHG. What am I doing wrong? Is this normal and expected and should I just ignore these issues? Or how am i supposed to work with my branches?


How do I locate Uncalled Functions?

I am looking at some C/C++ code that appears to have functions that are defined, but never used. This is a pretty tedious process to trace through the code and verify. I've done some surveys and there are a number of tools that can do this type of analysis. Can anyone share any experiences or tips on which tools and techniques are best or alternative methods of verifying this code is in fact not used?


Alternatives to null values and option-like types

Related to this question i want to know if there is a concise way to eleminate null values out of code in general or if there is not. E.g. imagine a class that represents a user with birthday as attribute which _can_ be set but does not have to, which then means it's null. In scala and similar languages one could use the Option type to describe this and i see why this is better then just having a regular null value as one would code it in java. However i wonder if this is the right concept or if we can do it better in this case and even in general. I came to the idea that we could replace the users birthday (and other optional or possibly unknown/unset attributes) with a list of possible optional attributes. So we could have like               ourUser.getOptionalAttributes()     // could return a list [Date Birthday, Float Height, Color Eyecolor]     // or just [Color Eyecolor]     // or even an empty list      However using a regular list would mean that we could store multiple birthdays e.g. So we needed a way to tell the compiler that the list may only contain one Birthday type. Am i totally on the wrong track here and are option types the (philosophical) correct way to express optional attributes? Also, are there additional concepts for handling the logic of optional attributes other than nullable types and option-like types?


would a composite design pattern be useful for group membership?

I'm trying to think about the best way to handle group memberships on a website. People sign up and select checkboxes in a list of interests. Every week we send out interest-themed emails to those members that indicated that interest. however i store the information in the database, while i am working with the lists and generating lists of email addresses or manipulating group memberships, the composite design pattern looked interesting. it would be easy to populate the group, then do some aggregating functions that say... generate the list of email addresses based on the interests. but i'm not sure i'm seeing any other advantages. i do need something scalable, and flexible. thoughts?


Rewriting code / better initial outline

Single-programmer project. I'm constantly having to rewrite my own code on an on-going project. It's not buggy, but every time I expand my program (which previously-planned features), I keep having to expand previous classes, which cause me to re-write code that worked fine before. I have unit-tests, so bugs aren't introduced but it still seems counter- productive and seems to be wasting time. I'm constantly adding features that weren't originally needed, but become needed as project grows in complexity. Should I continue with this iterative development? It seems with every iteration I keep having to re-write more and more of old code as new features are added. Is there a better way to manage my project? I know (approximately) what I want my program to do, and how to do it.   Also, what tools / development-philosophies should I use to manage one-man projects? I have a running to-do list (and that's all) has been doing a fine job so far. Maybe some kind of abstract class-outlining program?


Does this pattern disregard the DRY principle, and can I modify the pattern to fit?

I just started working at a company and we're currently in a fairly intensive (full-days most work days) training program to bring us up to speed on the way the company does things, and train us in VB.NET, along with some C#. They're beginning to migrate towards a modified Model-View-Presenter architecture, with server remoting playing a fairly large role. An example .NET program might look like this:               SomeSolution     |     +-+- ServerProject     | |     | +- ServerEmployee.vb     | |     | +- Server.vb     |     +-+- Presenter     | |     | +- PresenterEmployee.vb     | |     | +- Presenter.vb     | |     | +- IView.vb     |     +-+- ViewProject       |       +- ViewEmployee.vb       |       +- View.vb      The classes in question would be the employee classes. The example that I was given was that the `ServerEmployee` would have the most information - being retrieved from a database, it would likely have the most attributes, such as `.FirstName`, `.LastName`, `.MiddleInitial`, `.PreferredName`, `.HireDate`, and whatever other attributes were present on the database. The `PresenterEmployee` would have the other attributes, as well as a `.FullName` attribute that perhaps was generated this way:               If employee.PreferredName <> String.Empty Then         employee.FullName = employee.PreferredName & " " & employee.LastName     Else         employee.FullName = employee.FirstName & " " & Employee.MiddleInitial & " " & Employee.LastName     End If      And finally, the `ViewEmployee` would only have the `.FullName` and `.HireDate` attributes. We were informed that the rationale behind this design was that if we have say, a `DataStructures` class that's referenced by the other classes then each time the DataStruture class has to be rebuilt, the entire project must be re- deployed (which I understand is a somewhat tedious process because of some infrastructure decisions). I understand that that would not be A Good Thing™, but it seems that if you have some code that probably won't change much (a fairly generic superclass with some straightforward properties), it would make sense to avoid the code duplication. Am I correct in thinking that this is a violation of the DRY principle? The first thing I thought of when they taught this was "ewww, that kinda smells..." Other than (potentially) not having to redeploy the entire application every time the superclass is changed, is there any benefit to doing things this way? And if it is broken, and I want to take the onus to try and fix it, what are some good arguments to defend my choice?


Wide gap in my resume as a Java developer. What are must-have skills required to get hired those days?

For some legal reasons I haven't worked for anybody for the last 12 years. I am a java web developer or at least I am thinking so. For this period I have been working on my project- some sort of business network - and I did few small jobs, so right now I feel I am far behind in terms of my skills and the skills needed today. I lingered too long on Struts and Hibernate and thought that could the job for my project. I need to get a job, right now, so I am spending most of my time brushing my skills. My question is: What are the current necessary skills that could convince employers to hire me regardless of my past employment or the lack of it. Right now I am on AspectJ, IoC and Spring


Structure of a correctly implemented JTable with TableModel and Listeners?

I am pretty new to Java and its JTables and this is where I am struggling at the moment. I need to create a GUI which shows me results of a sql query like `SELECT * FROM tblPeople WHERE name='Doe'`. My idea was to create a a JFrame which displays a JTable with all found records. Besides this, I need to also implement some code to handle when a user is double clicking a record or selecting it by using his arrow keys (additional feature: pressing `12`(e.g.) should select the 12th record). What is the best way to structure my program (what classes do I need and especially where do I store my logic)? I came up with structuring it the following way:   * **Main.java** ("view")   * **SQLConnection.java**   * **PeopleTableModel.java** (only stores and returns data given by the passed ResultSet, "model" inherits from DefaultTableModel)   * **PeopleTable.java** (stores basically all my logic including KeyListener and MouseListener, "controller", inherits from JTable) Are there better ways to achieve my goals? If so, what are they?


.Net search engine architecture and technology choice

I am in the process of designing a search engine for an asp.net site. The site currently uses Microsoft Indexing Server to index and search content which range from simple text files to MS documents to PDFs. MIS is also used to crawl File servers. MIS in tandem with Index Server Companion crawls for content from external sites. I intend to replace MIS with the indexer/crawler I am trying to build. The motivation for going away from MIS is   1.MSFT would be discontinuing MIS support in their upcoming Server 2012 releases.   2.Major PaaS providers do not support MIS. Since my platform is completely on the Microsoft stack, I cant afford(due to deployment/maintenance issues than cost issues) to have a Java application server. Thus, Solr, and effectively, SolrNet is ruled out. With this being the context, I have couple of questions. ### 1.Technology choice I had done my initial investigation and looked at Lucene.Net. There seemed to be 2 issues in using Lucene.Net. First being, it cant crawl external content. There doesn't seem to be a direct port of Nutch in .Net. Second, since it is just an indexer, it cant parse various document types. The parsing is left to the developer.   So, what would be best technology choice on the .Net platform to achieve indexing & crawling? Are there any .Net open source libraries available for document parsing? ### 2.Architectural pattern Is there any general architectural pattern or best practice that needs to be followed in designing such a search engine?


Is there a well grounded theory on backward and forward compatibility of formats, languages, grammars and vocabularies?

I have a friend who has the _specific_ problem of building a case against the use of a custom HTML <wrapper> tag in some site's markup. Now, intuitively we can answer that use of such a tag is risky, as future HTML specs may define a wrapper tag with semantics that conflict with its use on the site. We can also appeal to a particular section of the HTML5 spec which also recommends against the use of custom tags for this reason. And while I agree with the conclusion, I find these arguments a little on the weak side, on their own. Is there some well grounded and proven theory in computer science from which we can derive this conclusion? Have programming language theorists created proofs about the properties of vocabulary versioning, or some such thing?


DDD and Value Objects. Are mutable Value Objects a good candidate for Non Aggr. Root Entity?

Here is a little problem Have an entity, with a value object. Not a problem. I replace a value object for a new one, then nhibernate inserts the new value and orphan the old one, then deletes it. Ok, that's a problem. Insured is my entity in my domain. He has a collection of Addresses (value objects). One of the addresses is the MailingAddress. When we want to update the mailing address, let's say zipcode was wrong, following Mr. Evans doctrine, we must replace the old object for a new one since it's immutable (a value object right?). But we don't want to delete the row thou, because that address's PK is a FK in a MailingHistory table. So, following Mr. Evans doctrine, we are pretty much screwed here. Unless i make my addressses Entities, so i don't have to "replace" it, and simply update its zipcode member, like the old good days. What would you suggest me in this case? The way i see it, ValueObjects are only useful when you want to encapsulate a group of database table's columns (component in nhibernate). Everything that has a persistence id in the database, is better off to make it an Entity (not necessarily an aggregate root) so you can update its members without recreating the whole object graph, specially if that's a deep-nested object. Do you concur? Is it allowed by Mr. Evans to have a mutable value object? Or is a mutable value object a candidate for an Entity? Thanks


How important are unit tests in software development?

We are doing software testing by testing a lot of I/O cases, so developers and system analysts can open reviews and test for their committed code within a given time period (e.g. 1 week). But when it come across with extracting information from a database, how to consider the cases and the corresponding methodology to start with? Although that is more likely to be a case studies because the unit-testing depends on the project we have involved which is too specific and particular most of the time. What is the general overview of the steps and precautions for unit-testing?


Is there a difference between arguments and parameters?

It might be like this: Parameter means from the callers POV and arguments mean inside the procedure, or other way round. Or is there no difference? ## Update In Swedish we say "anropsparametrar" i.e. "parameters that are calling the procedure" and we would not say "anropsargument" ("arguments that are calling the procedure").


combining (something like) Flash in a windows form application

I know this is a place where people ask advice for designing code. I am at a bit strange side on my coding quest, on one side people send me design stuff. Special graphics and ideas on how they should be shown in a program workflow. (i think the marketing designers are a bit to powerfull in this project They tend to think here that their pictures are the program itself, but all that coding still has to be written still ..by me in 1 week.. ) They want tweans of graphics and rotation etc.. Well in short this reminded me of things i have seen in flash But flash is for the web, as far as i know. But i think.. those people most likely use Adobe software so might safe it as some Adobe flash formats. In the end it is all about a interface for a machine Because of some hardware limits, i need to do it all in .net 2 on normal win forms. And on slow PC hardware (no direct10 or so).. directX is to much for me to finish in 1 week anyway Now i was thinking would it be possible to run flash on a form, or what would be something close the the Flash Experience ..you know text tweens/ slide ins etc something that could be combined with C# ?.


MIT app executing a GPL command

Can my MIT/BSD licensed, open source project, or a closed source project I build and sell, execute a command, where the command is a program released under the GPL? I would not be distributing any version of the GPL'd program, either source code or binary. I would be telling the customer/end user that they need to have the package/binary installed prior to running the program.


How can I improve the ease of which I can extend my software?

I am thinking about how software like Microsoft Windows grows from small as MS-DOS to Windows 7, Adobe Photoshop from its first version to version CS5. What techniques were used to accomplish this? Did they extend their software from the existing software or redesign for the next version? Or have they already planned their software solidly before they built them? It's hard for me to extend my application/software when I need to add new features and it makes a mess of other existing features. How can I improve my software's extensibility so that I can easily add new features to your software?


How to deal with social login

In my new web app I'm going to allow social login through Twitter (maybe), Facebook and Google and I'm in search of the best way to do it. Actually I'm using Rails with Devise + Omniauth and this is the problem: **Should I ask the user to choose a password so that he can login without a social network?** **Or maybe the user should be able to set a password if he want (for example when editing his account?)** The second way seems the best one but since Twitter doesn't provide user email and google doesn't provide an username I'll probably have to ask the user for username/email when he log in so in that case I may also ask for the password... waht do you think?


How important is it for a programmer to have an online presence?

I've noticed more and more mentions (both in posts here and in actual job descriptions) of programmers' "portfolios" - typically their public profiles on sites such as this, GitHub, etc. How important is this, and would companies (startups in particular) reject (or immediately discard without even interviewing) otherwise outstanding candidates who don't have an online presence? Personally, I prefer to keep a very low profile online. My name here cannot identify me, and I have other handles for other sites. I have a very spartan (and completely private) Facebook page. I do code on my own, but the code lives in local repositories. In general, the less information online about me, the better. I could see a designer needing some sort of online portfolio, but for a programmer, is this really a big negative when job-searching?


Why create a Huffman tree per character instead of a Node?

For a school assignment we're supposed to make a Java implementation of a compressor/decompresser using Huffman's algorithm. I've been reading a bit about it, specially this C++ tutorial: http://www.cprogramming.com/tutorial/computersciencetheory/huffman.html In my program, I've been thinking about having **Nodes** that have the following properties:   * Total Frequency   * Character (if a leaf)   * Right child (if any)   * Left child (if any)   * Parent (if any) So when building the Huffman tree, it is just a matter of linking a node to others, etc. However, I'm a bit confused with the following quote (emphasis mine): > First, **every letter starts off as part of its own tree** and the trees are > ordered by the frequency of the letters in the original string. Then the two > least-frequently used letters are combined into a single tree, and the > frequency of that tree is set to be the combined frequency of the two trees > that it links together. My question: why should I create a tree per letter, instead of just a node per letter and then do the linking later? I have not begun coding, I'm just studying the algorithm first, so I guess I'm missing an important detail. What is it?


How do I fill in the BSD license template for multiple copyright holders?

I am involved in an open-source project with multiple copyright holders. The project is licensed under the 3-clause BSD license. Unfortunately, the individual code files contain no reference back to their original owners (no copyright headers), but for the project as a whole a single file LICENSE.txt, which contains the BSD license text, is provided. The project also contains a separate file which identifies all copyright holders. However, I am struggling with a pragmatic question: the first line of the BSD license is supposed to identify the copyright owner:               Copyright (c) <year>, <copyright holder>      In our case, there is no single copyright owner (at least not for the project as a whole). So what should I put here, practically speaking? Obviously I can't just leave it out as the license itself refers to retaining "the above copyright notice". Is there a recommended way / format to list all copyright holders here, or perhaps to refer to an external list of copyright holders? We are talking 10 or more contributors by the way, some of them individuals, some companies, so it's not a short list. I looked at how some other projects do this (e.g. Linux), but most I could find use GPL, which does not contain the `<copyright owner>` bit in the license - and I have sofar failed to find a project that uses BSD and has multiple owners.


How to get the team back on track for SCRUM/Agile?

_There was a company developing software product. They had adopted SCRUM as agile method for entire development department incl. programmers, testers and analysts. It had been working grand for them in early months. However later things started to revert, enthusiasm cooled down and slowly people drifted back into their usual habits. The sprint became 6-8 weeks long, daily stand ups became weekly status updates around the table with bug count parade, scrum master became just a badge rotated between team members like a hot potato, product owner disengaged and lost the ownership of the backlog, and so on._ My question for you, fellow agile practitioners, is how to regain the SCRUM principles in such situation? What could the team members who still believed and care do? What are the best steps for development manager to take in such situation in order to get the team back on track for SCRUM/Agile?


How should I "dig deeper" as a web developer?

I am currently a full-stack web developer working mainly in Ruby/Rails/Javascript. The languages I use on a daily basis (ruby, css, javascript, php) are great, but they are very dynamic, high level languages. I would like to learn a lower level, preferably statically-typed, non memory- managed, language that gets me closer to the underlying architecture. However, I would like to approach this language from the angle of a web developer, and hopefully utilize the knowledge I gain to make me a better web developer. Any advice?


lots of images and ajax, or better solution?

I have a control where the user can select a value for the x and y axis from 2 dropdowns, and then there is a 4 by 4 grid (an image) which will show what their selections correspond to (updating dynamically). So, if the grid is:               a b c d     e f g h     i j k l     m n o p      If the user picks 2 for row (column is `null` for now), `e f g h` should highlight (using an outline). If they then pick 3 for column, only `g` should highlight. And so on for every combination. I know I can figure this out by making 25 separate images (one for each square + 4 rows + 4 cols + both null) and then load in the right image using ajax, but my question is if there is a better way or some sort of dynamic solution where I can draw over the image, or overlay another image in an intelligent fashion?


What is "The Cloud"? What do I say when people ask if my web service is "on the cloud"?

> **Possible Duplicate:**   >  What is "the Cloud" and how does it relate to development? First some context: I don't understand what people are asking when they ask "It it on the cloud?" Here is an example. I make a "website" with php that is two pages hosted on a dedicated linux box running apache. One has a form where you upload a file, and the second computes some stuff based on that file and coughs back an answer. Presumably you could call this an API as well if there is a check-box on the form to specify the response as human readable vs. XML. Is that "service" "on the cloud" or it is just a hosted service? Is gmail "on the cloud"? Is amazons S3 cloud "on the cloud" or is it "the cloud" or just "a cloud"? I'm pretty sure at this point that "on the cloud" is marketing jargon for "on the internet" Is there more to it than this? Should I ask this one on english.stackexchange? To differentiate my question from What is "the Cloud" and how does it relate to development? I am asking specifically how to answer the question I keep getting asked "Is it on the cloud?" without saying "What you are asking is meaningless." given the example of my little web service/API. Is every webpage "on the cloud"?


Freelancer websites and share source code with staff

How safe is sending project files via popular freelance websites? For example their staff/admins has unlimited access to tons of very valuable sources, what's the sense then to upload there something valuable?


Evolution of my MVC design with new UI complexity

I have a desktop instrumentation application in MVC. Currently I had 2 versions of the application, thus 2 views and 2 controllers, each having common code in a base class. The views react directly to events sent by the model, and the controller has a message queue for linking user actions to the model. Notably the message queue is common to the two controllers. In these two versions the UI logic is very simple, it's mainly reacting to buttons, passing parameters to the controller, and . In the next version I have some workflow tasks, so the UI will get more complex. I also want the initial versions to be still functional. Where do I put this complexity? Should I add another message loop that is in- between? Will it belong to the controller or the view? Where should I put the state of my workflow? Or should I build an intelligent view?


Junior developer introduction to job industry

I am a junior developer at my second working experience, the first one using PHP with WordPress and currently on Groovy on Grails. I like coding, I attend meetup to discuss technology etc but I still did not understand how to become a real professional with the "know how" attitude. I read Clean Coder, the author advises to spend 20 hours per week of my spare time to learn new technologies and to keep myself up to date. I do not find this realistic, if you want to have a bit of a social life, and I also noticed that learning at work, at least in the places where I worked, is not ideal. No support from seniors for new projects, no pair programming and code reviews, no company trainings, one hour a week tech meetings where seniors walk away after a bit because they already know the topic discussed and so on. Sometimes is quite hard to keep the motivation... My questions are:   1. Is our industry supposed to be like this? Is there real team working in the sense of sharing knowledge and help juniors to get up to speed?   2. Are we supposed to learn new technologies or technology features just in our spare time?Clean Coder says football players do not train during official matches and our working hours are like official matches, we should just perform and learn in other moments. Is it really like this?   3. How can I improve my skills with no support? Is it enough to read books and try out the exercises and perhaps some katas? In almost 5 month of Groovy on Grails experience at work, I have never had the opportunity to create anything from scratch, just worked on existing issues where it was even really difficult to get the domain knowledge from senior devs.


What should I do when I get stuck with a task for so long?

My team are using Scrum and we are new to this methodology. I use Essential Scrum as our guideline but I haven't finished it yet. On a chapter, it says the team should focus on idle tasks, not idle workers which I somewhat agree with it. Anyway, it doesn't say (at least on that chapter) what to do or how to solve it. What are some good suggestion about how to tackle idle tasks? **Update** Idle task in this context means a task that has been in progress for a lot longer than we expect, for example, if a task is estimated to be finish in 2 hours but it has been taking 6 hours and not sure when it will be finished.


Applying RESTful design to an entire website?

This all may come across very newbish, but I'm trying to wrap my head around designing a website that is thoroughly RESTful. I understand applying RESTful design to things like Users, Photos, Blog Posts, etc. because I think of them like "objects". But, what about an "about us" page. What kind of resource is that? Is it even a resource in the RESTful sense of the word? Also, say I go to the URL "http://www.example.com/", what resource am I asking for? The index resource?


Should a REST interface include the query ID as part of the response?

I am currently working an Android app that receives most of the displayed data from a REST interface. First, I request the information for a company the request includes a list of store IDs. With each ID I can then request the details for this store. As part of my app I can update the store opening hours and send them back to the server. For that, I obviously need the store ID to tell the server which store to update. Now, my question: The JSON object returned by {SERVER}/StoreDetails/{ID} does not include the the store ID. So I need to first fetch the JSON, parse it, and then manually add the store ID to the object - which I feel needlessly complicates my logic, as well as my model objects which now either need a setter of some kind of copy/update constructor when they could otherwise be totally immutable... Would it be/have been reasonable to include the store ID in the returned JSON object or is that considered redundant and a bad practice?


"Public APIs are forever: Only one chance to get it right"?

In an OS book I just read that, "Public APIs are forever: Only one chance to get it right". Is it true? Is it applicable only in APIs of Operating Systems or other APIs too? For example, will this be true for the APIs of Android Applications such as Tasker, Locale and Pushover?


What is the best way to store a table in C++

I'm programming a decision tree in C++ using a slightly modified version of the C4.5 algorithm. Each node represents an attribute or a column of your data set and it has a children per possible value of the attribute. My problem is how to store the training data set having in mind that I have to use a subset for each node so I need a quick way to only select a subset of rows and columns. The main goal is to do it in the most memory and time efficient possible (in that order of priority). The best way I have thought of is to have an array of arrays (or std::vector), or something like that, and for each node have a list (array, vector, etc) or something with the `column,line`(probably a tuple) pairs that are valid for that node. I now there should be a better way to do this, any suggestions? **UPDATE:** What I need is something like this: In the beginning I have this data:               Paris    4    5.0    True     New York 7    1.3    True     Tokio    2    9.1    False     Paris    9    6.8    True     Tokio    0    8.4    False      But for the second node I just need this data:               Paris    4    5.0     New York 7    1.3     Paris    9    6.8      And for the third node:               Tokio    2    9.1     Tokio    0    8.4      But with a table of millions of records with up to hundreds of columns. What I have in mind is keep all the data in a matrix, and then for each node keep the info of the current columns and rows. Something like this:               Paris    4    5.0    True     New York 7    1.3    True     Tokio    2    9.1    False     Paris    9    6.8    True     Tokio    0    8.4    False      Node 2:               columns = [0,1,2]     rows = [0,1,3]      Node 3:               columns = [0,1,2]     rows = [2,4]      This way on the worst case scenario I just have to waste               size_of(int) * (number_of_columns + number_of_rows) * node      That is a lot less than having an independent data matrix for each node.


Strategy for website with international strings

What things need to be considered for a Website that contains International strings, for instance Simplified Chinese and English mixed. UTF8 seems to me a natural choice, including a meta tag. Still, some users may only see white boxes. What is the best solution do deal with this? Currently I am thinking to provide an alternative image-based rendering, or even make it default. But IMHO this seems a weak solution. Or I could tell the user which OS/Browser combinations are known to work but such a list would probably be endless. Update: it's a Chinese learning site, most users will not have visited Chinese websites before


Storing documents in DMS

I need your opinions and suggestions about storing documents in a DMS system. I think the DMS should save its own copies of the documents, not their original path on the disk. So, the DMS should have its own space to write on. But what about the way they're stored? Do they have their own extension different from the original one? What about the algorithm that stores them? What about the algorithm that retrieves them? What do you suggest??


Default values - are they good or evil?

The question about default values in general - default return function values, default parameter values, default logic for when something is missing, default logic for handling exceptions, default logic for handling the edge conditions etc. For a long time I considered default values to be a "pure evil" thing, something that "cloaks the catastrophe" and results in a very hard do find bugs. But recently I started to think about default values as some sort of a technical debt ... which is not a straight bad thing but something that could provide some "short term financing" get us to survive the project (how many of us could afford to buy a house without taking out the mortgage?). When I say a "short term" - I don't mean - "do something quickly first and do refactor it out later before it hits the production". No - I am talking about relying on a hardcoded default values in a production software. Granted - it could cause some issues, but what if it only going to cause a single trouble in a whole year. Again - I am talking about the "average" mainstream software here (not a software for a nuclear power station) - the average web site or a UI application for the accounting software, meaning that people lives are not at stake, nor millions of dollars. Again, from my experience, business users would rather live with the software which "works somehow", rather then wait for a perfect one. And the use of default values helps a lot if you develop a software in a RAD style. But again - the longest debug sessions I have spent were because of the bugs introduced by a default value which either stopped being "a default" along the way or because a small subsystem has recently been upgraded and as a result of this upgrade it does not handle the default correctly (e.g. empty list vs null, or null string vs empty string). So my question is - are the default values good or evil. And if they are a technical debt - how do measure up how much you can borrow so you can afford the repayments? Would really appreciate any input. Cheers. EDIT: If I am using the default values as a way to cut the corners during the development - and if the corners cutting results in a bugs and issues - what is the methodology to recover from these issues?


Most suitable data structure for in-memory string -> int conversion for variable length strings

My project involves validating and normalising email addresses in this format [userpart]@[domainpart].[tld] After syntactic validation of the address, [tld] is checked to exist, otherwise the validation fails. After validation, [userpart] and [domainpart] are normalised into a 32-bit numeric ID called [partid] (one for each part), partid and the part string are permanently stored on disk when new strings are discovered. 4 bytes seems the most sensible for each as 3 bytes is not enough (there are around 200 million registered domain names just now). To process lists of new emails quickly, I've been using Judy arrays (JudySL to be exact, http://judy.sourceforge.net/doc/index.html) , where the part string is mapped to the part id. I've used Judy Arrays as I know how to use them and they generally perform well, although they are not thread safe which is a slight drawback (I use mutexes to get round that). There's no collisions that I'd get with a hash table... which reduces complexity somewhat. However they seem to be taking up a much larger proportion of memory than I'd like, so my question is what would you suggest as a better storage method? Example case:   * 64-bit system (Debian based)   * 150,000,000 "parts", averaging around 8 bytes each, 12 bytes total when including the partid   * ~1.67GB for that data in itself   * ~5.1GB used by Judy   * Perhaps worth noting that the emails are evaluated after being converted to punycode format.   * Input would come in lists varying between 10K and 1M rows   * Inserts on-demand, when a new [part] is found, ++partid is assigned as its partid and partid,part are written to disk   * No deletes required, only inserts and lookups. So I need around 3x more memory than disk space in order to convert [~8-byte- string] to an int. Is there any better(*) data structures that I should be considering? (* by better, I'd hope for reasonably fast, with a smaller memory footprint and preferably something pre-written like a library...) **Update** The TL;DR of my original question... converting a variable length string to a 32 bit INT. Strictly speaking the userpart is case sensitive but from what I understand the standard implementation is to ignore case. In that case (no pun), there are 56 valid characters in either punycoded domain part, or 6 bits worth. I'm thinking I can sacrifice 1-bit to indicate direct conversion of string->int without a lookup table, which will allow conversion back too. The bit would be switched on when this can occur and would prevent collisions with lookups, leaving 31 bits for data, and 2^31 IDs for all other domain parts that don't fit. I was messing around with fixed length 4-5-6 bit length codes based on the least frequent character, but huffman encoding would seem to (obviously?) win out in the long run and avoids a 2nd pass of the input string. Here's some data based on the char distribution across those 150m parts. http://pastebin.com/DTrUWSna Huffman manages to have yahoo, gmail and even hotmail squeezed into 31 bits which is excellent. 6.1% of all parts can be mapped this way. With the same huffman encoding, a further 70.5% can be mapped to 63 bits which'd allow a fixed length int key->value list. This should save on memory (I'll try report back) That leaves less than 25% of all parts to be mapped still. This new layout should help a lot for saving on memory, thanks for the suggestions so far.


Naming a "do X if needed" method

What is a good way to name a method that checks if X needs to be done, and does X it if necessary? For example, how to name a method that updates a user list if new users have logged in? `UpdateListIfNeeded` seems too long, while simple `UpdateList` implies a possibly expensive and unnecessary operation is done every time. `EnsureListUpdated` is a variant as well. C# has a `bool TryXXX(args, out result)` pattern (e.g. `int.TryParse(str, out num)`) to check if X is **possible** and do it, but that is subtly different.


Can I use code in my own projects that I have written for someone else?

In the past I did a freelancing project for someone where I wrote a couple of image filters. Nothing fancy, and a very very low cost project for them. I was wondering, if I wish to use these in a project of mine, would I legally/ethically be allowed to do that? If I couldn't use the exact code, could I at least use the general data I used to make them. (I modeled the filters in Photoshop and then coded a duplicate filter in a programming language.) My specific work was done through freelancer.com and we had no special terms or conditions.