How do I Integrate Production Database Hot Fixes into Shared Database Development model?

We are using SQL Source Control 3, SQL Compare, SQL Data Compare from RedGate, Mercurial repositories, TeamCity and a set of 4 environments including production. I am working on getting us to a dedicated environment per developer, but for at least the next 6 months we are stuck with a shared model. To summarize our current system, we have a DEV SQL server where developers first make changes/additions. They commit their changes through SQL Source Control to a local hgdev repository. When they execute an hg push to the main repository, TeamCity listens for that and then (among other things) pushes hgdev repository to hgrc. Another TeamCity process listens for that and does a pull from hgrc and deploys the latest to a QA SQL Server where regression and integration tests are run. When those are passed a push from hgrc to hgprod occurs. We do a compare of hgprod to our PREPROD SQL Server and generate deployment/rollback scripts for our production release. Separate from the above we have database Hot Fixes that will need to be applied in between releases. The process there is for our Operations team make changes on the PreProd database, and then after testing, to use SQL Source Control to commit their hot fix changes to hgprod from the PREPROD database, and then do a compare from hgprod to PRODUCTION, create deployment scripts and run them on PRODUCTION. If we were in a dedicated database per developer model, we could simply automatically push hgprod back to hgdev and merge in the hot fix change (through TeamCity monitoring for hgprod checkins) and then developers would pick it up and merge it to their local repository and database periodically. However, given that with a shared model the DEV database itself is the source of all changes, this won't work. Pushing hotfixes back to hgdev will show up in SQL Source Control as being different than DEV SQL Server and therefore we need to overwrite the reposistory with the "change" from the DEV SQL Server. My only workaround so far is to just have OPS assign a developer the hotfix ticket with a script attached and then we run their hotfixes against DEV ourselves to merge them back in. I'm not happy with that solution. Other than working faster to get to dedicated environment, are they other ways to keep this loop going automatically?


Any suggestions for pair programming with external resource?

I am a software engineer engaged in some extracurricular projects outside of my main gig. I was considering hiring a developer on Elance to assist me. Ideally, we would be a collaborative team where I can review their code and our "days" would overlap by a few hours. Ideally, when that persons day is over, I could do code review and then take off where they left off. Has anyone attempted this? Would it be practical to use a Rackspace Cloud Server for this effort where when one developer was done they just saved a VM image that would be accessible by another developer? Our development environment will be ASP.NET 4.0 MVC 3.


PyQt application architecture

I'm trying to give a sound structure to a PyQt application that implements a card game. So far I have the following classes:   * Ui_Game: this describes the ui of course and is responsible of reacting to the events emitted by my CardWidget instances   * MainController: this is responsible for managing the whole application: setup and all the subsequent states of the application (like starting a new hand, displaying the notification of state changes on the ui or ending the game)   * GameEngine: this is a set of classes that implement the whole game logic Now, the way I concretely coded this in Python is the following:               class CardWidget(QtGui.QLabel):         def __init__(self, filename, *args, **kwargs):             QtGui.QLabel.__init__(self, *args, **kwargs)             self.setPixmap(QtGui.QPixmap(':/res/res/' + filename))              def mouseReleaseEvent(self, ev):             self.emit(QtCore.SIGNAL('card_clicked'), self)          class Ui_Game(QtGui.QWidget):         def __init__(self, window, *args, **kwargs):             QtGui.QWidget.__init__(self, *args, **kwargs)             self.setupUi(window)             self.controller = None              def place_card(self, card):             cards_on_table = self.played_cards.count() + 1             print cards_on_table                  if cards_on_table <= 2:                 self.played_cards.addWidget(card)                 if cards_on_table == 2:                     self.controller.play_hand()          class MainController(object):         def __init__(self):             self.app = QtGui.QApplication(sys.argv)             self.window = QtGui.QMainWindow()             self.ui = Ui_Game(self.window)             self.ui.controller = self             self.game_setup()      Is there a better way other than injecting the controller into the Ui_Game class in the Ui_Game.controller? Or am I totally off-road?


Is it OK to include another person's open-source module in a project that you are uploading to GitHub?

This seems like it would be an obvious "yes". However, I just want to be sure and I've tried googling around to no avail. I am learning Python/Django and uploading all of the projects I'm creating to GitHub. I'm starting to add in existing modules from other open-source projects that do not belong to me. Is it still okay to upload MY projects to GitHub, even though they include other people's open source modules as well? Should I give them credit in the README, or by commenting where their code is included? Thanks.


How do I evaluate a .NET job?

I have been a programmer for a few years and until now I worked exclusively with PHP, although I did create a few small side projects in other languages. I'm currently interviewing with a non-IT that relies mainly on .NET and they seem to be willing to hire me. I probably should have thought of this sooner, but without commercial experience in .NET what questions should I ask to ensure that that job will help me advance my knowledge of the .NET platform or if they are doing .NET the right way (libraries, frameworks, third-party tools, etc.)?


Can C++ be used as a server-side web development language?

I'd like to get into web development using C++ as the "scripting language" on the server-side. My server infrastructure is *nix based, so doing web development in C++ on Azure is not applicable and C++/CLI ASP.NET is also not applicable. Separate from legacy CGI applications, can web development be done using C++ ? Thanks, Scott


Is it possible to combine C/C++ with web languages?

I would like to create a web application (meaning that will run from browser). The point is that I want to write just the UI in HTML5 + CSS + JS (or maybe even some PHP). On the other hand, I want to write the functionality of the application in C or C++. Then, I want to combine the code about the UI and functionality. Therefore, I would like to ask, whether it is possible to combine C/C++ code with web markup/programming languages?


Member functions vs. Non-member functions for math operators

I'm writing a linear algebra library (long story short, it's a school assignment) that involves matrices, vectors, etc. In the process of creating this library, I'm going to be creating functions that perform mathematical operations on objects. For example, transpose matrix, invert matrix, normalize vector, etc. I was curious as to what is the "best practice" for this sort of function... That is, should I make the function a member function, or non-member? (For clarity/library use sake) Example:               //Member function way:     B = A.transpose();     C = A.inverse();          //Non-member function way:     B = linalg::transpose(A); //Non-member transpose function in linear algebra namespace     C = linalg::inverse(A);      Is there some standard regarding these sorts of operations? Or, at least, is there a common way people do this? I'm leaning towards the first option, but I'd like to know if this is recommended.


Drawing the line between models & libraries?

As my webapps increase in size, so does the complexity. In order to keep my classes & files structured and easy-to-access, I am starting to get more and more confused: I have some very clearly defined data objects in my application - `orders`, `invoices`, `products` for example. All of those have their own entity object that handles enforcement of values and pure business logic along with a model that handles storage of each object to my persistent storage of choice (database). Ok - everything clear and separated that far. But what about a logic-heavy object like `users`? Users log in and out, change password (with everything that means - hashing, encrypting and so forth) and do a whole lot of interaction both in the database and with Sessions. Right now, I use an `Authentication`-class, a library, which carries all of these mentioned actions and a lot more. It does it's job, but It's kind of unclear to me **what I should put into a model and what should be a Library**?


Should I organize my folders by business domain or by technical domain?

For example, if I'm using some MVC-like architecture, which folder structure should I use:               domain1/         controller         model         view     domain2/         controller         model         view      Or:               controllers/         domain1         domain2     models/         domain1         domain2     views/         domain1         domain2      I deliberately left out file extensions to keep this question language- agnostic. Personally, I'd prefer to separate by business domain (gut feeling), but I see that most/many frameworks separate by technical domain. Why whould I choose one over the other?


Ways to describe or measure the learning curve for a new technology?

As I begin to learn some major new things beginning from zero, I wonder: is there any way to describe, perhaps even quantify, the height of a learning curve? Having worked at many places on many projects, and half the times not being a good fit, I see we all need better ways to describe skill levels and skills needed for a project. I'm interested, for the purposes of this question, in describing the amount of increase in skills/knowledge/savvy for someone to be effective on a given project, staying with the same employer or in the same situation generally. Example: The owner comes to me and says "Hey, this new thing, it's vital technology for our next major project. No one here knows much about it. How long will it take you to get up to speed on it?" (BTW, I want to consider only competent people. No PHBs or fanboys of glitzy new things. Those confounding factors are important in real life, but secondary to the main point here.) Loose relative words like "steep", "easy" etc don't mean much. The person learning the new thing, and their manager, may have different expectations. I'd like to find something more objective, even if not perfect. In some magically ideal world, we might say "it takes (n) hours to learn C++, to skill level (x), including all of OO, STL and (blah-blah) set of design patterns". Hours could be used to mark calendars, assign team members and generally plan well. But of course, we all come with different thinking styles, different past experience, different IQs, different levels of passion to know or use the new thing. And then, do you want to design it, fix it, or just use it? Hours might not be useful, even if there was some formula to account for all those factors. Personally, I learn new ideas in electronics or photography about 3 to 10 times faster than new ideas in software, but don't know if I'm comparing new ideas of the same "size". (And I'm not sure in what sense I mean "faster"; not necessarily hours or days.) In part, I'm wondering about the "size" of knowledge it takes to become competent at, or to master, a new technology. There is the rough rule that it takes 10,000 hours to master something. Maybe for becoming a superb flute player in the symphony, or to be a top-notch helicopter pilot, but obviously one can master tying their shows in far less time. Shoe-tying is a "small" skill, the others are worthy of full time careers. Maybe someday, with future discoveries in psychology, neuroscience and education theory, one could say something like: "it takes (n) million mental thought quanta to learn (new thing) given you already know x, y and z and have a natural talent for grokking (subject)." Then there's be a rule of thumb that a million thought quanta on average correspond to so many minutes or hours, with some of us faster or slower, affected by stress, health and other work. Yeah. Nice science fiction, but not useful today for deciding whether or not to accept a project, which candidate to hire, or making career changes. What can we do today to describe the steepness of the learning curve, or rather, the height of the hill we're climbing, metaphorically speaking? What's better than vague subjective generalizations?


Is it possible to get a job in corporate software houses without a degree

I have been developing web applications in PHP from two years and have worked with three organizations. I started with no programming knowledge at all, I had interest in web development so I read some books, followed tutorials and hang out with web developers to learn how to develop websites which took me to PHP and than eventually towards programming and I really enjoyed it. Learning OOP, studying servers behaviours, doing amazing things with JS, working and understanding with frameworks like Zend and Yii was quite an experience for me. My ideals also changed from movie stars to persons like Dennis Ritchie and Matt Mullenweg. It took a while to get a job when I got my first things became pretty easy but one thing that I came across while working in the small software houses is that they really don't worry about the code all they want is to get the thing done by any means so that can deliver the project on time to their clients. This is actually really disturbing I have switched two organizations just to excel in programming and contribute in the field of IT as much as I can but it doesn't seems possible if I continue working in the organizations which are much focused on client and don't bother to compromise on the quality of code. My dream companies are wordpress and the organizations which have developed open source PHP frameworks like zend, yii etc. Why? because they are AMAZING and just because of their contributions web has become so amazing and rapid development is in reach of every developer but I am not sure whether I will be able to get a chance in such companies or not because I don't have a degree not because I never wanted but because I really never had a choice. I was on my own from the teenage and it was not possible for me to afford the education and now when I have the resources I am lacking in time and focus. I have a full time job, blog and some responsibilities. Will it be ever possible to work in my dream companies or which are similar to my dream companies


Does test-driven development force me to follow SOLID?

I hear a lot from TDD practitioners that one of TDD's advantages is that it forces developers to follow SOLID principles (Single responsibility, Open- closed, Liskov substitution, Interface segregation and Dependency inversion). But as for me it is enough to just write some tests (unit test primarily) to understand it is important to follow SOLID (and thus create testable architecture). Does TDD force developers to follow SOLID more actively than just writing unit tests?


Is blocking java applets a necessary security measure?

Chrome 11 is now asking user permission to run both signed and unsigned Applets (yes, for signed applets the user is asked twice). Chromium team decided that this measure is needed even when the user is using an up-to-date JRE. Here's my bug report (which reflects solely my opinion: http://code.google.com/p/chromium/issues/detail?id=84001). My question is, how do you guys see it? Is Java Sandbox dated and unsafe? Do browsers need to impose a second layer of protection by default? **Update:** I'm also curious about how many of you guys have a clean record experience with Java against how many every hit a piece of malicious software? As a Java Power User for more than 10 years, the only time my antivirus ever complained about something related to Java was a false positive (I was downloading some libraries from Maven Central repository).


Why can't native machine code be easily decompiled?

With bytecode-based virtual machine languages like Java, VB.NET, C#, ActionScript 3.0, etc., you hear sometimes about how easy it is to just go download some decompiler off the Internet, run the bytecode through it one good time, and oftentimes, come up with something not too far from the original source code in a matter of seconds. Supposedly this sort of language is particularly vulnerable to that. I've recently started wondering why you don't hear more about this concerning native binary code, when you at least know which language it was written in originally (and thus, which language to try to decompile into). For a long time, I figured it was just because native machine language is so much crazier and more complex than typical bytecode. But what does bytecode look like? It looks like this:               1000: 2A 40 F0 14     1001: 2A 50 F1 27     1002: 4F 00 F0 F1     1003: C9 00 00 F2      And what does native machine code look like (in hex)? It, of course, looks like this:               1000: 2A 40 F0 14     1001: 2A 50 F1 27     1002: 4F 00 F0 F1     1003: C9 00 00 F2      And the instructions come from a somewhat similar frame of mind:               1000: mov EAX, 20     1001: mov EBX, loc1     1002: mul EAX, EBX     1003: push ECX      So, given the language to try to decompile some native binary into, say C++, what's so hard about it? The only two ideas that immediately come to mind are 1) it really is that much more intricate than bytecode, or 2) something about the fact that operating systems tend to paginate programs and scatter their pieces causes too many problems. If one of those possibilities is correct, please explain. But either way, why do you never hear of this basically? **NOTE** I'm about to accept one of the answers, but I want to kind of mention something first. Almost everybody is referring back to the fact that different pieces of original source code might map to the same machine code; local variable names are lost, you don't know what type of loop was originally used, etc. However examples like the two that were just mentioned are kind of trivial in my eyes. Some of the answers though tend to state that the difference between machine code and the original source is drastically much more than something this trivial. But for example, when it comes down to things like local variable names and loop types, bytecode loses this information as well (at least for ActionScript 3.0). I've pulled that stuff back through a decompiler before, and I didn't really care whether a variable was called `strMyLocalString:String` or `loc1`. I could still look in that small, local scope and see how it's being used without much trouble. And a `for` loop is pretty much the same exact thing as a `while` loop, if you think about it. Also even when I would run the source through irrFuscator (which, unlike secureSWF, doesn't do much more than just randomize member variable and function names), it still looked like you could just start isolating certain variables and functions in smaller classes, figure out how they're used, assign your own names to them, and work from there. In order for this to be a big deal, the machine code would need to lose a lot more information than that, and some of the answers do go into this.


How should a programmer plan his life for future

I have been doing web developmwnt for 3 years in php/joomla/jquery/mysql. I am now learning python/django/sysadmin/j2ee just to expand my knowledge. I am 28 and I can find jobs, but I was thinking if I go beyond 40 or 45 then there is every chance that companies will look for younger people, because you can always find young people with similar skills if not experience. So I was thinking, do I need to keep the same role as a web developer or do I need to seek a career path where age does not matter and experience is the key. I have a relative who worked for 15 years as a programmer, and is now 38. He became the recruiter for an agency which provides IT candidates to other companies. I think that sort of position is not linked to age. I may be wrong. The other option I was thinking of is to keep in mind that by the time I get to 40 or above, I should have enough links with clients so that I can get enough freelance work to make my living. Because then I don't have to be at the mercy of jobs, and age won't matter. So I just want to know: as programmer what is the future after 40 or 50? Because if we have that kind of goal, we need at least 10-15 years to get to that point.


Is just using an email address for login a good idea?

Many a times I need to log into a website that I used months ago and have forgotten my password. So clicking the reset password link and the site sends me an email with a single use link which allows me to enter a new password and logs me in. Happy days. This got me thinking; how about we skip the whole password thing and just send a single use link in an email that I click which logs me into a month long session. So, tell me. Why wouldn't this work?


What are the shortcomings of using AuthorizeAttribute in this way in MVC?

I have ASP.Net MVC project code with custom authorization as below:               public class UpdateAccrualAuthorize : AuthorizeAttribute     {         public override void OnAuthorization(AuthorizationContext authContext)         {             AccessPermissions securityObject = AppContext.CurrentUser.Permissions;             if (!securityObject.HasCostPageAccrualChangesAccess)             {                 authContext.Result = new RedirectToRouteResult(                                         new RouteValueDictionary(new { controller = Constants.HeaderPage.ErrorController, action = Constants.HeaderPage.AccessDeniedAction }));             }         }     }      Here the redirect route logic is inside the authorization logic Then I referred Changing my Action filter class to be a Custom authorization attribute. Here it says a different approach               if (!authorized)              base.HandleUnauthorizedRequest(filterContext);      and to make configuration entry               <system.webServer>         <httpErrors errorMode="Custom" existingResponse="Replace">             <remove statusCode="403" subStatusCode="-1" />             <error statusCode="403" path="/error/403" responseMode="ExecuteURL" />         </httpErrors>     </system.webServer>      and register a route               routes.Add("Error",                  new Route("error/{statusCode}", new { controller = "Error", action = "Details" })                            );      Update I also read Asp.net Mvc custom mechanism to handle unauthorized request about handling ajax requests in the AuthorizeAttribute **QUESTION** What are the advantages of this new approach over my approach?


debugging web applications using debug parameter

A suggestion has been made by a team member to leave all debug code intact in our web pages... and then to create a variable that can be turned on / off to enable / disable debugging. This is a technique we use in some of our low level, non web code. Just wondering if anyone had any comments on how they've implemented something similar for web applications? Some of our web applications are written in lua, and others in PHP. I like the idea and I've seen it used in different types of solutions. However, my knee-jerk reaction is that for web apps, it might not be such a great idea. I don't want to have a tonn of logs generated on the web server. At the same time, it'd be nice to simply enable a variable and then start collecting information. The alternative could be to always have a test page that calls the same methods that the production page does, but the test page dumps a bunch of data to the screen. Just wondering if anyone has any experience / comments on doing this for the web as far as how to build it in, how difficult it is to maintain etc. Thanks.


What's the best way to set up the distance and height of a triple monitor system

I am fortunate that my employer provides a triple monitor setup. However, I'm wondering if the greater degree of head turning and the closeness of the monitors is leading to some postural pain. Is there any advice or guidelines, specifically for _triple_ monitors which might be of use?


Current best practice/methods to code a VB.NET DAL in SQL Server

What are the current best practice/methods to code a VB.NET DAL in SQL Server? I have been trying to search but can't seem to find the right words to look for.


How does C++ handle multiple inheritance with a shared common ancestor?

I'm not a C++ guy, but I'm forced to think about this. Why is multiple inheritance possible in C++, but not in C#? (I know of the diamond problem, but that's not what I'm asking here). How does C++ resolve the ambiguity of identical method signatures inherited from multiple base classes? And why is the same design not incorporated into C#?


Is every page a new view?

I just started building an iOS app and wanted to get some feedback regarding views. I've got specs for               Activity Page     Activity Recording     Activity Create     Activity Save      Each of the specs show a different function, but would each of these be a brand new view in my iOS app?


Dependency Injection - Dependency Chain Pattern

On my last large project, I used dependency injection really heavily. I started out using constructor injection but even two or three dependencies resulted in really ugly code.               public MyClass(         IDependency1 dependency1,          IDependency2 dependency2         IDependency3 dependency3)      I am not a fan of property injection. Some people say it implies an "optional" dependency. I think what they mean is that there will be a default dependency (the production class) but it can be replaced with a mock object during test. Many times, my dependencies have dependencies, too, so I can't provide a default value unless I used a singleton or something. My problem with property injection is that I prefer fully initialized objects and don't want to accidentally forget to mock out a dependency during test. So, I found a compromise. I created a "parameter object" that had properties for all of my dependencies. I passed these to my constructors. This had the benefit of keeping my code somewhat cleaner _and_ I could ignore some dependencies during test if they weren't touched. Based on feedback I got the impression this was a bad idea. It was constructor injection or parameter injection - no compromise allowed. Later I realized that these parameter objects sometimes became their own classes (or set of classes). That's when I discovered an interesting pattern. Many business objects depended on other business objects, which had their own dependencies. What I ended up with was an interesting data structure, similar to a linked list. ![A Simple Depedency Chain](http://i.stack.imgur.com/zvN6P.png) This data structure could become fairly complex depending on the number of interacting classes. In most cases, the structure was closer to an n-ary tree. Each parameter object could link to any number of other objects (including other business objects). The business objects were the nodes of the tree and the parameter objects were like the edges connecting them. ![A Complex Dependency Tree](http://i.stack.imgur.com/BvnPD.png) I think connecting all these objects together without using a declarative dependency injection framework would be mind-numbing. The dependency injection framework I was using was going 8 levels deep in my code building the dependencies from the bottom up in the worst case. The parameter objects usually just exposed the dependencies. On rare occasions, I would hide them behind friendly function calls and made them their own business objects (usually resulting yet another parameter object). I had to remind myself that the parameter objects only existed because I didn't want to construct dependencies in the constructor (or pass them to the constructor). It only made sense to create new business objects when I started repeating myself. Even then, I ended up with an explosion of parameter objects. I've read plenty of books explaining that this situation should never happen. Classes should have very few dependencies. It was a sign that my classes did "too much". But in most of these cases, a business object used data from multiple database tables (repositories), configuration settings, services, etc. in order to calculate something. This occurred most often when implementing a series of steps making up a unit of work. When N things are needed to do a task, the best you can do is push those N things to other classes or on up the call stack. Is one class with 6 dependencies better or worse than 3 classes with two dependencies each? I am hoping to get some feedback on this approach to dependency injection - in how it relates to architecting a business layer.


Would porting JPype to Python 3 be useful?

I have an open source project my company would like me to do with a small team, creating an adapter for the Oracle NoSQL database to be used in Python, but to do that we would need to be able to make calls to the running Java server that Oracle NoSQL runs on. Looking around at our options, we came across JPype which seems like the best option. Unfortunately, JPype hasn't been actively developed for a couple years, which is a downside in and of itself, but more importantly I'm betting it doesn't work with Python 3.x. So now we're thinking that it might be best for us to fork JPype and make an open source version which is compatible with Python 3.x, or do that with the existing project if we can get in contact with the guy who used to maintain it. The only alternative we see would be working with JNI ourselves, which seems more difficult. I'm wondering from "real" Python developers (I'm primary a Java developer) whether or not a port of JPype to Python 3.x would be useful in and of itself, or if this would more just be something that would be useful for this specific use case only.


Writing and Understanding code

I can write code. I can read code but I can't implement good code. How to develop deep understanding of any framework or stuff that we are working on? Is it looking into documentation and working on it? I have seen in this form that people that have great understanding of things they are working on. How is this possible? How to not scrape on the surface only? How to manage time vs learning vs productivity?


Is every number in the code considered a "magic number"?

So every number in the code that we are sending to a method as an argument is considered as a Magic Number? To me, it shouldn't. I think if some number is let's say it is for minimum length of user name and we start using "6" in the code...then yeah we have a maintenance problem and here "6" is a magic number....but if we are calling a method that one of its arguments accept an integer for example as the ith member of a collection and then we pass "0" to that method call, in this case I don't see that "0" as a magic number. What do you think?


Does the state Pattern violate Liskov Substitution Principle?

This image is taken from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET ![enter image description here](http://i.stack.imgur.com/UCMr1.png) This is the class diagram for the **State Pattern** where a `SalesOrder` can have different states during its life time. Only certain transitions are allowed between the different states. Now the `OrderState` class is an `abstract` class and all its methods are inherited to its subclasses. If we consider the subclass `Cancelled` which is a final state that doesn't allow any transitions to any other states, we'll have to `override` all its methods in this class to throw exceptions. Now doesn't that violate Liskov's substitution principle since a sublcass shouldn't alter the behavior of the parent? Does changing the abstract class into an interface fixes this?   How can this be fixed?


Why does this article state that graduate education liberate one from concerns like the efficiency of hardware-based integers?

Quoting The Evolution of Haskell Programmer, > graduate education tends to liberate one from petty concerns about, e.g., > the efficiency of hardware-based integers What exactly does this suggest?   Is it that after graduation, one gets more interested in abstract ideas so much that he does not think hardware is relevant? Or that hardware is also abstracted and one is more interested in algorithms? I am trying to understand on what grounds the sentence is based.


What critical iPhone programming (methods/skills/languages/etc) would you teach to new teenage programmers?

Alaskan high schools are looking to teach iPhone programming skills to their students. Where would you start? More specifically:   * What languages would you teach, first, second, third? Would you teach languages at all?   * What programs would you teach with?   * How would you start someone practicing programming skills?   * Would you teach things like agile, scrum, or any work management system? What critical skills would you start with? Have you been trained by any teachers you really liked? Would you recommend any teachers or trainers?


Using Microsoft Word/Outlook for content publishing to Wordpress

I am tasked with building an tool to allow users to publish to Wordpress from their PC using MS Word and Outlook. I know, completely defeat the purpose of having Wordpress, but the basic requirement are: 1) Format must be preserved, including images 2) Providing an interface for categorizing and tagging the document After doing some research, I think this could be achieved by creating an VBA macro that saves Word to html format, and sending it via http to Wordpress XMLRPC However, I haven't quite work out how to include the images, and how to keep the category from Wordpress and the macro in sync. I would like to hear from anyone who have experience in this and suggestion on how to implement this.


What do you do with coder's block?

Lately it has been a bit rough. I basically know all the things I need and all the avenues to get there for work. There's been no real issue of a problem with too high complexity, and performance is good. Still, after three major projects this year, my mind is behaving a little strange. **It's like I'm used to working in O(1+log(N-neatTricks)) but for some reason it processes in O(N^2)!** I've experienced a sort of burnout after long deadlines and drudging projects before, but when it turns into a longer experience, I haven't found the usual suspects to be helpful.   * Take more walks   * Work on other code   * Overdesign everything until I feel intensely driven to just make it (sorta works) How can a programmer recoup from the specific hole in your head programming leaves after being mentally ransacked by these bloody corporations and their fancy money? Hopefully some of you have some better ideas, because I could really use another round of being looted and pillaged.I've often wondered if there are special puzzles or some kind of activity that would de-stress the tangled balance of left and right braininess programmers often deal with. Do any special techniques, activities, anything seem to help with the developer's mindset especially? **EDIT:** > While not necessarily my favorite idea presented, I think Francesco first > fix is the _real_ answer to a commonly confronted problem. I can see how > this question could be viewed as rather subjective or common, but I have yet > to see a descript of this very particular occurrence. Perhaps we should find > the standard deviation of different types of moods only programmers report > having and call it the something-or-other syndrome.


When should a graduate apply for a programming job at tech companies?

How early do tech companies expect job applicants to apply, and whats the shortest amount of time it will take from applying to a company to beginning to work there? For example, if I'm graduating in May and wants to start working in July or August, when should I apply for jobs at tech companies? I assume small companies only look at applicants a few weeks before they are ready to work, but what about large companies, like Google or Facebook?


Class instance clustering in object reference graph for multi-entries serialization

My question is on the best way to cluster a graph of class instances around specifically marked objects ( _objects_ are the graph nodes and the references to each other are the directed edges of the graph). To better explain my question, let me explain my motivation: I currently use a moderately complex system to serialize the data used in my projects:   * "marked" objects have a specific attributes which stores a "saving entry": the path to an associated file on disc (but it could be done for any storage type providing the suitable interface)   * Those object can then be serialized automatically (eg: `obj.save()`)   * The serialization of a marked object `'a'` contains implicitly all objects `'b'` for which `'a'` has a reference to, directly s.t: `a.b = b`, or indirectly s.t.: `a.c.b = b` for some object `'c'` This basically define specific storage entries to specific objects. I then have "container" type objects that:   1. can be serialized similarly (in fact their are or can-be "marked")   2. they don't serialize in their storage entries the "marked" objects (with direct reference): if `a` and `a.b` are both marked, `a.save()` calls `b.save()` and stores `a.b = storage_entry(b)` So, if I serialize `'a'`, it will serialize automatically all objects that can be reached from `'a'` through the object reference graph, possibly in multiples entries. That is what I want, and it usually provides the functionalities I need. However, there are some structural limitations to this approach:   1. the multi-entry saving can only works through direct connections in "container" objects, and   2. there are situations with undefined behavior such as if two "marked" objects `'a'`and `'b'` both have a reference to an unmarked object `'c'`. In this case my system will stores `'c'` in both `'a'` and `'b'` making an implicit copy which not only double the storage size, but also change the object reference graph after re-loading. I am thinking of generalizing the process. Apart for the practical questions on implementation (I am coding in python, and use Pickle to serialize my objects), there is a general question on the way to attach (cluster) unmarked objects to marked ones. So, my questions are:   * What are the important issues that should be considered? Basically why not just use any graph parsing algorithm with the "attach to last marked node" behavior.   * Is there any work done on this problem, practical or theoretical, that I should be aware of? **Example of a simple object graph to serialize:** ![](http://i.stack.imgur.com/nVpih.jpg) Circles are objects and arrow references. Orange circles are marked objects. When serializing `A`, object `B` to `E` should be serialized but not blue objects because they are not reachable from `A`. Now, `B` is serialized in its own entry (i.e. file) and the question is how to choose where to serialize objects `C` to `E`, to `A` or `B` entry? Some thinking on this example:   * object `C` is only reachable from `A`, so its should be attached to it   * to reach `E`, it is necessary to pass by `B`, so `E` should be attached to `B`   * what about `D`? Because after serialization if `B` is loaded (and not `A`), `D` should also be loaded but not `A`. Thus `D` should be serialized in `B` entry. **Note:** I added the tag `database` because I think the answer might come from that fields, even if the question is not really.


call sub function based on variable value

I have a function containing other functions. These function are called based on value of variable `action`. These sub functions are logically grouped - i.e., they all deal with file manipulation. Each function has 2 to 5 lines. I would like to improve the style. Is there a more concise way of achieving this end than what I have below? I feed there is a log of defining functions that contain not many LOC.               def my_function(action):              return { '1': func_a, '2': func_b, '3': func_c, '4': func_d}.get(action, err)()              def func_a():             ...             ...             return ...         def func_b():             ...             ...             ...             return ...         def func_c():             ...             ...             return ...         def func_d():             ...             ...             return ...         def err():             return      *discaimer: actual functions have logical names. My issue is with the proliferation of functions to define


What mobile specific/iOS unit tests should you write?

I have read a TDD book by Kent Beck as well as other Unit Testing tutorials. Most of the tutorials explain how to use a tool or give simple/silly examples. Here on stackoverflow there are a bunch of questions on _HOW_ to test for iOS, but I want to know _WHAT_ should be tested on iOS/mobile apps in general. Specifically:   1. What type of tests should you write for network/API calls? (Do you actually hit the endpoint or just mock up JSON? Do you test error handling?)   2. What type of tests should you write for data persistence (esp Core Data)   3. It is easy to write tests for the Model layer (and any model functions), but what should you test on the Controller layer?   4. What other mobile-specific tests might you write? For sake of greater clarity, what Unit Test might you write if you were building a Netflix app which contains features such as streaming video, image caching, local persistence, network calls,etc?


How to plan a client/server app networking architecture to cope with multiple unrelated exchanges of data?

I'm coding a server/client application pair in Java, as I learn about it. I have basic functionality of sending a message to the server and parsing it but in thinking about the big picture of their communication, I'm stumped about where to go from here. Both the client and the server have to be able to initiate an exchange of data so I need to have one thread reading at each side, at all times. On top of that, when one initiates an exchange, it needs to listen for the reply. If I do that, though, I'd have two threads reading data, which I guess wouldn't end well since, from my understanding, I wouldn't be able to make sure the data gets read in the thread I want. I see a few options but I'm not confident at going too far with each solution since my knowledge doesn't let me think too far ahead.   1. Use only the first thread that was originally waiting for data before the exchange, to also read the reply for the query that was just sent by a different thread, and forward the data where it belongs.  This sounds difficult. If I read the data in the same thread that requested it, it would be very straightforward compared to this.   2. Start reading the InputStream in the same thread that requested data and make the thread that was originally listening, wait. My problem with this is that, if there's other data arriving by the same client that is unrelated with the query that was just made, it would be fetched by this thread instead of the other one, which kinda defeats the purpose of reading the data here.   3. Establish another connection from the client, to another port, after the first is established. Then I could use one socket for exchanges initiated by the other side, and the other to listen for replies of queries made in the meantime. This way I'd know exactly what is going where, but wouldn't I have this same problem further down the road if I have two queries waiting for data at the same time? This sounds like simple functionality, trivial to find in many applications, so I'm guessing there's some tried and true method out there and there's no reason for me to try and reinvent the wheel here. So, to sum it up, what's the recommended way to set up client/server applications that can cope with possibly overlapping dialogs, initiated by either one, at unpredictable times? I started to modify some parts of the question to make it a bit clearer but I ended up almost rewriting it completely. If it's still a bit confusing is because I am confused. I think I'm missing some simple point but I haven't been able to find examples that show this.


Python in Big Data?

Can python be efficiently implemented in big data field? To be precise I am building an web app that analyses really big data in medical health care field consisting of medical history and huge personal information. I need some advice on how to handle very big data in python efficiently and with high performance. Also are their some open source packages in python available which have high performance and efficiency in big data handling? About users and data: Each user has about 3gb of data. Users are grouped based on their family and friend circles and the data is then analysed to predict important information and co-relations out of that. Currently I am talking about 10,000 users and will be rapidly increasing number of users.


How does one network at software conferences?

I'm still at Microsoft TechEd, and the response to my question about how to effectively use my time at software conferences was overwhelmingly "networking is the most useful part of software conferences". Problem: I have no idea how to even approach that task. I've always been kind of an introvert. At school and at work I've generally not had issues because there are enough extroverts around that approach me that I've made some awesome friends over the years. However, at conferences, it seems most are introverted like myself, and those who aren't seem to be salespeople. The couple of times I've felt okay approaching people it's been after a session where there's been healthy discussion throughout the whole room, and just when I get the nerve to go up and talk to some people, they leave and go on to other things. Is there a specific books I should read? Advice I can take? Anything as far as approaching people one does not know? 'Cause every time I try I just feel like an awkward mess. :( (Oddly enough, I don't have problems speaking to a group of people -- it's the one-on-one things that trip me up :P) (Oh, and by the way, if anyone from here is also there and would like to meet to talk about things, I'm game :P) **So, how does an introverted programmer like myself network effectively at software conferences?**


Suggestions to manage semi-structured email bounces?

The company I work for sends a lot of emails, and in return we get a lot of bounces.   We currently don't have a good way of sorting them and help us archive the routine ones while putting the important ones in front of human eyes.   From a format of view these email bounces are not well structured, but there are some sort of patterns.   There is a preliminary system that is being worked on but it is becoming an unmanagable collection of complicated regular expressions.   I convinced my company to let me take home a portion of the bounces, and I am hoping to find a better way to handle them in my free time. It's both an opportunity to learn something interesting and do something valuable.   How would you approach this problem? Is there a class of methods or algorithms that are a good fit for this situation? Thank you.


Imitating Exchange Server's "RBAC AuthZ" in my own application... (is there something similar?)

Exchange 2010 has a delegation model where groups of winrm cmdlets are essentally grouped into roles, and the roles assigned to a user. ![Exchange Roles Image](http://i.stack.imgur.com/CYzCU.jpg) (Image source) This is a great & flexible model considering how I can leverage all the benefits of PowerShell, while using the right low level technologies (WCF, SOAP etc), and requiring no additional software on the client side. ![image of how Exchange 2010 remote admin works](http://i.stack.imgur.com/G44ru.jpg) (Image source) **Question(s)**   1. Is there a way for me to leverage Exchange's delegation model in my .NET application?    2. Has anyone attempted to imitate this model?   3. If I must start from scratch, how would I go about imitating this approach?


Should a complex EL expression be replaced by a single javabean getter?

In JSF if I have a component that conditionally renders based on a number of variables what is the optimal way to handle the render statement... should the logic live in the component declaration or in some form of helper class? The text woof is only displayed when an animal is an elephant or dog and the animal is not mute. Option 1: Implementation in the view:               <h:outputText id="text" value="woof"        rendered="#{animal.type == 'elephant'                        or animal.type == 'dog' and not(animal.mute)}"/>      or Option 2: Encapsulation:               <h:outputText id="text" value="woof" rendered="#{animal.barkingAnimal}"/>      with implementation:               public class Animal {          public boolean isBarkingAnimal() {              return ("dog".equals(getType()) || "elephant".equals(getType())) && !isMute();          }     ...      So both work... but which is the right way to handle the scenario?


How does the Law of Demeter apply to object-oriented systems regarding coupling and cohesion?

How does the **Law of Demeter** applied to object-oriented systems with coupling and cohesion? I was reading a book "Software development and professional practice" and came across the chapter about LoD, and was curious about how that principle is applied into object oriented systems.


Programming judge with versus system

I'm looking for a programming judge system which supports putting contestants programs against each other in "matches". The format could be either for example a tournament style or chess ranking, but this isn't that important. A good example would be Google's AI challenge (http://aichallenge.org/) The only systems I've found so far are "regular" programming judges, i.e. those who can check if a program passes or fails a given problem, like DOMJudge. Do you know of any systems like this?


Is "VS Lightswitch" the "Oracle APEX" from Microsoft?

What do you think? Is **"Visual Studio Lightswitch"** becoming the **"Oracle APEX"** for **SQL Server** in the futrure? Are these two technologies comparable?


Getting involved in the Java Community Process (JCP)

The Java Community Process is meant to be just that. A process where the Java community can have its say on the future of the language. What is the best way to get involved in the JCP? A JSR (Java Specification Request) goes through various stages in its life cycle. Obviously if you are domain expert with deep knowledge of a subject then you would want to get involved in a relevant JSR at a very early stage. However, what stage is the best to get involved at if you are a likely end user (as a developer) of the JSR but are not the above mentioned domain expert?


Manage version control with a central development server (LAMP)

I'm working in a small team with up to 5 (web)developers. Because our team is growing frequently and we ran into problems with multiple people working on the same code we decided to set up a VCS. **Current Situation** Currently we are working with a central development server (LAMP). So every developer works on the same code base and if the code is tested and ready for our live server we just copy it via ftp. I know this is some sort of an anno 1600 workflow but yeah - it is what it is and also the reason for this question. On the development server our directory structure looks like this:               /var/www            /Project1            /Project2            /Project3            ...      Additionally there are some small non-webapplications - Android/iPhone/Windows 8 etc. apps and some C# tools which also should be included in the VCS. **Goal and problems** Our goal is to get a clean setup for a VCS, which works together with an issue tracking software, enables us to work togheter on the same project at the same time without overwriting our codes and simply gives us the advantage of version-control. I think the first question for us is, which technology should we use. Some of us have allready experienced subversion. But because git is some sort of becoming the "standard" and there are a lot of "pro git" arguments among the web users we tend to using git. There starts our uncertainty. For using git - a decentralised VCS - it looks like we have to start using seperate development servers on each developer's computer. The problems with that are:   * Some times we work on different computers, so when we forget to push our code we have a problem.   * We would have to work with virtual machines because the dev servers should be the same as our live server (This would simply not be enforceable in our environment, believe me it's not possible).    * The development server usually also served as a "tryout" or "presentation" server where non-developers had a look at what's going on. **Is there another possible setup with git so that we are able to benefit from the system while still using a single(!) development server?** Maybe with different directories for each developer. Or can we still work on the same code base with maybe locking the files we are working on and then commit them to a repository. It's maybe important to say that while it became a factor for us it is still uncommon that multiple developers work on the same part of an application at the same time.


How to manage maintenance

There are lots of great books and resources out there about managing new software developments, but very little that I've seen about managing ongoing maintenance of software systems. I'm not talking about big enhancements, I'm talking about the little 1 or 2 day bug fixes and updates that quickly accumulate once a system goes into production. Any recommended books or other resources on this subject?


what do database programmers do?

Every time I read about Oracle programmers etc, I get confused. I don't know what exactly they do. From my understanding, application programmers need to develop the core functionality. The libraries they use might help in GUI development or database connectivity but the functionality that makes that application that application must be programmed and that makes every application different (well some could be tweaked versions of others). In this relation, isn't database programming basically creating table and aren't these tables processed in response to SQL statements which are issued by an application which usually is the front end? So is table creation such a big deal?


Use client to access database or server to access database

I' creating a client server application in which I need to update a particular database. I'm using python with MySQL. There are two options: I use a client.py and server.py, the client.py can send data packed into JSON to the server, the server.py will handle the database and send query data back in the form of JSON. The second option is that there is no server.py file, instead the client accesses databases and queries directly with the MySQL server. Is there any benefits to using one method to another? **EDIT:** There can be atmost about 100 clients and they will be sending data throught the day with a delay of about about 20 seconds.


What was Ruby used for before Rails?

What type of programming or project would only involve the Ruby language? Rather than using RoR. What was Ruby used for before the Rails framework existed is what I am basically asking.


Develop a website using mustache.js and PHP

I'm thinking of building a website using mustache.js to render the website and having PHP as the backend. The PHP will then mainly contain queries to the database and some SESSION checkings. Previously I've used plain PHP to render the frontend but it gets way too messy. An example of what I'm thinking: **HTML File**
Your favourite website is {{website}}
                    **PHP File**               <?php         function getWebsite($userid){             $mysqli = (...);             $stmt = $mysqli -> prepare("SELECT name FROM websites WHERE userId = ?");             $stmt -> bind_param("i", $userId);             $stmt -> execute();             ...             ...             echo json_encode($results);         }     ?>      Is this a good structure or will it still get messy? Will it be slower?


Having a generic data type for a database table column, is it "good" practice?

I'm working on a PHP project where some object (class member) may contain different data type. For example :               class Property {         private $_id;     // (PK)         private $_ref_id; // the object reference id (FK)         private $_name;   // the name of the property         private $_type;   // 'string', 'int', 'float(n,m)', 'datetime', etc.         private $_data;   // ...              // ..snip.. public getters/setters     }      Now, I need to perform some persistence on these objects. Some properties may be a text data type, but nothing bigger than what a `varchar` may hold. Also, later on, I need to be able to perform searches and sorting. Is it a good practice to use a single database table for this (ie. is there a non negligible performance impact)? If it's "acceptable", then what could be the data type for the `data` column?


Inspection, code review - is it really testing?

ISTQB, Wikipedia or other sources classify verification acitivities (reviews etc.) as a static testing, yet other do not. If we can say that peer reviews and inspections are actually a kind of a testing, then a lot of standards do not make sense (consider e.g. ISO which say that validation is done by testing, while verification by checking of work products) - it should at least say dynamic testing for validation, shouldn't it? I am completing master thesis dealing with QA and I must admit that I have never seen worse and more ambiguous and contradicting literature than in this field :/ Do you think (and if so, why) that static testing is a good and justifiable term or should we stick to testing and static checks/analysis? Wikipedia: **_Static testing** is a form of software testing where the software isn't actually used. This is in contrast to dynamic testing. It is generally not detailed testing, but checks mainly for the sanity of the code, algorithm, or document. It is primarily syntax checking of the code and/or manually **reviewing the code or document** to find errors. This type of testing can be used by the developer who wrote the code, in isolation. Code reviews, inspections and walkthroughs are also used._ EDIT: One of the many sources that mentiones static testing to employ reviews etc. (look for "static testing" in Google books): ![enter image description here](http://i.stack.imgur.com/y768h.jpg)


Attributing credit for programming languages used

I'm working on a website and was hit with the thought of "do I need to give credit for the languages I'm using to build my website with?" I wasn't able to find any sort of licenses for HTML, CSS, or JavaScript and I'm a bit confused on the wording of PHP's license. My question is: Do I need to specify somewhere on my website (externally or internally) that I'm using HTML, CSS, JavaScript, PHP, and MySQL (and attribute credit, linking to their licenses if they have one, etc)?


Conflicting Java Styles within a Team

I am part of a Java development team with a 6 week deadline. This necessitates writing a good deal of code very very quickly. However our development team has different styles of coding. Everything from name conventions to methods of abstraction differ among our team. Does anyone know of any documents that dictate "standards" for java? To clarify, I was wondering if there was an organization that would dictate proper naming convention for variables and functions for example. This is paramount as with such a short deadline we can't afford to spend time trying to comprehend each others code.


How do you ensure your product meets basic usability guidelines?

There are some really common usability errors in everyday software we used; errors that result from the ways the particular programmer has learned without learning of all the other ways there are. For example, talking about Windows software in particular, the following common flaws come to mind:   * Failure to support multiple screens. For example, windows centered in the virtual desktop (instead of a specific screen) and hence displayed spanning the monitor boundary in a dual monitor setup.   * Failure to support serious keyboard users. For example, utterly messed up tab order; duplicate or completely missing accelerator keys.   * Alt+Tab order mess-ups. For example, a window that doesn't go to the end of the tab order when minimized.   * Subtle breakage of common controls that were reimplemented for one reason or another. E.g. failure to implement Ctrl+Left/Right on a textbox; failure to add an Alt+Space window menu to a skinnable window, failure to make Ctrl+Insert copy to clipboard, etc, etc. This one is a huge category in its own right. There are a gazillion of things like this. How can we ever make sure we don't break a large proportion of these? After all they aren't all written down anywhere... or are they?


Bill of materials database design in EF codefirst?

I'm having trouble generating a proper database design for bill of materials in EF Code-first I just need a general structure then ill add additional fields So i need to have a Product that is assembled from other Products which are assemblies of other Products. Example: Product 1:   * Aluminum Box 1x     * Aluminum Sheet 4x      * Foil 1x     * Screws 6x Product 2:   * Wheel Cart 1x     * Aluminum Box 1x     * Wheels 4x     * Screws 4x     * Foil 2x So notice Product 2 (Wheel Cart) is assembled from Product 1 (Aluminum Box) and some additional components, yet same Product Screws and Foil is used in both. So i think its hierarchical many to many. Or maybe someone knows a better solution. Doesn't have to be in EF Code-first, i can re-generate code from T-SQL. Thank you. _**EDIT:_** Ive been messing around and nothing seems to work, i have this currently: **Components** ComponentID Name Price ProductID N | | | 1 **Products** ProductID ParentID Quantity ComponentLookupId First i create a Component, then a Product which can be hierarchical and tie a Component to it, and now i am fetching the Name and Price of the Component via Lookup, which is sort of OK, but having problems with summaries. If i copy Name, Price then when Component is changed Product isn't. Or should i try many-to-many with additional fields in a join table.


Why doesn't Ruby have implicit conversion of Fixnum into String?

Ruby normally makes things easy. However, it doesn't allow implicitely converting a number to a string:               2.0.0p247 :010 > "a"+1     TypeError: no implicit conversion of Fixnum into String      Why is this when nearly every other language allows it, including Perl, PHP, Java and VBA?


Is Big Nerd Ranch or AboutObjects iOS training worth it?

I have a CS undergrad degree and have been programming for several years with my current company, messed around with Objective-C by making a few console apps and a few simple apps that I ran in the simulator: all basic stuff. My company asked me to take on our in-house iOS development and they offered to send me "away" for training. Has anyone been to either the Big Nerd Ranch or AboutObjects iOS training? Was it a worthwhile experience? Did you learn anything you couldn't have learned from books or other resources?


What's the next logical TDD move in this learning example?

I'm inching my way up the TDD ladder and I've got to a point where I'd like to get advice on the "next move". I realize there might not be a single answer here, so any logical suggestion would be great. The thing I think I'm stuck on is knowing weather I should force duplication or proceed with primary functionality implemented by minimal (and temporary due to not being general) code. I'm trying to go in a strict green/red/re-factor cycle. Also, this example is so simple it doesn't require any mocked objects, but I think it's still a valid example (please correct me if I'm wrong or I've gone into some kind of trivial case that's not worth working with). **UPDATE** : I continued with this almost to the conclusion so I suppose I'll leave it up and see if anyone has any comments and if not I will delete.. **Tests:**               using NSpec;          namespace TicTacToe     {         public class new_game : nspec         {             protected TicTacToeGame game;                  private void before_each()             {                 game = new TicTacToeGame();             }                  private void when_game_starts()             {                 it["board should be clear"] = () => game.BoardState.should_be("---,---,---");                 it["it's x's turn"] = () => game.PlayerUp.should_be('x');                 it["no winner yet"] = () => game.Winner.should_be('-');             }         }              public class specify_game : new_game         {             private void first_move()             {                 context["is x in the center"] = () =>                     {                         act = () => game.Move('x', 2, 2);                              it["board should have x in the center"] = () => game.BoardState.should_be("---,-x-,---");                         it["it's y's turn"] = () => game.PlayerUp.should_be('y');                              context["then y in the center"] =                             () =>                                 {                                     it["should throw OtherPlayerOccupiesSpaceException"] =                                         expect<OtherPlayerOccupiesSpaceException>(() => game.Move('y', 2, 2));                                     it["no winner yet"] = () => game.Winner.should_be('-');                                 };                              context["then y in the upper left"] = () =>                             {                                 act = () => game.Move('y', 1, 1);                                 const string expectedBoardState = "y--,-x-,---";                                 it["correct board state is " + expectedBoardState] = () => game.BoardState.should_be(expectedBoardState);                                 it["it's x's turn"] = () => game.PlayerUp.should_be('x');                                 it["no winner yet"] = () => game.Winner.should_be('-');                                      context["then x in the middle top"] = () =>                                     {                                         act = () => game.Move('x', 1, 2);                                         const string expectedBoardState2 = "yx-,-x-,---";                                         it["correct board state is " + expectedBoardState2] = () => game.BoardState.should_be(expectedBoardState2);                                         it["no winner yet"] = () => game.Winner.should_be('-');                                              context["then y in the right top"] = () =>                                         {                                             act = () => game.Move('y', 1, 3);                                             const string expectedBoardState3 = "yxy,-x-,---";                                             it["correct board state is " + expectedBoardState3] = () => game.BoardState.should_be(expectedBoardState3);                                             it["no winner yet"] = () => game.Winner.should_be('-');                                                  context["then x in the middle bottom"] = () =>                                                 {                                                     act = () => game.Move('x', 3, 2);                                                     const string expectedBoardState4 = "yxy,-x-,-x-";                                                     it["correct board state is " + expectedBoardState4] = () => game.BoardState.should_be(expectedBoardState4);                                                     it["x wins"] = () => game.Winner.should_be('x');                                                 };                                         };                                     };                             };                     };                 context["is y int the center"] =                     () =>                         {                             it["should throw NotYourTurnException"] =                                 expect<NotYourTurnException>(() => game.Move('y', 2, 2));                         };             }         }     }      **Implementation:**               using System.Linq;     using System.Text;     using System.Text.RegularExpressions;          namespace TicTacToe     {         public class TicTacToeGame         {             private readonly char[,] grid = new char[3,3];                  private bool xsTurn = true;                  public TicTacToeGame()             {                 for (int i = 0; i < 3; i++)                 {                     for (int j = 0; j < 3; j++)                     {                         grid[i, j] = '-';                     }                 }             }                  public string BoardState             {                 get                 {                     var sb = new StringBuilder();                     for (int i = 0; i < 3; i++)                     {                         for (int j = 0; j < 3; j++)                         {                             sb.Append(grid[i, j]);                         }                         if (i < 2)                             sb.Append(',');                     }                     return sb.ToString();                 }             }                  public char PlayerUp             {                 get { return xsTurn ? 'x' : 'y'; }             }                  public void Move(char player, int down, int over)             {                 over -= 1;                 down -= 1;                 if (player != PlayerUp)                     throw new NotYourTurnException();                 if (grid[down, over] != '-')                     throw new OtherPlayerOccupiesSpaceException();                 this.grid[down, over] = player;                 xsTurn = !xsTurn;             }                  public char Winner             {                 get                 {                     string boardState = BoardState;                          var xWins = new[]                         {                             "xxx,...,...",                             "...,xxx,...",                             "...,...,xxx",                             "x..,x..,x..",                             ".x.,.x.,.x.",                             "x..,x..,x..",                             "..x,..x,..x",                             "x..,.x.,..x",                             "..x,.x.,x..",                         };                              var yWins = new[]                         {                             "yyy,...,...",                             "...,yyy,...",                             "...,...,yyy",                             "y..,y..,y..",                             ".y.,.y.,.y.",                             "y..,y..,y..",                             "..y,..y,..y",                             "y..,.y.,..y",                             "..y,.y.,y..",                         };                          if (xWins.Any(win => Regex.IsMatch(boardState, win)))                         return 'x';                          if (yWins.Any(win => Regex.IsMatch(boardState, win)))                         return 'y';                          return '-';                 }             }         }     }      **Output:**               PM> NSpecRunner.exe .\TicTacToe\bin\Debug\TicTacToe.dll          new game       when game starts         board should be clear         it's x's turn         no winner yet       specify game         first move           is x in the center             board should have x in the center             it's y's turn             then y in the center               should throw OtherPlayerOccupiesSpaceException               no winner yet             then y in the upper left               correct board state is y--,-x-,---               it's x's turn               no winner yet               then x in the middle top                 correct board state is yx-,-x-,---                 no winner yet                 then y in the right top                   correct board state is yxy,-x-,---                   no winner yet                   then x in the middle bottom                     correct board state is yxy,-x-,-x-                     x wins           is y int the center             should throw NotYourTurnException          17 Examples, 0 Failed, 0 Pending


At which point is a continuous integration server interesting?

I've been reading a bit about CI servers like Jenkins and I'm wondering: at which point is it useful? Because surely for a tiny project where you'd have only 5 classes and 10 unit tests, there's no real need. Here we've got about 1500 unit tests and they pass (on old Core 2 Duo workstations) in about 90 seconds (because they're really testing "units" and hence are very fast). The rule we have is that we cannot commit code when a test fail. So each developers launches all his tests to prevent regression. Obviously, because all the developers always launch all the test we catch errors due to conflicting changes as soon as one developer pulls the change of another (when any). It's still not very clear to me: should I set up a CI server like Jenkins? What would it bring? Is it just useful for the speed gain? (not an issue in our case) Is it useful because old builds can be recreated? (but we can do this to with Mercurial, by checking out old revs) Basically I understand it can be useful but I fail to see exactly why. Any explanation taking into account the points I raised above would be most welcome.


Moving from an IT department to a proper technology company

I have been working with Java/web applications in an IT department of a retail company. As much as work goes, there is nothing much to say. Fixing couple of if/else loops, writing some simple business logic etc., is all what I have been doing. Having said that, I feel I have a good technical knowledge, and I am willing to move to companies like Microsoft/Google/Amazon etc., [I want to work in these places, because I feel I am a technical guy, and I am working in a place where most people freak out when the words like 'algorithm' are heard] I can of course prepare algorithms/computer science fundamentals etc.,(I hold a 4 year degree in computer science program) but beyond that, will my experience hold against me ? I doubt I'll even get a call from them seeing my work experience. What kind of questions(apart from the algorithm types) can I expect ?


Who invented Haskell's type classes?

Haskell's type classes are a very powerful tool and give Haskell a great expressive ability, compared to functional languages that don't have them. When were they invented, and who invented them?


Developing workflow for existing silverlight and WCF application

I have an already existing application in Silverlight 4.0 with WCF services. Now what I want is a workflow to be integrated along with the above application. The workflow will be a simple approval workflow i.e sequential workflow. Can any one suggest some links or a solution?


Which is better : Storing/retrieving images on/from SQL server or in a directory on server

I am working on a project in Asp.net MVC and need to work with images. There is an SQL database with a Product table. Every product in the table will have it's own image. I have two ways to do this : 1) Save the image in a web directory and store the URL on database. 2) Store the image in SQL itself in binary format and then retrieve it. Which is a better approach ? Mind you, I have no idea how second method works :-P . I will only learn this if there are merits to the second method


Advice on which storage technology for an Image repository

At this point, I'm not much of a programmer, solid html/css, familiar with JS but not a programmer by any means. I'm looking to pick up whatever is necessary for an upcoming project. I need to build an online image repository that will host around 15k photos. Those photos will need to have user entered data associated with them. They will need to be searchable by tags, and batch downloadable. Would you guys do filesystem or db storage? Basically, what type of storage solution would you use?


MySQL with mutiple threads and processes

I'm developing a telecom messaging platform in C, and I'm going to need multiple processes to be working with MySQL DB. How can I make two processes read/write to/from a Mysql DB and, if/when one of them goes down, get the other to seamlessly take over the work until the dead process gets back to work? I was thinking/googling some options and am stuck in place where I don't know which one to choose. What I think so far is that table lock is not the best option to go for, as it will stall the other process until the table is unlocked. The other option is to use row-level locks or manual locks, but I can't find the best way to do it.


How to set up a personal Apple developer account now with an eye on transferring app ownership to a company later?

I have two Mac applications that I wrote for my own personal use, but I'm considering polishing them up and giving selling them on the Mac App Store a try. It seemed very premature to consider what would happen if either app would become successful enough to make it possible to set up a business around it, or to sell it to another developer. That is, until I read that Apple doesn't make it easy to transfer app ownership. I'm not sure how to best register with the Apple Developer program now to avoid any possible hassle in this respect later. From what I understand, one can really only transfer ownership of a developer account. I'm not sure about the relationship between an Apple ID and an Apple developer account. Does this mean I should at least not use the Apple ID I'm already using for iTunes, but create a second one to use for registering as an Apple Developer? Is there any disadvantage to using separate Apple IDs like this on the same Mac (one ID for Xcode development, the other ID for iTunes/iCloud/App Store/...)? Should one go as far as having a separate Apple ID & Apple developer account per app one develops? Or is there some other solution to take into account the possibility of transferring app ownership?


Is it bad to have classes as properties of all other classes?

I've been making MVC programs for work (I'm an intern) and I feel like I'm doing a pretty good job at abstraction, single responsibility, etc. But I have this feeling about how I keep making objects properties of other objects and I'm not sure if it's a bad thing. Example:               User     {          String Username;          Int32 UserID;               .               .               .          BusinessLogicClass Variable;     }          BusinessLogicClass      {         AnotherClass Variable;         AndAnother Variable2;     }          AnotherClass     {          IThinkYoureGetting ThePoint;     }      All my Classes are properties of the others in one massive hierarchy, It's kind of what the business logic calls for but I can't help but wonder if I should be trying to prevent something like this. So I end up effectively with one variable that I control the children of, but the classes are separate. Is this something common? Is it bad? If it is bad, what should I do about it?


Effectiveness of FizzBuzz and Beyond

As part of the interview process we initially ask the candidates to do 'FizzBuzz' nowadays the percentage of candidates that can correctly answer FizzBuzz has increased dramatically - this may be due to it's popularity on the web. About a year ago, as a second question we began asking a question very similar to the original FizzBuzz. The question was designed to be as simple as the original FizzBuzz, and to also assess a particular ability of the candidate, specifically the ability to order and prioritize in a meaningful and logical manner a set of "business rules" that have been provided in some arbitrary order. The wording of the question initially seems slightly ambiguous, which may make it difficult for non-native English speakers, but if thought through can be correctly resolved - Also it gives the candidate the opportunity to ask questions for clarification, which is always a good thing. We find this a very important skill to have as a developer, as software development is typically based on functional requirements that are derived in no particular order over time, that may place constraints and conditions upon other areas of the software without explicitly indicating and it is the job of the astute developer to at the very least investigate potential issues and conflicts with regards to the implementation. What we found was that a little over 65% of the candidates (sample size of 38) that passed FizzBuzz completely failed FizzBuzz v2.0 Normally these candidates would be detected later on in the process, but it seems to be a nice way to detect them early on. My question is not about whether or not FizzBuzz is outdated, but rather what factors could be contributing to such a high number of candidates failing the FizzBuzz v2 question.   * Is the question too ambiguous?   * Does the stress of an interview environment decrease ones ability to think critically to the point of not being able to complete such a trivial task? **Question:** Write a routine in your favourite programming language that will take a list of strings as input, and for each string in the list will do one of the following:   1. Print only Fizz if the string contains the letter A   2. Print only Buzz if the string contains the letter B   3. Print only BuzzBuzz if the string contains both A and B   4. Print only FizzFizz if the string does not contain both A and B   5. Print only FizzBuzz if the string contains only one A and only one B * * * Some typical questions asked by candidates are:   * Should it be case sensitive?   * Does "contains A and B" mean A should come before B   * What should be printed if none of the points are met?   * What should happen if more than one condition can be met? We found that the overwhelming majority of candidates that successfully completed the question, didn't ask anything at all they just did it like they did FizzBuzz.


How can I understand aggregation and containment?

I'm confused between aggregation and containment. I'm wondering if the following represent an aggregation or containment?               class Auto      {             private string model;        private int speed;               class AutoCustomer          {             public string LastName;             public string Address;             public DateTime DateOfPurchase;          }     }


Questions on software development contracting

I am trying to understand a few aspects of applying for jobs such as the following: Android Developer - Front-end Experience Required - 3 month contract - London - £300 per day - Immediate start I have several questions and am particularly interested in the UK.   1. What is the reason for the high daily rate? Is this because it's short term and thus is less attractive to many people, or because it requires a higher level of skill/higher workload than the average permanent job?   2. How often to these contracts usually pay? Someone told me that they will pay every two weeks.   3. Just how essential are the skills listed in the job listing? For example, I have experience with Android and Java SE, but no experience with Java EE - would this put me out of the running for a Java EE contract?


Can python and php work together?

I am having a mobile app created for ios. The developers built the app in php. The app requires an algorithm so I found another programmer to develop it. The algorithm programmer built the algorithm in python. The developers refuse to finish the app because they say it won't work with python, while the programmer insist it will. The programmer says put the algorithm in its on server and connect then over http. Will this work and I'd so how risky is it to future problems?


How does Java handle integer overflows and underflows?

Does Java handle integer **overflows** and **underflows**? If so, how does it handle these?


Should ICT professionals be warranted professionals? Does anyone have any resources/journals that can help me since I have found none.


How can I retain knowledge about new technologies I don't use every day?

At work we mostly do WinForms development and it’s not a secret that it is already very outdated. I have a passion to learn new stuff like WPF, MVVM and want to use full advantages of C# 4.0. There is no way I can push my bosses to change “well-recommended” and “proven” technologies like WinForms to something else. I have up to two hours a day which I can dedicate to self-learning but I simply don’t know the most efficient way to study. I tried to read couple of books and even wrote a simple WPF application but think that it’s not enough. How can I manage my time learning new things in a way that sticks, even if I don't use it on a daily basis?


How complete and mature is PyWin32?

I am considering utilizing Python for creating an application. The purpose of this application is solely to interact with the Windows API. My question, therefore, is: Is PyWin32 mature and complete enough to be relied upon, or would I be better off doing this in C++? The reasons why I wanted to use Python are:   1. Easier access to coders   2. Easier to develop and maintain Python code than C++ code I saw that we are currently on Build 242 (or something) of PyWin32, which gives me exactly no idea about the maturity. I can see that there has been releases since 2004, though, but that does not really say a lot either.


Worst practices in developing database applications

In constrast to http://programmers.stackexchange.com/questions/123591/database-design-good- practices I wanted to ask:   What are the top worst practises you encountered when having to work with other people's database application code & databases ? Mine so far are:     * Not putting any foreign key constrains in the database (for ease of web forms development...)    * SQL queries by string concatenation (no escaping of ', no parameters)   * Usage of thread-unsafe code (with static variables) to decrypt the database password...


How do I make my customers not like me too much?

In 2004 I went to work for a consulting firm because I like variety, challenges, working with new technologies, etc. However, I've been a developer for 25 years - and spent the majority of my career as a direct-hire (12 years) then as an independent consultant for another 3 years (ah the DotCom bubble!) for one firm. So my instincts are more like a good internal developer than a consultant. My problem is what I call the "catch-22" of consulting. You go into consulting because you want to work at a lot of different engagements, but if you do a really good job your clients never want to let you go. And of course the salespeople are happy to keep you billing (and don’t want to alienate a good customer) So my question is – how do I overcome this? I have had some colleagues who had just the right type of “arrogance” (for lack of a better term) that made them initially attractive to some clients, but would grate on them over time – but that just isn’t my style. I want to do good work and be successful for my clients, but be able to “gracefully” move on after a reasonable amount of time.


Which license would I use for my library code?

I have signed a Non-competitive agreement but I would like to be able to reuse some code across all projects that I work on for this company. So, which license can be used for my library code that would basically say the following:   * I (the author) can use my library code in any client project.   * You cannot use my code in part or in whole in any of your projects.   * You may not redistribute or share my code in any way in part or in whole.


Is the science of Computer Science dead?

**Question :** Is the science and art of CS dead? By that I mean, the real requirements to think, plan and efficiently solve problems seems to be falling away from CS these days. The field seems to be lowering the entry-barrier so more people can 'program' without having to learn how to truly program. **Background :** I'm a recent graduate with a BS in Computer Science. I'm working a starting position at a decent sized company in the IT department. I mostly do .NET and other Microsoft technologies at my job, but before this I've done Java stuff through internships and the like. I personally am a C++ programmer for my own for-fun projects. **In Depth :** Through the work I've been doing, it seems to me that the intense disciplines of a real science don't exist in CS anymore. In the past, programmers had to solve problems efficiently in order for systems to be robust and quick. But now, with the prevailing technologies like .NET, Java and scripting languages, it seems like efficiency and robustness have been traded for ease of development. Most of the colleagues that I work with don't even have degrees in Computer Science. Most graduated with Electrical Engineering degrees, a few with Software Engineering, even some who came from tech schools without a 4 year program. Yet they get by just fine without having the technical background of CS, without having studied theories and algorithms, without having any regard for making an elegant solution (they just go for the easiest, cheapest solution). The company pushes us to use Microsoft technologies, which take all the real thought out of the matter and replace it with libraries and tools that can auto-build your project for you half the time. I'm not trying to hate on the languages, I understand that they serve a purpose and do it well, but when your employees don't know how a hash-table works, and use the wrong sorting methods, or run SQL commands that are horribly inefficient (but get the job done in an acceptable time), it feels like more effort is being put into developing technologies that coddle new 'programmers' rather than actually teaching people how to do things right. I am interested in making efficient and, in my opinion, beautiful programs. If there is a better way to do it, I'd rather go back and refactor it than let it slide. But in the corporate world, they push me to complete tasks quickly rather than elegantly. And that really bugs me. Is this what I'm going to be looking forward to the rest of my life? Are there still positions out there for people who love the science and art of CS rather than just the paycheck? And on the same note, here's a good read if you haven't seen it before The Perils Of Java Schools


Is it possible to prune the stacktrace returned for a custom exception in PHP

I am working on a project in PHP that does a lot of input validation and can throw different custom exception classes in various layers of the application. To make the project code easier to read, I've displaced all the validation code into static methods of a validation class, which performs the check and throws the appropriate exception if necessary. My problem is, the exception stacktrace displays the entire call stack down into the validation class, but I feel like the extra information is not helpful and will only serve to confuse someone trying to debug the location of the real problem. Should I simply rely on informative exception messages or is it possible to trim the trace log in some way.


Is it good idea to change complete enterprise level application into ajax web app

I am working on an application which is completely written using server side method in asp.net web forms with c# . Now my team lead wants to convert whole application to ajax , in that approach we need to do the following tasks one by one . 1- Change all page methods into web methods so all will be static methods 2- Use jquery ajax to call all web methods . 3- bind html using json response. Now i am looking for some framework which can make my json html binding work bit easy but most of the frameworks like (knockout) are much compatible with MVC framework . I have two main concern points:   1. Is it good idea to convert all methods into web methods and use ajax ?    2. If i have to work with this approach what is the best framework i can use ?


Is it bad practice to use Inheritance to associate methods with a basic container?

Basically, I have code that looks like this. It's a `typedef` and a set of methods that revolve around that `typedef`.               class foo {         // Foo stuff...              // Registration Stuff         private:             typedef std::map<std::string, std::string> MTRegistrationParams;                  void DispatchRegistrationMessage (MTRegistrationParams const &, std::string destination_id);             static std::string BuildRegistrationMessage (MTRegistrationParams const &, std::string message_id); // Only called by DispatchRegistrationMessage              // more Foo stuff...     };      I am thinking it might be clearer to just make a little mini-class, to help logically separate those methods from Foo's structure.               class foo {         // Foo stuff...              // Registration Stuff         private:             struct MTRegistrationParams : public std::map<std::string, std::string> {                 void DispatchRegistrationmessage (foo &, std::string const & destination_id);                 private:                     std::string BuildRegistrationMessage (std::string const & message_id);         };              // more Foo stuff...     };      The thing is... I don't usually make derived classes unless for the sake of virtual methods, and deriving from a standard container seems REALLY weird. Am I being overly concerned, or is deriving from standard containers just to decorate them with methods genuinely bad practice?


Should I include terms of agreement and privacy policy in my iOS application?

I am developing mobile based social network with backend and I cache some data from facebook. I asssume I should include a kind of Terms of use and privacy policy statement in the application? is it really neccessary? where can I find proper templates for this?


How large should an application be to warrant its own TFS Project?

Or more to the point, when should applications be consolidated into one Team Project? I'm considering the fact that each TFS Project will include the source code, work items, reporting, a project portal in SharePoint, and Team Web Access. What are the effective resource costs of creating a TFS Project?


How to design a calculator from scratch

A basic calculator can perform a wide variety of operations. How does the claculator 'get' the concept of adding two numbers in the same way a human does? I dont think people that make claculators store every possible result of every possible addition on the chip before shipping it. Soemhow the chip needs to 'learn' how to add. I mean if I were to start with a blank slate(chip) and 'teach' the chip to perform calculations(additions), how do i go about it? Do i need to learn artificial nural networks first?


Do Databases Optimize Queries with Sum/Average or Other Aggregates?

Imagine a database that has billions of rows with, say, payments. You need to calculate an average payment sum. That will be               SELECT avg(amount) FROM payments;      Now, if you need to re-calculate this figure every day, running this formula on the whole dataset is an overkill. Bicycles have speedometers that calculate every second the average speed and the average cadence (pedal RPMs), even though they don't keep the speed for each second, and you may ride hours, days and months without resetting the average counter. This is done in a simple way: the speedometer keeps the average value and the number of seconds. So when you add a new item to the sum, it just does this:               new_average = (current_speed + old_average * count) / (count + 1)      If you know maths, it's clear that any sum or product can be calculated incremententially. Even updates can be done the same way: substract the old value from the aggregate, add the new value. I want to know if any database can do this for the programmer? I understand that the query in the DB may be different and have criteria:               SELECT avg(amount) FROM payments WHERE condition_1 AND condition_2;      Yet, it is possible to cache averages with more information (what rows were in the sequence and what was the filtering condition). Is this done anywhere?


Direct Code Support?

A few times in the past I've hit a major wall and simply couldn't progress with a certain aspect of an app as Im a beginner and still learning the ropes (Objective-C specifically). I was curious if anyone knows of any services which support programmers in real time, paid or free and will over video, audio or text chat sit and work a problem out till its fixed and look through your code? I understand Stackoverflow does a super job at this! However Im in need of something a little more tailored where someone can spend a little time to sit and look and what Im dealing with and delve into my a code if need be. Thanks.