Designing a Database Application with OOP

I often develop SQL database applications using Linq, and my methodology is to build model classes to represent each table, and each table that needs inserting or updating gets a Save() method (which either does an InsertOnSubmit() or SubmitChanges(), depending on the state of the object). Often, when I need to represent a collection of records, I'll create a class that inherits from a List-like object of the atomic class. ex.               public class CustomerCollection : CoreCollection<Customer>     {          }      Recently, I was working on an application where end-users were experiencing slowness, where each of the objects needed to be saved to the database if they met a certain criteria. My Save() method was slow, presumably because I was making all kinds of round-trips to the server, and calling DataContext.SubmitChanges() after each atomic save. So, the code might have looked something like this               foreach(Customer c in customerCollection)     {        if(c.ShouldSave())        {            c.Save();        }     }      I worked through multiple strategies to optimize, but ultimately settled on passing a big string of data to a SQL stored procedure, where the string has all the data that represents the records I was working with - it might look something like this:               CustomerID:34567;CurrentAddress:23 3rd St;CustomerID:23456;CurrentAddress:123 4th St      So, SQL server parses the string, performs the logic to determine appropriateness of save, and then Inserts, Updates, or Ignores. With C#/Linq doing this work, it saved 5-10 records / s. When SQL does it, I get >100 records / s, so there is no denying the Stored Proc is more efficient; however, I hate the solution because it doesn't seem nearly as clean or safe. My real concern is that I don't have any better solutions that hold a candle to the performance of the stored proc solution. Am I doing something obviously wrong in how I'm thinking about designing database applications? Are there better ways of designing database applications?


Funding Agile Projects

The company I work within is tentatively moving towards an Agile project management strategy - having experienced the "joys" of waterfall one time to many. Key to this is a shift in emphasis towards delivering functionality as opposed to meeting hard deadlines. While the development process and client relationship has certainly improved by the iterative releases fostered through Agile , it is proving somewhat harder to apply the same rationale to the funding strategies for the project. Clients are often unaccustomed to concepts like Agile, and express great concern with **what they percieve** as a case of "it'll be ready when it's ready". I would like to hear people's thoughts and experiences in funding Agile projects **edit:** I want to stress that _I am not asking folks to explain the pros and cons of the Agile method_ to me, nor that I believe Agile equates to "it'll be ready when it's ready", this is a fear expressed by the clients/businesses I've worked with when advocating Agile development practices. What I am interested in is the experiences people have had resolving the conflicts between "traditional" waterfall budgeting methods entrenched in business client/relationships and more progressive development methods - and the budgeting strategies they have adopted to support that evolution.


Collaborative work (small team) - Best practices

I'm currently working in a very small team of programmers (2-3) and I'm looking for advices/best practices on how to organise our work. We're all working on the same application using PHP. Today we're kind of all working on our way. **Today situation:**   * List item that have to be worked on by each dev 1/week. What has to be done is defined at a high functional level (ex: Build the search engine for this product..)   * Commit / merge our individual branches (git) every week before the next meeting   * No real dev rules, no code review    * No test written (aouutch) **Problems faced:**   * Code quality issue: discovering someone else code is sometime tough (inline, variable+function+class names, spaces, comments..)   * Changes in already existing classes (impact on someone else work)   * Responsibility of each dev unclear: after getting someone else code   and discover something messy, should I make the change? Should he   make the change? How to plan those things,... **What I'm looking for:** Basically I'm looking into structuring the way we develop things in order to avoid frustration and improve overall quality.   * How to define coding standards (naming convention, code rules...)? Do you you any validation script to make sure code is valid before committing?   * Do you think that defining an architect role in the team is needed? Someone that would actually define what has to be developed during the next phase. By defining interfaces or class descriptions that have to be written. (Does it make sense in such a small team?) Today we're losing time into understanding what others did or tried to do, we're also losing time in discussion like "you should have done it that way! Why is this class doing that and not that..? Shouldn't we have a embedded class rather that this set of data...". I'm looking into a work process, maybe with more defined responsibilities and process in order to improve our performance. If you have experience, advices, best practices or anything to share that we could benefit from it will be much appreciated! Thanks a lot for your time!


Can a fresher from a college write design patterns under "area of interests " in resume?

I have keen interest in design patterns. I have been reading a lot about them. Specially, from HEAD FIRST. Can I write about design patterns in my resume? I am a fresher. Going to sit in on-campus placements. Though I think that would impress the interviewer if i am able to defend his questions but, on the other hand I think there can be three points I am worried about:   1. He might ask too deep questions to show me that I have written a wrong point.   2. He might not know about design patterns.   3. Besides he may ask of design patterns that are not in Head First.   4. he bounces on J2EE design patterns, which I am afraid to study right now. Anyways, what i am asking is. do the people who come to on-campus placements for taking interviews have any knowledge about design patterns? If they do, then how much. I am a bit afraid to put this on my resume.


Design principles - data conformance / business logic in the data access layer?

I'm working on a small webservices project (java, axis2..). There is a lot of existing code, the code is divided into many layers, from the first layer where the request in interpreted to a few layers down to the dao layer. In the dao layer I'm seeing some validation code interspersed in a few places. The project contains tables which have multiple unique columns, so the user may input a single column or a combination of columns. The validation in dao layer is to check if such a combination exists, if not throw an exception. I was told these kind of checks are more related to the schema and hence need to be in the dao layer. The dao interface has methods like 'checkIfThisExists/checkComboExists', Would this be a 'proper' design? I always thought the dao's job should only be to send and receive data, more like get and set.


Collaborative coding chat options

Hi guys : Are there any established online sites for collaborative coding ? I have a github project with 5 developers, in different areas - we need somewhere that we can all "hangout" at.   * Right now we use group skype, but skype is designed more for family/social communication , and doesn't work on linux.    * IRC is okay, but its a little difficult to use for novices.   * an interface like yammer, twitter, facebook would be ideal, but also, we would want it to be real time (not requiring page reloads etc...)


How can I get the team that I work with to communicate synchronously?

Okay, so I work on a team of 4 people. We're spread all around the country, and when we communicate, it's either through email or our issue tracker. That's okay most of the time, but I feel like I spend a lot of time waiting for people to reply to my emails/comments on tickets. That's a real productivity kill for me, since in the 5 or so minutes it takes to get a response, I usually start doing something else. I'd like to start using some kind of synchronous (i.e. instant) form of messaging so that we can communicate faster. I was thinking that I could set up a private IRC channel, but I'm not familiar with the ins and outs of hosting this and I'm not sure I could sell this to some people on the team. I also like the idea of being able to convey _status_ to everyone else -- show that you're available by being in the channel, and then set statuses (e.g. "working on x issue" or "eating lunch" while in the channel). Are there any no- or low-cost options (some time cost is okay, just not monetary) that will allow us to instantly communicate as a team, much like an IRC channel would allow? Some priorities:   * We all have to be able to chat at the same time or PM each other if needed   * Privacy is, of course, important   * It has to be relatively easy to set up or it won't get adopted   * It has to be low-cost Also, any thoughts on instant communication in general? I'm interested in any support for my theory as well as any criticism.


Schema Design : Advice Needed

I have a distributed data collection system where I have first layer as regional Databases where all collected data is initially stored and master database where all the data is consolidated, what are you thoughts on schema design of this situation, also important thing here is I could have overlapping Ids and dictionary tables are shared by all regional db and also in future there could be need to add new regional Dbs. I am not sure how to start on designing the schema for this situation and would like to discuss with SO Community ?


Declaring functions as final... except when it is me who does the deriving

I have a class in which I want to disallow other programmers from overriding one of it's methods, since it requires special knowledge of the inner workings of the class. Since I personally know how the class works, I would like to be able to make an exception and actually DO override the function in one derived class. Is this a common problem to which there is a standard solution, or does the fact that I feel like I have to make an exception like this mean I should rethink my approach? Edit: I didn't mention languages, since I was looking for a general answer, but since it was requested, this came up using PHP.


Variable type object

Is there a language with something like the following construct?               var_type(TYPE_1, TYPE_2,..., TYPE_N) obj;      and now its possible to:               TYPE_17 staticTypeVariable17;     obj = staticTypeVariable17;          TYPE_3 staticTypeVariable3;     obj = staticTypeVariable3;      without `obj` being a pointer of some base class and with no need for casting if the types used are from the predefined set. So basically an object that can switch it's type amongst a predefined set of types.


How are functions called when passing ++

I don't understand what is passed to the function f() when I call it like this.               main()     {       void f(int,int);       int i=10;       f(i,i++);     }          void f(int i,int j)     { printf("%d %d",i,j); }      gives me 11 10 .Can somebody explain why its 11?


Career stability or tech skill growth?

For the last 3 years, I've been working as the lone .NET software developer in a large non-tech, manufacturing company. The work conditions and the pay are great, and it is a very stable position, particularly considering that this is my first full-fledged development job. In my group, there's the IT Manager, an IT-Network Engineer, Help Desk staff, and myself. The problem I'm facing is that, since most of my work is fast application development projects (simple CRUD apps, web charts and database interfaces) I feel like my tech skills are stagnating, as I don't really get to do anything overtly complex. Many times, it's just the rehashing of something I've already done. It is very frustrating to read and research about frameworks and methodologies that, while great for larger projects, would amount to overkill for the stuff that is needed here. And with a family to return to every day after a 80 min commute, putting this to use in personal side projects is very complicated. I'm not sure what path to follow: if I stay, I have great job stability, but will probably move on to something I don't really want (I've been informally anointed, against my wishes, as the next IT Manager, but that's not going to happen for at least 5 more years), and if I leave, I get uncertainty and significant pay cut, as I don't have the skill set needed for dedicated dev teams / projects. I feel like I'm trapped in a big company environment, yearning for the action and dynamics of smaller shops. Anyone else in the same position? How did you manage to overcome the gaps between your skills and those required by the market? Did you stay at Big Corp, or moved to a smaller company?


How do you handle database security from a desktop application?

For about 10 years I've worked on various in-house desktop client applications with SQL Server data stores. Rarely did I start these projects - most are takeover work. One thing that seemed constant everywhere was that there was a single global SQL Server user account that this application used that granted it permission to the common database, and yes in some naive situations it used the `sa` user account, which I generally tried to fix when possible. You can't really effectively hide this username and password that the application uses to access the database. They're usually stored in an `ini` or `config` file, or possibly baked into the executable itself. In all cases, they're visible to the user if they do a little digging. In one case we actually used a `config` file but encrypted it, but of course the encryption key had to be stored in the executable (we weren't naive to the limitations of this, but it did effectively stop people from poking around who were savvy enough to look in `config` files). All of these systems had a user-authentication system built into the application, but of course they were all managed through the application itself, meaning the user information was stored in the database. The application restricted what things you could do based on your access level, but it's all kind of moot if you can just connect to the database and run ad- hoc queries. I'm interested to know what other systems do to get around this problem. Here are the options I know of:   1. Use SQL Server's security mechanism to maintain a user and roles list, and make the desktop application add and remove users through T-SQL queries.   2. Instead of connecting directly to the database, create some kind of web service that runs on the server and put the authentication logic in there. Make every request do security validation. The first options is a bit ugly because you're separating users from the database so users are no longer first class entities and you can't reference them with foreign key relationships, etc. The second just seems like a major performance problem, and a lot of extra work, plus you can't as easily use ORM mappers like NHibernate (I think). Does anyone have experience with this? Best practices? **Edit** Thinking a bit more, can SQL Server Authentication actually solve this problem? For instance, if your user must be able to insert and update timesheet records so you can edit your timesheet, there's no way SQL server can disallow access to other rows in the timesheet details table, meaning you can read and write _other_ people's timesheets too.


How fast should a web response be?

I've heard a few times that every extra [number1] milliseconds it takes to process a web request and return a response will lose you [number2] percent of users. Is this just "conventional wisdom," or have there been actual studies on the subject? And has there been found to be a lower bound to this phenomenon, like "[number3] milliseconds is fast enough, improving further than that won't hold any more users"?


User intentions analysis

I'm going to work on some project that would do a user-action recognition based on what he/she does in the system. As far as I understand there are two main parts here: Intercept the user actions (say http traffic in web/ui interaction in thick- client) analysis of user intentions. While the first part is rather technical and therefor easy to implement, the second one is AI related and can be academic. So I was wondering whether someone knows some third-parties/academic projects that would implement the 'action-recognition' stuff?


How to license a whole package without writing it into every file?

Is there a way I can make the license I use for an open-source software package be valid for all contents of the package without having to write it into every single file? I often saw a `LICENSE` file, but does this file (with the license in it) makes all contents of the package (i.e. the current directory and all sub- directories) use this license?


Career in Embedded Systems For CS Major

I'm entering my last few semesters of a CS degree and looking to start a career in Embedded Systems. From talking to a lot of people it seems like I might have been better off with a Computer Engineering degree but it is a bit late now. I am wondering what I can do to make myself employable in an embedded systems job in about a years time. I have taken a good number of computer architecture type courses as part of my degree and am hoping to tailor my electives towards embedded systems but it may not be feasible. What sorts of solo projects could I work on to get my chops up? I have an Arduino Uno but from what people have told me working with that doesn't really count. Can I access it at a lower level somehow? Are there books out there I can self study to learn more about embedded systems and the core knowledge I'll need to know? Is there some other cheap hardware kit I can buy to hack on that will be better than Arduino? Basically, how do I guarantee myself being an employable Jr. Level Embedded Systems Engineer in about a years time so I don't get stuck having to take a boring Java or Web App job?


Hudson or Jenkins

We have been using Hudson for quite a while and we loved it. Now many Hudson- developers have "left the building" to create their own: Jenkins (which means the project has been forked). As Hudson/Jenkins users, we are now worried whether we should opt for the original "big and stable" producer Oracle, or the "small and dynamic" newcomer Jenkins. **EDIT** : Our worries are mainly due to the fact that we did not really hear about this fork/split through any official ways. It looks like a guerilla action including the hijacking of logos and trademarks (after all, the copyright must be at Oracle, no? I'm not sure). So we're kinda missing professionalism here, as in well-organised course of action involving press relases, etc. Maybe we just missed that... What are good objective reasons to decide for either project in the future? Can we postpone that decision until later, or is that too risky? Here's one opinion about this: http://www.itworld.com/development/136173/more- concerns-surface-hudson-jenkins-split Why did you choose either one?


A little confused about Trac

I'm learning about the open source web based project management tool Trac and I'm a bit confused about its role in the area of reporting defects vs bug tracking. For those unfamiliar with Trac itself, it has a Ticket system which is the tool used to report issues, and you can choose between reporting a task, an enhancement, or a defect. It's that last option that I'm confused about. I get the impression that Trac is not meant to be a bug tracking tool, but if that's the case then what is the defect field for? I looked at the way the Trac team uses their own system, and it does _look_ like they post some things that appear to be bugs, but for the most part it's other kinds of issues, and that actually blurries the distinction for me even further. Can someone explain to me how the "defect" option is to be used? Is defect==bug? Should tickets be opened for bugs?


Fast lookup for organization hierarchy

I need a way to implement a fast lookup algorithm / system to find users very quickly in a multi-level department and multi-level employee/manager relation organization structure. Departments can have any level of departments and users directly connected to departments. User are connected to departments and other users at the same time. What would be the best approach to implement such a system? There will be approximately 2000 users and 30 departments. Is there a good way to hold all of this information on memory?


Is there an official standard regarding user password storage practices?

I recently used a government service that I had an account for from years ago. I couldn't remember my password for the service so I used the "forgot password" link and was astonished to see that this government website sent my password to my email address in plain text. I'm personally aware of how to handle user passwords, and I sent some comments about my concerns through a feedback form (this is a government website. People use other online gov. services which deal with sensitive information, as well as the fact that most people use the same password or handful of passwords for everything (I know I do) and I suspect the same security practices are used throughout) which I got a prompt response for. They simply reassured me that "the Ministry has taken the necessary steps to protect password information, including storing them with the proper encryptions in place." I'd like to just say "well obviously you haven't taken the necessary steps if you're able to email my password to me" but I'm not trying to be rude, and I don't think my message would ever reach somebody who knows what I mean anyway. So I'd like to just state that "the necessary steps haven't been taken according to [some official security standard]" which might prompt someone to look into it. I did a quick search on OWASP but only found an article regarding plaintext storage. Is there a security standard regarding user password handling out there which prohibits (as I think it probably would) storage of retrievable password information? Even better: is there such a standard which _must_ be followed by websites dealing with sensitive information such as banks and government web services? I know I probably won't change anything but it's worth a shot IMO.


How does thinking on design patterns and OOP practices change in dynamic and weakly-typed languages?

There is a fairly helpful question already along these lines ("Non-OOP Design Patterns?"), but I am more curious about a transitional point of view for someone just getting started with dynamic and weakly-typed languages. That is: let's say I've been programming in C++, C#, or Java for many years, and absorbed lots of wisdom along the lines of the GoF design patterns, Fowler's _Patterns of Enterprise Application Architecture_ , SOLID principles, etc. Now I'm dabbling in Ruby, Python, JavaScript, etc., and wondering how my knowledge applies. Presumably I could do direct translations in many cases, but almost certainly that wouldn't be taking full advantage of my new setting. Duck typing alone turns a lot of my interface-based thinking on its head. What stays the same? What changes? Are there guiding principles like SOLID, or canonical patterns (perhaps entirely new ones) that a dynamic language newbie should know?


Should I modify an entity with many parameters or with the entity itself?

We have a SOA-based system. The service methods are like:   1. `UpdateEntity(Entity entity)` For small entities, it's all fine. However, when entities get bigger and bigger, to update one property we should follow this pattern in UI:   1. Get parameters from UI (user)   2. Create an instance of the Entity, using those parameters   3. Get the entity from service   4. Write code to fill the unchanged properties   5. Give the result entity to the service Another option that I've experienced in previous experiences is to create semantic update methods for each update scenario. In other words instead of having one global all-encompasing update method, we had many ad-hoc parametric methods. For example, for the `User` entity, instead of having `UpdateUser (User user)` method, we had these methods:   1. `ChangeUserPassword(int userId, string newPassword)`   2. `AddEmailToUserAccount(int userId, string email)`   3. `ChangeProfilePicture(int userId, Image image)`   4. ... Now, I don't know which method is truly better, and for each approach, we encounter problems. I mean, I'm going to design the infrastructure for a new system, and I don't have enough reasons to pick any of these approaches. I couldn't find good resources on the Internet, because of the lack of keywords I could provide. What approach is better? What pitfalls each has? What benefits can we get from each one?


Should integer divide by zero halt execution?

I know that modern languages handle integer divide by zero as an error just like the hardware does, but what if we could design a whole new language? Ignoring existing hardware, what _should_ a programming language does when an integer divide by zero occurs? Should it return a NaN of type integer? Or should it mirror IEEE 754 float and return +/- Infinity? Or is the existing design choice correct, and an error should be thrown? Is there a language that handles integer divide by zero nicely? **EDIT** When I said ignore existing hardware, I mean don't assume integer is represented as 32 bits, it can be represented in anyway you can to imagine.


In an MVC architecture, how closely coupled are the Model and View to the Controller?

I've got an app which uses MVC, but I'm struggling a little as to how the controller should be architected. For example, the View is only viewing some subset of the model's data at once. However, I'm unsure as to exactly how this should be arranged. Is it normal for the View or Model to directly call functions on the Controller, for example? Through some sort of interface? Or are they totally encapsulated and never know about the Controller or each other? Just as an edit; this is a custom app not written in any web framework, so I'm not looking for framework-specific details here and have the freedom to make my own choice.


Why don't we use dynamic (server-side generated) CSS?

As server-side generated HTML is trivial (and it was the only way to make dynamic webpages before AJAX), **server-side generated CSS** is not. Actually, I've never seen it. There are CSS compilers, but they generate CSS files which can be used as static. Technically, it requires no special libraries, the HTML _style_ tag should reference to the PHP(/ASP/whatever) templater script instead of the static CSS file, and the script should send out CSS _content-type_ header - that's all. Does it have cache problems? I don't think so. The script should send out _no- cache_ etc. headers. Is it problem for designers? No, they should edit the CSS template (as they edit the HTML template). Why we don't use dynamic CSS generators? Or if there's any, please let me know.


How to talk to management about using integrated project management/bug tracking

**Background:** I have just started at a new shop, where there is one other developer. This shop was not historically a software shop, and their software development process really shows it. They recently started using subversion (although most of the code is not in a repository), and they do not have a bug tracker. They sell desktop software, and more recently mobile GPS devices with proprietary software. This seems pretty unsustainable. **My problem:** My manager seems amenable to installing Trac and integrating it with subversion. He's asked me to write a proposal for the company owners about it to justify why I might spend my valuable time fiddling with a Trac installation, and why we might change the development process to include formal bug reports and feature requests. I have been trying to come up with reasons that matter to people other than me (e.g., not: "So I can see the whole story about why someone wrote this now- buggy code.") and sort of falling flat. I'm not a manager, and I don't know a lot about managing things. I just want to avoid the headaches attendant with coding in the wild west. **My Question:** How do I (politely) tell managers that it's in their best interest to use Trac?


Is too much whitespace a bad thing?

I'm often told by my friends and colleagues that I use way to much whitespace. I guess I do use a little _too_ much whitespace. I often add a line break almost after every line and large blocks of whitespace, often 3 or 4 lines because it helps me see what I've written and understand what I've written when I look back on it at a later time. I also think it just looks cleaner. Although I can see two issues with this, 1) It can increase the file size of the source files, even just a line break every two or three lines can add up in a long file. I know that a good compiler will optimize all the white space out (I'm not actually sure, I think LLVM/Clang does this) but the source file is still large. And 2) it may cause some people to think I'm embellishing my code to make it look longer and "bigger" to make others think I'm doing more work than I actually am (consider 3000 lines vs. 6000 lines, 3000 being newlines). Which I am not doing that by the way. Is using too much whitespace bad from a technical standpoint and/or a professional standpoint?


How do I go about choosing a development lifecycle model model?

Based on this question about alternatives to the agile philosophy and its answers and comments I thought it might be useful to discuss what goes into the decision of what "methodology" to use when at the start of the project. Seems the consensus is that if what you are building requires exact specifications that waterfall is the way to go over agile. That seems to leave a HUGE space for agile development. Beyond "this is how are shop develops software" are there questions or "indicators" at the early planning stage that might give a better indication of what might work best for the client/project? Like with languages the idea is best tool for the job so as professional developers what do you do to make sure you're using the correct development methodology for a project you're about to start? Is it really as cut and dry as "if it's a bridge or nuke reactor type project use waterfall else use agile? I am a self taught programmer working for company that gives a lot of flexibility and they put a lot of trust in me so this kind of question is important to me. I want to make sure I am addressing my work/projects in the most efficient cost/time manner as possible.


Should I use different projects for building different layers in a 3-layer model?

I am creating a new project from scratch and have decided to use a 3-layer model. I am using:   * the 1st layer for business entities,   * the 2nd layer for business logic,   * and the 3rd layer for data logic layer. Do I need to create different projects for these different layers or do I need to create different _folders_ in one project? What are the pros and cons of both approaches?


Difference between mutex in windows and linux

Is that correct that a mutex object in Linux cannot be used for cross process synchronization as opposed to its Windows counterpart? If that is true - what was the idea to limit mutex synchronisation functionality on Linux?


git in non-distributed, independent, lone programming ...best practice(s)?

I am currently studying the git documentation to get a hang of distributed version control workflow and use of git command line. I want to first start using git with small, personal, pet projects so to gain experience before doing it on large scale (i.e., bigger projects, team dev). What areas of the git system should I, as a lone player, devote most of my study time to... what parts should I leave for the larger scale work later on. In other words what features of the git system will fully be grasped in team work only, and therefore should not be too involved with at an individual level?


I heard about the Supreme Court's decision today in the Microsoft vs. i4i case, so I read the relevant patent and was surprised it appears to just keep formatting codes in a separate table with pointers instead of leaving the formatting codes embedded in the text. I'm surprised no one else did that before 1998, thereby invalidating the patent, and that Microsoft couldn't uncover an example of such a system. I recall a micro-based word processor a friend and I were going to build in the 70's (never finished because the hardware never worked), and I definitely considered the tradeoff between keeping format stuff separate vs. embedded, so I would think someone in the subsequent 20 years (if not before) did likewise and actually wrote such a system. Didn't anyone implement formatting codes separate from the text before 1998?


When counting function points, is my website menu an External Input?

I'm doing a function point count for a large website. Does the main website menu count as an External Input? I'm doing a function point count as described in this article. If so, since you only click on one menu item at a time, I assume the number of DETs == 1?


Linux OpenGL programming, should I use GLX or any other?

I'm new to OpenGL and found that there are a lot of libraries to do that in C, and I also found that glx is most friendly with Linux X Server, I just want to do basic stuff, and I cannot find any tutorials for GLX. Is GLX a bad thing? I just want to do some small graphical things without installing many libraries and getting confused. Can anyone suggest me something which has tutorials and simple to compile? I found a link with an example with GLX and it worked perfect with no errors: anyone please suggest where I can find nice documentation or any better libraries.


CTO has left — codebase is a huge kludge, any advice on how to manage/handle/damage control?

I began work at a company 2 months ago as a PHP developer. I stepped in to somewhat of a kludge, but I've yet to find a company that isn't... The development stable is currently two developers (including myself) who will act as the interim CTO while the company seeks out a replacement CTO. The company is a news site that runs on top of an inhouse WordPress theme with enhancements in the form of arbitrary plugins, features built into the actual theme, and plugins some built in-house and some 3rd party ((some whose core code has been modified, which renders upgrading a nightmare). No coding standards have been upheld in the creation of the WordPress code and it appears that it has been a number of developers managing the code and no two components are completed using the same methodology, which is beyond a huge mess when it comes to debugging. I am the "WordPress" developer. The other developer is in charge of the latest foray which is developing an e commerce platform to complement the news site, which will be run on top of Magento. As the only WordPress developer I am handling all bugs and feature requests on a prioritized basis - I am interacting with business directly to hammer this out. The biggest issue I foresee is any bug/enhancement/project that is deemed a priority and requires a significant amount of work (read: 1 week+) becomes a bottleneck and essentially nothing can get worked on until I complete the project. They say that they understand that now but I foresee that becoming an issue when they actually see it in practice. I am looking towards the future and fully expect it to become a stressful situation (14+ hour days 7 days a week anyone?) - which is something I need to avoid at all costs. Until we restaff a CTO or I am considering proposing that I write up coding standards for the WordPress development and utilize odesk or another outsourcing solution for handling feature requests - ensuring they conform to the standards set forth. In the proposed environment I will (a) manage the odesk developers (ensure I communicate exactly what is needed, ensure they are coding to proper standards) (b) handle any quick feature requests / bug fixes (c) begin refactoring the WordPress code so that it conforms to the aforementioned in-house coding standards - to get us to a manageable state. The company has used outsourcing solutions in the past, so I am confident that the idea of using one would not be an issue. At this point I am only forumlating the plan to propose to management -- not yet thinking of HOW to do what I accomplish - I just want to get the full OK from them before doing that. What are your thoughts on this plan? Is there anything else that I should think about/consider? Thanks.


Storing n-gram data

(hopefully I landed on the right stack exchange site) I was hoping to brainstorm a little bit on the subject of storing n-gram data. In my project, I am trying to solve linguistic problems where I know all ( _n_ -1) data items and want to statistically guess my _n_ using linear interpolation over all applicable n-grams. (Yes, there is a tagger that assigns tags to known words according to its lexicon and a suffix tree that tries to guess the word kind for unknown words; the n-gram component discussed here will be tasked with resolving ambuguity.) My initial approach would be to simply store all observed n-grams (for _n_ = 1..3, i.e. monogram, bigram, trigram) data in respective SQL databases and call it a day. But the requirements of my project may change to include other vector lengths ( _n_ ), and I would like my application to adapt to 4-gram without a lot of work (updating schema, updating application code, etc.); ideally, I would simply tell my application to work with 4-grams now without having to change code much (or at all) and train its data from a given data source. To sum up all requirements:   * Ability to store _n_ -gram data (initially for _n_ = {1, 2, 3}   * Ability to change what kinds of n-grams should be used (between application runs)   * Ability to (re-)train n-gram data (between application runs)   * Ability to query the data store (e.g. if I have observed A, B, C, I'd like to know the most frequently observed item for what might follow using my trained 4-, 3-, 2-, 1-gram data sets) The application will most likely be read-heavy, data sets most likely won't be retrained that often   * The solution employs the .NET Framework (up to 4.0) Now what design would be better fit for such a task?   * A fixed table managed by a SQL server (MSSQL, MySQL, ...) for each _n_ (eg. dedicated tables for bi-grams, tri-grams, etc.)   * Or a NoSQL document database solution that stores the first _n_ -1 as the key of the document, and the document itself contains the _n_ -th value and observed frequencies?   * Or something different?


Why is x=x++ undefined?

It's undefined because the it modifies `x` twice between sequence points. The standard says it's undefined, therefore it's undefined.   That much I know. ### But why? My understanding is that forbidding this allows compilers to optimize better. This could have made sense when C was invented, but now seems like a weak argument.   If we were to reinvent C today, would we do it this way, or can it be done better?   Or maybe there's a deeper problem, that makes it hard to define consistent rules for such expressions, so it's best to forbid them? So suppose we were to reinvent C today. I'd like to suggest simple rules for expressions such as `x=x++`, which seem to me to work better than the existing rules.   I'd like to get your opinion on the suggested rules compared to the existing ones, or other suggestions. ### Suggested Rules:   1. Between sequence points, order of evaluation is unspecified.     2. Side effects take place immediately.   There's no undefined behavior involved. Expressions evaluate to this value or that, but surely won't format your hard disk (strangely, I've never seen an implementation where `x=x++` formats the hard disk). ### Example Expressions   1. `x=x++` \- Well defined, doesn't change `x`.   First, `x` is incremented (immediately when `x++` is evaluated), then it's old value is stored in `x`.   2. `x++ + ++x` \- Increments `x` twice, evaluates to `2*x+2`.   Though either side may be evaluated first, the result is either `x + (x+2)` (left side first) or `(x+1) + (x+1)` (right side first).   3. `x = x + (x=3)` \- Unspecified, `x` set to either `x+3` or `6`.   If the right side is evaluated first, it's `x+3`. It's also possible that `x=3` is evaluated first, so it's `3+3`. In either case, the `x=3` assignment happens immediately when `x=3` is evaluated, so the value stored is overwritten by the other assignment.   4. `x+=(x=3)` \- Well defined, sets `x` to 6.   You could argue that this is just shorthand for the expression above.   But I'd say that `+=` must be executed after `x=3`, and not in two parts (read `x`, evaluate `x=3`, add and store new value). ### What's the Advantage? Some comments raised this good point.   I certainly don't think expressions such as `x=x++` should be used in any normal code.   Actually, I'm much more strict than that - I think the only good usage for `x++` in as `x++;` alone.   However, I think the language rules must be as simple as possible. Otherwise programmers just don't understand them. the rule forbidding changing a variable twice between sequence points is certainly a rule most programmers don't understand.   A very basic rule is this:   If A is valid, and B is valid, and they're combined in a valid way, the result is valid.   `x` is a valid L-value, `x++` is a valid expression, and `=` is a valid way to combine an L-value and an expression, so how come `x=x++` isn't legal?   The C standard makes an exception here, and this exception complicates the rules. You can search stackoverflow.com and see how much this exception confuses people.   So I say - get rid of this confusion. === Summary of Answers ===   1. Why do that?   I tried to explain in the section above - I want C rules to be simple.   2. Potential for optimization:   This does take some freedom from the compiler, but I didn't see anything that convinced me that it might be significant.   Most optimizations can still be done. For example, `a=3;b=5;` can be reordered, even though the standard specifies the order. Expressions such as `a=b[i++]` can still be optimized similarly.     3. You can't change the existing standard.   I admit, I can't. I never thought I can actually go ahead and change standards and compilers. I only wanted to think if things could have been done differently.


Any one ever heard of the term collapsed Backbone? Could it be a virtual network that could be referred also to this term.


Software bug/defect classification

We're trying to come up with terms that better describe our bugs/defects. To us, the term 'bug' or 'defect' is too generic and doesn't accurately reflect what is happening. For example, instead of saying that there is a bug (in the general sense), we'd rather say what type of bug (an error, or enhancement, or improvement, etc.). What names do you use for describing 'bugs'? We found http://www.softwaredevelopment.ca/bugs.shtml which has some pretty good classifications. How do you classify them?


Asset licensing and GPL compatibility

If I want to bundle fonts and images with an application released under the GPL, are there specific requirements for the license of these assets?


Are there any alternatives to Hibernate Envers 3.6.2.Final?

I'm currently evaluating Hibernate Envers 3.6.2.Final; an auditing module part of Hibernate. As far as I am in my evaluation, I feel a _little_ disappointed by Envers. I would expect much more from it :   1. More _clear_ documentation     * The documentation is sparse or unclear; lack of small drawings in the document   2. More activity from the community     * I have waited two days for having an answer from... the creator on the forum. Is he a busy man or there is nearly no people out there?   3. Much powerful and flexible API     * Querying the historical data is painful. I have to rely on direct SQL to achieve a simple "select field, count(id) from table_aud group by field" Do you know any equivalent or do you want to share your thougths with me ?


Is this right in the use case of exec method of child_process? is there away to cody the envirorment along with the require module too?

I'm learning node. I am using child_process to move data to another script to be executed. But it seem that it does not copy the hold environment or I could be doing something wrong. To copy the hold environment --require modules too-- or is this when I use spawn, I'm not so clear or understanding spawn exec and execfile --although execfile is like what I'm doing at the bottom, but with exec... right?-- And I would just love to have some clarity on this matter. Please anyone? Thank you. **parent.js** -               "use strict";          var fs, path, _err;     fs = require("fs"),      path = require("path"),      _err = require("./err.js");               var url;     url= process.argv[1];          var dirname, locate_r;     dirname = path.dirname(url);     locate_r = dirname + "/" + "test.json";//path.join(dirname,"/", "test.json");          var flag, str; flag = "r", str = "";     fs.open(locate_r, flag, function opd(error, fd){         if (error){_err(error, function(){             fs.close(fd,function(){             process.stderr.write("\n" +              "In Finally Block: File Closed!" + "\n");});})}         var readBuff, buffOffset, buffLength, filePos;         readBuff = new Buffer(15),         buffOffset = 0,         buffLength = readBuff.length,         filePos = 0;         fs.read(fd, readBuff, buffOffset, buffLength, filePos,         function rd(error, readBytes){             error&&_err(error, fd);             str = readBuff.toString("utf8");             process.env.str = str;             process.stdout.write("str: "+ str + "\n" + "readBuff: " + readBuff + "\n");             fs.close(fd, function(){process.stdout.write(                 "Read and Closed File." + "\n"                 )});             //write(str);             //run test for process.exec**             var env, varName, envCopy, exec;             env = process.env,             varName,             envCopy = {},             exec = require("child_process").exec;             for(varName in env){                 envCopy[varName] = env[varName];             }             process.env.fs = fs,             process.env.path = path,             process.env.dirname = dirname,             process.env.flag = flag,             process.env.str = str,             process.env._err = _err;             process.env.fd = fd;             exec("node child.js", env, function(error, stdout, stderr){                 if(error){throw (new Error(error));}         });         });     });      **child.js** -               "use strict";          var fs, path, _err;     fs = require("fs"),      path = require("path"),      _err = require("./err.js");          var fd, fs, flag, path, dirname, str, _err;     fd = process.env.fd,     //fs = process.env.fs,     //path = process.env.path,     dirname = process.env.dirname,     flag = process.env.flag,     str = process.env.str,     _err = process.env._err;               var url;     url= process.argv[1];          var locate_r;     dirname = path.dirname(url);     locate_r = dirname + "/" + "test.json";//path.join(dirname,"/", "test.json");          //function write(str){     var locate_a;     locate_a = dirname + "/" + "test.json"; //path.join(dirname,"/", "test.json");     flag = "a";     fs.open(locate_a, flag, function opd(error, fd){         error&&_err(error, fs, fd);         var writeBuff, buffPos, buffLgh, filePs;         writeBuff = new Buffer(str),         process.stdout.write(             "writeBuff: " + writeBuff + "\n" + "str: " + str + "\n"),         buffPos = 0,         buffLgh = writeBuff.length,         filePs = buffLgh;//null;         fs.write(fd, writeBuff, buffPos, buffLgh, filePs-3,         function(error, written){             error&&_err(error, function(){             fs.close(fd,function(){             process.stderr.write("\n" +              "In Finally Block: File Closed!" + "\n");                 });             });             fs.close(fd,              function(){process.stdout.write(                 "Written and Closed File." + "\n");});         });     });     //}      **err.js** -                "use strict";         var fs;         fs = require("fs");              module.exports = function _err(err, scp, cd){             try{                 throw (new Error(err));              }catch(e){                 process.stderr.write(e + "\n");             }finally{                 cd;             }         }


Dependency Inversion Principle

I have been studying also S.O.L.I.D. and watched this video:   https://www.youtube.com/watch?v=huEEkx5P5Hs 01:45:30 into the video he talks about the Dependency Inversion Principle and I am scratching my head??? I had to simplify it(if possible) to get it through this thick scull of mine and here is what I came up with. Code on the marked My_modified_code my version, code marked Original DIP video version. Can I accomplish the same with the latter code? Thanks in advance. Original:               namespace simple.main     {          class main         {             static void Main()             {                 FirstClass FirstClass = new FirstClass(new OtherClass());                 FirstClass.Method();                 Console.ReadKey();                      //tempClass temp = new OtherClass();                 //temp.Method();             }         }               public class FirstClass          {              private tempClass _LastClass;              public FirstClass(tempClass tempClass)//ctor              {                  _LastClass = tempClass;              }                   public void Method()              {                  _LastClass.Method();              }          }              public abstract class tempClass{public abstract void Method();}              public class LASTCLASS : tempClass         {             public override void Method()             {                 Console.WriteLine("\nHello World!");             }         }              public class OtherClass : tempClass         {             public override void Method()             {                 Console.WriteLine("\nOther World!");             }         }     }      My_modified_code:               namespace simple.main     {          class main         {             static void Main()             {                 //FirstClass FirstClass = new FirstClass(new OtherClass());                 //FirstClass.Method();                 //Console.ReadKey();                      tempClass temp = new OtherClass();                 temp.Method();             }         }               //public class FirstClass          //{          //    private tempClass _LastClass;          //    public FirstClass(tempClass tempClass)//ctor          //    {          //        _LastClass = tempClass;          //    }               //    public void Method()          //    {          //        _LastClass.Method();          //    }          //}              public abstract class tempClass{public abstract void Method();}              public class LASTCLASS : tempClass         {             public override void Method()             {                 Console.WriteLine("\nHello World!");             }         }              public class OtherClass : tempClass         {             public override void Method()             {                 Console.WriteLine("\nOther World!");             }         }


How to find out if a company has insane policies

When interviewing for a job, is there a delicate yet accurate way to find out if they have insane policies, like "no open source", or "no installing software without permission", "not upgrading software until it's about to lose support", or "no visiting blogs"?


Ruby or Python?

This question is extremely subjective and open-ended. It might even sound like something I should just research for myself and make my own decision. But I'd like to put it out there and get some thoughts from others. Long story short - I burned out with the rat race and am on a self-funded sabbatical this year. Much of it is to take a break from the corporate grind and travel around, but I also want to play around with new technologies and do some self-learning projects, to stay up to speed on programming, and well - I just love tinkering with programming, when there's no pressure! Here's the thing: I am a lifetime C/C++/Java programmer. I'm a bit of a squiggly bracket snob since I've been working with this family of languages for my entire programming career. So I'd like to learn a language which isn't so closely syntactically related to this group. What I'm basically looking for is a language which is relatively general purpose, fun to learn, has some new concepts that are different from C++/Java, and has a good community. A secondary consideration is that it has good web development frameworks. A tertiary consideration is that it's not totally academic (read: there are real world jobs out there using it). I've narrowed it down to Ruby or Python. My impression of Ruby is that it is extremely web oriented - that the only real application of it is as a server side scripting language for doing web stuff (mainly Ruby on Rails). I don't have much of an impression of Python at all, except that it seems to have a passionate fan base and appears to be a fairly versatile language. **TL;DR** and to put it as succinctly as possible: which of these would be better for a C++/Java guy to learn to get some new perspectives on programming? And which is more open and general purpose and applicable to a wider set of applications? I'm leaning towards Ruby at the moment, but I worry to an extent that it looks like it's used as nothing but a server side web language.


Is MVC ever considered/applied system-wide?

I was having a discussion with a colleague and he bought up the topic of MVC and the use of ViewModels in ASP.NET MVC. The discussion was that, in an n-layer architecture, the UI, Business Layer and Data Access Layer are individual assemblies/projects and ViewModels are the UI's representation of a database/business object. The discussion on whether ViewModel's are useful moved into a discussion about how MVC should be applied. In my version (which is what I am used to/have seen elsewhere) takes into account separation of concerns and waterfall dependencies, where the UI project references the BLL, the BLL references the DAL and possibly all of them reference an "Entities" project. "MVC" is restricted to the UI. That is, the notion of "Models" (in my version, they are technically just ViewModels), "Views" and "Controllers" are individual files/objects in the UI layer. The BLL talks in terms of database entities and the UI will generally contain helpers that map a ViewModel to an entity. My colleague's version took this to the system/layer level, where the "Model" is the DAL, the "View" is the entire UI and the "Controllers" are the BLL as a whole. Given that in an MVC triad, the Model is unaware of Views or Controllers, the Views know about Models and the Controllers know about both.. does the system- level application of MVC not violate modular programming concepts/code reusability (disregarding the possible circular dependency issues)? Are patterns such as MVC applied at a system level often? My understanding was that MVC and related patterns were more often applied purely to the UI and not spread out across an entire n-layer system. By the way, we had a look at this question: What is MVC, really? ..but we also seem to disagree on whose argument the answers to this question supports! :) I could be just stuck in my little tiny .NET-oriented world and cannot see the bigger picture, so I would like to hear some thoughts on this.


We have a large Ruby on Rails application (25 million monthly users), our management decided to rewrite in Node.js, am I crazy?

Please tell me if:   * Node.js will make our site faster!   * Node.js will consume fewer server resources, we can save money!   * Node.js will make us more productive!   * Node.js means we can share client and server side JavaScript code. To clarify, we're rewriting a frontend server, which will talk to our existing Ruby on Rails application as an API. Meanwhile, we'll refactor our Ruby on Rails application into services. More details on the existing architecture:   * Memcached for HTML partials caching   * Redis for session, and some structured data caching   * MySQL single master, multiple slaves      * There's one large table that accepts a lot of writes (imagine a poll)     * Otherwise mostly reads.   * MongoDB for some metadata   * Ruby on Rails 3.0   * nginx and Unicorn


What should we include in SSAS cube design documentation?

What should we include in a SSAS cube design documentation? This is the initial phase of the document. I have included:   * data models,   * facts,    * dimensions,   * surrogate keys,   * hierarchies and levels within hierarchies,   * reports that we can pull from the cube,   * proactive caching. What else can we include?


Java or C++ for university CS courses?

I'm in the throes of getting myself enrolled in school to get a CS degree. The school I am looking at actually offers both Java- and C++-based for the introductory software development courses (object-oriented programming, design patterns, that sort of thing). It is student's choice which track to follow, but there is only time to follow one. _Knowing what you know now, if you had the choice, would you lay down your CS curriculum foundation in Java or C++?_ My current debate currently looks like this: A good friend (who has a PhD in AI) is touting Java as the better choice regardless of what I do, if only to open up more job opportunities later, though he might be biased since all of his work has been in Java (he loves it). I live in the Boston, MA, USA area and I see an equal amount of Java and C work. On the flip side, although I haven't entirely yet settled on what I want to do with the degree when I'm done, my preference would be to develop for the Mac, which I am doing now albeit in a limited capacity. To that end, I'm getting some limited exposure to C++ already, but I've had none with Java, and looking at my projects at my day job I don't see a need to use it anytime soon, "soon" measured by at least two years. I probably should note that I'm an adult going back to school after 20 years (I currently have _no_ degree of any kind) so I'm looking to maximize the opportunity and time spent as best I can. I'm kind of leaning towards C++ but I'm still ambivalent, and some outside, objective advice would help here. Or I could just be thinking too hard about it. **UPDATE:** It turns out the language selection wasn't so clear cut as I originally surmised. While a couple of core courses focused on Java, some of the other core courses work in primarily C and Java, but also a few others thrown in for good measure. In fact, my rest of my semester is going to be in Objective-C after spending time in Java and Javascript. Last semester was C, Javascript, and PHP, plus a few others thrown in as assignments required. Since things were pretty much split down the middle overall, and I am still getting answers to this, I am now trying to work my curriculum such that I meet all of the requirements for the degree but to absorb as many languages as I can reasonably handle. So far, my grades have not suffered trying to do this.


Can SQL Server and Mongo be used together?

We have a large news-oriented site that has high web traffic. The architecture is your often seen DB - Repo Layer - Services Layer - Asp.Net MVC. The problem that we've been seeing is around read performance. It turns out that all this DDD domain object stuff is great, in theory, for business rules, but has made life harder when it comes to optimizing read performance. As a solution, I'm considering something entirely new (for us): using noSQL. I'd like to use a noSQL database for data being presented on our website. We can't get rid of our SQL Server (at least not anytime soon), but it seems to me that a practical step would be to use Mongo as a query database for all new development. My question is whether it is possible to use SQL Server as your database of record and Mongo as your query database **together**? So when one of our editors updates a record, the data will be stored in SQL Server. This is necessary, because there is too much legacy code that cannot be re-written overnight. But when a viewer on the web site views an article or a list of articles, I'd like to take advantage of the performance of Mongo versus SQL Server. In order to keep data somewhat current, let's say 15 minutes old or less, SQL Server data would need to refresh Mongo. RDBMS have replication tools for operations like this and I'm wondering if there exists anything to do the same from SQL Server to Mongo. Lync server, maybe?


How do I get started with HTML5?

What is the recommended workflow to learn HTML5? What tools should I install? What SDK? Where to start? How to test? How to debug? What do I read? I understand that what is often labelled as "HTML5 development" is in fact a mixture of HTML, CSS, JS and more, however I don't believe that bigger projects are developed in Notepad. That is why I am asking you to reveal your tips and tricks about your workflow.


What are the best practices regarding unsigned ints?

I use unsigned ints everywhere, and I'm not sure if I should. This can be from database primary key id columns to counters, etc. If a number should never be negative, then I will always used an unsigned int. However I notice from other's code that no one else seems to do this. Is there something crucial that I'm overlooking? Edit: Since this question I've also noticed that in C, returning negative values for errors is commonplace rather than throwing exceptions as in C++.


Why can't the PHP engine handle HTTP communication?

The PHP engine interprets the PHP code and is perfectly capable of working with sockets, forming HTTP packets, etc. Why then do we need a separate Apache server, when the http serving duties could be embedded into the php application along with the page creation code?


Can you recommend a good commit message template / guidelines to enforce in the company?

In Git it's possible to set and enforce a good commit template. Can you recommend (preferably with argumentation) a good commit template / guidelines to enforce in the company?


c# class naming standards/guidelines

Over the years I've used various naming conventions for services in my applications for example:               [ClassName]Service       [ClassName]Manager       [ClassName]Factory       [ClassName]Provider       [ClassName]Helper      I generally only use the "Helper" suffix for utility classes that have no external dependencies. However I find that there is a bit of a cross-over between the others, and wondered if there was any recommendations/standards/guidelines on what to use and when?


Does Google Code source hosting have an API like Github

I looked and looked, and perhaps I am dense, but I could not find an API for open source projects on Google Code, similar to that offered by Github. Does it exist?


Automated Testing: Explaining its Business Value

To start I don't think this is a repeat of other questions on unit testing. What I'm looking for help with is articulating its value to a team of programmers, analysts, managers and testers. By automated tests, I don't think I need to make a distinction between unit tests (e.g. JUnit), BDD (e.g. JBehave, Fitness) and UI (Selenium , Watir) because I think they all provide similar value (but feel free to write an answer that disagrees :)) The following is a list I've identified, I'm looking for answers that help expand or refine:   1. **Time/Cost Savings** : writing automated tests can take more time than written test cases. However, considering tests are run multiple times, the marginal work (i.e. cost/time) to _execute_ automated tests is several orders of magnitude less. That the automated tests are cheap to run facilitates _changing_ the system over time.   2. **Documentation** : there is no truer way to know how a system works than its tests. Any other documentation is usually out of date the moment its written, but tests (at least those that pass) reveal how things actually work. This is true for both end-user AND API documentation.    3. **Code Quality** : test writing forces you to:      * consider clients because tests are a client     * breaks dependencies where making code testable often means figuring out how to make that code not require some other large system be available


Shortcomings of using dynamic types in C#

I have been recently studying more on the dynamic types in C#. With some examples I understood once the code is compiled, it does not need to be recompiled again but can be executed directly. I feel the flexibility provided by the keyword to actually be able to change data type at will is a great advantage. Question, Are there **any specific shortcomings** apart from wrong dynamic method calls which throw run time exceptions **which developers must know** before starting the implementation.


How, when, and why do developers use custom data structures in python?

Python's lack of pointers makes data-structure construction intuitively more challenging, and has so much built in functionality that, as an amateur, I can't see when, why, or how you would create something beyond what's already there. When have you built your own, and why did you do it? E.g. special types of trees, etc.


Non Blocking Sockets vs Blocking sockets - UDP - C&linux

When to use blocking sockets over non blocking sockets on UDP? Question 1:What's is recommended for the following scenario ? Multiple clients send data over multiple UDP sockets, i.e. say client1 sends data over sockets 100, 101, 102,..,105 . client2 on sockets 110,111,112...115 etc. Port numbers are fixed for clients. Number of clients are fixed(10). So totally 10 * 5 sockets. Data on each sockets(atleast 3 sockets) is sent every few milliseconds. The other 2 sockets are for sending commands and getting data. After receiving the data there is some IO involved where i write to disks. (I cant change any of the above. i.e. number of sockets ,etc ) Question 2:Is it best to use Threads for this scenario (or) Asynchronous IO multiplexing with nonblocking sockets?


Versions of .NET in an Interview

Interviews are full of an array of different types of questions. What I'm curious about is what people think about asking an interviewee about the differences in .NET versions. For instance, asking what was new in .NET V2.0 to 3.0 and then from 3.0 to 3.5 and so on. Is this a good interview question to find out what a person knows about the .NET world? As V2.0 was released in 2005, I start to wonder how valid it is to ask about what was new in a release done 6 years ago. Is it a good question at guaging a developers knowledge or just his/her memory?


How to credit other authors in an open source project

I have a pet project that I am planning to release as open source at some point in the not-too-distant future. A couple of the files use or are mostly code that was taken from a project released under the New BSD License. While I have changed it to fit my needs and added some small stuff, the algorithm and the functionality is basically exactly the same. I want to make sure that the author of the code gets credit and that the license is not broken, but I also want to make the reader aware that this is not the code as it was orignally released. How should I approach this? Should I isolate the code as much as possible and just retain the original license? Maybe put all the files that contain foreign code in their own folder and add a readme explaining what has been added/removed? There must have been tons of projects using other open source code. What is the standard approach to this?


Are there any industry standards that define code quality?

Our specific situation is that we are creating an agreement between ourselves and another team for shared control or use of a PHP based web application that we have been building. We have a set of standards and conventions documented in our technical specs. However, I have been asked to define them in terms of an industry standard. I am aware of different terminology for coding conventions. Hungarian notation, CamelCase, for example. And some defined standards for very specific things, PSR-0 for example covers namespaces in PHP. It seems the point is to try to give us stronger ground in the agreement, by pointing to industry standards rather than an arbitrary standard we set forth. They're looking for things like the PSR-0 or an ISO#### or IEEE#### that we can point to. My personal concern is that I've spent the time working with the team to show them the standards we have and to get buy in on the bigger parts of it. So I'm worried we'll either end up having to conform to some standard that doesn't match how we like to program, or the better case will be picking and choosing pieces of standards if they exist, to fit our current conventions. Anyway, the core of the question is, **Are there any industry standards regarding code quality, coding processes, or other areas that would help us keep their programmers from making disruptive or difficult to maintain code?** I realize we can't prevent it, but if we can point to the agreement, at least we have recourse other than refactoring or recoding it ourselves. Any other thoughts or suggestions would be helpful.


How to learn the practical uses of design patterns

I use OOP programming with inheritance, but I've not yet used interfaces.I want to learn how to use design patterns, but I'm finding them very difficult to learn. Is there is any way to learn design patterns easily? I searched quite a bit, but I was not able to find useful information.


Can you decipher this binary

_Thought I post this to the best community of programmers I know._ > David Johnston, the new Governor General, has the digital world confused. > > Just what is the meaning of that 33 character-long string of ones and zeros > that is emblazoned across the bottom of his fresh new Coat of Arms? > > According to the GG's website, "The wavy band inscribed with zeros and ones > represents a flow of information, digital communication and modern media." The binry is this:               110010111001001010100100111010011      It's not ASCII, is it just random? > Original article: http://www.cbc.ca/politics/insidepolitics/2010/10/the-new- > ggs-binary-banner-whats-it-mean.html _I'll accept the correct (if it can be solved) answer or failing that, the highest voted answer._


If you had to teach professional development to students that just graduated school, what would be the topics?

The idea is to give them more chances to be efficient in a professional environment. Most students are good with theory, most of them are smart, but they have to learn how to solve common technical problems. They will be better programmers as they practice, but maybe we can help them with some introduction training. > Which topics you would select for a two weeks full time training? It's an open question, I don't want to suggest things that will reduce the answers to a particular field.


Constructor vs setter validations

I have the following class :               public class Project {              private int id;         private String name;                public Project(int id, String name, Date creationDate, int fps, List<String> frames) {             if(name == null ){                 throw new NullPointerException("Name can't be null");             }                  if(id == 0 ){                 throw new IllegalArgumentException("id can't be zero");             }                      this.name = name;                 this.id = id;              }              private Project(){}              public int getId() {             return id;         }              public void setId(int id) {              this.id = id;         }              public String getName() {             return name;         }              public void setName(String name) {             this.name = name;         }          }      I have three questions:   1. Do I use the class setters instead of setting the fields directly. One of the reason that I set it directly, is that in the code the setters are not final and they could be overridden.    2. If the right way is to set it directly and I want to make sure that the name filed is not null always. Should I provide two checks, one in the constructor and one in the setter.   3. I read in effective java that I should use `NullPointerException` for null parameters. Should I use `IllegalArgumentException` for other checks, like id in the example.


How do I keep my projects from dragging on with endless tweaks and changes?

After working out a project, it might require too much tweaks and changes to get it working right... What can I do to prevent this?


Who uses GnuSTEP?

This has been a big question lurking at the back of my head. From what I see, GnuSTEP nowadays is primarily a "hobby" project of a small but tightly-knit group of people. However I haven't seen a large commercial (off-the-shelf) application that uses it, apart from the small applications that comes with the GnuSTEP distribution. Heck, since even Ubuntu doesn't really use it then is GnuSTEP really more than being a "hobby" framework? I know that Sony's SNAP at one brief moment uses GnuSTEP, but they killed the platform before it can do anything meaningful.


Why is design by contract considered an alternative to the pseudo programming process?

Right now I'm reading Code Complete by Steve McConnell and in chapter 9 he talks about the Pseudo Programming Process (PPP). From what I've understood, the PPP is a way of programming in which the programmer first writes the pseudo code for the routine he's working on, then refines it up to the point where pretty much each pseudo code line can be implemented in 1-3 lines of code, then writes the code in the designated programming language and finally the pseudo code is saved as comments for the purpose of documenting the routine. In chapter 9.4 the author mentions alternatives to the PPP, one of which is 'design by contract'. In design by contract you basically assert preconditions and postconditions of each routine. Now why would that be considered an alternative? To me it seems obvious that I should use both techniques at the same time and not chose one over the other.


Automated Acceptance tests under specific contraints

This question is a follow up to my previous question, which was a bit general, so I shall be more specific with this one. I want to automate acceptance testing on a web application. Briefly, this application allows the user to create contracts for subscribers with two constraints:   * You cannot create more than one contract for a subscriber.   * Once a contract is created, it cannot be deleted (from the UI). Let's say TestCreate is a test case with tests for the normal creation of a contract. The constraints have introduced complexities to the testing process, mainly dependencies between test cases and test executions.   * Before we run TestCreate we need to make sure that the application is in a suitable state (the subscriber has no contract)   * If we run TestCreate twice, the second run will fail since the state of the application will have changed.   * So we need to revert back to the initial state (i.e. delete the contract), which is impossible to do from the UI. More generally, after each test case we should guarantee that the state is reverted back. And since, in this case, it is impossible to do it from the UI, how do you handle this? **Possible solution** : I thought about doing a backup of the database in the state that I desire, and after each test case, run a script which deletes the db and restores the backup. However, I find that to be too heavy to do for each single test case. In addition, what if some information are stored in files? or in multiple or unaccessible databases? **My question:** In this situation, what would an experienced tester do to write automated and maintanable tests. Thank you. **More info** : I'm trying to integrate tests into a BDD (Behaviour Driven Development) framework, which I find to be a neat solution for test documentation and communication, but it does not solve this particular problem (it even makes it harder)


What are the warning signs of impending doom to watch out for on a project?

Having worked on a failed project is one of the few things that most programmers have in common, regardless of language used, industry or experience. These projects can be great learning experiences, soul-crushing disasters (or both!), and can occur for a multitude of reasons:   * upper management change of heart   * under-skilled / under-resourced team   * emergence of superior competitor during dev cycle   * over/under management Once you've worked on a couple of such projects, is it possible to recognise at an early stage exactly when a project is doomed to fail? For me, a big sign is having a hard & fast external **deadline combined with feature creep**. I've seen projects which were well planned out and proceeding right on schedule go horribly off the rails once the late feature requests started to roll in and get added to the final "deliverable". The proposers of these requests earned the nickname of Columbo, due to rarely leaving the room without asking for "just one more thing". What are the warning signs you look out for that set off the alarm bells of impending doom in your head?


use areFoo or isFoo?

I have never seen the use of "are" for boolean methods, but the use of "is" is very common. When I want to use "are" is usually because I am passing multiple variables, or a list of objects. I suppose I could rationalize my list of objects or multiple variables as one thing, such as "isSetupParametersValid", but that would still be plural. Is the lack of use of "are" in boolean methods, simply an arbitrary convention or a side-effect of using best practices. If it's a side-effect of best- practices, which ones? Note: for non-native English speakers "is" refers to a singular object, "are" refers to plural/multiple objects


PHP Project deployment

I have a PHP project that I'm currently developing. I'm nearly finished and I was wondering what is the best practice when it comes to beta testing and deploying updates/changes to the production site? For example, in order to test out new features, I thought about creating a sub-domain called beta.mysite.com that uses a duplication of the same project files as the production version and a duplication of the mysql db. Then after I test everything out, I need to export the mysql tables (if I changed the db structure) and copy over the files to the production area. But how do I do all that with keeping all the data that have been produced during my beta testing? I'm the only person that works on this project, I currently don't use any versioning tool, just Dreamweaver. Thanks,


How should you proceed when somebody rejected a good thing you made?

I made an application in extjs, and it was rejected by my technical architect, project manager, and team leader because it was a big JavaScript file. It feels very bad when you develop an application and it is rejected by your seniors. I don't want to feel bad and I want to concentrate on my work. I would like to restructure the code, as the coding structure in my company is very bad and I want to improve that. I want to work better and grow - how should I proceed?


Session states in ajax callback

Someone told me `Session` or `HttpContext.Current.User` will return different value when we are working with ajax postback, in case of when the are so many user are live to site. For example, suppose there are 1000 people are online in site, and from them 100 call ajax method/ wenmethod and on this we might get different value of `Session` or `HttpContext.Current.User` as per every user's `Session` or `HttpContext.Current.User` value are different. But my concept says it will return specific person's (who requested) `Session` or `HttpContext.Current.User` value, and server will be clear whose value need to be return. What you all guys says?


Is it possible to implement a native compiler for a 'managed language' such as Java?

In most cases, it is possible to create both a native compiler and an interpreter for a programming language. The compiler would simply convert the source code to machine code, and the interpreter would simply execute the source code (or some IL produced by a compiler). However, I'm not sure about languages with garbage collection. Let's take Java for example. When Java was designed, it was clear that Java programs were always going to be run on the JVM. And the JVM was supposed to feature a garbage collection mechanism. So while designing the Java language itself, there was no need for destructors and such. If one was going to implement a _native_ Java compiler, that would mean the Java source code would be compiled to machine code to be run on the machine itself, not on a VM. And the machine itself doesn't feature a mechanism for garbage collection. **How would someone implementing a native Java compiler deal with this situation? Is it possible to create a native compiler for Java, since the Java design 'counts' on automatic garbage collection? (And possibly on some additional things the VM does for the program?)**


What is the proper relationship between the software developer and the business customer?

IT professionals are experts who are trusted with the IT assets of a business or organisation. As trusted professionals we have responsibilities that extend beyond things that a non-IT customer can be expected to understand or be aware of. So I think the proper relationship between an IT professional and his internal/external customers is more like that between a doctor and patient than a servant and master. Am I right? Here's an analogy to think about. A patient insists that his leg needs to be amputated. His doctor disagrees but the patient cannot be persuaded. Should the doctor amputate the leg just to satisfy the patient? Another analogy. A customer wants a civil engineer to build a bridge to an unsafe design. Even when the engineer explains that it is unsafe the customer doesn't believe him. Should the engineer build the bridge anyway? I think the right answer in both these analogies is NO. The medical professional and engineering professional are supposed to be in a position of trust and ought to exercise their own judgement, even in the face of patient/customer disapproval. Shouldn't the same apply to IT professionals when the IT professional is qualified to make the decision but his customer is not?


How can I create a solid business case for upgrading our programmers to 256 GB SSD and 16 GB of RAM?

We have an environment based on Microsoft stack (VS2010, SQL Server, etc), and I firmly believe that we could improve productivity a little bit, having more RAM and a faster secondary SSD. What data do you advice to gather so I can solidify my request in such a way the advantages can be unbiasedly demonstrated? Currently we have only 6GB of RAM and slower HD drives, and at home I have a 128 GB SSD in my desktop and 16 GB of RAM (I also think is the max amount of memory supported by our workstations, if we could go bigger then better), so I can feel the difference and it's real. The issue actually is how to get a budget approval from management and spend it wisely to increase productivity.


How to use database adapters' cursors safely?

I started to use psycopg2 to connect my little python script to a PostgreSQL database few days ago. After some research I found that a lot of database connector, like psycopg, work using cursors. I know what is a cursor and how to use it. But I still wonder if it's safe to use the same cursor all along the script life. Is it safe? Or would it be preferable to use a different cursor for each query?


Is making a small change, testing it, then "rinse and repeat", a bad habit?

I am a programmer with a number of years of experience. I realized I got a certain habit. I'm not sure whether it's really a bad habit or not. I get a list of tasks to perform for a solution, even small small tasks, for example,   1. Change resources of this user control   2. Change size of another one   3. Add some HTML and coding on another user control All of these tasks are small. I mean they can be done within 10 minutes, **but I got a bad habit of making small changes and then test them again and again in a web browser**. Is this a good practice? Or should I perform them all at once and then test them together? If it is really a bad habit then how do I rectify it, since it feels like wasting time testing small changes over and over?


Writing code with 5 fingers, is more efficient?

Actually I tend to write with 4 fingers, my actual typing speed is in average 110~120 ( using http://www.typingtest.com/ with an spanish from spain ) I have some time trying to force myself to use 5 fingers, It's kind of weird, but I have noticed that when i'm writing a text like this, fingers tend to be in a really natural position, with time I could handle this... But when i'm programming everything is weir,using alt+tab is weird, using ctrl+b is wird, and all those shorcuts that some terminal related programs use, the "natural 5 fingers way" is natural just when i have to write text, but that don't apply when there is a lot of symbols like . -> ( ) [ ] " " && || , etc... Is there somebody that actually use 5 fingers to type?, is comfortable to write code using 5 fingers using that kind of "natural way" ? worth the effort to learn to use the 5 fingers?


Approached to build app centered around new API and suddenly API is abandoned

This isn't a huge deal, but I was approached by colleagues/friends to build an app using their new API. There was some potential for pecuniary gain for me depending on app usage. I spent a considerable amount of time polishing the mobile app, based on my assumption that, having been approached in a serious way, that the company would not suddenly shift focus and abandon the API. I wasn't even given so much as a heads up that the API was dead even though I had an app in production that relied on it... For the most part, building the app was a learning experience which I enjoyed, but I don't think I'd have expended all the effort if I knew that the company wasn't as serious about the API as their reaching out to me clearly indicated. How, if at all, would you react?


How can I put multiple hierarchical forms in a single web page and avoid making it a mess?

We are a group of developers working on a web application that accepts forms filled and sent by our users and present it in an overall view. Our main form view looks like this: ![enter image description here](http://i.stack.imgur.com/cReBC.png) There are multiple forms on this page. The form on the left is the parent form which contains general questions about the project. The right panels are more detailed questions and are about sub-projects. The forms are lengthy and contain different types of properties (form elements) in them. The parent form is static and is opened on page load. We have given no options to close or minimize it. The right panels (child forms) are collapsed by default and open by click and the contents are then rendered. This is done to reduce the page load time. I have annotated the picture so I don't have to explain everything myself. Everything in the picture that has a rectangle around it is a (Backbone) view by itself. To make it even more complex, look at this other picture: ![enter image description here](http://i.stack.imgur.com/BJs3N.png) Look at the photo slider view. Each slide in that slider is again, a view by itself. The manipulation buttons are rendered along with each slide so moving them somewhere else (like next to the "move left/right" buttons) is quite a pain. That is why we have not done it. Now look at the grand child form's fields that I have marked as "properties with relationships". If you change them, they become highlighted (with a yellow hollow color around them) and that changes a whole lot other things in the "child form" and the "parent form". We have managed that kind of relationship when saving the page but this kind of relationship adds to the complexity of the view. I guess you already have figured it out by now but I'm going to say it anyway: the code has grown out of hand. It is truly a can of worms. There are more than 30 functions in the base view file and 15 other views attached to this page. Multiple people have worked on this view and because it is a big file (base file: 2500 LOC), everybody has just tried to do their bit of task and not think about refactoring or simplifying the design of the page. The page is flawed because it is not extensible. For example, the grand-child forms have two more levels of child forms and we cannot add them to the page. We have been discussing for days on how to redesign this page but none of us seems to come up with a good idea. Now the question here is how can we redesign this page so it keeps all the functionality but with much simpler code? We are OK with a total redesign, a total new concept. We want to write the whole thing from scratch. All your ideas are appreciated.


show different xibs from inside a xib file

I'm a newbie in mac programming so here's my questions: I'm developing a mac app that has two xib file MainViewController and SecondViewController in MainViewController there's a button in which it calls Second View Controller. I'm using XCode 5 How to do this? and How to display video in a mac in XCode 5


What is the abstract name for Drive, Directory and file?

I want to give nice name to my function while returns drive, directory and file. Can you please suggest a good abstract name for this trio? This is the function.                 static IEnumerable<string> GetDriveDirectoriesAndFile(string path)       {          if (path.Contains('/'))          {             path = path.Replace('/', '\\');          }          if (path.Contains('\\'))          {             return path.Split('\\');          }          return null;       }      Thanks, Omkar


Is there a 'design pattern' type listing of common algorithms?

Is there a 'design pattern' styled listing of common/popular algorithms anywhere? Specifically, something that has a similar format along the lines of: **Algorithm Name:** e.g., Quick Sort, Bubble Sort, etc.   **Problem:** A description of the stereotypical problem the algorithm is supposed to address   **Description:** Description of the solution   **Implementation:** Code examples of the solution   **Big O Rating:** Self-explanatory   **Similar Algorithms:** Algorithms that address the same problem in different ways, or similar problems I really like the GoF design pattern listing style, and I think it would help me learn various algorithms better/easier if I could find a resource that was similar in terms of organization.


Simple vs Complex (but performance efficient) solution - which one to choose and when?

I have been programming for a couple of years and have often found myself at a dilemma. There are two solutions -   * one is simple one i.e. simple approach, easier to understand and maintain. It involves some redundancy, some extra work (extra IO, extra processing) and therefore is not the most optimal solution.    * but other uses a complex approach,difficult to implement, often involving interaction between lot of modules and is a performance efficient solution. Which solution should I strive for when I do not have hard performance SLA to meet and even the simple solution can meet the performance SLA? I have felt disdain among my fellow developers for simple solution. Is it good practice to come up with most optimal complex solution if your performance SLA can be met by a simple solution?


Best practice for packing Java enums?

What is the best practice for packaging Java enums? is it separate file for each enum?   or   having same file for all the enums? What are the pros and cons ?


How is data integrity maintained in a clustered environment when schema changes?

## Scenario A clustered environment running N identical application nodes interacting with a single relational database. ## Problem Is it possible to upgrade the nodes to a new application version, which requires a new database schema **and** maintain data integrity in the database **without** any downtime in the application and **without** losing any data or ending up with data in an inconsistent state?


Can I learn touch typing while doing normal typing during coding?

I'm having a big problem as I don't know touch typing. I look at the keyboard (hunt and peck). However, I really want to learn touch typing. I have tried many times, but I don't have the patience and time to spare an hour everyday for that. So, can I learn typing while I do some practice at my work? I mean, practicing those lessons whilst coding. Anyone know if that will work?


Are costs part of the requirements?

I am new to requirements analysis and have a simple questions: Would you include the budget in the requirements, if e. g. the departments budget for running costs is 10k a year.


What would you change about C# if you could?

> **With nearly 60 answers to this question it's highly likely that _your_ > answer has already been posted. Please don't post an answer unless you have > something new to say** Assume that your objectives are the same as for C#. I don't want an answer like "I'd write Python instead". I'm only interested in changes in the language itself - not in the standard library. Perhaps this would be interesting to discuss, but as it is shared between many languages it would be better to discuss this in another question instead. **Please post a single idea per answer; if you want to post several ideas, post several separate answers. Thanks!**


Is it possible to compile a higher level language to readable C++?

C++ is a great language in many ways, but some things in particular are cumbersome to write without an IDE. As a VIM user, it would be very interesting if I had access to a higher level language which enabled me to write C++ with S-Expressions and possibly with Lisp-like macros, allowing for the generation of clean code while avoiding rewriting the same patters over and over again. I've asked on freenode and tested several ideas, such as compiling Lisp->C with compilers such as ECL and Bigloo, but none of those generated particularly clean C code. Are there any works on this issue?


Does music increase your productivity?

I wanted to know whether you think and audio background is just a distraction or could be of some help while programming. For me, it works like this: when I'm writing pseudocode, or implementing procedures that are very clear in my mind in a language I can write without looking up docs, having music playing in the background (very straightforward electronics, mostly) helps me a lot: it kind of gives some rhythm to my coding and, if the procedures are trivial, avoids the distractions that boredom can cause. When I incur in a problem, or I have to try to fix a bug, instead, it just distracts me. Also, if the song is really regular and I know it well enough not to cause me to focus on it, it eliminates unexpected environmental noise that sometimes make me waste precious seconds before I can concentrate on the code again. * * * _Guidelines checklist: 1 ok, 2 I hope; 3 I suppose; 4 Definitely; 5 I would like that to happen; 6 Doch (English should implement a way to disambiguate double negatives in answers)_


Features to generate time expiring

There are something out of box to generate time expiring in php? For example I need to control the access to the system, I was thinking something to verify every first day of every month, and do this in my code. But it is not 100% safety, since another programmer can remove this line code that verify. Then I thought is it possible, to verify in another server, if the monthly time expire or not? and return the message to the user if the copy expired or not? What is the best to way to create a licensing features for time expiry? or I really need to get inside IonCube (Compiled Code Encoding) for example? What is the best practice?


How can Java be improved so that it no longer needs to perform type erasure?

The official Java tutorial on generics explains type erasure and why it was added to the compiler: > When a generic type is instantiated, the compiler translates those types by > a technique called type erasure — a process where the compiler removes all > information related to type parameters and type arguments within a class or > method. Type erasure enables Java applications that use generics to maintain > binary compatibility with Java libraries and applications that were created > before generics. This most likely was a pragmatic approach, or perhaps the least painful one. However, now that generics is widely supported across the industry, what can be done in order for us to not need type erasure? Is it feasible with out needing to break backwards compatibility, or if it is feasible, is it practical? Has the last statement in the quote above become self referential? That is: "type erasure enables Java applications that use generics to maintain binary compatibility with Java libraries and applications that were created with Java versions that perform type erasure."