Learning Java in a couple of days and preparing interview presentation

I know its not possible to 'know' or 'learn' Java fully in a couple of days but I really need some help on this guys. I have just graduated from university with a degree in computer science. The languages I would say I am 'proficient' at are: HTML/CSS/PHP. I have a job interview on friday and I have to prepare a presentation and have 3 technical test. Its a junior web developer role and forgive my naivety but I didn't realise Java was a factor in web development as I have only done HTML/CSS and PHP at university. **Presentation details:**   Duration 10 minutes.   Project: Talk about a project you have been involved with that you are proud of   \- What was your role in the project?   \- What technologies did you use?   \- Did anything go wrong in the project and how did you solve it?      Does any one have any hints, tips anything they can draw on from experience to help me out? **Technical test details:**   \- 20 mins   Part 1: HTML/CSS   Part 2: SQL   Part 3: Java   Number 1 (HTML/CSS) I am fine on.   Number 2 (SQL) I can relate to my knowledge in MySQL, hopefully ill be alright.   Number 3 (Java) BIG WORRY. I have no experience with Java and have never worked with it before. Should I tell them in advanced I have never worked with it before and that my strength is PHP which hopefully can be applied in the job and I will pick it up fairly quickly, or do it simply learn as much as I can in a couple of days and do my best. Thanks for any help guys


do I need French export compliance approval to submit an iOS app that uses encryption?

My company just (5th July 2011) received the following email from Apple: > Starting in the first week of July, apps that meet the following criteria > are required to comply with French Encryption Laws/Regulations if you intend > to distribute your app in France. > > This requirement applies to apps that use, access, implement, or > incorporate: > > (a) any encryption algorithm that is yet to be standardized by international > standard bodies such as IEEE, IETF, ISO, ITU, ETSI, 3GPP, TIA, etc. or not > otherwise published; or > > (b) standard (e.g., AES, DES, 3DES, RSA) encryption algorithm(s) instead of > or in addition to accessing or using the encryption in iOS and/or Mac OS X > > Apple will require you to upload a copy of your approved French declaration > when you submit your app to the App Store. > > Relevant French encryption regulations can be found at: > > > http://www.legifrance.gouv.fr/affichTexte.do?cidTexte=LEGITEXT000005789847&dateTexte=#LEGIARTI000006421577 > > http://www.ssi.gouv.fr/archive/fr/reglementation/regl_crypto.html > > http://www.ssi.gouv.fr/site_article195.html > > http://www.ssi.gouv.fr/site_article197.html > > Regards, > > Apple Export Compliance I've had a hunt around the web, developer forums, etc, and cannot find one single English description of exactly what this means. In my case (like many other people) I'm only using the standard encryption components provided in iOS - ie. https/SSL, AES, etc, I can't figure out if I need to do anything or not (beyond the USA encryption ERN that I've already completed). I'm worried it is going to delay submitting my next build though. Does anyone have any further information/links (or speak French)?


Solving programming problems or contributing code?

What are the best skills to develop for a college graduate?? Should one spend hours/days trying to solve problems on codechef or topcoder or contribute code to open source organizations? My personal experience says solving problems teaches you how to make optimal code and learn new programming techniques (which someone else has researched and made available) to solve problems, whereas contributing to open source teaches you how to organize code (so others can work on it), use coding conventions and make "real" use of what you have learnt so far, blah blah!! Also another thing to note is that many companies are hiring today based on one's problem solving skills (Is this something I should worry about?) P.S. I have done little of online problem solving and little of code contribution (via GSoC), but left confused what I should continue doing (as doing both simultaneously isn't easy). I am in final year of my CS degree and I want to make myself good enough before I get employed.


Is it a common practice to minimize JavaScript usage when building a website?

I've been a web developer for almost 10 years and I've gotten into the habit of trying not to use JavaScript whenever possible. I'm not talking about building web apps here, but database driven websites. Is this a good/respected approach?


Using template questions in a technical interview

I've recently been in an argument with a colleague about technical questions in interviews. As a graduate, I went round lots of companies and noticed they used the same questions. An example is "Can you write a function that determines if a number is prime or not?", 4 years later, I find that particular question is quite common even for a junior developer. I might not be looking at this the correct way, but shouldn't software houses be intelligent enough to think up their own interview questions? I've been to about 16 interviews as a graduate and the same questions came up in about 75% of them. This leads me to believe that many companies are lazy and simply Google: 'Template questions for interviewing software developers' and I feel there are doing themselves a disservice in taking this approach. **Question:** Is it better to use a set of questions off some template or should software houses strive to be more original and come up with their own interview material? From my point of view, if I failed an interview and went off and looked for good answers to the questions I messed up on, I could fly through the next interview if the questions are the same.


Should a project start with the client or the server?

Pretty simple question with a complex answer. **Should a project start with the client or the server, and why?** Where should a single programmer start a client/server project? What are the best practices and what are the reasons behind them? If you can't think of any, what reasons do you use to justify why you would choose to start one before the other? Personally, I'm asking this question because I'm finishing up specs for a project I will be doing for myself on the side for fun. But now that I'm finishing this phase, I'm wondering "ok, now where do I begin?" Since I've never done a project like this by myself, I'm not sure where I should start. In this project, my server will be doing all the heavy lifting and the client will just be sending updates, getting information from the server, and displaying it. But, I don't want that to sway the answer as I'm looking for more of an in depth and less specific answer that would apply to any project I begin in the future.


Which Scala open source projects should I study to learn best coding practices

What open source projects would you recommend for people to study to learn how the pros write Scala? Some of the attributes that I'm looking for - though they don't all have to be present in every exemplary project:   * Idiomatic use of the language and libraries   * Functional programming techniques   * Concurrency (using Actors or other methods)   * Large scale system with many modules   * Readability   * Java interop   * etc.


Throwing and catching exceptions in the same function/method

I've written a function that asks a user for input until user enters a positive integer (a natural number). Somebody said I shouldn't throw and catch exceptions in my function and should let the caller of my function handle them. I wonder what other developers think about this. I'm also probably misusing exceptions in the function. Here's the code in Java:               private static int sideInput()     {         int side = 0;         String input;         Scanner scanner = new Scanner(System.in);              do {             System.out.print("Side length: ");             input = scanner.nextLine();             try {                 side = Integer.parseInt(input);                 if (side <= 0) {                     // probably a misuse of exceptions                     throw new NumberFormatException();                 }             }             catch (NumberFormatException numFormExc) {                 System.out.println("Invalid input. Enter a natural number.");             }         } while (side <= 0);              return side;     }      I'm interested in two things:   1. Should I let the caller worry about exceptions? The point of the function is that it nags the user until the user enters a natural number. Is the point of the function bad? I'm not talking about UI (user not being able to get out of the loop without proper input), but about looped input with exceptions handled.   2. Would you say the throw statement (in this case) is a misuse of exceptions? I could easily create a flag for checking validity of the number and output the warning message based on that flag. But that would add more lines to the code and I think it's perfectly readable as it is. The thing is I often write a separate input function. If user has to input a number multiple times, I create a separate function for input that handles all formatting exceptions and limitations.


Is it possible to implement a completely-stateless multiplayer game?

I'm facing a challenge understanding how to program a web version of a card game that is completely stateless. I create my object graph when the game begins and distribute cards to PlayerA and PlayerB so I lay them out on the screen. At this point I could assume that HTML and the querystring is what holds at least _some_ of my state and just keep a snapshot copy of the game state on the server-side for the sole purpose of validating the inputs I receive from the web clients. Still it appears to me that the state of the game _is by its nature_ mutable: cards are being dealt from the deck, etc. Am I just not getting it? Or should I just strive to minimize the side-effects of my functions to the objects that I take as my input? How would you design a stateless card game?


Why would you ever use Lisp?

> **Possible Duplicate:**   >  Why is Lisp useful? Lisp has always stricken me as a very peculiar language... interesting in concept, but it just doesn't seem intuitive as, for instance, Java or C or C++. Why do a lot of people actually use Lisp then?


What is the relationship between an application server, a TCP/UDP client/server library, and a socket?

Up until now, the only networking concept I have ever implemented are basic sockets that are part of the java.net API. I am now trying to learn some higher-level API's/frameworks in java, and I am having trouble differentiating between TCP/UDP client/server libraries such as Apache MINA or kryonet and application servers such as Tomcat or JBoss. Furthermore, I would appreciate it if I could know the relationship between java.net.Socket and application servers and client/server libraries. My hypothesis is that Application Servers use websockets, which are similar to sockets but are limited by something related to the HTTP protocol. Moreover, I get the feeling that TCP/UDP client/server libraries are just higher-level abstractions of the basic sockets. Is this correct?


Is using Javascript/JQuery for layout and style bad practice?

Many, but not all, HTML layout problems can be solved with CSS alone. For those that can't, JQuery (on document load) has become very popular.* As a result of its ease, many developers are quick to use JQuery or Javascript for layout and style -- even without understanding whether or not the problem can be solved with CSS alone. This is illustrated by responses to questions like this one. **Is this bad practice? What are the arguments for/against? Should someone who sees this in practice attempt to persuade those developers otherwise?** **If so, what are the best responses to arguments in favor of JQuery saying it's "so easy"?** * * * * Example: Layouts that wish to use vertical layout flow of some kind often run into dead ends with CSS alone -- this would include layouts similar to Pinterest, though I'm not sure that's actually impossible with CSS.


Differences between software testing processes and techniques?

I get confused between these terms. For example, should unit testing be listed as a software testing process or technique? I think unit testing is a software testing technique. And how about Test driven development? Can you give me some examples for software testing processes and techniques? In my opinion, software testing process is a part of the software development life cycle. For example, if we use V-Model, the software testing process will be System test, Acceptance test, Integration Test.


Nervous about the "real" world

I am currently majoring in Computer Science and minoring in mathematics (the minor is embedded in the major). The program has a strong C++ curriculum. We have done some UNIX and assembly language (not fun) and there is C and Java on the way in future classes that I must take. The program I am in did not use the STL, but rather a STL-ish design that was created from the ground up for the program. From what I have read on, the STL and what I have taken are very similar but what I used seemed more user friendly. Some of the programs that I had to write in C++ for assignments include:   * a password server that utilized hashing of the passwords for security purposes,   * a router simulator that used a hash table and maps,   * a maze solver that used depth first search,   * a tree traveler program that traversed a tree using levelorder, postorder, inorder, selection sort, insertion sort, bit sort, radix sort, merge sort, heap sort, quick sort, topological sort, stacks, queues, priority queues,   * and my least favorite, red-black trees. All of this was done in three semesters which was just enough time to code them up and turn them in. That being said, if I was told to use a stack to convert an equation to infix notation or something, I would be lost for a few hours. My main concern in writing this is when I graduate and land an interview, what are some of the questions posed to assess my skills? What are some of the most important areas of computer science that are prevalent in the field? I am currently trying to get some ideas of programs I can write in C++ that interest and challenge me to keep learning the language. A sodoku solver came to mind but am lost as to where to start. I apologize for the rant, but I'm just a wee bit nervous about the future. Any tips are appreciated.


Reason for a reflection error

I’m working on an Eclipse plug-in project. Using this plug-in, users can create Eclipse Java projects with some specificities. For example, they can add Java classes’ names which will be saved in a file. These Java classes can be created on the src of the project or used from a jar file which must be added to the project classpath. In this case, the plug-in will use reflection to get some data from each class. There are two different test cases that give the same error because the plug- in can't find the class to instantiate:   * A jar contain a class having a name saved in the file is not added to the project classpath. So in this case the classpath is incomplete.   * The user of the plug-in updated a jar in which its old version of the jar contained the named class, but the new version of jar does not (which could happen if class was deleted from the new version of the jar). In this case, the plug-in will not find the class but the classpath is complete. So The plug-in must differentiate between the two test cases when it fails finding the class name using reflection. How that can be done?


Storage of value types and reference types in .net

In .net, the **value types** are stored on **stack** where as **reference types** are stored on **managed heap**. What is the reason for this one? Is it not possible to exchange their storage locations?


Does using a PHP framework count as experience using PHP to a company that doesn't use that framework?

I've started working at a company that uses the Yii PHP framework. I'm mostly using Yii but also some frontend stuff like jQuery and Ajax. What I'm worried about is limiting my skill set to a framework that isn't very popular. I mean, if the company I worked for was using Ruby on Rails or even Django, I wouldn't have this feeling of concern for the future. My first question is then, in regards to being able to find a job in the future somewhere else, is my feeling of concern warranted? Secondly, I see a lot of PHP jobs out there but do you think experience using a PHP framework counts as valuable experience to a company that doesn't use that particular framework or any framework at all?


Thick models Vs. Business Logic, Where do you draw the distinction?

Today I got into a heated debate with another developer at my organization about where and how to add methods to database mapped classes. We use `sqlalchemy`, and a major part of the existing code base in our database models is little more than a bag of mapped properties with a class name, a nearly mechanical translation from database tables to python objects. In the argument, my position was that that the primary value of using an ORM was that you can attach low level behaviors and algorithms to the mapped classes. Models are classes first, and secondarily persistent (they could be persistent using xml in a filesystem, you don't need to care). His view was that any behavior at all is "business logic", and necessarily belongs anywhere but in the persistent model, which are to be used for database persistence only. I certainly do think that there is a distinction between what _is_ business logic, and should be separated, since it has some isolation from the lower level of how that gets implemented, and domain logic, which I believe is the abstraction provided by the model classes argued about in the previous paragraph, but I'm having a hard time putting my finger on what that is. I have a better sense of what might be the API (which, in our case, is HTTP "ReSTful"), in that users invoke the API with what they want to _do_ , distinct from what they are allowed to do, and how it gets done. * * * tl;dr: What kinds of things can or should go in a method in a mapped class when using an ORM, and what should be left out, to live in another layer of abstraction?


How Can I Know Whether I Am a Good Programmer?

Like most people, I think of myself as being a bit above average in my field. I get paid well, I've gotten promotions, and I've never had a real problem getting good references or getting a job. But I've been around enough to notice that many of the worst programmers I've worked with thought they were some of the best. Bad programmers who are surrounded by other bad programmers seem to be the most self-deluded. I'm certainly not perfect. I do make mistakes. I do miss deadlines. But I think I make about the same number of bonehead moves that "other good programmers" do. The problem is that I define "other good programmers" to mean "people who are like me." So, I wonder, is there any way a programmer can make some sort of reasonable self-evaluation? How do we know whether we are good or bad at our jobs? Or, if terms like _good_ and _bad_ are too ill-defined, how can programmers honestly identify their own strengths and weaknesses, so that they can take advantage of the former and work to improve the latter?


How do you measure yourself as a programmer?

> **Possible Duplicate:**   >  How Can I Know Whether I Am a Good Programmer?   >  How to rate myself as a programmer I am self-learning Python. Everything is going well so far, but how do I measure myself? I mean, how can I say "I'm a beginner" or "I'm intermediate"? Is there some sort of guideline against which I can measure myself, something I have to learn before I am qualified enough?


How to rate your understanding of a programming language?

**Background:** (may skip): I am currently in my second year at university studying Computer Science and applying for placement positions for a year of work. One application I have run into is asking me to rate my knowledge of the programming languages I know. quote : " _rate your understanding and knowledge on a scale of 1 to 10 with 10 being the highest (eg. JAVA=8, C++=6, etc)._ " Now I feel like I am quite familiar with the languages I know but it is possible I may be over or under estimating my ability in them as I am ultimately still learning. **The Question:** is there a way or systematic approach I can use to give my understanding of a programming language a rating?


Where do my programming skills stand in relation to other programmers

I am a student currently studying an undergraduate CS course at a crappy university in a third world country. I do however have a continuous desire to improve myself. My Objective is to bring myself up to the standards of programmers in United States. To further that goal i program continuously(4-5 hours daily). But here comes my predicament. I am already considered better than most of my peers in university competitions but due to the really low quality of education the comparison is essentially useless. I have searched the internet for website that rank programmers based on challenges but haven't been able to find any. So the question is. Is there any way i can compare my programming skills with the rest of the world ? And finally while i do understand the SE prefers questions that can be answered and not questions that solicit debate, i would still ask for suggestions of the community. In my country mostly nobody cares about self improvement while this is a very big deal to me.


How to rate myself as a programmer

> **Possible Duplicate:**   >  How Can I Know Whether I Am a Good Programmer? I am sure many of us think of themselves as good coders, my question is how to be sure of this? How to know that i am 'above average'? How to compare myself against other coders? I dont mean taking formal tests, on a day-to-day basis, what is the way to evaluate oneself? Thanks for not closing


What are the guidelines and opinions to become a Good Programmer?

> **Possible Duplicate:**   >  How Can I Know Whether I Am a Good Programmer?   >  How to learn PHP effectively? I have a doubt about myself. I think I am not good enough in programming. I was really trying very very hard to learn programming and I am dedicated to it. Can you give me advice on what are the things that I need to master to become a better programmer or the stuff that will help me to improve my programming skills? Do I really need to learn c/c++ or java? I'm a PHP Programmer and I want to master it before learning new language. How can would I know if my skills is enough?


Is it possible to measure if someone is a 'good' programmer?

> **Possible Duplicate:**   >  How Can I Know Whether I Am a Good Programmer? There are a number of questions here about recognising or considering someone as a good/bad programmer. These are all subjective. What I'd like to know is if there is a way to measure this. I realise there will and should be a subjective element to it. But is it also possible to have some actual numbers to back up (or contradict) such an assessment?


How to measure his own skill in a programming language?

> **Possible Duplicate:**   >  How Can I Know Whether I Am a Good Programmer? As many programmers I have worked in several languages. While of course there are some that I am more at ease than other, I do not have a real way to precisely measure my skill in a specific language. So I thought of a system which allows me to help me with that. I am looking for 5 common criteria in programming languages, to which I will have a value from 1 (junior) to 4 ( Senior) to represent my skill. I however have no real idea of the criteria I should choose for that. Does anybody have suggestion ? Thanks.


How can I tell bad code from good code?

> **Possible Duplicate:**   >  How Can I Know Whether I Am a Good Programmer? I was looking at some posts on language execution speeds (e.g. whether one Language was faster then another or vice versa), and the common answer was that it really depends on how good the programmer is. I was wondering what that actually means. How can I tell bad code from good code?


What is considered "good programmer" professionally?

> **Possible Duplicate:**   >  How Can I Know Whether I Am a Good Programmer? Sometimes I hear someone say "good programmer" once I saw I guy saying that he was going to promote programmers that were good. My question is: what is the definition of good? I am not asking here how to find good programmers or how to identify one, but just knowing what "goo programmer" in professional sense is. 2nd question: How do I know if I am good or bad programmer?


How to prevent fat views in MVC?

I'm just curious. If I'm a lead dev in a company of a dozens of developers is there any way I can prevent a newbie developer from creating a fat view? By fat view I mean to have an empty controller, empty model and having all database and business logic in the view along with the html/js.


What to do with estimation of incomplete story?

I am part of a development team that is relatively new to `Scrum`, suppose that at the end of the sprint a few large stories are either `in progress` or were not `accepted` by the PO. Firstly, what happens with those user stories? Do you just carry them over into the next sprint? If so, should they be re-estimated? In my view the work remaining on these user stories can be minimal or a lot? If not, why not? EDIT: In my specific case, the stories were not completed because of an impediment that was a few days long, not because of user story underestimation. For those of you that it may help, we are using `VersionOne`


What's the best version control/QA workflow for a legacy system?

I am struggling to find a good balance with our development and testing process. We use Git right now, and I am convinced that ReinH's Git Workflow For Agile Teams is not just great for capital-A Agile, but for pretty much any team on DVCS. That's what I've tried to implement but it's just not catching. We have a large legacy system with a complex environment, hundreds of outstanding and undiscovered defects, and no real good way to set up a test environment with realistic data. It's also hard to release updates without disrupting users. Most of all, it's hard to do thorough QA with this process... and we need thorough testing with this legacy system. I feel like we can't really pull off anything as slick as the Git workflow outlined in the link. What's the way to do it?


How is client-side javascript covered by the GPL?

If I used a GPL-licensed Javascript libarary in a web application, would I then have to offer source code of the whole site to anyone who downloaded and executed the Javascript lib?


Perception of a developer that uses a pre-packaged web implementation for their personal site?

Lets say you're a web developer/programmer and you want to set up a personal portfolio site. Unfortunately, like most people with a full time job and a family, your time is hard to come by. You make the choice to, instead of building your own site from scratch, implement something like WordPress or Drupal. What effect (if any) might this have on people's (potential employers/fellow developers) perception of you as a developer?


What should I learn from Scheme?

I was wondering what unique features I can learn from Scheme that would help me become a better programmer? I have a lot experience in mainstream languages, and I am looking to expand my horizons and learn about functional aspects that are missing from other languages. I am familiar with closures from javascript, lambda expressions from C#, and I was wondering what I can focus on that is lacking in other languages? Aside from the Lisp syntax, I feel like what I have seen so far I've already encountered in other languages. **What is unique to Scheme/Lisp that will teach me something new?**


When using a programming library for an organization, can it still be a non-profit project?

I am currently developing a web-application that is to present data stored in a database. For the presentation there is a request for both presenting this in table format and graph format. The table format is straight-forward, simply output the data and voila! However, for the graph format it has proved a little more difficult. I have been reviewing a number of different libraries for visualizing data and it seems that there are quite a few that share licensing agreements; free for non-profit projects or non-commercial use. Now, if I was to create something for a company that later was to sell this, I can clearly distinguish that this is considered to be commercial use. But if I am working for an organization (not a non-profit) on a project that is to be used solely for internal purposes, it won't get anywhere near a customer, is this considered to be a non-profit project? **EDIT:** An example of such a license is Creative Commons Attribution- NonCommercial 3.0.


Avoiding polling with components

Once you create separate components that need to communicate with each other you enter the realm of systems programming where you have to assume that errors could originate at any step in the process. You throw `try-catch` blocks out the window and have to develop robust alternatives for error handling yourself. We have two systems both with REST apis. Both systems have GUIs that users can use to add/update information. When information is added to one system it must be propagated to the other. We have integration software (the middleman) that polls on a minute-by-minute basis, picks up adds/edits and translates them from one system to the other. Each invokation keeps track of the timestamp of the last successful run--we have one timestamp for communication in either direction. In this way, if any part of the system fails, we can resume right where we left off when the issues are corrected. I have heard bad things about poll-based approaches: namely the fact that it runs without regard to whether there is actually work. I have heard that push- based approaches are more efficient because they are triggered on demand. I am trying to understand how a push-based approach might have worked. If either system attempts to push an add/edit, we have to assume that it could fail because the other system is down. It would seem to me that either system would need to maintain its own outgoing queue in order to resume once the issue with the other system is corrected. It seems to me that using a push approach eliminates the middleman, but heaps more responsibility on each system to manage its messages to the other system. This seems to not be a clean way of separating concerns. Now both systems have to take on middleman responsibilities. I don't see how you would redesign the middleman for a push-based architecture. You run the risk that messages are lost if the middleman himself fails. Is there a fault-tolerant architecture that could be used to manage system interactions without the polling? I'm trying to understand if we missed a better alternative when we devised/implemented our poll-based middleman. The software does the job, but there's some latency.


How to verify that library assemblies originate from a given Web site?

How would the following solution be implemented? Would you need to put this code in each library assembly or just in the main assembly that is determining whether it is safe to call the library assembly based on whether or not it originates from a given intranet Web site? Also, who should call the CheckSite method - each library assembly or the main app? Here is the example and solution from a practice exam for the C# Specialist Exam 70-483 that I am referring to: > You are an application developer for a company. You are creating an > application on the company’s Web server that will manipulate confidential > data from business partners. The application relies on many library > assemblies in the company intranet to complete its work. You are required to > verify that every assembly originates from the same intranet Web site. Which > code should you use to verify the current assembly originates from the > company intranet?               public bool CheckSite () {         SiteMembershipCondition site = new             SiteMembershipCondition( “http://intranet.company.com” );         return site.Check( Assembly.GetCallingAssembly().Evidence );     }


Interop Best Practices: Should I use Static Class, or Normal Classes

I have a front end C# that needs to call a C++ back end. So interop is needed. I have an "interop layer", that converts the C# data structure into C++ structure, and do all the memory freeing grunt work. My question is, should I write this interop layer as a _static_ class, or should I wrap it in a normal class and instantiate it as an object when I need to use it?


What should be the next thing after being accepted as a contributor to an Open Source Project?

So this is the first time I am trying to work with an `Open Source Project`. I created a `Code Plex` Account browsed for a project that I thought I might become a part of. I sent a request to join the project.The project head accepted my request. I have already `downloaded` the `source code` of the project. Can some one just suggest what should I be doing next? Since I have never worked with `Open Source Projects` the best thing I think for me would be to go through the `code` and just study it and understand how it works. Apart from that I want to know what things many of you do when you are accepted as a contributor. Also the project I choose to work includes `ASP.NET MVC` and a `javascript` library `Raphael.js` which I have no prior experience with. So should I also start looking at it also? Any suggestions are welcome.


How can you distinguish a good consulting firm from a body shop?

It seems to me that most consulting firms do little more than match resumes to positions, typically with insightful criteria such as "X years experience in technologies Y and Z." But there are also some consulting firms that attempt to find talented developers and invest in them. And rather than simply providing staff augmentation, they either partner with a client to accomplish a project, or supply the entire team. How can you effectively (and quickly) determine which is which? Since no one advertises themselves as a "body shop," how do you find and pursue the firm that is actually looking for good developers, and not just resumes? Is there a Joel test for consulting firms? One that can be applied before you are hired? I'm asking as a potential employee here.


Is HTTPS enough to avoid replay attacks?

I am exposing a few REST methods on a server for an mobile app. I would like to avoid that users can sniff how HTTP methods are built (from the mobile app) and then send them again to the server. Example :   * The mobile app send a request   * The user uses a proxy and can check what's going on on the network   * The user sees and save the request that the mobile just sent   * => Now I don't want the user to be able to send over manually that request Is it enough to secure the server over HTTPS?


What are non-programming mistakes that a programmer should avoid?

People make mistakes, even in the real life... Which should we, geeky programmers, avoid?


How is it possible to build the whole codebase from source at Google scale?

The first answer to an old, recently active question linked to a video which talks about how Google repository is done. One interesting thing which was mentioned is the fact that **everything is build from source, without relying on binaries.** This helps avoiding issues with dependencies becoming obsolete but still being used in other projects, an issue I indeed encountered a lot. How is it technically possible? If I try the same thing in my company, even considering the huge gap between the scale of my company codebase and the scale of Google's one, it wouldn't be possible for two reasons:   * The IDE (Visual Studio) will quickly become unresponsive, given that is suffers a lot at even small solutions containing, say, 50 projects.   * Any static analysis would be crunched by the size of the whole codebase. For example code metrics or static checking of code contracts would hardly be possible (code contracts would probably take days or weeks).   * With continuous integration, compiling would take a huge amount of time too and would crunch the servers as soon as a project with lots of dependencies is modified, requiring a large tree of projects to be recompiled. How can a small company circumvent those issues and be able to:   1. Use the IDE without being affected by poor performance,   2. Compile the code after each commit without crunching the server, even when the consequences of a change require a large amount of the codebase to be recompiled?


Deprecated Methods in Code Base

A lot of the code I've been working on recently, both professionally (read: at work) and in other spheres (read: at home, for friends/family/etc, or NOT FOR WORK), has been worked on, redesigned and re-implemented several times - where possible/required. This has been in an effort to make things smaller, faster more efficient, better and closer to spec (when requirements have changed). A down side to this is that I now have several code bases that have deprecated method blocks (and in some places small objects). I'm looking at making this code maintainable and easy to roll back on changes. I'm already using version control software in both instances, but I'm left wondering if there are any specific techniques that have been used by others for keeping the superseded methods without increasing the size of compiled outputs? At the minute, I'm simply wrapping the old code in C style multi line comments. Here's an example of what I mean (C style, psuedo-code):               void main ()     {       //Do some work       //Foo();  //Deprecated method call       Bar();    //New method     }          /***** Deprecated code *****     /// Summary of Method     void Foo()     {       //Do some work     }     ***** Deprecated Code *****/          /// Summary of method     void Bar()     {       //Do some work     }      I've added a C style example, simply because I'm more confident with the C style languages. I'm trying to put this question across as language agnostic (hence the tag), and would prefer language agnostic answers, if possible - since I see this question as more of a techniques and design question. I'd like to keep the old methods and blocks for a bunch of reasons, chief amongst them being the ability to quickly restore an older working method in the case of some tests failing, or some unforeseen circumstance. Is there a better way to do this (that multi line comments)? Are there any tools that will allow me to store these old methods in separate files? Is that even a good idea?


from Java to SAS

I am a seasoned python,java,...other programmer having a (fairly advanced) mathematical education (so I do understand statistics and data mining, for example). For various reasons I am thinking to switch to SAS/BI area (I am naming SAS because it might be, for me, a possible way to enter in BI). My question, for whoever might have an experience of both: is it, in BI current state, worth it? I mean, the days of big ideas in BI _for business_ seem to be over (there are the APIs, managers think that they know what you can do with them), and my mathematical background might turn out to be superfluous. Also, the big companies now have their data organized, have their BI procedures well established, and trying to analyze it from a different standpoint might not be what they want. Another difference is: while in Java etc. development one codes and codes and codes, I don't know if this is the case for BI; in fact, from what I read on the net, a BI (or OLAP, ...etc) developer, in a big organization, is usually in a state of standby, and does in fact little coding.


How was programming done 20 years ago?

Nowadays we have a lot of programming aids that make work easier, including:   * IDEs   * Debuggers (line by line, breakpoints, etc)   * Ant scripts, etc for compiling   * Sites like StackOverflow to help if you're stuck on a programming problem 20 years ago, none of these things were around. Which tools did people use to program, and how did they make do without these newer tools? I'm interested in learning more about how programming was done back then.


Is Reading the Spec Enough?

This question is centered around Scheme but really could be applied to any LISP or programming language in general. **Background** So I recently picked up Scheme again having toyed with it once or twice before. In order to solidify my understanding of the language, I found the _Revised^5 Report on the Algorithmic Language Scheme_ and have been reading through that along with my compiler/interpreter's (Chicken Scheme) listed extensions/implementations. Additionally, in order to see this applied I have been actively seeking out Scheme code in open source projects and such and tried to read and understand it. This has been sufficient so far for me understanding the syntax of Scheme and I've completed almost all of the Ninety-nine Scheme problems (see here) as well as a decent number of Project Euler problems. **Question** While so far this hasn't been an issue and my solutions closely match those provided, am I missing out on a great part of Scheme? Or to phrase my question more generally, does reading the specification of a language along with well written code in that language sufficient to learn from? Or are other resources, books, lectures, videos, blogs, etc necessary for the learning process as well.


How to design a log() method that can easily be accessed from the outside of the Console class?

Recently my team has programmed a custom developer console in a video game which can easily be hidden or displayed, because it's more comfortable and less of a hassle. The Console class contains a log(string) function which should be easily accessible from anywhere outside of it, without having to reference it everywhere. How could we design a method that can be easily accessed from the outside of the class? For example printing a message to the console in C++ is as simple as:               cout << "Message";      Well we want something similar at best, maybe Console::log(), but we are clueless how to achieve a _proper_ way of doing it. Cheers.


How do I deal with a MIT project with no included copyright notice?

There's a (possibly abandoned) library I'm using in my project. Its Google Code project page mentions it's MIT licensed. Nowhere in the code itself, nor any of the included files, is there a copyright notice or license specified. The closest thing is the author's name in one of the headers. Since the sole requirement of the MIT license is its inclusion of the copyright notice, which is non-existant in this libary, what's the best manner to proceed?


Career Shifters: How to compete with IT/ComSci graduates

I am wondering what are the chances of a career shifter (mid 20's), who have maybe 3-6 months programming experience vs. younger fresh IT/Com Sci graduates? You see, even though I really love programming (Java/J2EE), but nobody gives me a feedback when I apply online. maybe because they preferred IT/ComSci graduates vs a career shifter like me. So can you advice on how to improve my chance on being hired? How can I get a real-job programming experience if nobody is hiring me? I can make my own projects (working e-commerce site blah blah) but it is still different from the real job. And my code is working but it still needs a lot of improvement and no one can tell me how to improve it because no one sees it (because I'm doing it alone?). Do you know any open source websites (java/j2ee) / online home-based jobs who accept java/j2ee trainees?


Programming puzzle with constant selection

THE QUESTION: There is an event where there are N contestants. There are three tasks in the event: A,B,C (say). Each participant takes part in the events in the listed order: i.e a contestant must first complete A and B before beginning C. However, in event A only one person can participate at a time. Any number of people may simultaneously participate in B and C. So the event works as follows. At time 0, the first contestant begins A, while the remaining citizens wait for the first person to finish. As soon as the first person is done, he or she proceeds to event B, and the second citizen begins A. In general whenever a person completes A, the next person begins A. Whenever a person is done with A, he or she proceeds to B immediately, regardless of what the other contestants do. The whole event ends as soon as all the contestants finish all 3 events. So the basic question is given the number of participants N, and the time taken by each person for each of the 3 events, calculate the minimum time in which the whole event might be completed. MY ATTEMPT: This is the algorithm I came up with: LeastTime(people (2d array [n][3] with time of each person for each event, n, front_chosen = false)                   The least time for n people can be broken up into 2 cases:         1. The current guy seated first for event A             1.1 We take t1_1 -> time for current guy in event A + time taken for the rest of the people to finish the whole event with the front taken             1.2 We take t1_2 -> time for current guy in event A + time for his remaining events             1.3 The time taken for the whole event in this case is t1 = max{t1_1,t1_2}.               2 The current guy is not seated first for event A             2.1 We modify people such that the first element is placed last             2.2 t2 -> LeastTime(people, n, false)         3. We return min {t1,t2}      So that is what I came up with. What are some better i.e more efficient solutions? Even Alternate Solutions will be helpful.


Why can't SQL return joined tables in a nested format?

For example, say I want to fetch a User and all of his phone numbers and email addresses. The phone numbers and emails are stored in separate tables, 1-user to many phones/emails. I can do this quite easily:               SELECT * FROM users user          LEFT JOIN emails email ON email.user_id=user.id         LEFT JOIN phones phone ON phone.user_id=user.id      The problem* with this is that it's returning the user's name, DOB, favorite color, and all the other information stored in the user table over-and-over again for each record (users*emails*phones records), presumably eating up bandwidth and slowing down the results (unless I'm mistaken on this?). Wouldn't be nicer if it returned a single row for each user, and within that record there was a _list_ of emails and a _list_ of phones? It would make the data much easier to work with too. I know you can get results like this using LINQ or perhaps other frameworks, but it seems to be a weakness in the underlying design of relational databases. We could get around this by using NoSQL, but shouldn't there be some middle ground? Am I missing something? Why doesn't this exist? * Yes, it's designed this way. I get it. I'm wondering why there isn't an alternative that is easier to work with. SQL could keep doing what it's doing but then they could add a keyword or two to do a little bit of post-processing that returns the data in a nested format instead of a cartesian product.


Why did Microsoft abandon IronRuby and IronPython?

Several years ago, Microsoft announced that Ruby and Python were coming to .net. The projects were called IronRuby and IronPython, respectively. Microsoft said that the projects would be built on top of the .net DLR. WIKIpedia indicates that for all intents and purposes, these projects have been abandoned by Microsoft. Why did Microsoft abandon these projects?


Arranging the colors on the board in the most pleasing form

Given a rectangular board of height H and width W.   N colors are given and each color occupies Xi percentage of area on the board.   Sum of Xi's is 1. The colors on the board must be placed in rectangles.   An optimal solution has the rectangles' aspect ratios as close to 1 as possible.   An ideal case has the board filled only with squares. What's the best algorithm for laying out the rectangles?


Defining work days and work time

I'm working on development of SMS parking software, and I'm stuck at one point for a month... I need to implement periods of payment (or work time, of a work day, if you will). Here's the problem: For an example, traffic wardens work from Monday to Saturday. From Monday to Friday, the work times are from 07:00 to 21:00, and on Saturday, the work time is from 07:00 to 14:00. The project request was, that the customer can pay parking by SMS unlimited, which I did, but didn't implement this logic. I started with making a table for this periods of payment, it consists of: dayofweek (INT, for use with mysql function DAYOFWEEK, to tell me which day in week is the current date), work_start and work_stop (DATETIME, for defining starting and ending the work day), but I'm unsure if I should use DATETIME, beacuse of the date, or should I use only TIME. The idea is this: If you send an SMS, at 20:50, Monday, it should be valid until 07:50, Tuesday (it's payed by the hour). Extending the time of payment, regarding the work time in week. Currently, it works with extending time by the hour without this rule. Really would use some help, or some ideas, I'm stuck with this for quite some time...


In embedded, is there any difference between a device driver and a library?

Assuming a platform with no kernel mode, such as Atmel AVR, is there any difference between a device driver and a library, given that everything is user mode anyway? I ask because I'm thinking about how I want to layer my code. It's like this:               +----------------+     | Business logic |     +----------------+     |   CAN library  |     +----------------+     | MCP2515 driver |     +----------------+     |   SPI driver   |     +----------------+      The SPI "driver" has an interrupt handler, and it talks directly to the microcontroller's SPI peripheral, which _sounds_ like a driver, but other than that, I don't see how it's any different to, say, the CAN library, which has high-level functions like "send this message".


How do I contribute to open source projects?

What are the mechanics of contributing to open source projects? How are they managed? What exactly is meant by submitting a patch? Should I do some reading up on advanced version control techniques?


Do objects maintain identity under all non-cloning conditions in PHP?

PHP 5.5 I'm doing a bunch of passing around of objects with the assumption that they will all maintain their identities - that any changes made to their states from inside other objects' methods will continue to hold true afterwards. Am I assuming correctly? I will give my basic structure here.               class builder {       protected $foo_ids = array(); // set in construct       protected $foo_collection;       protected $bar_ids = array(); // set in construct       protected $bar_collection;       protected function initFoos() {         $this->foo_collection = new FooCollection();         foreach($this->food_ids as $id) {           $this->foo_collection->addFoo(new foo($id));         }       }       protected function initBars() {         // same idea as initFoos       }       protected function wireFoosAndBars(fooCollection $foos, barCollection $bars) {         // arguments are passed in using $this->foo_collection and $this->bar_collection         foreach($foos as $foo_obj) { // (foo_collection implements IteratorAggregate)           $bar_ids = $foo_obj->getAssociatedBarIds();           if(!empty($bar_ids) ) {             $bar_collection = new barCollection(); // sub-collection to be a component of each foo             foreach($bar_ids as $bar_id) {               $bar_collection->addBar(new bar($bar_id));             }             $foo_obj->addBarCollection($bar_collection);             // now each foo_obj has a collection of bar objects, each of which is also in the main collection. Are they the same objects?           }         }       }          }      What has me worried is that `foreach` supposedly works on a copy of its arrays. I want all the $foo and $bar objects to maintain their identities no matter which $collection object they become of a part of. Does that make sense? EDIT: My understanding is that using the `clone` keyword is the only way to really copy an object in PHP 5+. Using the assignment operator basically just creates another reference to the same object. I'm hoping that return values and `foreach` also work that way.


Syntax of passing lambda

Right now, I'm working on refactoring a program that calls its parts by polling to a more event-driven structure. I've created sched and task classes with the sced to become a base class of the current main loop. The tasks will be created for each meter so they can be called off of that instead of polling. Each of the events main calls are a type of meter that gather info and display it. When the program is coming up, all enabled meters get 'constructed' by a main-sub. In that sub, I want to store off the "this" pointer associated with the meter, as well as the common name for the "action routine.               void MeterMaker::Meter_n_Task (Meter * newmeter,) {       push(newmeter);      // handle non-timed draw events       Task t  = new Task(now() + 0.5L);       t.period={0,1U};       t.work_meter = newmeter;             t.work  = [&newmeter](){newmeter.checkevent();};<<--attempt at lambda       t.flags = T_Repeat;       t.enable_task();       _xos->sched_insert(t);     }      A sample call to it:               Meter_n_Task(new CPUMeter(_xos, "CPU "));      've made the scheduler a base class of the main routine (that handles the loop), and I've tried serveral variations to get the task class to be a base of the meter class, but keep running into roadblocks. It's alot like "whack-a- mole" -- pound in something to fix something one place, and then a new probl pops out elsewhere. Part of the problem, is that the sched.h file that is trying to hold the Task Q, includes the Task header file. The task file Wants to refer to the most "base", _Meter_ class. The meter class pulls in the main class of the parent as it passes a copy of the parent to the children so they can access the draw routines in the parent. Two references in the task file are for the 'this' pointer of the meter and the meter's update sub (to be called via this).               void *this_data= NULL;     void (*this_func)() = NULL;      Note -- I didn't really want to store these in the class, as I _wanted_ to use a lamdba in that meter&task routine above to store a routine+context to be used to call the meter's action routine. Couldn't figure out the syntax. But am running into other syntax problems trying to store the pointers...such as                 g++: COMPILE lsched.cc     In file included from meter.h:13:0,                      from ltask.h:17,                      from lsched.h:13,                      from lsched.cc:13:     xosview.h:30:47: error: expected class-name before ‘{’ token      class XOSView : public XWin, public Scheduler {      Like above where it asks for a class, where the classname "Scheduler" is. !?!? Huh? That IS a class name. I keep going in circles with things that don't make sense... Ideally I'd get the lamba to work right in the Meter_n_Task routine at the top. I wanted to only store 1 pointer in the 'Task' class that was a pointer to my lambda that would have already captured the "this" value ... but couldn't get that syntax to work at all when I tried to start it into a var in the 'Task' class. This project, FWIW, is my teething project on the new C++... (of course it's simple!.. ;-))... I've made quite a bit of progress in other areas in the code, but this lambda syntax has me stumped...its at times like thse that I appreciate the ease of this type of operation in perl. Sigh. Not sure the best way to ask for help here, as this isn't a simple question. But thought I'd try!... ;-) Too bad I can't attach files to this Q.


Architecting Domain Layer and other modules with dependency injection in mind

I am currently new to Dependency Injection pattern. I am influenced by link by Mark Seemann. **I have a confusion regarding whether an interface for an agent class of some agent module should be included in domain layer?** _by agent I mean a class / module that interacts with external wcf/ webservices._ I have a diagram that shows it. In short, is it Ok to have: IProductAgent interface in Business layer where the actual implementation will be in an Agent Module. The confusion arises by the fact that: **Is calling a service even considered a business rule?** Today a service fulfills a facility, tomorrow there might be some another means of catering this same facility. Liskov's Substitution Principle. Apologies if I am mixing things here.


What do you call classes without methods? For example,               class A     {       public string something;       public int a;     }      Above is a class without any methods. Does this type of class have a special name?


The different types of CMS - Pros and cons

As I understand it, there are three different "types" of CMS:   1. **Proprietary** : A CMS built and owned by a company, and altered to meet a client's needs.   2. **Open-Source** : An open/free version of the above. An existing system altered to meet a client's needs. (E.g. Drupal, Joomla, etc.)   3. **Fully Bespoke** : A CMS built from scratch to the client's exact needs. It seems to me that, from a client's perspective, their order of preference (if everything else was equal) would be 3 -> 2 -> 1. There's a danger that option 3 could be riddled with difficult to understand code, but that's a danger with the other two as well. As developers, what's best for our clients? I ask this because a competing agency just pitched to one of our clients that Open-Source CMSes are the preferred solution. While I can see the benefits of using OS software, I can't see how it's better than a Fully Bespoke solution. As a developer blog put it, > "Adding features to [an existing] CMS is not easy. It takes more time than > to develop the feature alone, because you need to trick the CMS into doing > something it was not designed to do. This is especially true for features > that write to the database a lot, like community features, or features that > have unusual business logic."


I know how to program, and how to learn how to program, but how/where do you learn how to make systems properly?

There are many things that need to be considered when making a system, let's take for example a web based system where users log in and interact with each other, creating and editing content. Now I have to think about security, validation (I don't even think I am 100% sure what that entails), "making sure users don't step on each others feet" (term for this?), preventing errors in many cases, making sure database data doesn't become problematic through unexpected... situations? All these things I don't know how or where to learn, is there a book on this kind of stuff? Like I said there seems to be a huge difference between writing code and actually writing the right code, know what I mean? I feel like my current programming work lacks much of what I have described and I can see the problems it causes later, and then the problems are much harder to solve because data exists and people are using it. So can anyone point me to books or resources or the proper subset of programming(?) for this type of learning? PS: feel free to correct my tags, I don't know what I am talking about. Edit: I assume some of the examples I wrote apply to other types of systems too, I just don't know any other good examples because I've been mostly involved in web work.


why are noSQL databases more scalable than SQL?

Recently I read a lot about noSQL DBMSs. I understand CAP theorem, ACID rules, BASE rules and the basic theory. But didn't find any resources on why is noSQL scalable more easily than RDBMS (e.g. in case of a system that requires lots of DB servers)? I guess that keeping constraints and foreign keys cost resources and when a DBMS is distributed, it is a lot more complicated. But I expect there's a lot more than this. Can someone please explain how noSQL/SQL affects scalability?


Why NoSQL over SQL?

> **Possible Duplicate:**   >  When would someone use MongoDB (or similar) over traditional RDMS? How well the SQL and NoSQL go head-to-head. I read somewhere that SQL databases are not well for data that is well structured or has some graph- iness associated with it. Is it really the case? Apart form Facebook, Google, and some other big players on the web, I don't know how well small-players and start-ups have used these tools. I found another similar question about the same here. But I couldn't gather much stats from here. These are certain specific cases, and is there a general pattern (like the one mentioned above) for which these NoSQL databases can be used? How wise will it be for a start-up to go for a NoSQL database if the developers know that the amount of data involved will be a little large and is well structured, but requires frequent CRUD operations? Here on stackoverflow, one can find questions about when not to use SQL, but are there any scenarios when one should avoid using NoSQL databases? Also, how effective will it be to use both in parallel so that we get the best of them both? One last question, do these distributed NoSQL databases perform equally well when they are used in a single-node setup?


Wrapping REST based Web Service

I am designing a system that will be running online under Microsoft Windows Azure. One component is a REST based web service which will really be a wrapper (using proxy pattern) which calls the REST web services of a business partner, which has to do with BLOB storage (note: we are not using azure storage). The majority of the functionality will be taking a request, calling our partner web service, receiving the request and then passing that back to the client. There are a number of reasons for doing this, but one of the big ones is that we are going to support three clients: our desktop application (win and mac), mobile apps (iOS), and a web front end. Having a single API which we then send to our partner protects us if that partner ever changes. I want our service to support both JSON and XML for the data transfer format, JSON for web and probably XML for the desktop and mobile (we already have an XML parser in those products). Our partner also supports both of these formats. I was planning on using ASP.NET MVC 4 with the Web API. As I design this, the thing that concerns me is the static type checking of C#. What if the partner adds or removes elements from the data? We can probably defensively code for that, but I still feel some concern. Also, we have to do a fair amount of tedious coding, to setup our API and then to turn around and call our partner’s API. There probably is not much choice on it though. But, in the back of my mind I wonder if maybe a more dynamic language would be a better choice. I want to reach out and see if anybody has had to do this before, what technology solutions they have used to (I am not attached to this one, these days Azure can host other technologies), and if anybody who has done something like this can point out any issues that came up. Thanks! Researching the issue seems to only find solutions which focus on connecting a SOAP web service over a proxy server, and not what I am referring to here. Note: Cross posted (by suggestion) from http://stackoverflow.com/questions/11906802/wrapping-rest-based-web-service Thank you!


Full Trust level: should be a concern?

**Should I worry about the safety of my application if it runs in Full Trust level?** If yes, why? What damages could be done? If the trust level should be a concern why it is the default level for asp.net applications instead of medium? I know all the _yes_ and _no's_ between medium and full trust levels, but I can't see where this could be a **serious** risk to the application and server. Considering this: My ISP wants to (and will) change the trust level to Medium of an IIS asp.net mvc application running on a **dedicated** server. This simply will break my application, since it relies heavily on `System.Reflection` namespace and it uses 3rd party assemblies which don't have the `AllowPartiallyTrustedCallers` defined. The application runs under a specific user that has read only access to the application directory and only execute permission on stored procedures on the Sql Server. The authentication is via SSPI, so no passwords on web.config. The ISP claims that if they let my application run in full trust they can not guarantee the security of my server. I never heard about a single case when the full trust was the cause to a security break. It seems to me that they are not sure about what they are doing. I can't see a security flaw here. The only securiy flaw I can see in general is the password stealing from the web.config, but this is not possible in my current setup...


How to avoid oscillation by async event based systems?

Imagine a system where there are data sources which need to be kept in sync. A simple example is model - view data binding by MVC. Now I intend to describe these kind of systems with data sources and hubs. Data sources are publishing and subscribing for events and hubs are relaying events to data sources. By handling an event a data source will change it state described in the event. By publishing an event the data source puts its current state to the event, so other data sources can use that information to change their state accordingly. The only problem with this system, that events can be reflected from the hub or from the other data sources, and that can put the system into an infinite oscillation (by async or infinite loop by sync). For example               A -- data source     B -- data source     H -- hub          A -> H -> A -- reflection from the hub     A -> H -> B -> H -> A -- reflection from another data source      By sync it is relatively easy to solve this issue. You can compare the current state with the event, and if they are equal, you don't change the state and raise the same event again. By async I could not find a solution yet. The state comparison does not work by async event handling because there is eventual consistency, and new events can be published in an inconsistent state causing the same oscillation. For example:               A(*->x) -> H -> B(y->x)         -- can go parallel with     B(*->y) -> H -> A(x->y)         -- so first A changes to x state while B changes to y state         -- then B changes to x state while A changes to y state         -- and so on for eternity...      What do you think is there an algorithm to solve this problem? If there is a solution, is it possible to extend it to prevent oscillation caused by multiple hubs, multiple different events, etc... ? **update:** I don't think I can make this work without a lot of effort. I think this problem is just the same as we have by syncing multiple databases in a distributed system. So I think what I really need is constraints if I want to prevent this problem in an automatic way. What constraints do you suggest?


Sample domain model for online store

We are a group of 4 software development students currently studying at the Cape Peninsula University of Technology. Currently, we are tasked with developing a web application that functions as a online store. We decided to do the back-end in Java while making use of Google Guice for persistence(which is mostly irrelevant for my question). The general idea so far to use PHP to create the website. We decided that we would like to try, after handing in the project, and register a business to actually implement the website. **The problem** we have been experiencing is with the domain model. These are mostly small issues, however they are starting to impact the schedule of our project. Since we are all young IT students, we have virtually no experience in the business world. As such, we spend quite a significant amount of time planning the domain model in the first place. Now, some of the issues we're picking up is say the reference between the Customer entity and the order entity. Currently, we don't have the customer id in the order entity and we have a list of order entities in the customer entity. Lately, I have wondered if the persistence mechanism will put the client id physically in the order table, even if it's not in the entity? So, I started wondering, if you load a customer object, it will search the entire order table for orders with the customer's id. Now, say you have 10 000 customers and 500 000 orders, won't this take an extremely long time? There are also some business processes that I'm not completely clear on. Finally, my question is: does anyone know of a sample domain model out there that is similar to what we're trying to achieve that will be safe to look at as a reference? I don't want to be accused of stealing anybody's intellectual property, especially since we might implement this as a business.


Is unit testing development or testing?

I had a discussion with a testing manager about the role of unit and integration testing. She requested that developers report what they have unit and integration tested and how. My perspective is that unit and integration testing are part of the development process, not the testing process. Beyond semantics what I mean is that unit and integration tests should not be included in the testing reports and systems testers should not be concerned about them. My reasoning is based on two things.   1. Unit and integration tests are planned and performed against an interface and a contract, always. Regardless of whether you use formalized contracts you still test what e.g. a method is supposed to do, i.e. a contract.  In integration testing you test the interface between two distinct modules. **The interface and the contract** determine when the test passes. But you always test a limited part of the whole system. Systems testing on the other hand is planned and performed against the system specifications. **The spec** determines when the test passes.   2. I don't see any value in communicating the breadth and depth of unit and integration tests to the (systems) tester. Suppose I write a report that lists what kind of unit tests are performed on a particular business layer class. What is he/she supposed to take away from that?  Judging what should and shouldn't be tested from that is a false conclusion because the system may still not function the way the specs require even though all unit and integration tests pass. This might seem like useless academic discussion but if you work in a strictly formal environment as I do, it's actually important in determining how we do things. Anyway, am I totally wrong? (Sorry for the long post.)


Proper XAML for Windows 8 Applications

I have been wanting to understand more of proper XAML design since most of my current experience is in what I grew up in: Windows Forms. More specifically, though it is really a specific subset of Xaml, I am interested in Windows 8 Application development. I do have read considerable parts of 70-502 exam book by Microsoft and of course I have visited the Microsoft site to learn how many pixels what where and how is supposed to go to meet Windows 8 design guidelines. All these resources however focus on very small scale problems. How to make a button, how to connect it to a controller... I am looking for resources that teach me how to translate a design into xaml. All the individual components I am aware of, though not indepth. DockPanels, StackPanels, buttons, boxes, borders and styles. But I don't have a resource that tells me how to combine them into a high quality design. Does anyone have resources that teach weilding Xaml on an application scale?


Becoming a better C/Java programmer

I've currently hit a plateau and want to get better at coding in C and Java. I want to improve, but I think I hit a plateau on my learning curve. I can't find any "advanced" tutorials on the net; most of the things that are introductions that I already know. I don't really know where to go from here to get better. How do I get past the plateau? Would reading through the Linux kernel's source help? Is there a site, or something with advanced exercises or tasks to do? Not something that requires expert knowledge, and nothing basic, but something in the middle. Something with programming puzzles or riddles, that take a couple of hours at most, but not months. By advanced, I mean that I already know the syntax pretty well. I haven't mastered it, and still make mistakes here and there, but I wouldn't be completely useless without my IDE of choice (Eclipse). In Java, I have a basic grasp of collections, the Swing library, and the JDBC library. I also have some basic experience with ant and junit. I can make basic 2D games, and utility programs with local database connectivity. I'm reading up on Java's sound API. As for C, it's pretty rusty. I do know the syntax, and know how to use make, but I don't know many libraries. I've tinkered with sqlite3, and made a simple pacman type game that runs on a win32 console a few years ago, but I never really advanced past the basic syntax. Also, I recently learned about function pointers. Basically, I've gotten the lessons most books have in their first few chapters, but don't really know where to go from here. I am aware that the best way to improve is to code, but I don't really know _what_ to code. I don't really want to keep making the same kinds of programs again and again, but I can't think of any short, but new project.


Reuse the data CRUD methods in data access layer, but they are updated too quickly

I agree that we should put CRUD methods in a data access layer， However, in my current project I have some issues. It is a legacy system, and there are quite a lot CRUD methods in some concrete manager classes. People including me seem to just add new methods to it, rather than reuse the existing methods. Because   1. We don't know whether the existing method is what we need   2. Even if we have source code, do we really need read other's code then make decision?   3. It is updated too quickly. Do not have time get familiar with the DAO API. Back to the question, how do you solve that in your project? If we say "reuse", it really needs to be reusable rather than just an excuse.


Can I sell apps on the apple's US app store market?

given Apple's bizarre geographical segregation I was wondering if, as an Italian, I am allowed to create an English application sold on the US app store for $0.99 (regardless of the current USD <=> EUR exchange rates). It seems a really stupid question and I really hope that I can but who knows, since I can't buy them maybe I can't sell them either.


What are some good ways for an experienced .NET client developer to start learning web development?

My background is as follows. I've been programming since I was young, worked in BASIC, then Asm for M68K, then C, C++, and now I've spent the past 5 years in .NET becoming a rather good .NET developer. Somewhere along the line, I realized I have no clue how the internet works, I don't know how TCP/IP works, I have no clue what HTML is capable of, or how PHP plays into the picture, or why Ruby on Rails should make me happy. I have no experience with LAMP or IIS, and I only have an inkling of a clue what Sharepoint is. In short: I'm internetstupid. I am intelligent and a capable developer, but I lack even rudimentary skills (routing, web hosting, hosting a custom DNS for intranet domain resolving, etc.) I have no clue where to start on web development learning. Here's the good news! I know what I'd like to learn to do (at least for now!) I want to be able to develop my own personal domain to host WSDL services, to power my applications, to showcase my work, to host my living resume, to market my brand so to speak. Stackoverflow, I beg you, help this disconnected but talented developer become part of the current era instead of being a relic stuck in the previous great golden age of software! Note: I'd prefer to stay wedded to MS for now for the most part as I'm already familiar with the .NET ecosystem. I'm okay branching out, but not ready to do so (I think?) If you can convince me otherwise that's fine.


Handling out of hours support

This isn't a programming question per se - more about application management. I work for what started out as quite a small company, which has grown rather quickly and become very succesful in a relatively small period of time. Nearly all trade happens online, and our IT team is very small relative to the amount of money that gets pumped through the site (it's me and two others). There are occasionally "blips" in the framework outside of hours, which inevitably results in either myself or one of my colleagues receiving a phone call. Our call centre aren't particularly great at analyzing errors etc.. and 99% of the time the solution is actually a data entry / user training issue. 1% of the time it's a real bug. Our company is now insisting that we three developers figure out an on-call rota where we can be contacted with assurances that we won't be out of town etc. unpaid whether we are called or not, in case something goes wrong out of hours. Not all of our skills overlap, so I may not be able to quickly diagnose and fix a problem that one of the others could (e.g. database timeouts would need the DBA, email issues would need our infrastructure guy, website issues would need me). None of us are particularly happy about this, so I was wondering if anyone else has had a similar experience and how you dealt with the situation? EDIT: Thanks all for the suggestions - I've marked one as the right answer purely on the basis as it made me feel a bit better, but all suggestions are pretty much bang on what we've been discussing internally. We do feel like it's a little unfair we now have to give up our weekends so everyone else can get rich. We are attempting to push towards a more mature development process to minimize bugs too, but that would require the rest of the company to change too and they _really_ don't want anything to change outside of IT!


How to maintain VCS changeset/revision simplicity in the face of accidental partial commits?

Working on a project with a couple of classmates, and I've noticed that we get a lot of partial commits which are then corrected:               Rev 249 Log: committing change foo, yeah!     Rev 250 log: oh dear, forgot these files!     Rev 251 log: oh my, how could I possibly forget another file in the *same* change?      The obvious answer is to be more careful. But as of 2011, programmers are still (almost) human, and are error prone. The problem is that this causes ambiguity when reverting or merging. Do we leave them there? Do we modify the commit history?


How to convince boss to start using Codeigniter or YII at work?

i work for a web development company and during the one year i have spent here, there were no improvements in the technologies we used to built our websites. I introduced jquery to them (buying the Novice to Ninja by Sitepoint) and now, i want to get rid of all these crappy PHP from scratch and use a PHP framework instead. So what reasoning i can use to convince my boss to switch, and how to convice the other developers too?


Would a multitouch capable PC allow me to do Android development simulating the touch UI without an Android device?

I recently purchased a Samsung Galaxy Tab as a reference implementation (phone and first gen Android tablet), of Android 2.x for app development. I have noticed a slew of Android 3.0 slates being talked about at CES 2011 (Motorola XOOM, etc.). If I had a multitouch PC with the Android SDK/Emulator on it, would this allow me to more closely approximate device simulation by allowing user input via the multitouch screen ? Would it work via touch just like Windows 7 recognizes touch as mouse style input ? Has anyone done this ?


Design review: how well does my object oriented design fit the SOLID principles?

_This thread will be long, but I will try to make it as short as I can. Thank you._ I have recently implemented a relatively simple program. What this program does is generate a simple piece of music and play it. I will describe the object oriented design of the program and would like to hear your review of the design. **Especially how well it fits the SOLID principles** , where it doesn't, and how I can improve my design to be more SOLID in the future. _(If there's something in the description that isn't clear enough, please tell me.)_ I have divided my design into two parts. **1-** The "behind the scenes" system that generates the content - a series of notes and chords (as will be explained later) - and is responsible for playing it. **2-** The system that provides a UI to control the "behind the scenes" system. This system tells the other system when to create new music and when to play it. I will describe each system separately. * * * **System 1 - responsible for the generating and playing music.** The way music is created is by first generating a chord progression (a series of chords to be played one after the other), and then generating a melody based on that progression. I will describe how this is designed 'from the bottom up'. **Generating a chord progression**. Class `Note`: the most basic class. Responsible for playing sound files, and is set in instantiation to play a specific sound (C, D, etc.). It has an interface to play() and to stop() the playback. It also has a method `getName()` to identify it (the name is fed to the Note through the constructor). Class `Chord`: this class is instantiated with an array of three `Note` objects and a name. For example, a `Chord` named `cMajor` will be instantiated with the Notes `c`, `e`, and `g` and the string "CMajor". `Chord` has an interface to play() and stop() the notes it's composed with, has a method `getName()` and a method `getNotes()` that returns the array of Notes. Class `Progression`: this class is instantiated with an array of `Chord` objects, and has logic to play and stop them one after the other in a particular tempo (speed, in BPM - beats per minute). It has a method `play(int bpm)` and a method `getChords()` that returns the array of Chords. Class `ProgressionGenerator`: implements an algorithm to create a particular series of `Chord` objects, and instantiate a `Progression` with these chords. To summarize: a Progression is composed of Chords, which are composed of Notes. The ProgressionGenerator instantiates a Progression with a particular series of Chords. **Generating a melody**. Class `MelodyNote`: composed with a single `Note`. It has an attribute `double duration` which specifies for how long this note is to be played relative to a measure/bar of music (e.g. 'half note' is specified as 0.5, 'quarter' as 0.25). It has a method `getDuration()` and an interface to play() and stop() it's inner `Note` (basically delegates to the Note). Class `Melody`: composed with a series of `MelodyNote`s. Has logic to play the series of notes in a particular speed. It uses each `MelodyNote`'s `duration` to know when to stop a note and play the next one. Class `MelodyGenerator`: implements an algorithm to generate a series of `MelodyNote`s and instantiate a `Melody` with it. It does this based on a `Progression`. The method signature is `Melody generate(Progression prog)`. **So to summarize:** Progression **\--> composed with** Chords **\--> composed with** Notes Melody **\--> composed with** MelodyNote **Each object controls it's inner objects and exposes them.** For example Chord has logic to play it's inner Notes, and has a method `getNotes()` that returns them to whoever needs to know. For example, `MelodyGenerator` uses `progression.getChords()` in order to build a melody according a particular series of chords. It also uses `chord.getNotes()` when choosing what notes to place over a chord. **One last thing:** the generators use the singleton class `NotesAndChordsSupplier` to get the Note and Chord instances they need. It hands them existing instances. * * * **System 2 - responsible for providing a UI to control the creation and playback of music.** This system is designed using the **MVC pattern.** The Model encapsulates the creation and playing of music. The View is the UI that provides buttons to tell the Model to play and make new music. The Controller is notified by the View when buttons are pressed and invokes the proper actions on the Model. **The Model** The Model contains a `Progression`, a `ProgressionGenerator`, a `Melody` and a `MelodyGenerator`. When it's told to generate new music, it simply delegates the task to the generators. When it's told to play music, it delegates the task to the melody and progression. Simplified code:               public void makeNewMusic(){         progression = progGenerator.generate();         melody = melodyGenerator.generate(progression);     }          public void playMusic(){ // this actually starts two separate threads, but irrelevant.         progression.play();         melody.play();     }      The Model is connected (in a loosely-coupled manner) to two objects: it's `Melody` and the `View` \- both via the Observer pattern. The Model implements two interfaces: `Observer` and `Observable`. It's registered as an observer to the Melody, and the View is registered as an Observer to the Model. When the Melody finishes it's playback, it notifies it's observer - the Model. When the Model is notified, it notifies it's own observer - the View. This way, the View gets notifies when playback is finished, so it can re- enable it's UI buttons that were disabled during playback. **The View** The View is the UI and it has two buttons: `Play` and `New Tune`. They invoke `playButtonPressed()` and `newTuneButtonPressed()` on the Controller, respectively. The View also features `enableButtons()` and `disableButtons()` methods. As I said, the View is registered as an Observer to the Model. It is notified when playback of the music is finished, so it can re-enable it's buttons that were disabled by the Controller when playback started. **The Controller** When the View calls `newTuneButtonPressed()` on the Controller, it simply delegates to the Model: `model.makeNewMusic()`. When the View invokes `playButtonPreesed()` on the Controller, two things happen. 1- The Controller calls `disableButtons()` on the View. 2- The Controller calls `playMusic()` on the Model. All buttons on the View are disabled by the Controller when music playback starts. The Controller registers the View as an observer to the Model, and the Model as an observer to it's member Melody. * * * **UML class diagram to illustrate the architecture** _(Please note: in this post I ommited a class`Scale`, which isn't important. Ignore it in the diagram)._ ![enter image description here](http://i.stack.imgur.com/Xi0mc.png) * * * **Thank you for reading all of this. I will appreciate any kind of criticism of the object oriented design of the program.** **Especially, how well are SOLID and OO principles integrated in my design, and how can I design more in the spirit of SOLID on the future.**


How can I identify a namespace without using a string literal?

My team has a lot of IOC conventions that look something like...               if (type.Namespace == "My.Fun.Namespace")     {         // do stuff     }      Of course, maintaining this kind of thing becomes brutal after awhile, and we would rather not. The only option I could think of was to store these all in one place, as string constants or something of that nature, but that isn't a lot better... We have been considering making classes that basically serve as namespace identifiers in order to have almost an anchor type to key off of, like, say...               if (type.Namespace == typeof(My.Fun.Namespace.MarkerClass).Namespace)     {         // do stuff     }      But that just feels weird. So is there another way to solve this one that we just don't know about? If not, has anyone had any luck with the whole marker class concept?


How would you advocate not using a shared spreadsheet to track bugs / issues?

In our company, the developers want to use a proper bug tracking tool to manager issues in our application. The management however insists on using a shared spreadsheet (formeerly a shared excel file, now a spreadsheet on a web base solution allowing concurrent access). Their argument is that the spreadsheet allow them to have a more highlevel view of the state of the project as they can see how many bugs are open with a quick glance. This also allow them to see who is working on each bug, and get estimation of the time required to close them all (as developer are required to fill time estimation of the bug they are working on). As you can understand, this is not really practical to use for the developers (bug tracking software were invented for a reason). So how can I advocate bug tracking software to ease the work of the developer ? As a bonus, which software would you recommend that would allow the management to be able to get their feedbacks (number of bugs opens, who is working on them, time estimation) with a high level view ?


Compatibility Test and other testing method to use while building software

I will be adding a feature to the software and have to update or modify some of public API of the present open source software. What are steps which could be taken to ensure the compatibility of the software. what are the testing methods which are used in open source world to test the newly added features?? Open Source program is: Xapian


New grad; To overcome complete lack of experience, should I ditch a creative pet project in lieu of one that would demonstrate more applicable skills?

I am currently working on a project on github that I think would be a good demonstration of my initiative, creativity and enthusiasm. It is an educational game I am developing in pygame that enables the user to learn to improve their development productivity by using vim, specifically with python, though learning to code faster with vim should be transferable to any language. I think this is something that might have a mass appeal and benefit to a lot of people in a measurable way. -However- I am graduating from college in a month (my degree is computer science with a minor in English), with no experience that is relevant to helping me get any kind of job in the field, and a gpa that doesn't tout my merits. I could pursue a career in game development, but it's not necessarily what I'm most interested in, and see myself applying to startups around the country. To the places I am looking at applying, showing that I have experience with pygame is going to be largely irrelevant, except in demonstration of my ability to code, period. A lot of skills that ARE more marketable, such a data modeling, GIS, mobile application, development, javascript, .net framework, and various web development technologies, are not going to be showcased by this project (on the upside, employers do like to see familiarity with git and python). I'm wondering if I should sink all my free time in the next couple of months into this project, since I'm motivated and interested in it, and if the value of being able to demonstrate ambition and 'good ideas' (for lack of a better term, and in my own opinion) will compensate for the absence of demonstrating more sought-after skills. I am probably at a point where I should either commit fully to this project now, or put it on the backburner in favor of something else, and I am leaning towards continuing with what I am already working on, because I think it's a great idea, and something achievable to me with enough dedication over the next couple months. But the most important thing to me is being able to get a job out of college, which I am exceedingly concerned about as the professional landscape which I am navigating for the first time is a lot more intimidating than I could have anticipated, with almost every job (even short-term contract positions) requiring years of experience which I lack. ## So in brief, the common denominator to answering the question "How can I overcome experience requirements for a job" seems to be "Show off your own project." I want to know WHICH project I should work on to best increase my chances of getting a job out of college, keeping in mind that I have no experience. I believe this question is applicable to any new grad that lacks demonstrable experience.


Assignment of roles in communication when sides could try to cheat

Assume two nodes in a peer-to-peer network initiating a communication. In this communication, one node has to serve as a "sender", another as a "receiver" (role names are arbitrary here). I'd like the nodes to assert either role with approximately equal probability. That is, in N communications with various other nodes a given node would assume the "sender" role roughly N/2 times. Since there's no third-party arbiter available, nodes should agree on their roles by exchanging messages. The catch is that we can encounter a rogue node which would try to become the "receiver" in most or all cases, and coax the other side to always serve as a "sender". I'm looking for an algorithm to assign roles to sides of communication so that no side could get a predetermined role with high probability. It's OK for the side which is trying to cheat to fail to communicate.


When to use HTTP status code 404 in an API

I am working on a project and after arguing with people at work for about more than a hour. I decided to know what people on stack-exchange might say. We're writing an API for a system, there is a query that should return a tree of Organization or a tree of Goals. The tree of Organization is the organization in which the user is present, In other words, this tree should always exists. In the organization, a tree of goal should be always present. (that's where the argument started). In case where the tree doesn't exist, my co-worker decided that it would be right to answer response with status code 200. And then started asking me to fix my code because the application was falling apart when there is no tree. I'll try to spare flames and fury. I suggested to raise a 404 error when there is no tree. It would at least let me know that something is wrong. When using 200, I have to add special check to my response in the success callback to handle errors. I'm expecting to receive an object, but I may actually receive an empty response because nothing is found. It sounds totally fair to mark the response as a 404. And then war started and I got the message that I didn't understand HTTP status code schema. So I'm here and asking what's wrong with 404 in this case? I even got the argument "It **found** nothing, so it's right to return 200". I believe that it's wrong since the tree should be always present. If we found nothing and we are expecting something, it should be a 404. # More info, I forgot to add the urls that are fetched. Organizations               /OrgTree/Get      Goals               /GoalTree/GetByDate?versionDate=...     /GoalTree/GetById?versionId=...      My mistake, both parameters are required. If any versionDate that can be parsed to a date is provided, it will return the closes revision. If you enter something in the past, it will return the first revision. If by Id with a id that doesn't exists, I suspect it's going to return an empty response with 200. ### Extra Also, I believe the best answer to the problem is to create default objects when organizations are created, having no tree shouldn't be a valid case and should be seen as an undefined behavior. There is no way an account can be used without both trees. For that reasons, they should be always present. # also I got linked this (one similar but I can't find it) http://viswaug.files.wordpress.com/2008/11/http-headers-status1.png


Haskell Using Source File Problems

I recently started using Haskell Platform. I created a source file using Wordpad and named it add. I tried double clicking it so I can open it in ghci but I get <[1 of 1] Compiling Main (C:\add.hs,interpeted) C:\add.hs:1:6: parse error on input '\' Failed modules loaded: none.> What do I do so I can use my source file?. Should I use another text editor?. Thanks


Distributed Development Tools -- (Version control and Project Management)

I've recently become responsible for choosing which source control and project management software to use for a company that employs me. Currently it uses Jira (project management) and Subversion (version control). I know there are many other options out there -- the ones I know about are all in this article http://mashable.com/2010/07/14/distributed-developer-teams/ . I'm leaning towards recommending they just stay with what they have as it seems workable and any change would have to be worth the cost of switching to say github/basecamp or some other solution. Some details on the team:   * It's a distributed development shop. Meetings of the whole team in one room are rare.   * It's currently a very small development team (three developers).   * The project management software is used by developers and a product manager or two. What are you experiences with version control and project management web applications? Are there any you would recommend and you think are worth the switching cost of time to learn new services / implementing the change? Edit: After educating myself further on the options it appears DVCS offer powerful benefits that may be worth investing in now as opposed to later in the company's lifetime when the switching cost is higher: I'm a Subversion geek, why I should consider or not consider Mercurial or Git or any other DVCS?