how to handle / architect soa when service becomes unavailable?

Say I've got a third-party service called Cool.io that provides a RESTful API but often goes down. My applications consume that API, but when Cool.io goes down, my app really can't do much... but it should! Say I create a proxy to the Cool.io and this proxy stores a copy of Cool.io's data and provides RESTful endpoints for my application. Let's assume that my proxy has 100% reliability, or, at least more than Cool.io's. Let's also assume that my proxy has no problem propagating PUTs/POSTs to Cool.io, and no problems receiving the same from Cool.io (in other words, there are no data sync issues between my proxy and Cool.io). This decouples my application's dependency on Cool.io, which goes down all the time... but it doesn't decouple the proxy from the Cool.io service. As such, when my application modifies something on the proxy, the proxy's data changes and tries to send that change to Cool.io. But, if Cool.io is down, that request just results in an unavailability error (or a failed connection). What's the proper way to architect something like this? How do guys like Amazon or Netflix decouple their services such that an outage doesn't affect the consumer, or if it does, it does so gracefully? Is a message queue in order here? Is there a simpler solution than creating a proxy to the unreliable service?


Reasonable test coverage requirements when dealing with a contractor?

We're outsourcing some work to an external developer, so I'm busy writing up a contract about what constitutes a deliverable. So far I require that the code is shipped with automated tests. But, what is a reasonable way to specify the detail of tests up-front in the contract in a measurable way? I'm loathe to say "100% code coverage" because it's been established pretty often that 100% is pretty meaningless, and the diminishing returns above about 70-80% would probably just be pushing up our costs unnecessarily, and possibly even pushing up the complexity of certain things that might otherwise be very simple. Internally we pretty much leave it up to our developers to decide on the level of tests needed, based on their intuition and experience. With a contractor however there is a fixed price that has to be agreed to up front and we need some way to enforce a certain level of quality. Any suggestions or recommended reading matter would be appreciated!


Algorithm to minimize distance variance between 2D coordinates

I've been looking around for an algorithm that would optimize the distance between 2 list of coordinates and choose which coordinate should go together. Say I have List 1:               205|200     220|210     200|220     200|180      List 2:               210|200     207|190     230|200     234|190      Calculated Distance between Coords:               205|200 to 210|200 == 5.00     205|200 to 207|190 == 10.20     205|200 to 230|200 == 25.00     205|200 to 234|190 == 30.68          220|210 to 210|200 == 14.14     220|210 to 207|190 == 23.85     220|210 to 230|200 == 14.14     220|210 to 234|190 == 24.41          200|220 to 210|200 == 22.36     200|220 to 207|190 == 30.81     200|220 to 230|200 == 36.06     200|220 to 234|190 == 45.34          200|180 to 210|200 == 22.36     200|180 to 207|190 == 12.21     200|180 to 230|200 == 36.06     200|180 to 234|190 == 35.44      This Algorithm would pick:               205|200 to 230|200 == 25.00     220|210 to 207|190 == 23.85     200|220 to 210|200 == 22.36     200|180 to 234|190 == 35.44      The Algorithm would pick these numbers as they would be the group that would have the littlest variance between the distance. Conditions:   1. A Coordinate may only be used ones from each list   2. If List 1 or List2 is larger than it still only uses each coordinate once, but it tries to get the smallest distance variance and does nothing with the unused coordinates. If you need more clarification please ask. P.S. I've looked at the Hungarian algorithm and it seems like it will sort of do the job, but not exactly how I was expecting. The Hungarian algorithm will only try and make the least distance from all the coordinates, which can mean the smallest variance, but not every time as variance is more important here then least distance optimization. **Additional Information** I will have an array of List1, List2, and then the distances:               Distance[List1_item_0][List2_item_0] = 5;     Distance[List1_item_0][List2_item_1] = 10.20;     Distance[List1_item_0][List2_item_2] = 25.00;     Distance[List1_item_0][List2_item_3] = 30.68;          Distance[List1_item_1][List2_item_0] = 14.14;     Distance[List1_item_1][List2_item_1] = 23.85;     Distance[List1_item_1][List2_item_2] = 14.14;     Distance[List1_item_1][List2_item_3] = 24.41;          Distance[List1_item_2][List2_item_0] = 22.36;     Distance[List1_item_2][List2_item_1] = 30.81;     Distance[List1_item_2][List2_item_2] = 36.06;     Distance[List1_item_2][List2_item_3] = 45.34;          Distance[List1_item_3][List2_item_0] = 22.36;     Distance[List1_item_3][List2_item_1] = 12.21;     Distance[List1_item_3][List2_item_2] = 36.06;     Distance[List1_item_3][List2_item_3] = 35.44;      From the Distance['List1_item_#] I would need to pick a distance. Once that distance is picked the [List2_item_#] CANNOT be picked by a different [List1_item_#]. The distances picked for each [List1_item_#] element would need to be picked in a way that the variance between them all is minimal. So distance for each [List1_item_#] should be as close as possible to each other without reusing a [List2_item_#] more than once.


What are the most popular IDEs per language?

This has nothing to do with having a favourite editor or anything like that. I was just wondering, per language, what are the most popular Integrated Development Environments? Maybe a top 2-3 if there is some contention. (Perceived popularity is enough) Thus Far: **C#** - Visual Studio, SharpDevelop **Java** - Eclipse, NetBeans, IDEA **Objective-C** - Xcode **Delphi** - RAD Studio **Object Pascal** - Delphi, Lazarus **C, C++** - Visual Studio, Vim **PL/SQL** - RapidSQL, Oracle SQLDeveloper **PHP** - Eclipse, NetBeans, Nusphere PHPed **Actionscript (AS2, AS3)** - FlashDevelop **Flex** - Flash Builder 4 **Python** - Eclipse, IDLE **Perl** - Padre **Common Lisp** - Lispworks, Emacs **Ruby** - TextMate **Haskell** - Vim **Fortran** - Vim **Visual Basic** - Visual Studio


How come compilers are so reliable?

We use compilers on a daily basis as if their correctness is a given, but compilers are programs too, and can potentially contain bugs. I always wondered about this infallible robustness. Have you ever encountered a bug in the compiler itself? What was it and how did you realize the problem was in the compiler itself? ...and how _do_ they make compilers so reliable?


Application internal design VS Web application design

I come from the web application development and I try to make a small desktop application. I am looking for a good way to build the skeleton of my desktop application. From the web design, the skeleton is mainly handled by the web browser combined with the web server which manage application states (each page could be compared to a state) which in some way "wrap" the whole application and give you access to the basic informations like the `post` and `get` variables (and many others). Finally you can wrap the whole web application in a MVC design. I am wondering how I can do the same (or something similiar) in a desktop application? How can (or should) I properly wrap my application? Should I go with a state machine design combined with a MVC or is there something better? Thanks for your time


Ways of handling asynchronous receive calls

I am implementing a primitive message-passing system. Currently, I am designing a receive function for async calls. Can I implement such a async receive function without using callback functions?


How to prevent same user rating a web content like video more than once?

We have youtube kind of website where we calculate rating for every video. Based on rating we award cash. Our problem is no same user can rate a video more than once. We thought if we keep track of static IP, we will be able to achieve this but we found there are third party tools that can be used to manipulate the IP and break this. **Note:** We thought about only signed in customers can rate the video but client asks that even guest should be able to rate the video. Do we have any other method to track this so that they a user cannot rate more than once?


Are there any good Java/JVM libraries for my Expression Tree architecture?

My team and I are developing an enterprise-level application and I have devised an architecture for it that's best described as an "Expression Tree". The basic idea is that the leaf nodes of the tree are very simple expressions (perhaps simple values or strings). Nodes closer to the trunk will get more and more complex, taking the simpler nodes as their inputs and returning more complex results for their parents. Looking at it the other way, the application performs some task, and for this it creates a root expression. The root expression divides its input into smaller units and creates child expressions, which when evaluated it can use to build it's own result. The subdividing process continues until the simplest leaf nodes. There are two very important aspects of this architecture:   * It must be possible to manipulate nodes of the tree after it is built. The nodes may be given new input values to work with and any change in result for that node needs to be propagated back up the tree to the root node.   * The application must make best use of available processors and ultimately be scalable to other computers in a grid or in the cloud. Nodes in the tree will often be updating concurrently and notifying other interested nodes in the tree when they get a new value. Unfortunately, I'm not at liberty to discuss my actual application, but to aid understanding a little bit, you might imagine a kind of spreadsheet application being implemented with a similar architecture, where changes to cells in the table are propagated all over the place to other cells that need the result. The spreadsheet could get so massive that applying multi-core multi-computer distributed system to solve it would be of benefit. I've got my prototype "Expression Engine" working nicely on a single multi- core PC but I've started to run into a few concurrency issues (as expected because I haven't been taking too much care so far) so it's now time to start thinking about migrating the Engine to a more robust library, and that leads to a number of related questions:   1. Is there any precedent for my "Expression Tree" architecture that I could research?   2. What programming concepts should I consider. I realise this approach has many similarities to a functional programming style, and I'm already aware of the concepts of using futures and actors. Are there any others?   3. Are there any languages or libraries that I should study? This question is inspired by my accidental discovery of Scala and the Akka library (which has good support for Actors, Futures, Distributed workloads etc.) and I'm wondering if there is anything else I should be looking at as well?


c++ Model View Presenter: Where to construct presenter?

I'm using the Model View Presenter (MVP) pattern as described in The Humble Dialog Box paper (pdf) with an MFC project. I'm sure the issue is the same with most GUI toolkits. The thing that's bothering me is the concrete view (i.e., the dialog class) is creating not only the presenter but also the services that the presenter needs. Is that normal? Why does the view need to know what services the presenter needs? What I'm thinking is that I should dependency inject the presenter into the dialog class. The main control for the application is a class derived from CWinApp. So should I construct services and presenter in this class and then inject them into the dialog class? Although how would I dependency inject the presenter into the dialog class when the presenter needs a reference to the view class in it's constructor? `MyPresenter(IView *view, MyService *service);` Also how about if the main window spawns off a popup window, where should the details for that windows presenter and services get constructed? Since this is C++ I don't think I'd be interested in any kind of DI framework. **UPDATE** One idea I had was to construct the presenter with a null view, constructor inject the presenter into the dialog class, and then in the constructor of the dialog class call a `SetView(IView *view)` method on the presenter with `this` where `this` would be the dialog class (which derives from IView). So:               MyApp::Start()     {       SomeService *service = new SomeService();       MyPresenter *presenter = new MyPresenter(null, service);       MyDialog *dialog = new MyDialog(presenter);       ...     }          MyDialog::MyDialog(MyPresenter *presenter):      presenter_(presenter)     {       presenter_->SetView(this);     }      Seems a little kludgy but keeps service construction out of the Dialog class. The null view seems a little dangerous. An alternative would be to actually construct a NullView class that had empty method bodies and then pass that into the presenter constructor.


Mac Applications Developer interview preparation

I'm a Mac Applications Developer with an experience of 1 year and 8 months. I need to change the company. What type of questions should I expect in an interview? I've worked on 2 projects of which the second one is a very large and have been working on that for about more then a year till now. But, none of them are in the market yet. Both are desktop applications.   * How good should I prepare for the interview?   * On what things should I concentrate more ?   * This will be my first interview as an experienced. I haven't worked on iOS. Will that be a demerit ?   * Would that be a disadvantage having unreleased projects in my resume ?   * Should I think of including the other projects on which I haven't worked(but studied) into my resume, even after knowing that it is not a good thing to do ?


C++ "under the hood" books for advanced readers?

Are there any particularly good books for understanding how C++ works "under the hood"? My reasons for asking this are that I am very interested in C++ performance system programming (low latency etc). I have been suggested the following but wasn't sure if there are any others:   * C++ FAQs    * Modern C++ Design    * Effective C++ Basically I dont want books which are going to teach me the C++ syntax, but rather if I create this object, this is what really happens and this is achieved via this part of the operating system bla bla etc. An example of something I recently learnt and would like to learn more similar interesting facts: if you inline C++ code too much, you will increase the program instruction size, the number of OS pages it occupies and this will increase the likelihood of TLB misses for the processor.


I had a bad job interview, but still got the job. How do I handle the relationship with my new manager?

I participated in a set of interviews for a position in which I was hired recently. During the interview process I was interviewed 6 seperate times. 3 technical interviews and 3 situational / business interviews. During my second (and most dificult interview) the interviewer, who is now my manager, asked me to provide a solution to a programming problem overnight. I submitted the solution the next day but found out shortly that it was not what the interviewer expected. I quickly followed up with another solution that included the correct answer, and was deemed as such from the interviewing company. I now know that behind the scenes, during this time period, the interview process was changed because the manager had not hired any employees for the position in a 6 month time period. Now that I have the position, I am somewhat worried that this particular situation has put a bad taste in this manager's mouth regarding my placement here (which I believe was done above his head because of the new hire process taking too long). I have now been at the job for over 2 months and have NOT had ANY direct interaction with this manager, just a team lead. I believe that I have performed well, and have received praise and confirmation of my perceptions from my team lead. From a professional perspective, How do I make sure that my manager sees this, noting my interviewing history? Thanks in advance for any answers.


Process arbitrarily large lists without explicit recursion or abstract list functions?

This is one of the bonus questions in my assignment. The specific questions is to see the input list as a set and output all subsets of it in a list. We can **only use cons, first, rest, empty?, empty, lambda, and cond**. And we can only define **exactly once**. But after a night's thinking I don't see it possible to go through the arbitrarily long list without map or foldr. Is there a way to perform recursion or alternative of recursion with only these functions?


Looking for unpaid interns (2) - am I crazy?

**Edit - 6/10/11 in response to first batch of responses** : Wow, what a response. Let me speak to a few points.   1. I already stated that I will have a curriculum, and my intention is to teach people the things that college courses don't prepare you for (the entire CI process and all the technologies it entails for one)   2. All the people that complain about **CS programs that don't prepare students to enter the workforce**... where are you at? You seem to have left and invited the anti-taking-advantage-of-students brigade, and the you-cheap-bastard committee in your place.   3. I didn't really want to advertise the fact that I was at a **not for profit** as I just trashed my IT department (and deservedly so) I doubt **any** of them will actually see this, but it was my preference to not make myself easier to identify to people in my organization   4. I am not as convinced as many here seem to be that there are a lots of local business wanting interns (paid or not), but I will definitely feel it out with local schools if I decide to go forward   5. Regarding being Cheap... seriously? I am a developer. Not a manager, not anybody with any ability to spend budget. I am trying to improve myself (by mentoring), others (interns, and by extension the community) my team, and my employer.   6. I **did not** refer to **useless** CS grads. I referred to **clueless** CS grads. As in the many questions on this very forum that deal with the notion that CS grads know nothing about actually applying the technical skills they have acquired.  **End Edit/Rant** Just to give you an idea of where I am coming from... I am a developer on a small team reporting to the business (yes, the business... we have a horrible, dictatorial IT division that refuses to meet business needs, hence several business development teams) in a fairly large company. My motivations for wanting interns include:   * Bettering my own skills, (technical and otherwise) by mentoring others   * Teach interns (and even coworkers) ideas and methods for software construction that go beyond just solving a biz problem (readable/maintainable code, benefits of design and testing, etc   * Accelerate adoption of .Net on the team   * Help solve the problem that we all complain about - that being clueless CS grads I don't, for one second, believe that getting unpaid interns will be free labor. Before even going down that path, I will have setup an entire CI setup, which will of course be one of the benefits to the interns. I will also have to find a small project, or a piece of a project that can be broken off and given to interns to chew on. I will have a bit of a curriculum, which will include introduction to all the technologies involved in the CI, and other software development concepts. I will also be prepared to spend time with them every day to help set direction and help out when they hit a wall. I've been kicking this idea around in my head for a bit now, and the recent questions have prompted me to post. I was actually surprised to see such a negative reaction to unpaid internships, but then again maybe it is the norm that unpaid internships aren't that helpful for the intern? Anybody with experience with interns (either being one, or teaching one) have any thoughts?


When designing a job queue, what should determine the scope of a job?

We've got a job queue system that'll cheerfully process any kind of job given to it. We intend to use it to process jobs that each contain 2 tasks:   * Job (Pass information from one server to another)      * Fetch task (get the data, slowly)     * Send task (send the data, comparatively quickly) The difficulty we're having is that we don't know whether to break the tasks into separate jobs, or process the job in one go. Are there any best practices or useful references on this subject? Is there some obvious benefit to a method that we're missing? So far we can see these benefits for each method: **Split**   * Job lease length reflects job length: Rather than total of two   * Finer granularity on recovery: If we lose outgoing connectivity we can tell them all to retry   * The starting state of the second task is saved to job history: Helps with debugging (although similar logging could be added in single task method) **Single**   * Single job to be scheduled: Less processing overhead   * Data not stale on recovery: If the outgoing downtime is quite long, the pending Send jobs could be outdated


What is the canonical approach to using a VCS right from a project's infancy?

## Background I've used VCS (mainly `git`) in the past to manage many existing projects and it works great. Typically with an existing project, I would check in each change I make to the code that either optimizes or changes the overall functionality (you know what I mean, in suitable steps, not every single line I change). ## Problem One thing I've not had so much practise at is creating new projects. I'm in the process of starting a new project of my own that will probably grow quite large, but I'm finding that there is _a lot_ to do and a lot changing in the first few days/hours/weeks/the period up until the product is actually functioning in it's most basic form. Is there any point in me checking in each step of the process as I would with an existing project? I'm not breaking the project with changes I make since it isn't working yet. At the moment I've simply been using VCS as a backup at the end of each day, when I leave the computer. My first few commits were things like "Basic directory structure in place" and "DB tables created". How should I use a VCS when starting a new project?


Why would I want to use CRaSH?

Justed stumbled across CRaSH and although it looks mighty interesting, I'm wondering why a Java developer should invest time & energy into learning (yet another) shell language. What sort of standard- and cool-applications can CRaSH be used for? Is this like a Groovy-version of Jython? I guess, when the dust settles, I'm looking for CRaSH's "wow" factors. I'm sure they're there, but after spending ~20 minutes perusing the documentation I'm just not seeing them. Thanks in advance!


Starting my first project and have no idea about it. Guide please

I am a Computer Science student (6th semester). I want to make a project and I have a team of 4 people (My friends). So we are 5 people and we have decided to make a " **Web based file explorer** ". The project will be similar to THIS one. How should we start with this project? We guys don't know much about programming. I know Java a little and I am a RHCE so can handle the server and all such administrative stuffs. Since this is our first project so we guys have no idea how we'll make it? I know Java and other guys in the group knows C#, ASP.NET, PHP, SQL and Joomla. Please guide and give your suggestions. Thank you. PS : Perhaps my question is not complete, if you want more information then leave a comment I will edit the question.


What is the disadvantage of using abstract class as a database connectivity in zend framework 2 instead of service locator

If I use database by creating adapter with drivers, initialize it in some abstract class and extend that abstract class to required model. Then use simple query statement. Like this:               namespace My-Model\Model\DB;     abstract class MysqliDB {         protected $adapter;              public function __construct(){              $this->adapter = new \Zend\Db\Adapter\Adapter(array(                     'driver' => 'Mysqli',                     'database' => 'my-database',                     'username' => 'root',                     'password' => ''             ));         }          }      And use abstract class of database like this in my models:               class States extends DB\MysqliDB{              public function __construct(){             parent::__construct();         }         protected $states = array();              public function select_all_states(){             $data = $this->adapter->query('select * from states');             foreach ($data->execute() as $row){                 $this->states[] = $row;             }             return $this->states;         }     }      I am new to zend framework, before i have experience of working in YII and Codeigniter. I like the object oriented in zend so i want to use it like this. And don't want to use it through service locater something like this:                public function getServiceConfig(){             return array(                 'factories' => array(                 'addserver-mysqli' => new Model\MyAdapterFactory('addserver-mysqli'),                 'loginDB' => function ($sm){                     $adapter = $sm->get('addserver-mysqli');                     return new LoginDB($adapter);                 }             )             );              }      In module. Am i Ok with this approach?


Can anyone explain representation of float in memory?

This is not duplicate question as I read the previous question. Can anyone help me in understanding `how float values are stored in the memory` . My doubt is here float values contain '`.'` (`for example 3.45`) how the `'.'` will be represented in the memory? Can anyone please clarify me with a diagram?


What individual needs to be aware when signing a NDA with client?

I am very new to IT industry and have no prior experience. However I came into contact with a party who is gear to build a mobile application. But, they want me to sign NDA (No Disclosure Agreement). The definition seems vague, > The following definitions apply in this Agreement: Confidential Information > means information relating to the online and mobile application concepts > discussed and that: > >   * (a) is disclosed to the Recipient by or on behalf of XYZ; >   * (b) is acquired by the Recipient directly or indirectly from XYZ; >   * (c) is generated by the Recipient (whether alone or with others); or >   * (d) otherwise comes to the knowledge of the Recipient, > When they say otherwise comes to the knowledge of the recipient. Does it mean if I think of any idea from my own creative mind and which is similar to their idea then it would be a breach of this agreement? and also is it okay to tell to include application name in definition as currently to me it sounds like any online of mobile application concept they think I should not disclose it to anybody. `"Confidential Information means information relating to the online and mobile application concepts discussed and that:"` I am more concerned about this part, > Without limiting XYZ’s rights at law, the Recipient agrees to indemnify XYZ > in respect of all claims, losses, liabilities, costs or expenses of any kind > incurred directly or indirectly as a result of or in connection with a > breach by it or any of its officers, employees, or consultants of this > Agreement. Is it really common in IT industry to sign this agreement between client and developer? Any particular thing I should be concerned about?


Standards & compliances for secure web application development?

I am working with developers right now that write code the way they want and when i tell them to do it other way they respond that its just matter of preference how to do it and they have their way and i have mine. I am not talking about the formatting of code, but rather of way site is organized in classes and the way the utilize them. and the way they create functions and process forms etc. Their coding does not match my standards, but again they argue that its matter of preference and as long as goal achieved the can be different way's to do it. I agree but their way is proven to have bugs and we spend a lot of time going back and forth with them to fix all problems security or functionality, yet they still write same code no matter how many times i asked them to stop doing certain things. Now i am ready to dismiss them but friend of mine told me that he has same exact problem with freelance developers he work with. So i don't want to trade one bad apple for another. **Question is is there some world wide (or at least europe and usa) accepted standard or compliance on how write secure web based applications. What application architecture should be for maintainable application.** Is there are some general standard that can be used for any language ruby php or java govern security and functionality and quality of code? Or at least for PHP and MySQL i use for my website. So i can make them follow this strict standard and stop making excuses.


How to select a most probable option from the list based on user text Input

I am working over a OCR Application where I need to select a option based on user text input.               Ex:     Available Options:     ["python", "ruby", "java", "clojure", "haskell"]          Input: kava     Output: java          Input: ruby     Output: ruby          Input: clujuro     Output: clojure          etc..       my application is python based, is there a algorithm already exist to solve this problem.


Why is it good to split a program into multiple classes?

I'm still a student in high school (entering 10th grade), and I have yet to take an actual computer course in school. Everything I've done so far is through books. Those books have taught me concepts such as inheritance, but how does splitting a program into multiple classes help? The books never told me. I'm asking this mainly because of a recent project. It's an arcade video game, sort of like a Flash game as some people have said (although I have no idea what a Flash game is). The thing is, it's only one class. It works perfectly fine (a little occasional lag however) with just one class. So, I'm just asking how splitting it into multiple classes would help it. This project was in Java and I am the only person working on it, for the record.


Do you ever worry that you're more concerned with how something is built rather than what you are actually building?

As a programmer I have an inherent nagging annoyance at my tools, other peoples code, my code, the world in general. I always want to improve it. So I refactor, I stay on top of the latest techniques. I try and learn patterns, I try to use frameworks so as not to reinvent the wheel. I can write a tech spec that will blow your socks off with the amount of patterns I can squeeze in. However, lately I feel I actually know more about the tools I use than how to actually implement successful software. I feel like I'm lacking in the human factors skill set and I believe that to be a successful software engineer takes more than knowing the coolest framework. I think it needs some of the following skillsets too.   * Interaction design   * User experience    * Marketing I've got a bit of this that I've learned from people I've worked with and great projects I've worked on but I don't feel like I "own" these skills. Am I right? Should I be trying to develop these skills further, or should these be left to the people who do these for a career? How do you make sure you don't get too tied up in how you're doing something and make sure you "make your users awesome"? Does anyone know of good resources for learning these skills from a programming point of view?


OO best practices for C programs

_"If you really want OO sugar - go use C++"_ -- was the immediate response I got from one of my friends when I asked this. I know two things are dead wrong here. First OO is NOT 'sugar', and second, C++ has NOT absorbed C. We need to write a server in C (the front-end to which will be in Python), and so I am exploring better ways to manage large C programs. Modeling a large system in terms of objects, and object interactions makes it more manageable, maintainable and extensible. But when you try to translate this model into C which does not bear objects (and everything else thereof), you're challenged with some important decisions. Do you create a custom library to provide the OO abstractions your system needs? Things like objects, encapsulation, inheritance, polymorphism, exceptions, pub/sub (events/signals), namespaces, introspection, etc. (for example GObject or COS). Or, you just use the basic C constructs (`struct` and functions) to approximate all your object classes (and other abstractions) in ad-hoc ways. (for example, some of the answers to this question on SO) The first approach gives you a structured way to implement your entire model in C. But it also adds a layer of complexity that you have to maintain. (Remember, complexity was what we wanted to reduce by using objects in the first place). I don't know about the second approach, and how effective it is at approximating all the abstractions you might require. So, my simple questions is: What are the best practices in realizing an object oriented design in C. Remember I am not asking HOW to do it. This and this questions talk about it, and there's even a book on this. What I am more interested in are some realistic advice/examples that address the real issues that show up when dong this. _**Note: please don't advice why C shouldn't be used in favor of C++. We've gone well past that stage._**


Too much version control and bug tracking overhead per change?

I work at a place that is CVS-crazy and Bugzilla-nuts.   1. There are so many branches off each release that one cannot count them. Everyone is constantly auto-merging.    2. There is no _fluidity_ at this job. Everything feels _lock-step_. It takes 25 steps even for a simple thing. It's not like being on a factory production line: it's like setting up a factory myself every day. Example situation: To fix a single bug, first I obtain a clean, new virtual machine. Then I create a branch for that single bug fix, based on another branch described in the Bugzilla report. I install the branch on the machine, set that up. I fix the bug. I check it in, leaving it and the machine for others to test with. Then I have to go into the bug control software and explain what I did and write a test case, with all the steps. Eventually someone else merges it with a release. No matter how tiny the bug is, I have to do all of these things. Sometimes people combine work on multiple bugs, but as I said there are so many branches that this is hardly possible. At any other job, I'd just go in and fix the bug. I barely even remember using SCM, although every job I've had has used it: that's because at every other job, they somehow kept it _out of the way_. _Is there a point at which the process gets in the way and becomes an end unto itself? Is that even engineering?_


Where does Web Reference go in 3-layer app

I have a 3 layered application.   * Presentation Layer (PL): ASP.NET MVC app   * Business Logic Layer (BLL) project   * Data Access Layer (DAL) project I need to add a Web Reference to a service for a payment gateway. Where does it go? `PL` or `BLL`? P.S. Before using the Web service I need to retrieve some data from database and send that data to web service.


Can everything in computing be classified as either data or a process?

Working in a field called "revenue assurance" I basically build systems to validate other systems. After a while in this market it seems to me that all these "validations" are verifying either a process from my customer's environment or the data used by these processes. With this in mind I am considering using such definition to orientate sales people and even architects working on the products. However, researching this topic I couldn't find a definitive answer although haven't dismissed the possibility either. Is everything one of the two then?


What skills are essential for professional programming that are not commonly taught in schools?

I am a first year computer science major. I went to a job fair, handed out resumes, much to my surprise I got an interview and eventually an internship as a developer. I explained to the interviewer (who will be my boss) that I am only a first year and do not have a large amount of experience programming. He simply told me that because I have a strong background in math (I am almost done with my BA in math, plus I have some grad courses under my belt) the he is confident I will do fine. I do well in all programming courses but I still feel that I am at a disadvantage. Right now, I really just want to do good at this job when it starts. The job will be using mostly C#, but besides obviously learning some C#, what is the one skill that you wish you could have learned before you became a real programmer? Any advice is greatly appreciated, but if you have any books in mind please tell. Thanks!


Exploratory Development vs Incremental Development

In Software Engineering Methodologies... The Evolutionary Development contains Exploratory & Prototyping... Is Exploratory Development same as Incremental Development... What do you mean by exploratory Development?


Java MVC extra classes

I have a simple MVC project. My current packages:   * gui    * controller    * db    * domain I want to put extra classes which I will use, e.g. md5 hashing, email validator (methods which I will use in more than one class). Where do I put them? I will probably not use them in only one package, but in two or three (not in model for sure). Do I create an extra package, or do I put them in domain as they're "static" (unchangable)?


Kafka, is it possible to get the message offset after producing?

While using Apache Kafka, is it possible to get the offset of the message that has been produced? From the Kafka documentation page it says: > each message in the partition are assigned a unique sequential id/number > called Offset Now suppose when I am producing any message I want to retrieve the offset that has been assigned to it.


How common is it for a team to write everything in-house?

In a recent interview I asked the interviewers "how do you go about evaluating new technologies and libraries (such as SignalR) and bringing them in to use?". They said they don't, that instead they write everything themselves so they don't have to rely on anyone else. The firm doesn't work for the government or defence contractors or on any safety-critical projects or anything like that. They were just your average, medium-size software development firm. My question is: **how common is it for teams to write everything themselves? Should I be concerned by teams that do?** Edit -- Most every response has said this is something to be concerned by. **Would a second interview be an appropriate time to ask them to clarify/repeat their position on writing everything in house?**


Best practices for for putting tabular data on the web for users to edit?

I've been working in ASP.net for over three years now. The project I'm working on is designed with a 3-layer presentation/business/data design. The presentation layer is an ASP.net web site. The business and data layer are also in .net, with the data layer working with a SQL server. Recently, I've had to add several new screens to my ASP.net web application. The order from my customer was essentially, "Take these Excel Spreadsheets and put them on the web so that I don't have to pass them around to the different people who make edits and I don't have to worry about keeping track of the changes." Sounds simple, right? Well, I've been doing this, but I feel as if I'm making the project more difficult than it needs to be. I'd like to tell you how I've done this and I'd like to know how I can improve my process. (1) I showed the spreadsheets to my DBA who created a table for each spreadsheet with a column for each column on the spreadsheet. Let me emphasize that in my office, only the DBA is allowed to change anything about the structure of the data in SQL. (2) I created functions in my business and data layers that   (a) Get the rows from the tables.   (b) Insert rows.   (c) Update rows. (3) I coded an ASP.net web page to user the ASP.net GridView to display the tabular data to the user. There is one button the user can click to add a new row and another button the user can click to edit an existing row. (4) I wrote JavaScript so that upon a button click, the user sees a form he can use to add a new row or edit an existing row. (5) I wrote some ASP.net page methods that allow the user to send changes back to the ASP.net server using AJAX once he fills out the form. (6) I wrapped the ASP.net GridView in an ASP.net UpdatePanel so that the table can be refreshed without reloading the whole page. That is my process. I've been doing this for each spreadsheet I received from my customer. I feel like there ought to be a better way to do this. I have a co-worker who really likes the DHTMLX stuff, but that would only possibly replace or simplify steps 4 and 6. What is a better way to accomplish what my customer wants?


run local php/database application on windows pc without wamp

I have a php/mysql applications which I designed, and the client doesn't want it to be online (installed on a webserver) or available on the internet, he wants his employees to use it on a local system. I don't want them to go through the process of starting up wamp to access the program, is there a simple way to make php web programs run on a local windows pc? using mysql database?


What can multiple threads do that a single thread cannot?

While threads can speed up execution of code, are they actually needed? Can every piece of code be done using a single thread or is there something that exists that can only be accomplished by using multiple threads?


What part of your work does a company own when you program for them?

Say you're a software engineer, what does the company actually own of your work? Do they own the source code, the binary, both? What about code you do outside of the workplace? Do they have any claim to that? I was just wondering from a legal standpoint how that all works.


What is the benefit of a visual editor over straight programming?

I'm trying to figure out what the benefit to having a WYSIWYG HTML editor over hard coding, outside of, say, accessibility. It seems like a waste of time to learn how to use something like Dreamweaver over Notepad++. Am I missing something here? Every time I've ever used one, I end up going back into the code to fix the problems the visual editor made.


Scrum - real life example?

I'm starting with scrum and saw many partial examples on books and tutorials, but when try to use scrum in the real life, it's not easy to write the user stories and create the product backlog. I want to see a real project with user stories, product backlog and sprint backlogs to see if I'm doing it in the correct way. Is there any open source project with a public product backlog ? Is there any shared complete user stories and product backlog from a real project?


Reading data from file and const

Is it sane to let a read method on a file object to be const? For example               size_t read(void* buffer,size_t length) const;      The read method does not change the contents of the file, but updates the file pointer which is invisible behind a handle.


admin-over-clients application

I have the same web application running on several different servers. Now I want a central place to administer everything in one web interface. What is the best way to do this? Should I provide a REST interface on every web application and let the admin application make all the calls? This seems like a common problem that's already been solved by smarter people than me. UPDATE: I want to change the application data per web application + see the results per web application


How concerned about load balancing do I need to be?

I'm currently working on a project which will have client applications (desktop & android & web) communicate with varies processes running on a server(s). My question is how much should I be thinking about load balancing and the like? All projects which I have worked on before consisted of creating applications for internal use within companies so the number of connections was alwyas very low (probably no more than 50 at a time). However in my own time I decided to start creating a piece of accounting software, just because. So what I have ended up with is a WPF desktop application, and ASP.NET MVC web site and an Android App which all connect to various processes/data running on my server. On the server there is an SQL database (MS), various WCF services for communication from client to server and a few services running cleanup stuff. This works fine when I'm testing and its just me connected. However I have no idea how it will scale if a few people start connecting at once. I'm not even sure if I will release the software, let alone anyone use it! However as part of a learning exercise how should I be developing the system so that it could take on a large load and not crash/delay. I'm aware this could be a very open question and could be subjective to a lot of things, but as I say I have no experience in this department and it's something I would like to learn.


Why is String immutable in Java?

I couldn't understand the reason of it. I always use String class like other developers, but when I modify the value of it, I need to create new instance of String. What might be the reason of immutability for String class in Java? I know there are some alternatives like StringBuffer or StringBuilder. It's just curiosity.


Origin of structures and classes

What design and implementation issues did programmers have to solve when they decided first to use structures and classes? When did this happened and who were the pioneers behind these ideas? Note, this is double question, because structures and classes are related. I realize that structures are quite older than classes. It would be great if the answer would talk separately about both of them and cite some sources.


Algorithm for finding overlapping times

Part of our ERP system is a sub-system for running background jobs. We track a variety of meta-data about our jobs in a table including timestamps for submitted, started, and end times. I'm creating a report showing the performance of our job system, detailed by day. One KPI is maximum # of jobs running at once. The algorithm I'm currently using is:               dim cnt as integer    'number of overlapping jobs     dim max as integer    'maximum number of jobs running at one time          for each Job where               Job.SubmitTs = today            'bJob is a 2nd instance of Job       for each bJob where                bJob.SubmitTs =  today and                bJob.StartTs  <= Job.EndTs and                bJob.EndTs    >= Job.EndTs         cnt = cCnt + 1       next            if cnt > max then max = cnt     next      The problem with this algorithm is that it is very slow due to all the looping. I was wondering if there is a faster way to implement this? **Edit** I cannot use SQL queries to access the data.


Newbie worried about CASE tool

I'm looking for some guidance on CASE tools and whether my concerns are valid. Recently I was in a meeting between my employer and an external software company which have a CASE tool currently in beta. They demonstrated this tool to us, showing how you build a UML model in Enterprise Architect (or something like it) and then, through their tool, that UML model is transformed into a Visual Studio project, with C# files, stored procedures for SQL Server, code for the data layer, WCF stuff, logging code and allsorts. Now, admittedly, I don't see the point in this, as in I'm not convinced it will save that much time (plus it feels like overkill). The tool authors said that a trial of the tool at another company had saved a team there 5 weeks of development time (from 6 weeks down to about 1 week) using this tool. I find the accuracy of that estimate hard to believe. My main concern is whether using this tool is going slow down my productivity. For example - Say I have a UML model which I built a VS solution from. Now, I want to rename a class method to something else; will this mean having to update the UML model first and then rebuilding the code? Is this how case tools normally work? Something I will need to check with the authors is the structure of the generated VS solution. I like the Domain Driven Design way of project structure - Infrstructure, Services, Model, etc. I doubt very much this tool will do that. Also, I've been playing around with Entity Framework Code First and think it's a great way to build the data model. I have nice repositories, unit of work classes and other design patterns that work well with EF. I have data anootations and stuff like that working great. By not having EF (the CASE tool uses it's own data layer code) I'm concerned that this tool's data layer code might not be a nice to integrate in the UoW pattern, repositories, etc. This I will need to verify when I get a closer look at the generated code. What are other people's experiences with CASE tools? Am I being paranoid about nothing? Am I being unfair - are my negativities unfounded? EDIT: I like to use TDD/BDD for building my code, and using a CASE tool looks like it will make this difficult. Again, any feedback on this would be great. Cheers. Jas.


Architecture design for a web application that runs SSH connections to remote servers

This is a followup to my question here. I have to make a web GUI for a library that manages remote clusters via SSH. The main point is that this library spawns threads and subprocesses (Popen) internally (for the SSH connections), so I think I am I/O bound by these SSH connections. I want to prevent my server from going down as soon as I get 20-50 simultaneous requests. I have no idea of how to proceed with the architecture. I don't know if I can solve this at the server level with a more powerful server (gevent??) or if I should do something like using background threads (twisted reactor??) Some considerations:   * I work with django so the server (if I finally have only one) must be WSGI.   * I need both blocking and non-blocking calls via SSH.   * I will probably need shared state between successive requests as well.


Are square brackets and curly braces in Clojure still S-expressions?

I am trying to learn Lisp and looking at all the Lisps out there and their differences. I see that in some implementations of Scheme, you can use square brackets interchangeably with round brackets for readability, so because they are treated the same, I assume they are still just S-expressions like everything else. However, in Clojure I see that square brackets and curly braces are used to represent different data types like vectors and so on. Are these also still valid S-expressions, or must they be considered atoms? Doesn't this "break" the whole concept of S-expressions, thereby making Clojure an "impure" Lisp?


Web Developer or Software Engineer?

A question that I have been asking myself and really confused which path to take. So I need your guys help as to the pros and cons of these 2 professions in today's world. I love web applications development as the Web is the best thing to happen in this age and nearly everyone gets by on the World Wide Web. And also tend to keep learning about new technologies and about web services.      On the other hand I like software engineering also for the desktop applications as I have had experience with development small scale softwares in VB.Net, Java, C++, etc.      Which path has more scope and better future? Whats your view?


Why do some open source projects do not accept pull requests, but emailing patch files only

Why do some open source projects not accept pull requests, but require contributors to email patch files only? e.g. Git Although they publish code in github or other distributed scm hosting. It is not interactive nor convenient to send patch files. Patch file is an old-fashioned way. Pull requests are interactive. Other people may also discuss.


Is there a valid reason to wrap built in type with your own

I am editing some c++ and all of the built in types have been wrapped in a corresponding wrapper class. All of the operators have been overloaded to do bizarre things like operator[] coded to ignore the argument or to exactly what the underlying type would do. Is this malevolent or is there some possibility this is a good idea in some other universe.


What is the definition of user classes, with respect to software use?

I'm writing the Software Requirement Specification document for a piece of software that I am developing. A part of the SRS is the identification of the user class. Can somebody please give or refer me to definition of a user class as it relates to a software product?


Image coordinates calculation algorithm

I was looking at _Jcrop_ library code for scaled image size calculation, but I couldn't clearly understand algorithm used in following function: https://github.com/tapmodo/Jcrop/blob/master/js/jquery.Jcrop.js#L187               function presize($obj, w, h)     {       var nw = $obj.width(),           nh = $obj.height();       if ((nw > w) && w > 0) {         nw = w;         nh = (w / $obj.width()) * $obj.height();       }       if ((nh > h) && h > 0) {         nh = h;         nw = (h / $obj.height()) * $obj.width();       }       xscale = $obj.width() / nw;       yscale = $obj.height() / nh;       $obj.width(nw).height(nh);     }      I know that its using jquery image object and boxWidth and boxHeight as described on following link:   http://deepliquid.com/content/Jcrop_Sizing_Issues.html But I want to understand the algorithm used.


During interviews, how do I gauge a company's respect for my position?

I'm a web developer who previously joined a software company not knowing their value and respect went to big data analysis, not their website. Sure, they needed a public-facing website, but I eventually found that the most exciting, valued projects there went to data teams. Realizing this, members of the web team were picked off and switched teams, making it hard for those left behind to keep up the work load, and making us look bad. At times it seemed the company culture sneered at us, wondering, _"What does that team even do here?"_ A friend of mine had the opposite problem at another software company. All he wanted to do was crunch big numbers. However he complained that the rest of the company wouldn't shut up about developing the usability of their website. Meanwhile his analytics team languished. I've also heard of salespeople getting love at a company, while engineering as a whole is undervalued, or vice versa. As for my story, if I could have known the company was like that, I might have avoided the job in the first place. So, before I join a new company, how do I gauge its actual respect for my programming role? For its other roles? I want to avoid companies that aren't serious about my particular focus in programming, or, perhaps bigger picture, companies that don't value everybody who works there. (Note I think gauging the company's attitude toward the basic needs of its programmers is covered by these related questions.)


Internship Pay Reasonable?

I received an offer at two companies for a spring co-op. They are both software engineering related. The first company(C1) offered me 22/hr. Is $22/hr + housing stipend a reasonable offer? The area is cheap to live in, which leads me to believe that 22/hr is a good offer. Would it be possible/reasonable to negotiate this? I still have not received the offer details from the other company(C2), but they said they are currently preparing the letter. C2 is in Boston, which will obviously be more expensive. C2 pays for housing entirely. My main problem is deciding between the two. Both are apparently good places to work, so the main issue comes down to pay. Everything else put aside, what salary/hourly rate should C2 offer to top C1?


Functional Languages that compile to Android's Dalvik VM?

I have a software problem that fits the functional approach to programming, but the target market will be on the Android OS. I ask because there are functional languages that compile to Java's VM, but Dalvik bytecode != Java bytecode. Alternatively, do you know if the `dx` utility can intelligently convert the `.class` files generated from functional languages like Scala? **Edit** : In order to add a bit more helpfulness to the community, and also to help me choose better, can I refine the question a bit?   * Have you used any alternate languages with Dalvik? Which ones?   * What are some "gotchas" (problems) that I might run into?   * Is performance acceptable? By that, I mean the application still feels responsive to the user. I've never done mobile phone development, but I grew up on constrained devices and I'm under no illusion that there is a cost to using non-standard languages with the platform. I just need to know if the cost is such that I should shoe- horn my approach into default language (i.e. apply functional principles in the OOP language).


Best opinion to give a potential client

I have a friend that works for a company. They use a software product that is aged, and written in Delphi. There are concerns at this company about the life of the software company that provides the software (which they pay a monthly license to use). It's quite _specific_ software. My friend has spoken to his boss and I am being invited in with the potential opportunity to "re-write" their windows application with a view to also supplying source-code (C#, is what I plan to provide should this kick off). Giving this some more thought, and even though it could give me some nicely- needed cash, I wonder what is the best option here... The initial requirement would appear to be to replicate this application exactly as it stands. It was not developed in-house and therefore is used by other companies as-well. It's large and complex. While this does not worry me, I am concerned at the cost and time to do this just to bring it "in-house". They don't appear to want any new or different functionality, just a code-base they own. So I guess, my real question; now that you have background information - is it worth me suggesting that rather than re-write this thing dot-for-dot, and feature-for-feature, to actually see what parts they use/don't use - and design an application tailored just for them rather than the generic off-the- shelf one they are using? It seems a huge waste to just duplicate the application just to have ownership, but then I'm a programmer and not a business-decision-maker :) Any ideas/thoughts/flames?


Appropriate data structure for deeply nested data?

I can't figure out what would be an appropriate data structure for my problem. I need to write a script that will count some events. Input is a list of events (thousands of them). Each event is an object with following attributes:               class Event       company       city       office       department      You can look at it like this: „Each event is related to one company in a particular town in one office and in one department of that office“. My script needs to output the total number of events for company, town office and department. Basically it needs to output sentences like this:               Total events in company X in town Y in office Z in department T : 15     Total events in company X in town Y in office Z in department R: 36     ...     Total events in company N in town Y in office G in department T: 89     ...      How should I store these counts and how should I count them. I was thinking of using nested dictionaries (in python) or in-memory SQL database. Is there any other way?


Scoring/analysis of Subjective testing for skills assessment

I am lucky in the sense that I have been given the opportunity to be a 'Technical Troubleshooter' for our offshore development team. While I am confident and capable of dealing with most issues, I have come across something that I am not. Based on initial discussions with various team members both on and offshore, a requirement for a 'repeatable, consistent' skills assessment has been identified. In my opinion, the best way to achieve this would be a combination of objective and subjective tests. The former normally being an initial online skills assessment on various subjects, for example General C#, WCF and MVC. The latter being a technical test where the candidate would need to solve various problems and (hopefully) explain the thought processes involved with the solution whilst doing so. Obviously, the first method is consistent, repeatable and extremely accurate. The second is always going to be subjective and based on the approach, the solution (or possibly not) and other factors. The 'scoring' of this is also going to be down to the experience and skills of the assessor and this is where my problem lies;   * The person that is expected to be the assessor initially (me) has no experience.   * The people that will ultimately continue this process for other people will never remain the same due to project constraints and internal reasons, this changes the baseline for comparison.   * I am not aware of any suitable system that can be classed as consistent and repeatable for subjective tests with the 2 factors above, let alone if those did not exist. So anyway, I have to present a plan that will ultimately generate a skills/gap analysis and it is unlikely that I will be able to use an objective method (budget constraints most likely reason). The only option left is the subjective methods and the issues above. Does anyone have any suggestions for an approach that may tick all the boxes?


What does this javascript file do? Is this a virus?

While searching on google I found a website that shows other content to Google Bot and other to his users, and also a very suspicious javascript file. Maybe it's a tracking cookies virus/malware, I don't know, so I am asking here if someone can explain me the code?               document.write ('\n');     var a1156tf="51la";var a1156pu="";var a1156pf="51la";var a1156su=window.location;var a1156sf=document.referrer;var a1156of="";var a1156op="";var a1156ops=1;var a1156ot=1;var a1156d=new Date();var a1156color="";if (navigator.appName=="Netscape"){a1156color=screen.pixelDepth;} else {a1156color=screen.colorDepth;}     try{a1156tf=top.document.referrer;}catch(e){}     try{a1156pu =window.parent.location;}catch(e){}     try{a1156pf=window.parent.document.referrer;}catch(e){}     try{a1156ops=document.cookie.match(new RegExp("(^| )a1156_pages=([^;]*)(;|$)"));a1156ops=(a1156ops==null)?1: (parseInt(unescape((a1156ops)[2]))+1);var a1156oe =new Date();a1156oe.setTime(a1156oe.getTime()+60*60*1000);document.cookie="a1156_pages="+a1156ops+ ";path=/;expires="+a1156oe.toGMTString();a1156ot=document.cookie.match(new RegExp("(^| )a1156_times=([^;]*)(;|$)"));if(a1156ot==null){a1156ot=1;}else{a1156ot=parseInt(unescape((a1156ot)[2])); a1156ot=(a1156ops==1)?(a1156ot+1):(a1156ot);}a1156oe.setTime(a1156oe.getTime()+365*24*60*60*1000);document.cookie="a1156_times="+a1156ot+";path=/;expires="+a1156oe.toGMTString();}catch(e){}     try{if(document.cookie==""){a1156ops=-1;a1156ot=-1;}}catch(e){}     a1156of=a1156sf;if(a1156pf!=="51la"){a1156of=a1156pf;}if(a1156tf!=="51la"){a1156of=a1156tf;}a1156op=a1156pu;try{lainframe}catch(e){a1156op=a1156su;}     a1156src='http://web.51.la:82/go.asp?svid=8&id=17211156&tpages='+a1156ops+'&ttimes='+a1156ot+'&tzone='+(0-a1156d.getTimezoneOffset()/60)+'&tcolor='+a1156color+'&sSize='+screen.width+','+screen.height+'&referrer='+escape(a1156of)+'&vpage='+escape(a1156op)+'&vvtime='+a1156d.getTime();     setTimeout('a1156img = new Image;a1156img.src=a1156src;',0);


Can I use FontAwesome fonts with my own custom CSS files?

I want to use the WebFont icon library FontAwesome (FA) for all the icons in my project. They are using SIL OFL 1.1 for the fonts and MIT License for the source files. My problem is that, I want to use the FA fonts in my project, however I don't want to be tied to their CSS files. Is it possible for me to use the fonts with my own custom CSS styles, without having any dependence on the FA's CSS files. I don't even mind endorsing the project on my website, but if even do that, I want to only endorse the art not the code. FontAwesome License: http://fortawesome.github.io/Font-Awesome/license/


What is the most pragmatic & basic UI pattern to follow for Silverlight and/or WPF

Here is the context. The apps will:   * consume existing (and standard) web services.   * app is UI intensive (UI updated frequently and lot of data to display).   * development team experience level is average.   * development team has very few experiences in silverlight & WPF.   * I want it simple, but I want to avoid a complete rewrite in the near future, so I must (try to) take a correct path from the beginning. I know that using no pattern at all is the easiest and fastest way to go, and that implementing MTVT is the phantasm of all the .NET architects out there. But I don't have the budget ;) I need a pragmatic solution, easy to implement, easy to understand, and that works. When I browse the internet, MVVM Light is well positioned, but Microsoft is proposing its own implementation. Will it become standard like ASP.NET MVC?


Git Workflow - turning a local reposity into a "central" one

I have a local repository with a toy project that has turned out to be more serious than I had thought. So from a single development branch where I have carelessly committed, I have started to use branches kind of like in the famous http://nvie.com/posts/a-successful-git-branching-model/ I would now like to have a "central" remote repository that I can push my develop and master tree. The first issue is: how do I do this. Do I initialize an empty repository on my server and reference to this repository as the remote origin in my local repository? Do I have to create the branches in the remote repository beforehand or is it enough just to push them? Secondly the first commits in my local repository are really awkward, so I would like to cumulate a lot of those early commits into one, either in the way of --no-ff or as I understand to squash them. As I understand, this is only working with an intermediate branch. i.e. right now I have 2 branches " **develop** " and " **master** " in my local repository. I came up with two ideas how to "change history" I create two branches **develop-squashed** and **master-squashed**. Rebase my original branches to those while squashing commits I want to loose. Upon having **-squashed** branches being equivalent with the original master and develop branches, I can delete the original ones and "rename" the ***-squashed** branches to **master** and **develop**. Finally I can push **_master_** and **_develop_** into the _remote_ repository.   * Is that the way to go?   * How can I make sure that by rebasing, both branches **master** and **develop** both have the same history up to the point when I started to follow the "successful git branching model"? (They have the same history up to that point at the moment).


optimise my solution

I just solve this but want know more efficient way to do matrix multiplication               M :     ------     1 1 0     0 0 5     3 2 0       f[n] = M^n I have implemented using Exponentiation_by_squaring Is there more efficient then this ?


Content of Project Wiki

I've set up a small Google Code project. I feel a bit obligated to use the built-in wiki feature, but I'm unsure of what to use it for. The project is basically a C++ library for container classes. I'm currently the only member of my project, but I might get a few friends involved. So, what should I use the wiki for? Do I even need to use it at all?


Reasons Programmers Leave

I am interested in finding out why programmers leave their jobs and if the reasons for leaving have resurfaced in your now job? Is the reason for leaving simply down to remuneration, location, I hate my boss / coworker, lack of recognition or retirement / new career path. Update: I am responsible for a team of programmers and testers and I would like to better understand what could motivate my team to leave, and hopefully try to address such issues.


Is a complete rewrite against the license/eula of this software?

Okey, so I have for a while now been thinking of rewriting the minecraft server, this time in a language called golang. It's just a example project that I can learn a new programming language through.. My question is: If I -rewrite- the minecraft -server-,:   * I read the Minecraft EULA, and they only talking about -modifying- the the current server or client. Nothing about re-creating it. Do I violate the EULA if I recreate the minecraft server in golang?   * If I ever will finish the project, having a completley functional rewritten server. Can I release it?   * And if I can release it, can I earn money from it in form of donations? Thanks!


Is there an excuse for short variable names?

This has become a large frustration with the codebase I'm currently working in; many of our variable names are short and undescriptive. I'm the only developer left on the project, and there isn't documentation as to what most of them do, so I have to spend extra time tracking down what they represent. For example, I was reading over some code that updates the definition of an optical surface. The variables set at the start were as follows:               double dR, dCV, dK, dDin, dDout, dRin, dRout     dR = Convert.ToDouble(_tblAsphere.Rows[0].ItemArray.GetValue(1));     dCV = convert.ToDouble(_tblAsphere.Rows[1].ItemArray.GetValue(1));     ... and so on      Maybe it's just me, but it told me essentially nothing about what they represented, which made understanding the code further down difficult. All I knew was that it was a variable parsed out specific row from a specific table, somewhere. After some searching, I found out what they meant:               dR = radius     dCV = curvature     dK = conic constant     dDin = inner aperture     dDout = outer aperture     dRin = inner radius     dRout = outer radius      I renamed them to essentially what I have up there. It lengthens some lines, but I feel like that's a fair trade off. This kind of naming scheme is used throughout a lot of the code however. I'm not sure if it's an artifact from developers who learned by working with older systems, or if there's a deeper reason behind it. **Is there a good reason to name variables this way, or am I justified in updating them to more descriptive names as I come across them?**


I just received a complaint from a user of the website I maintain. Should I do anything?

I was sent sent a large wall of text from a user of the website I maintain at my job. They are clearly upset for having to deal with a horribly outdated web application that has not seen any serious updates in over 6+ years. No refactoring has been done, the code quality is terrible, the security unchecked, policy compliances ignored, in addition to being ugly and frankly embarrassing. Keep in mind this is a small business but the website is used by hundreds daily. I'm one of two programmers there, and I've been working there for two years. This person says they are about my age (22) and understand technology (but can't use proper grammar). The complaint mentioned awkward pages and actions on the website, but they don't even have a clue as to the depth of the flaws in this website. Now, I would love to honestly tell them that there's a lot wrong with this company and that this application was built when we were in high school. And that while it's not my fault that the website is terrible, I'm the one in position to fix it. But on the other hand, I could just say nothing and ignore it. Would doing this publicly have any advantage to future employees (showing integrity) or would it just be a completely pointless mistake? Odds are, even if I respond only that one person will ever read it. Regardless, I'm probably just going to ignore it and continue starting my project to refactor the website.


Date & time - apply current, or 'then' DST?

I'm designing a function that given a UTC timestamp will convert it to the local time. The question I have, should the current times DST settings be applied to the conversion, or the timestamps DST settings? If going with the former, current DST setting applied to timestamp - it would mean 4pm that was recorded with DST+1 would be 3pm with DST+0 and 4pm with DST+0, depending on the time of the year you checked the date at. If going with the latter, the timestamps DST setting would be applied to it - so 4pm recorded with DST+1 will always say 4pm, no matter what time of the year you've checked it at. Which is more preferrable in practice?


difference between exponential and logarithmic growth

Why   `for(k=1;k<=n;k*=2)` grows logarathmically = `O(logn)` but I feel it grows exponentially, as the seq look like `1,2,4,8....` and for fibonacci series people say it grows exponentially. which for me doesnt look like `0,1,1,2,3,5...` but for tis they tell `O(2^n)`. PLease explain


How often should saving to disk occur in an automatically saving text editor?

I am developing a simple text editor and would like the application to save the text automatically. In other words, the user would never have to press a save button. I have seen other applications that do this, and was wondering how often is it safe to write files to disk? From a user experience standpoint, it seems that the more frequently this happens the better, but I am worried about performance and possible disk wear (especially on writes to SSDs). It seems like the operating system disk caching might help avoid these problems, but I also don't know if its safe to rely on that for an application like this. I was planning on writing the whole document to disk at each save, but this just seems terribly inefficient if the OS ends up writing it to disk to frequently, but relying on program unload may lose data in the case of a crash. Does anyone have any experience dealing with this that might be able to help?


Do cross reference database tables have a place in domain driven design?

First some background. Let's say we have a system where a customer is placing an order in a web interface. The items that customer is ordering can priced in various ways. Sometimes including the cost of delivery and sometimes not at all. That pricing effectively depends on a variety of factors including the vendor's own pricing model, that vendor's individual contracts with customers as well as that vendor's contracts with its own suppliers. Let's assume that once a customer places an order for a particular item and chooses a contract if any, the method of delivery can be determined by variables on those contracts. Those delivery methods also live in their own table in the database and have various properties consumed downstream. It makes sense that a cross reference or lookup table would store that information. That table would be loaded into the domain and could then be used to apply the appropriate delivery method while processing the order. Does this make sense in the context of domain driven design? Or is my thinking too relational? Is this logic that should be built into it's own class/method (I mean beyond apply the cross reference table data)?


Use adapter pattern for coupled classes

I need (for unit testing purposes) to create adapters for external library classes.ExchangeService and ContactsFolder are Microsoft's implementations in its' EWS library. So I created my adapters that implement my interfaces, but it seems that contactsFolder has a dependency for ExchangeService in its' constructor. The problem is that I cannot instantiate ContactsFolderAdapter without somehow accessing the actual ExchangeService instance (I see only ExchangeServiceAdapter in scope). Is there a better pattern for this that retains the adapter classes? Or should I "infect" ExchangeServiceAdapter with some kind of GetActualObject method? ![enter image description here](http://i.stack.imgur.com/rgpv1.png)


Does it make sense to make a field mandatory which has a default value?

Consider a drop down "Duration" which has 3 options               1. 30 days     2. 60 days     3. 90 days      and by default 30 days will be the selected value. Does it make sense to make this dropdown mandatory? Do we really need to put a ***** (Mandatory mark) for this field?


Why isn't the Stab language more widely used?

I am wondering if there are technical reasons that make Stab an unsuitable alternative to Java. Stab borrows heavily from C#, bringing many C# features to the JVM:   * Less verbosity      * type inference (implicit typing)     * properties and indexers     * null coalescing operator     * 'using' and 'as' shortcuts   * delegates   * lambda expressions   * anonymous types   * generators (iterator blocks/yield return)   * non-checked exceptions   * initializers   * partial classes and methods   * extension methods   * a form of LINQ   * other stuff Many of the above features seem like things that people are clamouring for in Java. Stab seems like a way of getting these features today while not falling very far from the Java tree. I am surprised that Stab has not been more popular with C# developers that also have to write and maintain code on the JVM. Stab is not 100% the same as C# but it is pretty close and I would think that C# developers would prefer coding in Stab to coding in Java. I am surprised that Stab has not seen greater adoption with Java programmers. It has a syntax that is very similar and incremental to Java, uses the plain vanilla JDK, and generates libraries that interact very naturally with Java on the JVM. Scala is an obvious alternative as well and has an even greater feature set. I can see why you would choose Scala. In my opinion, Scala is a bigger jump conceptually, syntax-wise, and even in terms of libraries for both Java and C# programmers. Even in a world with Scala as a choice, I am surprised that Stab has not seen more traction. It seems like there could be a few reasons:   * People are just not aware of it   * Java folks do not like the 'Microsoft' influence   * These features are not as compelling as I imagine compared to vanilla Java   * There are technical issues with using Stab in the real world The last option seems most suitable for discussion here. So, what are the technical reasons that keep Stab from being a popular choice when developing on the JVM? I think this may be the first question here about Stab. Ceylon already has questions and nobody has even seen it yet.


Any reasons not to use multiple version control systems?

I'm working on a project which uses GIT as the main version control system for trunk, the official branches and most sub-projects/unofficial branches. As such, I want to make my own branch use GIT to allow the rest of the community to access my branch using the system they know. However, I'm working on a part of the project which overlaps both official and unofficial branches, along with some patches which will never enter trunk - as such, I need to be able to keep my patches separate, allowing all to be used in my branch and selective patches to be taken for use in trunk. This naturally leans towards using mercurial queues. Is there any reason that I can't use mercurial for my own local repository, but push the entirety to both GIT and Mercurial hosted repositories? Or rather, is there any good reason not to, I'm sure it's possible.


Interesting variations of FizzBuzz?

In hiring programmers, a common test is the Fizz Buzz test. What are some neat/interesting variations on fizz buzz which keep with about the same difficulty level? Basically, if I asked someone to do a fizz buzz test over email or something, I'd want to make sure they can't just google the code.


What is the point of properties?

Here are some arguments for properties and my counter-arguments: ### Easier to use than writing getter and setter methods Getter and setter method pairs are a code smell. Making it easier to write these is like making it easier to fail a math test by using a Scantron form and filling in all 'C's. Objects that contain only state, for persistence, shouldn't be using getters/setters and should be creating immutable objects at the time of persistence. What is important to a consumer of an object is what it does, not how it does it. Its behavior is what it does; its state is how it does it. If you find yourself caring about an object's state (except for persistence, though this also breaks OO), you're simply not doing OOP and losing out on its advantages. ### They give a rough indication of performance to consumers This is something that could change in the future, for any given property. Suppose in release 1.0, accessing PropertyX simply returns a field. In release 1.5, if the field is null, PropertyX uses the Null Object pattern to create a new null object. In release 2.0, the field is getting further validated by the getter method in PropertyX. As the property gets more and more complex, the performance indication of using a property seems less and less truthful. ### They're better than public fields This is true. But so are methods. ### They represent a fundamentally different aspect of an object than a method, and all consumers of the object should care about this Are you sure that both of the above statements are true? ### They're easier to type, man Sure, typing `myObject.Length` is easier than typing `myObject.Length()`, but couldn't that be fixed with a little syntactic sugar? * * * ### Why use methods instead of properties?   * No performance guarantees. The API will remain truthful even if the method gets more complex. The consumer will need to profile their code if they are running in to performance issues, and not rely on word-of-API.   * Less for the consumer to think about. Does this property have a setter? A method sure doesn't.   * The consumer is thinking from a proper OOP mindset. As a consumer of an API, I am interested in interacting with an object's behavior. When I see properties in the API, it looks a lot like state. In fact, if the properties do too much, they shouldn't even be properties, so really, properties in an API ARE state as they appear to consumers.   * The programmer of the API will think more deeply about methods with return values, and avoid modifying the object's state in such methods, if possible. Separation of commands from queries should be enforced wherever possible. * * * So I ask you, why use properties instead of methods? Most of the points on MSDN are code smells in and of themselves, and don't belong in either properties or methods. (These thoughts came to me after thinking about CQS.)


What strategy to landing an enterprise postion given a non-enterprisey past?

I'm at a place of potential career change. Among the options is to stay in software development but move into commercial and enterprise systems work. My past has been mostly working with scientists and engineers in academic and research organizations. It's cool to be on the cutting edge of discovery, but coolness doesn't help buy furniture, build long term savings, buy solar panels, boost the local economy, or fund friends' start up ideas. The pay _can_ be decent by general population standards, but is around 2/3 to 1/2 what it could be at a commercial firm. Besides the money, there's the nature of the work. Academic groups often don't have good software development methodologies in place. I'm lucky to have svn in my current project. Many developers are students with immature approaches to design, who have glamour stars in their eyes for every new fad technique. Many high IQ people with expertise in one area who try to develop software apps going beyond just the math and plotting they really need, tend to over- design everything. One recent science data analysis project written by several people none of whom had a holist view of the project, involved such a tangle of badly organized layers of abstraction for things that really don't need any abstracting, with overuse of... oh never mind, this isn't the place to go ranting about all that! In contrast, all commercial projects are well-managed with proper tools, keen judgement, well-tuned regression and unit testing, and efficient methodologies. Right? Right? (laughter follows...) Well alright, the grass isn't actually greener _anywhere_ , but I accept imperfection. I do get more of a thrill out of making a good product that solves real world problems, while making a good salary with a real potential of bonuses or other rewards for mission crititcal work done under budget and in time. Another big advantage of commercial and enterprise IT work is that one can live in or near just about any city, whereas science swdev work strongly clusters to where science is done: university towns and near research centers like NIH, NASA, Fermilab, NRAO etc. While I have >20 yrs of experience in software, I have little know-how of databases (beyond the toy examples given in mysql tutorials), networks (beyond setting up a home LAN), financial stuff, point-of-sale stuff, BI stuff, or anything remotely enterprisey. I think BI might be interesting, but I don't know much more than how to spell it. So what is the gap (or canyon) I must bridge to make this change? What are effective strategies for making this shift? Are certain types of organizations, or certain job roles, better suited for this switch? What culture shock can I expect and how to deal with it, especially regarding what to say at a job interview? I can find out which specific skills are needed from job descriptions; what I'm after is all the other stuff, the unwritten and the hard to define things to consider. Or am I a fool to even be considering all this?


Does your organization still use the term "screens" to describe a user interface?

I have been in the field long enough to remember when the term "screen" entered our lexicon. As difficult as it is to believe, the early systems on which I worked had no user interface (UI). These systems ran as "card image" production jobs back in a day when being a computer operator required a reasonably deep understanding of how computers worked. Flashing forward to today: I cringe every time I hear a systems practitioner use the term "screen." The metaphor no longer fits the medium. The term somewhat fit back when the user dialog consumed 100% of available monitor real estate; however, the term lost its relevance the moment we moved to windowed environments. With the above said, does your organization still use the term "screens" to describe an application's UI? Has anyone successfully purged the term from an organization? For those who do not use the term to describe UI dialog elements, what term do you use in place of “screen.”


Acceptable # Lines of Code for Projects to be Presented to Interviewer?

I'm going to graduate soon and I've been thinking. I have a few really small projects/scripts (~100-200 LOC) that I made on my free time and I have them on Github. I was wondering if they are "worthy" enough to be presented to future employers? Or should I only include those that are big (~1000 LOC)?


How to efficiently protect part of an application with a license

I am working on an application that has many functional parts. When a customer buys the application, he buys the standard functionality, but he can also buy some additional elements of the application for an additional price. All of the elements are part of the same application executable. A license key is used to indicate which of the elements should be accessible in the application. Some of the elements can be easily disabled if the user didn't pay for it. These are typically the modules that you can access via the application's menu. However, some elements give more problems:   * What if a part of the data model is related to an optional part? Do I build up these data structures in my application so the rest of my application can just assume they're always there? Or do I don't build them, and add checks in the rest of may application?   * What if some optional part is still useful to perform some internal tasks, but I don't want to expose it to the user externally?   * What if the marketing responsible wants to make a standard part now an optional part? In all of my application I assume that that part is present, but if it becomes optional, I should add checks on it everywhere in the application. I have some ideas on how to solve some of the problems (e.g. interfaces with dual implementations: one working implementation, and one that is activated if the optional part is not activated). Do you know of any patterns that can be used to solve this kind of problem? Or do you have any suggestions on how to handle this licensing problem? Thanks.


JavaScript and callback nesting

A lot of JavaScript libraries (notably jQuery) use chaining, which allows the reduction of this:               var foo = $(".foo");     foo.stop();     foo.show();     foo.animate({ top: 0 });      to this:               $(".foo").stop().show().animate({ top: 0 });      With proper formatting, I think this is quite a nice syntactic capability. However, I often see a pattern which I don't particularly like, but appears to be a necessary evil in non-blocking models. This is the ever-present nesting of callback functions:               $(".foo").animate({         top: 0,     }, {         callback: function () {             $.ajax({                 url: 'ajax.php',             }, {                 callback: function () { ... }             });         }     });      And it never ends. Even though I love the ease non-blocking models provide, I hate the odd nesting of function literals it forces upon the programmer. I'm interesting in writing a small JS library as an exercise, and I'd love to find a better way to do this, but I don't know how it could be done without feeling hacky. Are there any projects out there that have resolved this problem before? And if not, what are the alternatives to this ugly, meaningless code structure?


What timestamp to use when pulling files from a VCS system?

Yesterday, a colleague asked me how to configure our VCS to timestamp the local copy of files pulled from the repository with the modification time in the repository. I've always believed that they should be timestamped with the time they were pulled so that if you make a change, build, then back out by overwriting the changed file with the repository's copy, everything that depends on that file will build correctly. I thought about it overnight, but couldn't come up with a good reason to have timestamped with the repository modification time. What would be the advantages of doing it that way? (Bonus question: repository modification time and local modification time are the only timestamping strategies that I'm aware of. Are there others in use by VCS systems?)


Tools every graduate student should know?

I recently started on my master studies adventure, and got recently introduced to LaTeX. I am parallely learning it and also wondering what other languages|tools are absolute essential for graduate student (Masters|PhD) to know? I want to continue into PhD later in my career.


What is the politically correct way of refactoring other's code?

I'm currently working in a geographically distributed team in a big company. Everybody is just focused on today's tasks and getting things done, however this means sometimes things have to be done the quick way, and that causes problems... you know, same old, same old. I'm bumping into code with several smells such as: big functions pointless utility functions/methods (essentially just to save writing a word), overcomplicated algorithms, extremely big files that should be broken down into different files/classes (1,500+ lines), etc. What would be the best way of improving code without making other developers feel bad/wrong about any proposed improvements?


Can a table be both Fact and Dimension

Ok, I am a newbie and don't really think "dimensionally" yet, I have most of my initial schema roughed out but I keep flipping back and forth on one table. I have a Contract table and it has a quantity column (tonnes), and a net price column, which need to be summed up a bunch of different ways, and the contract has lots of foreign keys (producer, commodity, futures month etc.) and dates so it appears to be a fact table. Also the contract is never updated, if that makes a difference. However, we create cash tickets which we use to pay out part or all of the contract and they have a contract ID on them so then the contract looks like a dimension in the cash ticket's star schema. Is this a problem? Any ideas on the process to resolve this, because people don't seem to like the idea of joining two fact tables. Should I put producerId and commodityId on the cash ticket? It would seem really weird not to have a contractID on it.


Should I expect my team to have more than a basic proficiency with our source control system?

My company switched from Subversion to Git about three months ago. We had weeks of advance notice prior to the switch. Since I'd never used Git before (or any other DVCS), I read Pro Git and spent a little time spinning up my own repositories and playing around, so that when we switched I'd be able to keep working with minimal pain. Now I'm the 'Git guy' by default. With a couple of exceptions, most of my team still has no idea how Git works. For example, they still think of branches as complete copies of the source code, and even go so far as to clone the repo into multiple folders (one per branch). They generally look at Git as a scary black box. Given the fundamental nature of source control in our daily work (not to mention the ridiculous amount of power Git affords us), I'm of the opinion that any dev who doesn't achieve a certain level of proficiency with it is a **liability**. Should I expect my team to have at least some understanding of how Git works internally, and how to use it beyond the most basic pull/merge/push operations? Or am I just making something out of nothing?


Alternatives to sql like databases

These days computers usually have 2GB or 4GB memory. I like to use some secure client server model, and well an sql database is likely candidate. On the other hand I only have about 8000 records, who will not frequently be read or written in total they would consume less then 16 Megabyte. And it made me wonder what would be good secure options in a windows environment to store the data work with it multi-client single server model, without using SQL or mysql? Would for well such a small amount of data maybe other ideas better? Because I like to keep maintenance as simple as possible (no administrators would need to know sql maintenance, as they dont know databases in my target environment). Maybe storing in xml files or.. something else. How others would go if ease of administration is the main goal? Oh and it should be secure to, the client server data must be a bit secure (maybe NTLM files shares https or...etc) Maybe I should say something of the use, it would be like client ask for a single record and retrieves an answer a single byte is returned those clients won't launch complex questions, only the maintenance server side might require record editing, clients will only ask not change records. And clients wont perform advanced queries.


Are the following Use Case Levels determined correctly?

I am confused about use case levels. All I could understand was that use cases that are contained in another use case fall under the level which is below the level of the container use case. I have identified the following use cases for an e-commerce store and I would like to know if their levels are correctly determined or not. Please provide a description of the differences between levels if I have done something wrong here. ![Identified Use case Levels](http://i.stack.imgur.com/QijX0.png)


Is mysql_* deprecated after PDO was introduced?

I have been noticing for a long time on Stack Overflow that most users recommend to use PDO instead of `mysql_*`, because PDO is more secure than `mysql_*`. But my question is if websites which are already running with `mysql_*` will stops working? Or what exactly does "deprecating" mean here? So should we have never used `mysql_*`? From which PHP version is is deprecated?


Explain Model View Controller

My experience with developing dynamic websites is limited mostly to Java servlets. I've used Tomcat to develop various Java servlets, and I wouldn't hesitate to say that I'm reasonably proficient with this technology, as well as with client-side HTML/CSS/Javascript for the front-end. When I think "dynamic website", I think: user requests a URL with a query string, server receives the query, and then proceeds to output HTML dynamically in order to respond to the query. This often involves communication with a database in order to fetch requested data for display. This is basically the idea behind the `doGet` method of a Java `HttpServlet`. But these days, I'm hearing more and more about newer frameworks such as Django and Ruby on Rails, all of which take advantage of the "Model View Controller" architecture. I've read various articles which explain MVC, but I'm having trouble really understanding the benefits. I understand that the general idea is to separate business logic from UI logic, but I fail to see how this is anything really different from normal web programming. Web programming, by it's very nature, forces you to separate business logic (back- end server-side programming) from UI programming (client-side HTML or Javascript), because the two exist in entirely different spheres of programming. **Question:** What does MVC offer over something like a Java servlet, and more importantly, what exactly _is_ MVC and how is it different from what you would normally do to develop a dynamic website using a more traditional approach such as a Java servlet (or even something older like CGI)? If possible, when explaining MVC, please provide an _example_ which illustrates how MVC is applied to the web development process, and how it is beneficial.