Why interviewers want Optimal Algorithms

In an interview with a software company they asked me some algorithm design questions. Being strong in mathematics I was able to solve it mathematically, but each time when I propose my algorithm they were doubtful about its working and I have to prove it with examples. I didnt get a call for further rounds, I believe my solutions were correct. After googling I have found answers to most questions but they were implemented in a different way. Why do interviewers look for optimal answers rather than solutions, which came out of our thoughts rather than memorization of an optimal answer and delivering it.


What is the relevance of Unit Testing in an "Release early release often" environment?

Over last one year or so, I have driven my team towards the release-early- release-often mode of development (AKA: Rapid Application Development, not Agile). For more information about the manner in which we close the build, see my answer here: A simple ways to improve the release quality in RAD environment When we adopted RAD, people were quite independent and they were doing unit testing first; the integrated tests happened much later in the process. It was a natural process for them without much formal enforcement. Now the situation is quite different:   1. The entire platform is well integrated with established builds/releases working client-side without any hot spots.    2. New functionality requirements keep coming and we incrementally build them as we go.    3. The overall dynamics of the system are very important because while independent development groups might be following processes right, major failures have arisen due to complicated, non-obvious circumstances.    4. Many parts of the system involve new algorithms and research inputs so the challenges (and hence mechanism for testing) are not quite always foreseen correctly, like feature testing in well-defined software. Recently, I was trying to get better overall picture to see if we need process improvement. When I sat down with my team, many of them balked: "We don't do unit testing anymore!" while others thought we shouldn't start now because it will never be effective. Are unit tests useful in a relatively mature system? Should we at least need to weigh test scope depending on the maturity of units? Will unit testing slow down the pace of development? Is there a need to evaluate unit testing in a different way? What are the best practices of testing for a mature platform in a release- early-release-often environment?


Web Application: Combining View Layer Between PHP and Javascript-AJAX

I'm developing web application using PHP with CodeIgniter MVC framework with a huge real time client-side functionality needs. This is my first time to build large scale of client-side app. So I combine the PHP with a large scale of Javascript modules in one project. As you already know, MVC framework seperate application modules into Model- View-Controller. My concern is about View layer. I could be display the data on the DOM by PHP built-in script tag by load some data on the Controller. Otherwise I could use AJAX to pulled the data -- treat the Controller like a service only -- and display the them by Javascript. Here is some visualization I could put the data directly from Controller:               Username <input type="text" id="username" value="<?=$userData['username'];?>">
     Date of birth <input type="text" id="dob" value="<?=$userData['dob'];?>">
     Address <input type="text" id="address" value="<?=$userData['address'];?>">      Or pull them using AJAX:               $.ajax({       type: "POST",       url: config.indexURL + "user",                       dataType: "json",       success: function(data) {          $('#username').val(data.username);         $('#dateOfBirth').val(data.dob);         $('#address').val(data.address);       }     });      So, which approach is better regarding my application has a complex client- side functionality? In the other hand, PHP-CI has a default mechanism to put the data directly from Controller, so why using AJAX?


Example of time-saving usage of compile-time meta-programming?

The webpage of Converge states that: > Converge has a macro-like facility that can embed domain specific languages > with arbitrary syntaxes into source files. I am most intrigued by the possibility to create domain specific languages. My understanding of the purpose of such languages, is that they enables the developer to become much more efficient when solving domain specific problems. So, I went on to read the "about" section. There are two examples of usage here, but none of them describe how the developer could save development-time by utilizing Converge. Can anyone come up with an example or refer me to an example? I am happy to read examples in other languages than Converge.


How to handle status columns in designing tables

How to handle multiple statuses for a table entry, for example an item table may have an active, inactive, fast moving, and/or batch statuses. And I wanted to handle them in single column with VARCHAR type. Also I might set each of those attributes as a boolean with different columns. But I am not sure what consequences this might lead to. So if you have experienced such situations which one would be the best way to handle it?


Retrying a statement or call in a catch block - code smell or anti-pattern?

I'm wondering how better to perform this operation for a large amount of files. The bit I'd like some thoughts on **whether this copy/paste is acceptable enough of a tradeoff**.   * try to write a file   * if the target dir doesn't exist, create it   * try again to write the file. If something else throws and exception, let it raise.               try{        File.Copy("@D:\foo.txt", @"C:\mydir\foo.txt");     }     catch (DirectoryNotFoundException){            CreateDirectoryForFile(@"C:\mydir");        File.Copy("@D:\foo.txt", @"C:\mydir\foo.txt"); //copy pasted from the try block     }      There's a simpler block that's easier to read, but leads to a higher number of disk IO calls that is necessary:               CreateDirectoryForFile(@"C:\mydir\foo.txt");     File.Copy("@D:\foo.txt", @"C:\mydir\foo.txt");      Can pattern 1 be improved?


Do delegates defy OOP

I'm trying to understand OOP so I can write better OOP code and one thing which keeps coming up is this concept of a delegate (using .NET). I could have an object, which is totally self contained (encapsulated); it knows nothing of the outside world... but then I attach a delegate to it. In my head, this is still quite well separated as the delegate only knows what to reference, but this by itself means it has to know about something else outside it's world! That a method exists within another class! Have I got myself it total muddle here, or is this a grey area, or is this actually down to interpretation (and if so, sorry as that will be off topic I'm sure). My question is, do delegates defy/muddy the OOP pattern?


Debug multiprocessing in Python

What are some good practices in debugging multiprocessing programs in Python?


Algorithm for detecting a knob-turning gesture?

What is the math to identify a gesture for the motion made by two fingers turning a knob (tracking two sets for xycoords)? Is there a library/api anyone is familiar with that contains a good library of gestures for multitouch applications?


Raw Sql vs SqlAlchemy when Django ORM is not enough

In a django project, if a situation comes that Django ORM is not able to execute some complex queries then there are 2 options:   1. Use Raw Sql queries    2. Use SqlAlchemy  I want to know if there are some rules like some pros and cons of both which can guide me to choose one of the above 2 options. Or is it entirely depends on what we like?


Theta notation on constant time. Why we use the 1?

In asymptotic notation when it is stated that if the problem size is small enough (e.g. `n<c` for some constant `c`) the solution takes constant time and is writen as `Theta(1)`.   Why we write `1` inside the `Theta`?   What does the `1` mean? Why not `Theta(c)`?


Generating CMakeLists.txt

I got a bunch of `C++` sources files and headers. They may use external libraries such as Boost e.g. I am interested in the process of building binaries for Windows and *nix.   * Makefiles (*nix) and .vcproj (Windows) call compilers with some specifications such as the order of compilation, compilation options and stuff.   * CMakeLists.txt can be used by CMake to build either makefiles or .vcproj and use very helpful commands such as recursive search of files, automatic linkage with known libraries, installers, variables that can be used in source files... Is there any existing tool that would generate a CMakeLists.txt from specified options ? Options could be like : scan this folder and make a library out of it, then scan this other folder and make an executable and automatically link both with Boost as well along with a user friendly installer with generated INSTALL.txt and README.txt. Something very powerful like that.


Getting out of my head

I've spent the last year as a one-man team developing a rich-client application (35,000+ LoC, for what it's worth). It's currently stable and in production. However, I know that my skills were rusty at the beginning of the project, so without a doubt there are major issues in the code. At this point, most of the issues are in architecture, structure, and interactions -- the easy problems, even architecture/design problems, have already been weeded out. Unfortunately, I've spent so much time with this project that I'm having a hard time thinking outside of it -- approaching it from a new perspective to see the flaws deeply buried or inherent in the design. **How do I step outside my head and outside my code so I can get a fresh look and make it better?** Is this a smaller issue than I think it is, or is this a problem experienced by others as well?


Does there exist a decent monetary bounty system for open source software?

I personally would be willing to pay $10 to someone who can offer to make microphone drivers work with one of my laptops under Ubuntu 10.10. I thought that other users could contribute to the same thing, and thus find a willing developer. Does there exist such a project(s)?


Is GCC dying without threads support on Windows?

I need some opinion. GCC was always a very good compiler, but recently it is losing "appeal". I have just found that on Windows GCC does not have `std::thread` support, forcing Windows users to use another compiler because the most exciting feature is still missing. But why really doesn't GCC still have threads support under Windows? License problems? ABI incompatibilities? (Well there are already several cross- platform libraries using multithreading: boost, POCO, SDL, wxwidgets, etc. Wouldn't it be simple to use already existing, and MIT/libpng licensed, code to fit this hole instead of shipping GCC releases with no thread support?) Recently, looking at compiler comparisons, GCC has the widest support for C++11 features with respect to other compilers, except for the fact that on Windows this is not true because we are still lacking atomics, mutexes and threads :/ I'd like to know more about this topic, but the only thing I can find is people asking for help because: > "thread" does not exist in std namespace Looking at tickets tracking and mail discussions of GCC/TDM-GCC, there were requests for thread support since 2009. Possible that after 4 years still no solution? What's really happening?


Custom animation iOS

I have seen animation, and i can't figure out how to do something like in this video(youtube). I want to discuss how it's made. I don't think that they're using sprites. I have one idea how to do this: for example i want to create animation of "walking" animal (when animal moves, he's legs "runs" moving animation), i should create customView with imageView of animalBody 3 and two imageViews of animal legs 2. Then i make hard coded animation of moving legs and voila, i have custom animation. When i move customView, then i should start animation of legs. But is there better approach to do this? Thanks! ![enter image description here](http://i.stack.imgur.com/f1mdB.png) ![enter image description here](http://i.stack.imgur.com/wSdey.png)


Web API URI Schema Design

I'm in the middle of designing an API for a very basic flashcard application for learning purposes and I'm wondering if you all think there can be any improvements. In the app, a Folder contains Folders and Sets. A Set contains Cards. The Homepage lists any top-level Sets and Folders that the I've created (but never cards). Here's the URI schema I've come up with: ![enter image description here](http://i.stack.imgur.com/r8lES.png) Does this seem ok? My goal is to keep the URIs terse/concise/simple and push any relationship metadata (parentFolderId, parentSetId, etc) into the body of the request. Thoughts?


What do I need to include in my OOP design document?

I am a graduate student in aerospace engineering. A lot of my Master's thesis has been on developing an OOP software architecture in MATLAB to facilitate control of Arduino-based vehicles (blimps, cars, quadrotors, etc). All my code is heavily documented, but my thesis itself needs to be more than a reference of every class and method - it needs to describe at a high level how each piece works together, and _why_ my architecture is the way it is. I only have a minor in computer engineering and I consider myself a pretty competent programmer, but I have no experience writing this kind of document. What kinds of things need to be included in the document? (Diagrams, paragraph explanations of how each class operates, etc)? I don't want to just rehash my code comments (although at the start of each file there's paragraphs of comments about how that class relates to other classes). I also wonder if it's necessary to get rather technical (I implement some fairly advanced MATLAB concepts [that is, advanced for non-computer engineers] such as listeners and callbacks); my audience also hails from an aerospace engineering background. Examples would be appreciated if they exist. **EDIT** : The part my audience really cares about is not the software architecture (the stuff this question entails); this document is really for people who will use my work in the future - who are **not** computer engineers! So I guess the main question is, what needs to be in the document such that people who are not up to speed on the project (and we can assume competent with the language) can understand the architecture, maintain and use the software?


Functional programming and stateful algorithms

I'm learning functional programming with **Haskell**. In the meantime I'm studying Automata theory and as the two seem to fit well together I'm writing a small library to play with automata. Here's the problem that made me ask the question. While studying a way to evaluate a state's reachability I got the idea that a simple recursive algorithm would be quite inefficient, because some paths might share some states and I might end up evaluating them more than once. For example, here, evaluating **reachability** of _g_ from _a_ , I'd have to exclude _f_ both while checking the path through _d_ and _c_ : ![digraph representing an automaton](http://i.stack.imgur.com/4JG7I.png) So my idea is that an algorithm working in parallel on many paths and updating a shared record of excluded states might be great, but that's too much for me. I've seen that in some simple recursion cases one can pass state as an argument, and that's what I have to do here, because I pass forward the list of states I've gone through to avoid loops. But is there a way to pass that list also backwards, like returning it in a tuple together with the boolean result of my `canReach` function? (although this feels a bit forced) **Besides the validity of my example case** , what other techniques are available to solve this kind of problems? I feel like these must be common enough that there have to be solutions like what happens with `fold*` or `map`. So far, reading learnyouahaskell.com I didn't find any, but consider I haven't touched monads yet. ( _if interested, I posted my code oncodereview_)


Is throwing an exception from a property bad form?

I've always been of the mindset that properties (ie, their set/get operations) should be fast/immediate and failure-free. You should never have to try/catch around getting or setting a property. But I'm looking at some ways to apply role-based security on the properties of some objects. For instance an Employee.Salary property. Some of the solutions I've run across that others have tried (one in particular is the AOP example here) involve throwing an exception if the accessor doesn't have the right permissions - but this goes against a personal rule that I've had for a long time now. So I ask: am I wrong? Have things changed? Has it been accepted that properties should be able to throw exceptions?


Sprite Sheets in PyGame?

So, I've been doing some googling, and haven't found a good solution to my problem. My problem is that I'm using PyGame, and I want to use a Sprite Sheet for my player. This is all well and good, and it would be too, if I wasn't using a Sprite Sheet strip. Basically, if you don't understand, I have a strip of 32x32 'frames'. These frames are all in an image, along side each other. So, I have 3 frames in 1 image. I'd like to be able to use them as my sprite sheet, and not have to crop them up. I have used an awesome, popular and easy-to-use game framework for Lua called LÖVE. LÖVE has these things called "Quads". They are similar to texture regions in LibGDX, if you know what they are. Basically, quads allow you to get parts of an image. You define how large a quad is, and you define parts of an image that way, or 'regions' of an image. I would like to do something similar to this in PyGame, and use a "for" loop to go through the entire image width and height and mark each 32x32 area (or whatever the user defines as their desired frame width and height) and store that in a list or something for use later on. I'd define an animation speed and stuff, but that's for later on. I've been looking around on the web, and I can't find anything that will do this. I found 1 script on the PyGame website, but it crashed PyGame when I tried to run it. I tried for hours trying to fix it, but no luck. So, is there a way to do this? Is there a way to get regions of an image? Am I going about this the wrong way? Is there a simpler way to do this? Thanks! :-)


get all the combination of a given set of numbers

I m trying to get the possible combinations of a given set of numbers say for example 123 The possible combinations would be 123 132 213 231 312 321 For this i have written a code as below -               import java.util.ArrayList;          /* Name of the class has to be "Main" only if the class is public. */     public class Main {          /**      * @param args the command line arguments      */     static ArrayList list;          public static void main(String[] args) {         // TODO code application logic here         Main nm = new Main();         nm.list = new ArrayList();         /*         for(int i=1; i<= 4; i++) {             list.add(i);         }              list.remove(list.indexOf(1));              for(int i=0; i<= 2; i++) {             System.out.print(list.get(i));         }         */         nm.test1();             }          public void test1() {                 for(int i=1; i<= 4; i++) {             if(!list.contains(i)) {                 list.add(i);                 test1();                 list.remove(list.indexOf(i));             }         }                    if(list.size() == 4)          {             for(int i=0; i< 4; i++) {                 System.out.print(list.get(i));             }             System.out.println("");         }     }      } This gives the correct output as shown here in the link I was thinking about if this the right approach or if there can be any optimizations done so that this code may be used to get combinations of numbers of 10 to 20 digits or more. Regards


Design pattern for handling a response

Most of the time when I'm writing some code that handles the response for a certain function call I get the following code structure: example: This is a function that will handle the authentication for a login system               class Authentication{          function login(){ //This function is called from my Controller     $result=$this->authenticate($username,$password);          if($result=='wrong password'){        //increase the login trials counter        //send mail to admin        //store visitor ip         }else if($result=='wrong username'){        //increase the login trials counter        //do other stuff     }else if($result=='login trials exceeded')        //do some stuff     }else if($result=='banned ip'){        //do some stuff     }else if...          function authenticate($username,$password){        //authenticate the user locally or remotely and return an error code in case a login in fails.     }         }      **Problem**   1. As you can see the code is build on a `if/else` structure which means a new failure status will mean that I need to add an `else if` statement which is a violation for the _Open Closed Principle_.   2. I get a feeling that the function has different layers of abstraction as I may just increase the login trials counter in one handler, but do more serious stuff in another.   3. Some of the functions are repeated `increase the login trials` for example. I thought about converting the multiple `if/else` to a factory pattern, but I only used factory to create objects not alter behaviors. Does anyone have a better solution for this? **Note:** **This is just an example using a login system.** I'm asking for a general solution to this behavior using a well built OO pattern. This kind of `if/else` handlers appears in too many places in my code and I just used the login system as a simple easy to explain example. My _real_ use cases are to much complicated to post here. :D Please don't limit your answer to PHP code and feel free to use the language you prefer. * * * **UPDATE** Another more complicated code example just to clarify my question:                 public function refundAcceptedDisputes() {                         $this->getRequestedEbayOrdersFromDB(); //get all disputes requested on ebay             foreach ($this->orders as $order) { /* $order is a Doctrine Entity */                 try {                     if ($this->isDisputeAccepted($order)) { //returns true if dispute was accepted                         $order->setStatus('accepted');                         $order->refund(); //refunds the order on ebay and internally in my system                         $this->insertRecordInOrderHistoryTable($order,'refunded');                                             } else if ($this->isDisputeCancelled($order)) { //returns true if dispute was cancelled                         $order->setStatus('cancelled');                         $this->insertRecordInOrderHistory($order,'cancelled');                         $order->rollBackRefund(); //cancels the refund on ebay and internally in my system                     } else if ($this->isDisputeOlderThan7Days($order)) { //returns true if 7 days elapsed since the dispute was opened                         $order->closeDispute(); //closes the dispute on ebay                         $this->insertRecordInOrderHistoryTable($order,'refunded');                         $order->refund(); //refunds the order on ebay and internally in my system                     }                 } catch (Exception $e) {                     $order->setStatus('failed');                     $order->setErrorMessage($e->getMessage());                     $this->addLog();//log error                 }                 $order->setUpdatedAt(time());                 $order->save();             }         }      **function purpose:**   * I am selling games on ebay.   * If a customers wishes to cancel his order and gets his money back (i.e. a Refund) I must open a "Dispute" on ebay first.   * Once a dispute is opened I must wait for the customer to confirm that he agrees to the refund (silly as he's the one who told me to refund, but that's how it works on ebay).   * This functions gets all disputes opened by me and checks their statuses periodically to see if the customer has replied to the dispute or not.   * The customer may agree (then I refund) or refuse (then I rollback) or may not respond for 7 days (I close the dispute myself then refund).


Java: The best way to learn it when MOOCs and books are not enough?

This topic was taken from Stack Overflow, but it was put on-hold due to Opinion-based question. So I moved it to here. I've had some great troubles with my homework exercises and I've used excessive time on doing simple programs like arrays and methods. For example it took me over 20 hours to create a program that asks user to enter row and columns size and then prints the matrix. I've read over 20 java books and tried 4 MOOCs, and even Buckys videos but it feels like I won't get in-depth understanding of Java fundamentals. Here's a list of problems that I face everyday when I'm coding java:   1. Problem solving   2. Creating methods and using them   3. Arrays   4. "I've no idea how to do this"   5. What is constructor and how to use it   6. "Where can I find help?" I've asked this question before but the answers have been like: "Read books" or "Just start coding" but neither of these haven't helped me because I've tried to code, but I haven't had any reasonable goals and reading books feels like eternal loop that just leads nowhere. I know that Internet is full of 'What is the best way to learn Java'-questions but I think that I've to try ask this because this topics question does not appear in Google Search + I think that there are people who are struggling with the same problem. Any advice would be appreciated. I'm eager to learn Java, I just need to find my own way to do it!


Communication between programmers and system engineers. Tool for planning builds and maintenance jobs

We have Development department and the department of System Engineers that works on a big project (development of J2EE application). We are using _Build management system_ , _Bug tracking system_ and a _Wiki engine_ in our work. Sometimes we have a situation when some developer initiate a server restart or an application build that breaks the debug process for other developers (in some cases developers using the same remote _Developer_ server). At the present moment we are using the _chat_ application for approving the process of restart\rebuild server (application). Can anyone share the experience of solving collision like I described above? * * * My vision is to use application which was able to do the following things:   * create request for server restart (or application rebuild\redeploy);   * subcribing for notification on "new request created" event;   * manual approving the request (by several members) and automatic approving of request (in case nobody declined the request during the some period of a time);   * subcribing for notification on "the request is approved" event;   * the request solving;   * subcribing for notification on "the request is solved (done)" event. It looks like the request has its own lifecycle or workflow. I think that some _Bug tracking system_ (for example, _by Atlassian Jira_ ) can help to create the request and can start the workflow on it. But this solution does not look perfect (even good) for me - its too "heavy and bulky".


How can I provide guidance on technology choices through user stories?

I'm a project manager for a team of firmware engineers making the transition to adopting Scrum and I'm moving to support the team in a Product Owner role. We've just gone through Scrum training and are beginning a month of coaching which is going to be invaluable. Coming from a technical background I can already see the challenge of shifting my point of view from the solution domain to focusing on business value. For me it's very tempting to think of "how" to solve a problem. But I like the concept of user stories and defining vertical slices of functionality that give value to the customer and letting the team determine the "how". Forgive me if this is a naive question, but as the PO how can I provide guidance on specific technical direction through user stories? My concern is that in some cases without guidance the team may head down the wrong path on key technical decisions. As a simplistic example I might have a user story: > As a clinician I want the device to record information about the patient's > treatment so that I can determine if the patient's therapy has been > effective. Now say time to market is critical and I want to fork out for an off-the-shelf file system stack to save time, what conveys that to the team? They might go off and start writing their own stack from scratch. Is this sort of guidance provided through:   1. Conversations during sprint planning and backlog grooming? But if so, is it my place as the PO to even be suggesting how to solve a problem.   2. Acceptance criteria? I don't really like this, I have a bad feeling about making acceptance criteria so prescriptive that they specify how to solve a problem.   3. Constraints? Thanks in advance. I could (and will) ask our Scrum coach but I won't be able to do that before Monday and this question has been really bugging me :)


Proper Architecture for DBContext and Migrations with Multiple Projects

I have multiple projects that will be using the same business objects (customer, order) but the projects operate in different databases within the organization and I would like to understand the proper architecture that I should create to service such needs. Here is a list of the different types of projects in play:   * ASP.NET MVC front end to handle all general user actions. This front end is deployed to a dedicated instance per customer.   * Centralized Windows Service to process FTP files and transmit the data to each customer instance.   * ASP.NET MVC front end to manage all customers and their instances. All business objects (customer, order, etc) are located in a Core class library. Each of the projects will need to use the business objects at one point or another but connect to a different database. Should the DBContext reside in the Core library or in the project? Should Entity Framework migration be located in the same location as the DBContext?


Python Socket Scripting. What am i doing wrong?

My socket program hangs at clientsocket, address) = serversocket.accept() and doesn't spit our an error or anything. I followed directions on https://docs.python.org/3/howto/sockets.html I've been trying to figure it out for an hour now, but to no avail. I'm using python3 btw. What am i doing wrong? EDIT: My intedentation is all screwed up because I pasted it wrong, but other than that my code is as I have it in my file.                   #import socket module         import socket         #creates an inet streaming socket.         serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)         print('socket created')         #binds socket to a public host, and a well known port         serversocket.bind(('127.0.0.1', 1024))         #print(socket.gethostname())# on desktop prints 'myname-PC')         #become a server socket         serversocket.listen(5) # listens for up to 5 requests              while True:             #accept connections from outside             #print('In while true loop') This works, but we never get to the next print    statement. Why the hell is it catching at line 20?             (clientsocket, address) = serversocket.accept()             #clientsocket = serversocket.accept()          print('Ready to serve')     #now we do something with client socket...     try:         message = clientsocket.recv(1024)         filename = message.split()[1]         f = open(filename[1:])         outputdata = f.read()         #send an http header line         clientsocket.send('HTTP/1.1 200 OK\nContent-Type: text/html\n\n')              for i in range(0, len(outputdata)):             clientsocket.send(outputdata[i])         clientsocket.close()          except IOERROR:         clientsocket.send('HTTP/1.1 404 File not found!')         clientsocket.close()


Could implicit static methods cause problems?

This is a purely hypothetical question. Say I create a class method that contains no references to instance variables or other resources. For example (C#):               protected string FormatColumn(string value, int width)     {         return value.Trim().PadLeft(width);     }      As far as I can see, there is absolutely no reason why this method could not be declared static:   * It only uses method-scope variables.   * It doesn't `override` a base class method.   * It's not `virtual` or `abstract`. My questions are:   Is there any benefit to calling a static method over an instance method?   If so, why doesn't the compiler implicitly convert this to a static method? I'm certain I've missed some key point here. Any ideas?


What effect does using multiple childViewControllers views inside a ContainerViewController have on memory?

I have three childViewController views inside my ContainerViewController and these three views are inside a horizontal scroll view. My intention is to build an app that has a custom camera on one ChildViewController view, a tableView which will display JSON data on another view, and a page which will show a list of the users friends. The reason I am building it this way is to achieve a dragging/sliding effect between the three different child views. Although I get the result I want from a UI/UX perspective, i'm not sure how this will effect memory and performance. If i'm not mistaken my containerViewController will be handling a lot of activity. Would there be an alternative way to architect this type of application? I understand I could have three separate view controllers using a Navigation Controller but than I wouldn't achieve the UI/UX experience I want. I'm really after the dragging/sliding between different pages experience, similar if not the same as Snapchat/Tinder


Which aids to decision-making exist for going open-source?

I am involved in the development of a software product that I'd like to see becoming open source. My bosses will ponder this request benevolently I assume, yet they still want to see some evidence that this is a good idea, at least that it is not a bad idea. They have little experience with open source themselves. We work in an academic public service environment, so financial interests are little to non- existing. I think their primary concerns are bad reputation by publishing a project and nobody is interested, and maybe the potential loss of control of the development process. I wonder whether there is (possibly peer-reviewed) material out there that advocates for going open source. But I'm also interested in documents describing a critical perspective towards such a step. Moreover, case studies would be helpful I think. The documents may be behind a journal paywall.


Anonymous access to api REST, protection

I have a public website that does not require authentication. It's a lighting calculator for indoor cultivation. Anyone can enter and complete the process and ultimately save your settings for future use sharing it on Facebook or twitter. The configuration is saved as a document in a database, using a REST api. At this time nothing prevents someone make a bot and fill my hard disk in a few hours. What steps can I take to give protection to my service?


What is the largest size a HashSet or TreeSet be?

So I am working on a solo project that involves **a lot** of strings. In one of my smaller test cases there will be _at least_ 70 million elements. So my question is, what is the largest possible size a TreeSet or a HashSet can reach until it can no longer grow **OR** until it reaches a size that it can no longer be feasible to use in terms of efficiency.


Using a zLib like icensed library which has dependencies on LGPL or GPL libs; what license am I able to release my project under?

If I use an Open Source library which is released under a zLib like license, but it has dependencies on libraries that are using LGPL or GPL; what license am I able to release my project under? If I read things I find on the net it sounds like I can sell my project but I can't stop people from distributing it freely as per GPL?


How to check the space complexity of this program?

I have written my version of strstr function in c. I am using a temporary array of size 26. Then is the space complexity O(1) or O(n)? This is my code :               void strcheck(char t[], int n, char p[], int m)     {         int i, j, k;         int temp[26];              for (i = 0; i < 25; ++i)             temp[i] = 0;         for (i = 0; i < n; ++i)         {             k = t[i] - 'a';             temp[k]++;         }         for (j = 0; j < m; j++)         {             k = p[j] - 'a';             if (temp[k] > 0)                 temp[k]--;             else                 break;         }         if (j == m)             printf("string occured\n");         else             printf("not occured\n");     }      The program is working correctly just wanna know about space complexity. Thanks


Video conferencing server architecture

I am developing a video conference application with the following requirements:   * Audio works like call conference, where all participants may talk at the same time.   * However, video works like broadcasting, where only one designated client broadcasts one video to the rest. Clients will be Android devices. One way of doing this is to use a SIP stack (e.g. Asterisk) and use its conference call capabilities; however the video conference part of Asterisk looks pretty undeveloped. Also, there might be some issues using SIP, as the app will be used over 3G and/or restrictive firewalls. Another way is to use streaming media server like Wowza, which while it is impressive on live video streaming, it does not seem to have a conferencing capabilities. Is there a better way to approach this? It seems that this use case is pretty common and there are various similar solutions for desktop apps.


What should a CS grad know?

In thinking of making a good introductory resource guide for new Computer Science students... **What is a good list of expected knowledge and ability for a computer science BS grad?** And if you graduated a while ago, how does this compare to the standards for graduates at that time? And, are there any things you would want college grads to know that most entering the field don't? Many thanks!


Object Oriented Programming Language performance ranking

After reading this post about ideal programming language learning sequence, I am wondering what would have been the answers if the question was performance -instead of learning- oriented ? Since there are many programming languages I chose to ask the question for OOL to be the least subjective. But any thought or comparison about no-OOL are appreciated :D If we omit the programming effort, time and costs. What is your ranking of the most powerful object oriented languages ?


Opinions on distribution of software via virtual appliance

I've created a distribution of my open source application framework in a working virtual appliance. It includes everything to get started with the tutorial. The distribution is Fedora 14 running Tomcat 5.5 and Oracle 10g Express Edition, plus my framework. It is completely preconfigured and boots into a working running copy. Would this be something you might try? What assurances might you need to get you to try it? **Edit:** The VM is just over a 2Gb download. Alternatively it is also available via 23Mb download for the source and a PDF detailing how to configure the Tomcat and Oracle dependencies.


I've failed at PHP several times. Is Ruby the Cure?

_Extremely, extremely_ subjective question here, but its something I've been struggling with for quite a while. I've seriously tried to become a reasonable PHP coder for the past several years. But I've really failed every time. I hate to describe myself as a beginner, b/c I've been designing websites (using WordPress, Drupal, etc) for years, but still I just can't seem get better at programming. Could it be that I have some kind of allergy to PHP? I went through Chris Pine's awesome into to Ruby about a week ago (for about the fifth time), and though it did all all seem much clearer to me than PHP, I wondered if I was just switching languages to find an easy way out? The things I struggle with in PHP all seem elementary—when to use a function, how to return database queries in foreach/while statements, when to turn those queries into reusable functions, adding arguments to functions, etc, etc. And all the OOP stuff that I keep seeing these days just files over my head. I guess my question(s) are: Am I going about learning how to program in the wrong way? Do I have some aversion to PHP that's preventing me from catch on? If I keep pushing at Ruby/Rails, will it just eventually 'click'. Or, the one I fear, am I just unlikely to ever be a programmer?


How to balance Front End and Back End coding skill

This is a question specifically for web applications developers. In recent years I spent most of my time on SaaS products, which leads you dig deep into more back-end stuff, like how to use less memory resources, make session working with load balancer, write efficient SQL queries, performance tuning, solving technique difficulty. There is no web designer working with us, generally what we get is a snapshot of what the system should look like, but nobody here cares how you produce it. Since now the company plan changed and they are going to change and the SaaS product will reach end of life soon, and I just feel I lack of those HTML/CSS knowledge, I mean I never got a chance to check those things as a whole stuff, but only learn from what I need to work out. All those above seems made me out of fashion about front-end skills, I seems tend to ignore learn things about it. Till just now I realized that might be a mistake I made, for instance I still tend to use table layout in HTML and just realized how bad practice that is recently. I start wondering if I were going to find a new job, how good should I be on front-end coding compare to back-end skills? Is it OK for now as more and more web designers or user interface designers are hired so we don't need to worry about Html/Css too much? Or should I pause my back-end skill improvement and jump back on front-end a while and then make it half and half? Sorry English is not my native language so there might be something expressed not that clear. Thanks for reading this long post!


OOP question for product catalog

I have a question bugging me for some days. I made a webshop for a good friend of me. The problem is I have an OOP class question. People can buy some clothing in the shop. The problem arise how to show different information for different products? What I have now is the following:   * abstract Product class   * Cloth extends Product   * Trousers extends Product Problem is that trousers can contain extra information like:   * fiber type   * structure How can I show those information in the shop? I query for all products and receive the Product class with only the selling price and name? What is the correct way to figure out it is a trouser to show those information like fiber structure on the detail page?


Are ASP.NET Web Parts useful & common enough practice in the real world, outside of SharePoint projects?

Studying for the .NET 70-515 exam. There is a chapter on Web Parts. I will suck it up and learn what I need to learn here, but... I am wondering, do ASP.NET developers in the real world often turn to Web Parts _outside_ of SharePoint development? I do not **ever** plan to deal with SharePoint - I prefer working on large scale public-facing web sites and applications - and Web Parts (SharePoint, too) hardly seem useful to me in that context. But what do I know? Help me understand the relevance or irrelevance of this technology, please. Should I keep ASP.NET Web Parts on my _ignore-list_ , if SharePoint is already on it too? Thanks!


Stored Procedures a bad practice at one of worlds largest IT software consulting firms?

I'm working at a project in one of the world's top 3 IT consulting firms, and was told by a DBA that company best practice's state stored procedures are not a "best practice". This is so contrary to everything I've learned. Stored procedures give you code reuse, and encapsulation (two pillars of software development), security (you can grant/revoke permissions on an individual stored proc), protect you from SQL injection attacks, and also help with speed (although that DBA said that starting with SQL Server 2008 that even regular SQL queries are compiled if they are run enough times). We're developing a complex app using Agile software development methodology. Can anyone think of good reasons why they wouldn't want to use stored procs? My guess was that the DBAs didn't want to maintain those stored procs, but there seem to be way too many negatives to justify such a design decision.


Basic Objective-C Questions

I'm new to objective C, I'm following "Objective C 5th Edition Stephen Kochan and I don't have anyone to ask my doubts to. I'm confused with this question: Q. Is it necessary to use "-" or "+" before every property or method declaration in Interface? What will happen if I don't use "-" or "+" before every property or method declaration in Interface?


Should I return iterators or more sophisticated objects?

Say I have a function that creates a list of objects. If I want to return an iterator, I'll have to `return iter(a_list)`. Should I do this, or just return the list as it is? My motivation for returning an iterator is that this would keep the interface smaller -- what kind of container I create to collect the objects is essentially an implementation detail On the other hand, it would be wasteful if the user of my function may have to recreate the same container from the iterator which would be bad for performance.


Is there a way for developers and their clients to make a 'safety net' for the final transaction of software for money?

First off, we presume that the projects in question are not large or important enough for the parties involved to establish a formal contract, and that the parties are not able to meet in person. So, how can the programmer(s) be sure that they will be paid(in full), and how can the client be sure that the their requirements are met, e.g. testing it without acquiring the full source code?


Comparing TCP/IP applications vs HTTP applications

I'm interested in developing a large-scale user-facing website that is written in Java. As for design, I'm thinking of developing independent, modular services that can act as data providers to my main web application. As for writing these modular services (data providers), I can leverage an existing framework like Spring and develop these services following the RESTful design pattern, and expose resources via HTTP with a message format like JSON...or I can leverage an existing network framework like Netty (http://netty.io/) and serialization format like Protobufs (https://developers.google.com/protocol-buffers/docs/overview) and develop a TCP server that sends back and forth the serialized protobuf payload. When should you choose one over the other? Would there be any benefit of using a serialization format like Protobufs and sending stream of bytes over the wire? Would there be overhead in just using JSON? How much overhead is there between using TCP/IP and using HTTP? When should you use Spring over Netty, and vice versa to build such a service?


Using home server to develop, moving everything out of local machine

I'm sorry if this question is too broad, but I hope it's not :) I'm thinking about setting up small & cheap home linux based server (one of those $200-$300 micro PCs), to move my whole development environment out from my laptop (databases, interpreters etc.). The main reason is - while I earn my meal coding PHP, I'd like to try new things that require installing new stuff and I want to keep my laptop running smoothly. Other reason is that I find setting up and maintaining dev environment on OS X somehow disturbing (you just can't upgrade PHP, you have to do some tricks to do this). Setup I thought about is: 1\. Mount server's drive via `Samba` 2\. Use `NetBeans` saving directly to server, work, run apps on server Keeping that in mind, my main (and IMHO quite specific) question is - will it work? I mean - won't this setup slow down my development instead of making it cleaner and separated from development machine? By slowing down I mean: samba issues, configuration issues, gotchas and so on. Technologies I intend to use: `mysql`, `postgres`, `php`, `pyton`, (maybe) `java`, (maybe) `RoR`, (maybe) `Solr`.


How can I update a large legacy codebase to meet specific quality standards?

There is a lot of information about tools and techniques for improving legacy codebases, but I haven't come across any successful real world case studies. Most advice is on the micro level, and while helpful, doesn't convince many people because of a lack of evidence it can help at the macro level. I am looking specifically for incremental improvements that have been proven to be a success in the real world when updating a large legacy codebase to meet today's quality standards, and not a complete rewrite. Before:   * Large: greater than 1MLOC   * Legacy: no automated tests   * Poor quality: high complexity, high coupling, high escaped defects After   * Automated tests   * Easier updates/maintenance   * High quality: lowered complexity, decoupled code, few escaped defects What kind of incremental steps have been proven in the real world to update a large legacy codebase successfully to meet above quality standards, without going through a total rewrite? If possible, include an example company or case study of a large legacy project that has gone through a "successful" quality improvement process in your answer to back it up.


Loading dynamic css based on user

I want to provide different UI theme based on user who logged in. For that I have came up with following 2 options:   * create separate files for all themes duplicating all the common css. This way I can easily do some login in scripting and get the required css file. But I end up having same css classes code in many different theme files. This is real pain when you have to change something common to all files.   * make a common file and separate theme files containing only theme specific css. This way everytime I need to load 2 css files, one - common file by default and then load theme specific file to override default css classes. Please help me to choose better option. If there is other simple and easy way to do it then please do let me know.


How I identify true error?

I am writing a program to scrap some data from the web. The pages are sequential ( 1,2,3 ... ), but I have no idea when will it stops. I combine a prefix and a integer to make a link for the python urllib to parse on it. For example : 'http://some.domain.com/page' + '1' + '.htm'. So the request would fail if the link is invalid, however, there could be some other error such as network error, connection timed out which will resolve itself. I could retry a couple of times on these error. Aside from 'Page not found' error, there could be other error such as 'Internal Server Error' which was thrown when the server is down. There error won't fix themselves. I should probably move on or stop the program. Back to my program. Because I don't know when is the page index are going to end, so I set the end integer to 9999. The links may run out after some hundreds. I should identify this and send a 'break' to it. What will you do? Gather all the possible error and put them on the exception line and treat them differently? Now I just stop after 10 failures.


Decorators in Python

I am just learning python, and I am currently playing with Tornado framework. I see this class:               class AuthHandler(BaseHandler, tornado.auth.GoogleMixin):         @tornado.web.asynchronous         def get(self):             if self.get_argument("openid.mode", None):                 self.get_authenticated_user(self.async_callback(self._on_auth))                 return             self.authenticate_redirect()      I am having trouble grasping what the decorator does there (@tornado.web.asynchronous). Does it overwrite that function? You can see the full source at https://github.com/facebook/tornado/blob/master/demos/chat/chatdemo.py


scons and python unit tests best practices

I am using scons to build a large project containing a mix of C++ and Python. I would like scons to run Python unit tests either using nose or not. Currently, we have a long list of tests files and run a test builder on each one. This causes each test file to be run as a separate script which feel inelegant and inefficient. Is there a better way of doing this?


which are the best front end web developer blogs

Looking for recommendations on industry-expert blogs from front-end web developers (emphasising RIA applications; e.g. HTML5, Javascript, AJAX, JQuery, Ext JS). Trying to sort out the best from the rest. Which blogs are the well respected and worth following?


Is there a name for the Builder Pattern where the Builder is implemented via interfaces so certain parameters are required?

So we implemented the builder pattern for most of our domain to help in understandability of what actually being passed to a constructor, and for the normal advantages that a builder gives. The one twist was that we exposed the builder through interfaces so we could chain required functions and unrequired functions to make sure that the correct parameters were passed. I was curious if there was an existing pattern like this. Example below:               public class Foo     {        private int someThing;        private int someThing2;        private DateTime someThing3;             private Foo(Builder builder)        {            this.someThing = builder.someThing;            this.someThing2 = builder.someThing2;            this.someThing3 = builder.someThing3;        }             public static RequiredSomething getBuilder()        {            return new Builder();        }             public interface RequiredSomething { public RequiredDateTime withSomething (int value); }        public interface RequiredDateTime { public OptionalParamters withDateTime (DateTime value); }        public interface OptionalParamters {            public OptionalParamters withSeomthing2 (int value);            public Foo Build ();}             public static class Builder implements RequiredSomething, RequiredDateTime, OptionalParamters         {           private int someThing;           private int someThing2;           private DateTime someThing3;                public RequiredDateTime withSomething (int value) {someThing = value; return this;}           public OptionalParamters withDateTime (int value) {someThing = value; return this;}           public OptionalParamters withSeomthing2 (int value) {someThing = value; return this;}           public Foo build(){return new Foo(this);}        }     }      Example of how it's called:                  Foo foo = Foo.getBuilder().withSomething(1).withDateTime(DateTime.now()).build();        Foo foo2 = Foo.getBuilder().withSomething(1).withDateTime(DateTime.now()).withSomething2(3).build();


Genetic programming

I recently was browsing Reddit and came across a post linking to a "JavaScript genetic algorithm" example. I've really been fascinated with the concepts of genetic algorithms and programming, however even after some Googling I am still left slightly confused. Can someone please explain to me how it works? I suppose the vocabulary terms are confusing me more than anything else. I've never taken a computer science class but I do program on my spare time and enjoy it. I'm 16 years old so I would appreciate brief examples and perhaps explanations. Just the concept of genetic programming and how I could implement it into my projects and why. Thanks.


Assigning effective complexity ratings to tasks

I want to make excellent estimations about, how much effort is required for a particular task. The constraint is, that I have already solved the problem and written down steps required to solve it. Also I have the description of what kind of problems it solves, compiled example program, it's source code with comments, tests and test data, language abnormalities involved with particular solution and etc. And I have done this for set of languages X. My sub questions are:   * did I ask right sub questions?   * is this a Fermi problem (or paradox)?   * on what should I base my decision upon?   * what elements should it contain to be effective?   * what should a I know, before giving a rough estimation?   * what kind of argument scales should it use: linear, logarithmic, ...?    * how does estimation change, if definition of required feature changes?   * how do I evaluate it, is there some-kind of table like this IBM's (bogus) one ?   * how does estimation differ, if i'm asked to solve it in language {x, y}? Where x ⊇ X and y ∉ X. My question is: **What is the most efficient way, to rate task recreation difficulty?** ## About the question Although I have been learning the profession of software engineering for quite some time, only now I find myself going to work as one. In university I found, that 2 time managemanet techniques work really well:   * doing projects ASP - several weeks early also means virtually no competition at all, to be graded   * timesliceing - deciding how much continuous time I will spend on a task, before switching to a new one. If it's important, I'll just schedule a new time slice sooner, then I would.  Thy seem incompatible for this task or rather, it seems a complex problem to adapt them. ## Example: Irregular click event hot-spots Difficulty rating : ★ ★ ☆ | Time estimation : 1 work day ![enter image description here](http://i.stack.imgur.com/EhTHi.jpg) Example of required data creation process ![enter image description here](http://i.stack.imgur.com/okHb2.jpg)


How easy/difficult is it to start using something like Python/Django in an existing Java project?

I have a Java project which uses Java to access some 3rd party libraries. For other things I'd like to use something newer like Python maybe. Is it easy to incorporate into an existing project? How do people usually do that? Thanks, Alex


Where does a "Technical Programmer" fit in, and what does the title mean?

Was: "What is a 'Technical Programmer'"? I've noticed in job posting boards a few postings, all from European companies in the games industry, for a "Technical Programmer". The job description was similar, having to do with tools development, 3d graphics programming, etc. It seems to be somewhere between a Technical Artist who's more technical than artist or who can code, and a Technical Director but perhaps without the seniority/experience. Information elsewhere on the position is sparse. The title seems redundant and I haven't seen any American companies post jobs by that name, exactly. One example is this job posting on gamedev.net which isn't exactly thorough. In case the link dies: > **Subject** : Technical Programmer > > Frictional Games, the creators of Amnesia: The Dark Descent and the Penumbra > series, are looking for a talented programmer to join the company! > > You will be working for a small team with a big focus on finding new and > innovating solutions. We want you who are not afraid to explore uncharted > territory and constantly learn new things. Self-discipline and independence > are also important traits as all work will be done from home. > > Some the things you will work with include: > >   * 3D math, rendering, shaders and everything else related. >   * Console development (most likely Xbox 360). >   * Hardware implementations (support for motion controls, etc). > > > All coding is in C++, so great skills in that is imperative. _Revised Summarised Question_ : So, where does a programmer of this nature fit in to software development team? If I had these on my team, what tasks am I expecting them to complete? Can I ask one to build a new level editor, or optimize the rendering engine? It doesn't seem to be a "tools programmer" which focuses on producing artist tools, often in high-level languages like C#, Python, or Java. Nor does it seem to be working directly on the engine, nor a graphics programmer, as such. Yet, a strong C++ requirement, which was mirrored in other postings besides this one I quoted. **Edited To Add** As far as it being a low-level programmer, I had considered that but lacking from the posting was a requirement of Assembly. Instead, they tend to require familiarity with higher-level hardware APIs such as DirectX, or DirectInput. I wasn't fully clear in my original post. I think, however, that Mathew Foscarini has it right in his answer, so barring someone who definitely works with or as a "Technical Programmer" stepping in to provide a clearer explanation, I'll go with that. A generalist, which also fits the description of a more-technical-than-artist TA.


Which tools do you use to manage your todo list?

I would like to optimize the way I manage my todo list. My tasks are, for a large part, related to `C++` coding but also include readings, presentations, research... Lately I discovered the `@todo` command in doxygen, which is pretty cool for the coding part. I would like to keep a clear track of all my tasks in one big tool though. Any ideas ?


Began with iOS development, skipped CS, and getting hit hard at interviews?

I'll start with a brief background: my degree is in Recording Arts, so mainly audio engineering and stuff relating to the music industry, with some synthesis and stuff which was my link into coding (via an environment called PureData). I've been working for an iOS developer for the last three years handling audio stuff (mainly musical), and having minimal coding work to do (things like localization, etc.) I've written some basic iOS projects myself which are increasing in complexity slowly, and am pretty comfortable with with the basic concepts of iOS development (MVC, delegation, KVC, etc.) I've been attending interviews just to test the water to see where I'd fit in with some junior iOS developer jobs that could really challenge me and help me grow as a developer, and I'm being hit really hard by interviewers who expect me to have a CS degree and really in-depth knowledge of basic CS concepts. This may be a statement born out of frustration, but they don't seem to want to touch any potential employee who didn't get a Computer Science degree, or has a thorough knowledge of it. As examples, one that hit me hard in an interview yesterday was something theoretical about behaviours belonging to classes and being accessible to a non-inherited class.. I had no idea, really. I can go in and code classes with inheritance, but discussing them on an abstract level with a sheet of blank paper in front of me is very daunting. Another example was discussing "data structures" - as far as I'm aware those are just variable types, and arrays/dictionaries, etc., but the guy acted like I knew 5% of the story there and seemed surprised. I've since looked up these things and learned a little more, but I think this is a band-aid on the problem. It's pretty demoralising to feel like I'm progressing as a developer but also feel like I'm still nowhere towards a proper career as a software developer, and I realise this post may well be closed (though I genuinely do think this is the best place for it and hope others can offer advice), but I'm trying to establish exactly how I can learn those core CS concepts without needing to reiterate the basic coding constructs I'm already very familiar with. I've tried watching along with various iTunes U courses, some of the MIT stuff online, etc., and they all jump straight into Java in lesson 1, 2, or 3 and begin talking about if statements, variables, etc., then move up in complexity while remaining almost exclusively with the code itself. Perhaps I'm making too big of a distinction between programming and CS, but I'm in a boat where I'm boring easily of hearing what an "if" statement or a "for" loop does over and over, and want to understand the underlying concepts that the interviews I've dealt with all expect me to know like the back of my hand. I'm hoping some folks here will have some advice on patching up those CS- shaped holes in my knowledge so that I can properly begin my career as a software developer, rather than simply getting better and better with iOS development and leaving a gaping hole where my actual education should have been. **EDIT:** I want to try to make this into a more specific question which can be answered as opposed to discussed, as per the rules, so: **Is it possible to overcome a missing CS education by just pushing forward with programming and learning concepts as you come across them?**


PGAS Systems in the wild

Has anyone had any experiences with developing a Partitioned Global Address Space product or system, or an application that used PGAS, or anything PGAS- like? I'm looking for insights, warstories, and practical approaches with regards to languages used, wisdom learned, and ideas/applications either dreamed of or spun off from actual development.


How do distributed version-control systems deal with fragmentation?

Here is the scenario: X is the author of a software. X releases v1.0 on an open source license on Github and moves on. People interested in the software fork and improve the software. Now there are 15 different flavours of the software. Few also try to send a pull request back, however since X no longer works on the software, the pull request is just sitting idle on his project page. As a new user wanting to use the most active and stable release of the software, how does he learn which out of the 15 he should clone and use? He certainly would like to use the more active branch, since it may have more bug fixes and features upgrades. I see that the model works for bigger open-source projects, because the author of the software is usually well-known in the community. As a result, the user base inadvertently knows which branch to clone from. However, how does one solve a problem for a software, where the author, maintainer and several contributors all are practically unknown in the open-source community?


Interviewing Process (using blank paper etc)

> **Possible Duplicate:**   >  What are the pros and cons for the employer of code questions during an > interview? I am curious to know why do companies hand you a blank paper and ask you to write code? This confuses me, because these days intellisense, google, stackoverflow etc are common sources to look up syntax and / or IDE gives you a colored indicator if your syntax is wrong. I usually get stressed out during these situations. I am curious to know opinions of other developers. I am posting this on this forum, hoping to get helpful feedback from other experienced developers.


Does it make sense to develop open source python library for database inspection?

Some time ago I came up with an idea for a library for database inspection. I started developing it and got some very basic functionality, just to check if that's possible. Recently however, I get second thoughts, whether such project would really be useful. I am actually planning to develop following software suite:   * library for `python`, that would provide easy interface to inspect database structure,   * desktop application in `PyQt` that would use the interface to provide graphical database inspection,   * web application in `Django` that would use the interface to provide database inspection through the browser. Do you think such suite would be useful for other developers/database administrators/analysts? I know, that there is pgadmin for `PostgreSQL` and some tool for `sqlite3` and that there is `Java` tool called `DBInspect`. Usually I would be against creating new tool and rather join existing project, but I am not `Java` programmer (and I would rather stick to `python` or `C`, which I like) and none of these projects provide a library for database inspection. Anyway I would like to hear some opinions from fellow developers, whether such project make sense or I should try to spend my free time on developing something else.


How much information can a user reasonably process from a UI?

As an example, say there's an interface that contains a table/grid of information that is periodically updated. The table is meant to represent an event that has happened, perhaps the date and time of a stock price change . The acutal frequency of these events could be dozens of events per second. This is obviously too much information for a user to process/understand, so I'm trying to find out how much information a user COULD process in a given amount of time so that we can throttle the data and come up with an alternate display. I know some studies have been done on this, but I can't seem to find an authorative source.


Online Advertising And Marketing Your Services?

I have been working on freelance sites for a good 4 or 5 years, bending over backwards to build a decent portfolio and generate great ratings. I take huge pride in my work (web applications). I'm completely lost because when I think what would happen if I suddenly lost my freelance account it isn't a pretty picture. I have literally no idea where else I could advertise my services apart from google paid advertising. Any suggestions? I'd of course be more than willing to pay for marketing and such. I've been searching google for ages and can't find much advice on where to advertise to secure good clients for web development work. I say good clients because I mean actual business owners, not somebody else who is outsourcing to me (where do they find clients?). I'd appreciate any help.


In what visual format should I present an estimate for a software project?

What I mean is, do people print some kind of line item form? What data does it contain? What are the line items usually? Otherwise, do you just present a written document describing with a paragraph? Do you show the number of hours or just a lump sum? Perhaps you only show dollars per hour and an estimate of the hours. Do you give multiple estimates, a high and a low? Is there any best practice for making sure you don't screw yourself or your client? Just trying to get an idea of a few samples of what a client might want to hold in their hands or see on their LCD screen so they can authorize the work that is being presented and agree on the cost.


Architecture For Mockable DAL On Large Projects

I have recently been reading an article about creating a blog using ASP.NET and MVC, and in the article the user splits the Data Access Layer into a separate Class Library, and creates an interface for this to allow the DAL to be mocked for testing. This works great for small projects, but I am struggling to see how this will scale. For example in the article you end up with the following Interface:               public interface IBlogRepository     {         IList<Objects.Post> Posts(int pageNo, int pageSize);         int TotalPosts(bool checkIsPublished = true);              IList<Objects.Post> PostsForCategory(string categorySlug, int pageNo, int pageSize);         int TotalPostsForCategory(string categorySlug);         Objects.Category Category(string categorySlug);              IList<Objects.Post> PostsForTag(string tagSlug, int pageNo, int pageSize);         int TotalPostsForTag(string tagSlug);         Objects.Tag Tag(string tagSlug);              IList<Objects.Post> PostsForSearch(string search, int pageNo, int pageSize);         int TotalPostsForSearch(string search);              Objects.Post Post(int year, int month, string titleSlug);              IList<Objects.Category> Categories();         IList<Objects.Tag> Tags();              IList<Objects.Post> Posts(int pageNo, int pageSize, string sortColumn, bool sortByAscending);              void AddPost(Objects.Post post);     }      There is then an associated .cs file with the implementation of this interface. How would you implement a similar architecture for a much larger project? For example the project I have at work consists of 25 controllers, each having as a minimum list, add, edit, view, delete and count. That would lead to an interface with 150+ functions. Is this kind of architecture still suitable for larger projects, and if so how would you structure this to avoid having a single file implementing 150+ functions?


Is there any hope for writing good code atop a horribly designed database?

Here's my predicament. One of several programs I've recently inherited is built with a horrible database on the backend. The esteemed creators of it apparently did not appreciate relational concepts. A table for each and every client, named as a unique client ID. Eighty-three cryptically named fields. The code is all procedural with dozens of concatenated inline SQL statements. As we weren't provided with an important ancillary application that runs off the same database, I've been tasked with recreating it from scratch. I'm a sole developer, which isn't even my primary responsibility as at least half of my time is taken up by operations stuff. There's an unavoidable deadline set for 30 days from now. Despite my inexperience, I'm certain I could have designed this database and existing application much better than they were, but I don't really think it's realistic for me to alter the database, adjust the existing application, and be sure I didn't break anything while needing to create the additional application this quickly. So let's assume I am stuck with the terrible database. Needing to work with such a bad structure, would anything I write that conforms to it just add to the heaping pile of technical debt to be shelved away until something completely breaks or new functionality is needed? How could I approach this situation and get something good out of it besides a hopefully functional application? edit: In case anyone's interested, we ended up scrapping this horrible database and the application that ran on it. We outsourced the creation of the ancillary application (I wasn't involved in setting this up) to ultimately two different contractors who both ended up falling through on us, accomplishing nothing. I ended up having to rush out a horrific, partially functional hack of a fix in three days that's still in use today.


Starting a job in the financial sector, advice needed

Starting a job in the financial sector in the next couple of weeks. I have never done financial programming (EG Loans, mortgages, etc). Just to get acquainted and familiar with this kind of thing, are there any open-source application libraries in C# that I could look at and get a feel for? Any suggestions?


Is there a time bomb in sequential process id allocation when the `unsigned` wraps?

I'm designing and implementing a multiprocessing postscript interpreter ("lightweight" processes simulated by a single OS-thread), and I need to generate a unique identifier for each process in the system, as well as maintain ids for any dead processes which still have live references. (Reference: Adobe PLRM, 2ed, Ch. 7 Display PostScript, http://partners.adobe.com/public/developer/en/ps/psrefman.pdf) I've started with a simple increment, which arithmetically maps to the table index for the per-process data. http://code.google.com/p/xpost/source/browse/itp.c#115               unsigned nextid = 0;  // global (file-static) counter          unsigned initctxid(void) {  // generate a new cid         while ( ctxcid(++nextid)->state != 0 )  // .state == 0 means free             ;         return nextid;      }          context *ctxcid(unsigned cid) {  // get context data from cid         return &itpdata.ctab[ (cid-1) % MAXCONTEXT ];     }      But there's gonna be a big problem if (when) the unsigned wraps around. Perhaps not scary for a game or an application, but this thing is supposed to be a server. Eventually. I'd like to avoid writing (in earnest) the disclaimer, "warning: will start having strange problems after running for a long time". So, it should be easy enough to detect when it wraps, but what then? Bail out? So the situation/scenario so far is: you're a multitasking postscript server with a handful of processes with cids allocated during one _epoch_ of the generator, and the epoch has just turned. My thought (not impossible, just seems really hard) is to _compact_ these existing IDs down to the _0..N_ range (rewriting all references, scanning all memory if necessary) and reset `nextid` to N. But that's gonna be a pain-in-the-butt. Is there a different way to generate these IDs so I don't have to do a big garbage-collect on them, and have it work, you know, _perpetually_? Edit: A fact I neglected to mention was that the Display PostScript reference says IDs are not re-used during a running instance of the system. But since these IDs are not exposed, they cannot be saved in any form other than the context object. So re-use should be just fine as long as no running process can know about it (contains an old context object in accessible memory).


Design suggestion required to create an Export plugin

I am trying to create Export Module for our application, this seems to me a bit complex so I am posting it here to get some guide lines. In our database we have a list of Products, which can be exported as XML, RTF or PDF The user can select one or many products from the list to export. After Selecting the product(s) he/she is presented with list of Export type(XML, RTF, PDF) and a list of Connections( where to send this export files) like FTP, HTTP, EMail etc whose details are already configured. And this export is used for many different users, who have different needs. For example User1 need only Description, User2 needs Description+Thumbnail etc. Should I create for Export type(XML, RTF, PDF) a Manager class? and For Connections also a Manager class? And for Different users should I create an Interface?


Why is there no 'finally' construct in C++?

Exception handling in C++ is limited to try/throw/catch. Unlike Object Pascal, Java, C# and Python, even in C++ 11, the `finally` construct has not been implemented. I have seen an awful lot of C++ literature discussing "exception safe code". Lippman writes that exception safe code is an important but advanced, difficult topic, beyond the scope of his Primer - which seems to imply that safe code is not fundamental to C++! Herb Sutter devotes 10 chapters to the topic in his Exceptional C++ ! Yet it seems to me that many of the problems encountered when attempting to write "exception safe code" could be quite well solved if the `finally` construct was implemented, allowing the programmer to ensure that even in the event of an exception, the program can be restored to a safe, stable, leak- free state, close to the point of allocation of resources and potentially problematic code. As a very experienced Delphi and C# programmer I use try.. finally blocks quite extensively in my code, as do most programmers in these languages. Considering all the 'bells and whistles' implemented in C++ 11, I was astonished to find that 'finally' was still not there. So, why has the `finally` construct never been implemented in C++? It's really not a very difficult or advanced concept to grasp and goes a long ways towards helping the programmer to write 'exception safe code'.


Is relying on implicit argument conversion considered dangerous?

C++ has a feature (I cannot figure out the proper name of it), that automatically calls matching constructors of parameter types if the argument types are not the expected ones. A very basic example of this is calling a function that expects a `std::string` with a `const char*` argument. The compiler will automatically generate code to invoke the appropriate `std::string` constructor. I'm wondering, is it as bad for readability as I think it is? Here's an example:               class Texture {     public:         Texture(const std::string& imageFile);     };          class Renderer {     public:         void Draw(const Texture& texture);     };          Renderer renderer;     std::string path = "foo.png";     renderer.Draw(path);      Is that just fine? Or does it go too far? If I shouldn't do it, can I somehow make Clang or GCC warn about it?


I hope this question gives some interesting answers because it's one that's bugged me for a while. **Is there any real value in unit testing a controller in ASP.NET MVC?** What I mean by that is, most of the time, (and I'm no genius), my controller methods are, even at their most complex something like this:               public ActionResult Create(MyModel model)     {         // start error list         var errors = new List<string>();              // check model state based on data annotations         if(ModelState.IsValid)         {             // call a service method             if(this._myService.CreateNew(model, Request.UserHostAddress, ref errors))             {                 // all is well, data is saved,                  // so tell the user they are brilliant                 return View("_Success");             }         }              // add errors to model state         errors.ForEach(e => ModelState.AddModelError("", e));              // return view         return View(model);     }      Most of the heavy-lifting is done by either the MVC pipeline or my service library. So maybe questions to ask might be:   * what would be the value of unit testing this method?   * would it not break on `Request.UserHostAddress` and `ModelState` with a NullReferenceException? Should I try to mock these?   * if I refractor this method into a re-useable "helper" (which I probably should, considering how many times I do it!), would testing that even be worthwhile when all I'm really testing is mostly the "pipeline" which, presumably, has been tested to within an inch of it's life by Microsoft? I think my point **really** is, doing the following seems utterly pointless and wrong               [TestMethod]     public void Test_Home_Index()     {         var controller = new HomeController();         var expected = "Index";         var actual = ((ViewResult)controller.Index()).ViewName;         Assert.AreEqual(expected, actual);     }      Obviously I'm being obtuse with this exaggeratedly pointless example, but does anybody have any wisdom to add here? Looking forward to it... Thanks.


Can I set the IMEI of a blustacks virtual device?

Using an app "Get My IMEI" I was able to retrieve an invalid IMEI for my bluestack emulator however I can't see how I can change it. The guys at XDA developers forum are talking about it, but it's an old post so I wanted to know if it is possible now? I am building an app that uses IMEI validation and bluestack is the device I use for development on Eclipse. It's way faster than the normal method and I don't need to keep track of the apk version installed or clean it like I would do if I used my physical device. If the device IMEI is already stored in the database I have no problem. The problem is when I have to register the device to the service (front-end) I need a valid IMEI. I know the IMEI can be spoofed like the mac address or the ip but it's just some extra security feature that is added. * * * _I asked the same questionat Stack Overflow but the guys didn't think it had anything to do with programming. So I added the context of what I am trying to do so at this point I don't even know if the question was rejected because I mentioned XDA._


What does Uncle Bob mean by 'noun phrase names'?

I am reading _Clean Code_ by Uncle Bob. Because I am not a native-English speaker, I couldn't understand following statement: > Classes and objects should have noun or noun phrase names like `Customer`, > `WikiPage`, `Account`, and `AddressParser`. Avoid words like `Manager`, > `Processor`, `Data`, or `Info` in the name of a class. A class name should > not be a verb. As I know, none of the `Manager`, `Processor`, `Data`, and `Info` is a verb, isn't it? What is the actual point he want to emphasize?


The difference between "concurrent" and "parallel" execution?

What is the difference between the terms _concurrent_ and _parallel_ execution? I've never quite been able to grasp the distinction. The tag defines concurrency as a manner of running two processes simultaneously, but I thought parallelism was exactly the same thing, i.e.: separate threads or processes which can potentially be run on separate processors. Also, if we consider something like asynchronous I/O, are we dealing with concurrency or parallelism?


Does Java have a built in method to determine if an identifier is legal

Naming a variable or class, for example, must adhere to certain rules (such as not allowing keywords or reserved words as identifiers) I really don't want to code my own method to do such a thing. Does java have something already built in? My goal is that I am building an expression builder / code generator. It will recognize user specified variables and these must respect java's identifier rules or a warning is presented to user to rename his variable.


Mobile application development- suggestions for chosing the platform

I am planning to build a mobile application (a text editor based app) to primarily use with my symbian device. I have plans to make it commercial too, once its complete. Now the manufacturer (NOKIA) website lists some choices for mobile app development - java, native platform for symbian (using c) and QT. I am aware about the aspects of scaling and extending the app for other platforms. Android is increasing in it's market share like anything, symbian is losing too. Also if i need to get the platform specific functionalities (say reading the contact list or sending an sms) i should be compromising the portability. I was not able to find any comparisons between these portability and platform specific features aspects. If i chose java, i think i could easily port my application for android/iphone and make it commercial. I have no idea how portable the QT platform can be. I do not want to go by Nokia's suggestions since i doubt they are biased to their products(even if they provide excellent developer support) I have to start learning from the beginning, irrespective of whichever platform i chose (except languages) Please advice me if i have assumed something wrong, and your opinion about portability versus platform features. Thanks,   Abhi


First Class Functions

I started seriously taking a look at Lisp this weekend (by which I mean I have only been learning Lisp and not reverting back to projects in C#) and must say I love it. I have dabbled with other functional languages (F#, Haskell, Erlang) but haven't felt the draw that Lisp has given me. Now as I continue to learn Lisp, I have started wondering why non-functional languages don't support first-class functions. I know that languages such as C# can do similar things with delegates and to an extent you can use pointers to functions in C/C++ but is there a reason why this would never become a feature in those languages? Is there a drawback to making functions first- class? To me, it is extremely useful, so I am lost as to why more languages (outside the functional paradigm) don't implement it. [Edit]I appreciate the responses so far. Since I have been shown that many languages now support first-class functions now, I'll re-phrase the question to be why would it take so long for languages to implement them? [/Edit]


What's the better user experience: Waiting once at startup for a long time or waiting frequently for a short time?

I'm currently design an application that involves a lot of calculation. Now I have generally two possibilities which I have both tested: 1) During startup of the application I calculated only the most important values and these values that consume a lot of time. So the user has to wait approximately 15 seconds during startup. But on the other hand a lot of user interactions require recalculation so that the user often has to wait 2-3 seconds after clicking somewhere until the application has calculated and loaded all values 2) I load everything during startup. This takes from 90 to 120 seconds... This is quite a long time, but the big advantage is that all the user interactions are executed immediately. So what would you generally consider the better approach? Loading all time- consuming operations during startup or when needed?


What is the difference between "good" designers and "great" designers?

While reading this wikipedia article, Brookes has told that there is a difference between "good" designers and "great" designers. What is the difference between them? How can I decide if a designer is good or great?


.net data access technology

Iam new with .Net technology and i need a help with choosing correct path of creating application. I want to create application that get its data from web- service and small part from local SQLCE database. Mainly I have problems with database access and making database access clean in code. What .Net technology should i choose to accomplish that in good way with clean and easy to maintained code.


What language and topics should be covered when teaching non-CS college students how to program?

I have been asked by many of my non-computer science friends to teach them how to program. I have agreed to hold a seminar for them that will last for approximately 1 to 2 hours. My thoughts are to use Python as the language to teach them basic programming skills. I figured Python is relatively easier to learn from what I have researched. It is also a language I want to learn which will make holding this seminar all the more enjoyable. The topics I plan to cover are as followed:   1. Variables / Arrays   2. Logic - If else statements, switch case, nested statements   3. Loops - for, while, do-while and nested loops   4. Functions - pass by value, pass by reference (is this the correct terms for Python? I am mostly a C/C++ person)   5. Object Oriented Programming Of course, I plan to have code examples for all topics and I will try to have each example flow into each other so that at the end of the seminar everyone will have a complete working program. I suppose my question is, if you were given 1 to 2 hours to teach a group of college students how to program, what language would you choose and what topics would you cover? Update: Thank you for the great feedback. I should have mentioned in my earlier post above that a majority of the students attending the seminar have some form of programming experience whether it was with Java or using Matlab. Most of these students are 3rd/4th year Engineering students who want to get a refresher on programming before they graduate.


Does agile approach support taking a task from a team?

Can customer take one of tasks during the planning meeting, which was already assigned to this team, and put it to another team? For example because a customer think that the other team will be faster in implementing it? Is it normal for some agile methodologies? If yes, could you, please, provide me with the source of this information(book or web link), because I do not know how to handle it, especially because of team spirit: such a thing can make people in team demotivated and also there can origin some tenses in between these two teams... It is part of some agile methodology and what are the constraints to make this thing?


Backtrack My "Education"

A while ago, I decided to start programming. I really, just jumped into a language (Perl) and went from there. What I regret is that I just jumped in: I didn't learn the basics (if you would call them basics). I didn't learn about Computer Science. This issue, I believe, is holding me back from my true potential. Where should I "restart"? Are there any books, articles, etc. that I should read? Are there any topics an experienced programmer should know? What's your advice?


How do I prepare for an 'aptitude for programming' test?

I have a job interview tomorrow and it's for a junior web developer role. I am really excited about it because I really want to get my foot in the door in this industry. I have been told how the interview will pan out. It will consist of a 45 minute interview with two of their developers and an 'aptitude for programming' test. I am really worried about the 'aptitude for programming' test. Questions I am hoping the stack community can help me out with is:   1. What exactly is this? (as far as I understand it is a written test using a fictional programming language).   2. If you have done this before, either as the interviewer or interviewee, can you give me any advice, hints or help?   3. Are there any online sources that may help with this, i.e. blogs, websites, places I can practice a few online?


Empty superclass for Collection of derived classes

Basically, what I would like to obtain is a way to iterate through ONE list, and call methods specific to the interface the objects in the collection implement. In my Java project, it would result in something like this:               //GameComponent would be my empty abstract class       HashSet<GameComponent> components = new HashSet<GameComponent>();      components.add(/* instance of a class that extends GameComponent and implements Drawable || Updatable */);            for (Drawable d : components)         d.draw();          for (Updatable u : components)         u.update();      My friends suggested me to just make two separate lists, but that means some objects will be in both lists.   I also think that it makes sense (abstraction-wise) to have one list of GameComponents and iterate through that one list.   But I also don't like having an empty class to inherit from, only for categorisation. So, the question is: does my approach make sense? If so, is it elegant? If not, what pattern could I follow?


How does one securely and privately address security concerns inside code

I recently finished a practicum for which I desperately need a recommendation from. However when I was working on the code for the public face web-portal I noticed many sql injection possibilities and as well as other things. What bothers me is the complete ignorance of the indevidual managing the code. He wrote much of the code and is completely unaware of what SQL is supposed to be used for. In that manner he also doesn't know how to properly protect against SQL injection and the like. While I was working for the individual I tried to push him in the right direction of looking and seeing how broken the system was. But I really need a good recomendation for a job and didn't wish to upset him. The office is also a very close-knit office and there was no-one I felt would understand the severe need for code review. Why I feel that this issue must be addressed is because they system was for a School district to manage student records very personal student records. We (the developers including another student) had access to a clone of the live database for testing purposes and there my little brother is set to enroll in that school district next year. The lead developer is somewhat good at programming but with the lack of understanding regarding SQL and relation databases the system will be exploited and most likely within the next year as it's being rolled out district wide. I really feel I should have said something to someone. :( Besides phoning up the supervisor and asking him to do something what can I legally do. Can I phone the RCMP (I'm Canadian) and ask them to investigate (I know that's dumb but this is verging on criminal negligence).


Should I get a service-oriented architecture certification?

In my place of work, we have a number of applications that seem to interact in a rather ad-hoc, haphazard way, and I feel I need to understand system integration better. I'm currently deciding whether to do an SOA School Profesional Certification. The certifications are well recognised, but from what I've read of them, I'm a bit concerned that even after I've passed the exams, I won't really be in a position to implement what I've learned, or that the information won't be hugely useful in my day to day job as a developer. It all seems a bit too theoretical. Will it be any practical use to me? Also, I've heard the 150 page booklet that costs $300 is not enough to prepare you for the exam. Is this correct? **Edit** Really, what this comes down to is whether SOA is really going to be the answer to my integration problems. At the moment, it seems to be the de facto answer.


Is it possible for two DLLs to conflict , preventing solution to build

Though I have a specific case, but I was wondering about the general situation. Can two DLLs, when added as Reference to a Visual C# project collide with each other to prevent the solution from building? If this is the case, what are the possible ways to mitigate this.


What are some high quality Enterprise Architecture conferences or training programs?

I am looking for a conference or training which will give me a broad exposure to enterprise level software architecture. I've been with the same company for 10 years and we've grown to the size where we really need to lay out a framework for the applications which support our company's business. The organic growth over the last 10 years has left us with a tightly coupled and fairly messy set of applications. We need to do a better job at componentizing our business entities and have more rigorous control on the interfaces between those entities and our business processes. I'm looking to get a broad, yet practical exposure on design patterns to support that architecture (SOA, messaging, ESB's etc). I'm hoping to gain insight from folks who have direct experience with implementing or working with what would be considered an enterprise class architecture.


How do you get into the zone? How long does it take? What steps do you take before?

Getting into zone is a pleasurable and fruitful process. We produce good source code and we get lots of satisfaction from our work done while being in the zone. But, how does one get into the 'zone'? Do you follow a specific process? Apart from switching of email system, mobiles and other mundane non- productive applications, is there anything else that can be done?