How can we improve overall Programmer Education & Training?

Last week, I was just viewing this amazing interview by Kevin Rose of Phillip Rosedale, of Second Life. And they had an amazing discussion about how to find, hire and identify good programmer's, and how hard it is to find good ones. Which has lead me to really think about the way we programmer's learn, are taught. For a majority of us, myself included, we are self-taught. Which is great about being a programmer, anyone can learn and develop skills. But this also means, that there is no real standards of what a good programmer is/are, and what kind of environment's encourage the growth of programming skills. This isn't so much a question, but just a desire in me, to see how we can change the culture of programming, and the manager's of programming, so that education and self-improvement is encouraged. There are a lot of avenue's for continued education, youtube videos, books, conferences, but because of the experiental nature of what we do, it isn't always clear what's important to learn and to master. Let's look at the The Joel 12 Steps. The Joel Test Do you use source control? Can you make a build in one step? Do you make daily builds? Do you have a bug database? Do you fix bugs before writing new code? Do you have an up-to-date schedule? Do you have a spec? Do programmers have quiet working conditions? Do you use the best tools money can buy? Do you have testers? Do new candidates write code during their interview? Do you do hallway usability testing? I think all of these have important value, but because of something I call the Experiential Gap, if a programmer or manager has never experienced any of the negative consequences for not having done items on the list, they will never see the need to do any of them. The Experiental Gap, is my basic theory, that each of us has different jobs and different experiences. So for some of us, that have always worked with dozens of programmer's, source control is a must have. But for people who have always been the only programmer, they can not imagine the need for source control. And it's because of this major flaw in how we learn, that we evaluate people by what best practices they do or not do, and the reason for either can start a flame war. We always evaluate people in our field by what they do, and think "Oh if this guy/gal isn't doing xyz best practice, he/she can't be a good programmer, so let's not waste time or energy talking to them." This is exactly why we have so many programming flame wars, that it becomes, because of the Experiental Gap, we can't imagine people not having made the decisions that we have had to made. So this has lead me to think, that we totally need to rethink how we train, educate and manage programmer's. For example, what percentage of you have had encouragement by your manager's to go to conferences, and even have them pay for it? For me, and a lot of people, this is extremely rare, a lot of us would love to go to conferences, to learn more, but the money ain't there to do that. So the point of this question is really to spark a lot of how can we train, learn and manage better? How can we create a new culture of learning that doesn't insult people for not having the same job experiences. Yes we all have jobs and work to do, but our ability to do our jobs well, depends on our desire, interest and support in improving our mastery of our skills. Right now, I see our culture being rather disorganized, we support the elite, but those tons of us that want to get better, just don't have enough support to learn and improve ourselves. I mean, do we as an industry, want to be perceived as just replaceable cogs? Thank you...


Is it better to concentrate on one or two research projects throughout undergrad?

Currently in the 4th semester of engineering in an Indian university. The thing is - is it better to do as many short-lived projects/research work on diverse topics of computer science or stick to one/two projects consistently throughout my undergraduate years? Case in point: currently working on an image-processing project that promises to carry on for a year or so (as per the prof). Does this seem like being over-specialized at too early a level? Although taking on too many things will spread me out thin and in all probability not end up getting any meaningful work done. Especially as I hope to apply for grad school in the US. Would really appreciate any views and suggestions on this.


Common interview: flexibility on code test?

I'm looking my first job and tomorrow I have my first interview in which they will test my programming skills by doing some code. I want to know if it's usual they let you search on internet if you don't remember an specific method name or something related to syntax's ?. If this is unusual then what should I do in case of forget something related to syntax?


Should I label class diagram variables as private or public?

In my program, I have several class variables whose access specifier is known as private package. The default accessor specifier in Java is known as private package where it is accessible within the package which the class belongs to. For the UML class diagram , should I label these variables as public or private? I can't decide because of this concept of private package.


Why use classes when programming a tkinter gui in python

I program primarily in python and have programmed a couple of GUI's with Tkinter, every tutorial I have ever seen has recommended defining and using a class for the GUI, but my GUI runs flawlessly using only procedures, without a class. Why use a class? It seems from my perspective to simply be an extra layer of complexity and unnecessary code.


Is better Show() + Hide() or SetVisible(bool visible)?

What is better and why? (From interface-design point of view) : a) To have two `Show()` and `Hide()` functions b) To have one `SetVisible(bool visible)` function EDIT: For example some object have visibility state and this functions is used to change it. c) To have all three `Show()`, `Hide()`, `SetVisible(bool visible)` functions


Can you use UML in a TDD project?

If so, at what stage? or it is also an iterative process? If iterative, how formal? Also, how useful is UML for a solo programmer doing open source? While I like to see a picture of the system, it feel so formal and a bunny trail for TDD. Thanks.


Same source code compiling in various languages

What do you call source code valid in several languages? There was a specific word for it and really crazy examples.


How should I handle using two databases with a legacy PHP application?

I have a legacy PHP application that was written in 2004 and uses MSSQL as a database backend. At this stage MSSQL is still supported by PHP but only just via a Microsoft driver. I have looked at converting to mysql via automated tools, which work quite well, but I have quite complex views which need a lot of individual work to convert. I don't have a great deal of time to do this. Many tools I wish to use and frameworks I would like to move the application to, don't support MSSQL, so I was considering adding new features using a new mysql database and wondered if anyone had opinions on the pros and cons of using two seperate database backends in a single application?


How to make custom libraries accessible?

I am trying to compile and install every custom module under it's own designated folder. (ex: `/myApps/myLinux/compiled_app`) I had luck with Python so far, where my Python is compiled from source and lives in: `/myApps/myLinux/python2.5` and "python2.5" -> `/myApps/myLinux/python2.5.6-gcc463` So I can access this Python through a wrapper script that sets the right environment. The question is recently I had to compile and add something called gperf3.0.4. So now it lives: `/myApps/myLinux/gperf3.0 and "gperf3.0" -> /myApps/myLinux/gperf3.0.4-gcc463 ` The question is: How will I point to this lib if some other app needs to access it? Is it done through the LD_LIBRARY_PATH variable?


How do you detect lying Stubs/Mocks?

Consider this piece of code from the PHPUnit manual(I'm using PHP only as an example):               class StubTest extends PHPUnit_Framework_TestCase     {         public function testStub()         {             // Create a stub for the SomeClass class that could be later injected into another class, but removed here for simplicity.             $stub = $this->getMock('SomeClass');                  // Configure the stub.             $stub->expects($this->any())                  ->method('doSomething')                  ->will($this->returnValue('foo'));                  // Calling $stub->doSomething() will now return 'foo'.             $this->assertEquals('foo', $stub->doSomething());         }     }      Now I just stubbed the method `doSomething()` to return `foo`. What if some time later in the future I decide to implement `SomeClass` like this:               class SomeClass{              function doSomething(){             return 'bar';         }     }      Of course i have tests for `SomeClass` that test for `bar`, but I totally forgot to test for `foo`. Now I have a lying test. How does TDD handle this situation?


Storing data in elasticsearch vs mongodb

We are trying to create an online-shopping like application in which we have to store a huge amount of data,since the data that will be stored are mostly document like data, the suggestion was to store the data in mongodb and using elasticsearch to add the search functionality, but i also know that elasticsearch itself can be used as a database to store the data, but I'm not sure if that's the right thing to do. Can you guys help me out?


Should I implement a function or a method?

Once in a while I encounter a C function in my colleagues' code. Mostly it is in some helpful objective categories, and those functions are mostly an internal calculation of something or a comparison of values. Since those guys are not part of the company anymore, I can't ask them why they decided to go with a C function instead of a proper objective C method. So the question is: Why implement certain algorithms as a C function instead of objective C method? What are the considerations?


Who is a CMS really for?

I have started lately discovering `Content Management Systems`, and I was wondering, who is really **CMS** for? What I mean by that: is it only for `companies`, `small businesses` or `individuals`, that pays a contractor to make a website that it's users can just upload content through a easy interface. Or is it used also by programmers, to build their own websites, projects? Would a _Facebook_ , _Tweeter_ , `StackExhange` ever started by using a **CMS** , a very powerful one for example. Would you as a programmer build your own "fancy" website on top of a **CMS** , for example like Typo3, or you would build it from scratch? P.S To be more clear is a summary: _`What I mean to begin with is, would I as a developer choose a CMS to develop a website that can be scaled with a big base of users, be stuck if I choose to start with a CMS system. What if I build a website using CMS, and the website explodes in popularity, and then I wanted to add much more functionality that I have planed, is it possible that the CMS will limit the growth, because it might have not been build for that kind of scale?`_


Should a developer also act as a tester?

We're a scrum team of 3 developers, 1 designer, the scrum master, and the product owner. However, we don't have official tester in our team. A problem that is always with us, is that, testing the application and passing those tests and removing bugs has been defined as one of the criteria to consider a PBI (Product Backlog Item) as done. But the problem is that, no matter how much we (3 developers and 1 designer) try to test the application and implemented use cases, still some bugs are not seen and ruin our presentation (Murphy's law) to stakeholders. As a remedy, we recommended that the company hire a new tester. Someone who's job would be testing, and testing only. An official professional tester. However, the problem is that, scrum master and stakeholders believe that a developer (or a designer) should also be a tester. Are they right? Should we developers (also designers) be testers too?


Are programmers bad testers?

I know this sounds a lot like other questions which have already being asked, but it is actually slightly different. It seems to be generally considered that programmers are not good at performing the role of testing an application. For example: Joel on Software - Top Five (Wrong) Reasons You Don't Have Testers (emphasis mine) > Don't even think of trying to tell college CS graduates that they can come > work for you, but "everyone has to do a stint in QA for a while before > moving on to code". I've seen a lot of this. **Programmers do not make good > testers** , and you'll lose a good programmer, who is a lot harder to > replace. And in this question, one of the most popular answers says (again, my emphasis): > Developers can be testers, but they shouldn't be testers. **Developers tend > to unintentionally/unconciously avoid to use the application in a way that > might break it.** That's because they wrote it and mostly test it in the way > it should be used. So the question is _are programmers bad at testing?_ What evidence or arguments are there to support this conclusion? Are programmers only bad at testing their own code? Is there any evidence to suggest that programmers are actually _good_ at testing? What do I mean by "testing?" I do _not_ mean unit testing or anything that is considered part of the methodology used by the software team to write software. I mean some kind of quality assurance method that is used after the code has been built and deployed to whatever that software team would call the "test environment."


Training resources or ideas for very small team without a dedicated QA person or QA team

I have a very small 3-developer programming team that has zero QA people. We would like to hire a QA person but are unable to at this time. Until we can hire a QA person with proper QA training we're going to have to test each other's work. I'd like to hear from anybody who has done this, how one does such training. I am an expert developer, and I respect QA as a separate profession. I don't think I think like a QA person, but I need to start thinking more like one. In the absence of other people doing this job, some of it will fall to me. Is there any book, or tutorials on How to Do a Good Job at Testing and QA on a software product that addresses the idea of teaching a programmer to do QA? Similar question here suggest to them that they run their team with Scrum, which we are currently working towards, but we will have to do without a QA person at least until our team size can increase.


Should a developer create test cases and then run through test cases?

I work for a company where the development manager expects a developer to create test cases before writing any code. These test cases have to then be maintained by the developers. Every-so-often a developer will be expected to run through the test cases. From this you should be able to gather that the company in question is rather small and there are **no testers**. Coming from a Software Architect position and having to write / execute test cases wearing my ' _tester_ ' hat is somewhat of a shock to the system. I do it anyway but it does seem to be a rather expensive exercise :) **EDIT:** I seem to need to elaborate here: I am _not_ talking about unit-testing, TDD, etc. :) I am talking about that bit of testing a **tester** does. Once I have developed a system (with my unit tests / tdd / etc.) the software goes through a _testing phase_. Should a developer be _that_ tester and developer those _test cases_? I think the misunderstanding may stem from the fact that developers, typically, are not involved with this type of testing and, therefore, assumed I am referring to _that_ testing we do do: unit testing. But alas, no. I hope that clears it up.


Should developers be responsible for testing other developer and contractor/vendor code?

I have been working (~ 5 years & first IT job) as an application developer at a large financial institution with a strict corporate hierarchy, multiple LOBs, and heavily process-laden IT departments. Now, one aspect of this culture is to use a lot of external contractors and vendors to port legacy code to current technologies. However, the internal developers are made to test (black-box) their code. A majority of the time these external developers do not ensure that their apps work end-to-end properly before releasing their code and wait for us (internal developers) to investigate issues/collect logs/any screen shots of failure/database logs etc. I am wondering if anybody else has encountered such a situation in their role as developers in IT shops/orgs. Do you really improve technically or intellectually, especially, on large complex projects where testing can go on for more than 6 months ? For instance, I went a whole 7 months QC'ing and acting as a non-coding team-lead thinking that I should not let the team down. However, I see now that this is detrimental to my coding skills.


Functional testing must be done by external party to avoid bias?

Our developers demand that someone external to the development team completes the functional testing. Their argument is that they are biased and cannot test their own code as they are too close to it. Our last round of testing is with the client in the form of UAT. To be clear by 'functional testing' I mean testing the code against the specs, eg. when you click on 'submit' the index page should load. By UAT I mean the client comes in and runs through use cases on the release candidate. While I understand this argument of bias, is it reasonable for the developers to demand someone else complete their functional testing or is this just a way to avoid doing their job?


Mobile applications in Delphi

Many of us know that Delphi executables are little bit gigantic, but again it is acceptable as nowadays 1.5 mb is not a big issue in PC. But what about mobile devices? Currently Firemonkey supports iOS and in the near future it is going to Android and so on. Isn't 4 mb of executable size for mobile devices is too much for a simple application? Will Delphi team try to reduce the size of executable in the future OR is it possible to do without loosing most of the features in Firemonkey?


Will I learn more freelancing or working for a company?

I got out of school about a year ago, and have been freelancing since then. Sometimes it seems like it would be a good idea to work for a company for a few years, to learn from people with more experience than I have. But on the other hand, working for myself has let me pursue projects/technologies that I'm interested in learning about, and I'm hesitant to give that up. Any advice?


How do I spot and document a GPL violation?

How to spot that someone copied open source code licensed with GPL to their closed source commercial application, when you don't have access to their closed source code? Edit: Great answers! Part 2. What if it is a webapp where you don't even have access to the executables? Scenario: They copy the source, make some minor changes to the gui so the front end is nearly identical; add a new feature to the otherwise totally identical back-end; and fail to release it back to open source.


Efficient way to find highest value from predicates

I have predicate, that enumerates through backtracking list of values. I want to find highest value from this list. For example:               ranked_move(X,Y,R) :- between(0,10,Y), between(0,10,X), rank_move(X,Y,R).     top_move(X,Y) :- % X, Y for highest R      Right now, I have it solved by using `findall` and custom predicate that goes through the list and remembers highest value it comes across. But I would like to know if there is way to do it without first turning the moves into a list. Eg. do the picking predicate directly on `ranked_move`. I know about http://stackoverflow.com/questions/1701693/max-out-of-values- defined-by-prolog-clauses . I haven't tried it, but I assume Prolog is not going to go through the predicates efficiently.


how to contribute the same source code to two separate open-source projects?

Let's say there are two similar open source projects A and B, both licensed under the Apache Software License 2.0. I would like to contribute an improvement to both projects (because I don't know which one is administered better, and I would like to see my improvement show up in both). Is there a way I can contribute this improvement to both projects in a simple way? (One obvious approach is to start an open source project C licensed under Apache 2.0, but that's a headache for various reasons; I don't want to maintain a project myself)


What is the proper response to lousy error message?

I've just come across (for the 47 millionth time) some code that looks like this:               except IOError, e:       print "Problems reading file: %s." % filename       sys.exit( 1 )      My first reaction is very visceral: the person who coded this is a complete idiot. How hard is it to print error messages to stderr and to include the system error message in the string? It certainly used to be the case that, for simple programs (command line filters), best practice was to print error messages to stderr and (when appropriate) to include the system error in the message. A very large percentage of developers no longer follow those rules. Many questions of the form "what is best practice for error messages" include answers about massive logging frameworks and exception handling mechanisms that do not apply to the simple filter. Has best practice changed? or is failure to include system error messages and printing error messages to the wrong stream the mark of a novice?


It's 2011 - why do I still have to use tables for email?

This might seem like a rant, but I am curious. CSS replaced tables for layout a long time ago. But we still have to use tables for layout when creating rich emails. Why is this? Are there any other options? Are there really technical constraints that prevent CSS from working in an email. What are they? I can see how linked or embedded style sheets might be a problem, but not even inline styles work. Is this ever going to change?


How would you TDD the functionality of getting the corresponding process of a running windows service?

## Purpose Over the last year or more I've been learning unit testing via books I've read recently like _The Art of Unit Testing_ , _Working Effectively with Legacy Code_ , and others. I've also been using unit tests, mocking frameworks, and the like, periodically at work and definitely see the value. However, I'm still having a hard time wrapping my mind around TDD (as opposed to TAD) when the situation calls for code that is gong to mostly use external API calls. ## Problem to solve Get the process associated with a windows service using the service name. example: `Function GetProcess(ByVal serviceName As String) As Process` ## Rules   * Show each major iteration in production & test code using TDD      * No need to see any other code or configuration that is required to get things to run. Just curious about the interfaces, concrete classes, and test methods.   * C# or VB.NET   * Must use the .Net framework regarding services/processes (i.e. `System.Diagnostics.Process`)   * Test Frameworks:      * Nunit or MSTest   * Isolation Frameworks:      * Moq, Rhino Mock, or Microsoft Moles   * Must write true unit tests (no integration tests) ## Additional notes As far as I can tell there are two approaches design wise.   1. Use an Inversion of Control approach along with using the Adapter and/or Facade patterns to wrap the underlying .net framework objects dealing with processes and services.   2. Keep the .net framework code in the class containing the Get Process method and use code detouring (interception) via Microsoft Moles to isolate the hard dependencies from the method under test.


How do you use blank lines in your code?

There has been a few remarks about white space already in discussion about curly braces placements. I myself tend to sprinkle my code with blank lines in an attempt to segregate things that go together in "logical" groups and hopefully make it easier for the next person to come by to read the code I just produced. In fact, I would say I structure my code like I write: I make paragraphs, no longer than a few lines (definitely shorter than 10), and try to make each paragraph self-contained. For example:   * in a class, I will group methods that go together, while separating them by a blank line from the next group.   * if I need to write a comment I'll usually put a blank line before the comment   * in a method, I make one paragraph per step of the process All in all, I rarely have more than 4/5 lines clustered together, meaning a very sparse code. I don't consider all this white space a waste because I actually use it to structure the code (as I use the indentation in fact), and therefore I feel it worth the screen estate it takes. For example:               for (int i = 0; i < 10; ++i)     {         if (i % 3 == 0) continue;              array[i] += 2;     }      I consider than the two statements have clear distinct purposes and thus deserve to be separated to make it obvious. So, how do you actually use (or not) blank lines in code ?


How up-to-date is the Joel test?

I want to convince my partners that we should have a spec and that bugs should get fixed before writing new code. Should I refer to the Joel test? Do you think that the Joel test is up to date? I think that not having a spec is bad project management. Do you agree with the Joel test? Could you add something? It doesn't mention for instance Open Source.


Is it bad practice to update an object in a static method?

Still learning .net and OOP and have a basic question I hope. This is an asp.net mvc app. Looking at the code below, I am most concerned with the line in CheckShippingVendor that says ValidateDelivery(shipmentItem). Is it okay to pass in an object as a parameter and have the private static method update that item. When I did a resharper Extract Method refactoring this is what it did for me. Class is instantiated and call the CheckShippingVendor method:               var packageStatus = _inventoryService.CheckShippingVendor(shipmentId, shipmentFile);      Here is the rest of the code:               public PackageStatus CheckShippingVendor(string shipmentId, mvFile shipmentFile)     {             var packageStatus = new PackageStatus();             using (var shipmentItem = shipmentFile.Read(shipmentId))             {                     ValidateDelivery(shipmentItem);                     shipmentFile.Write(shipmentId, shipmentItem);             }             return packageStatus;     }          private static void ValidateDelivery(mvItem shipmentItem)     {             int shipped;             var shippedResult = Int32.TryParse(shipmentItem[1].ToString(), out shipped);             if (!shippedResult)                 return;                  int delivered;             var deliveredResult = Int32.TryParse(shipmentItem[57].ToString(), out delivered);             if (!deliveredResult)                 return;                  shipmentItem.Message = "NO INFORMATION AT THIS TIME";     }


What features in Eclipse is not available in Visual Studio?

I have done much development in Java using Eclipse, and now I have started to use Visual Studio for .NET development. So far I find the IDEs to be able to do the same things, but just different. What features in Eclipse isn't available in Visual Studio?


Is the algorithm more important than the programming language?

During the current (2013) Google Code Jam contest, there was a problem that took C++ and Java people 200+ lines of code as compared to Python people that solved the same problem only using 40 lines of code. Python is not directly comparable with C++ and Java but the difference in verbosity I thought might perhaps have an influence on the efficiency of the algorithm. How important is knowing the right algorithm compared to the choice of language? Could an excellently implemented Python program be implemented in C++ or Java in a better way (using the same algorithm) and does this have any relation to the natural verbosity of certain programming languages?


In functional programming how does one achieve modularity through mathematical laws?

I read in this question that functional programmers tend to use mathematical proofs to ensure that their program is working correctly. This sounds alot easier and faster than unit testing, but coming from an OOP / Unit Testing background I've never seen it done. Can you explain it to me and give me an example?


Debugging applications

In my current developement, I have decided to keep the command prompt open so I can see debug messages. For example, if something wasn't happening when it should, I would put a cout statement at every function to determine where the broken link is. Sometimes, I might get hundreds of the same message (like WM_MOUSEMOVE) and I need to determine whether or not the messages are still coming, so I would using a static variable, and increment it, so I might have:               ...     3> WM_MOUSEMOVE processed.     4> WM_MOUSEMOVE processed.     54> WM_CLICK processed.     5> WM_MOUSEMOVE processed.     ...      in my cmd. (Don't ask me why there would be 54 WM_CLICK and 4 WM_MOUSEMOVE) What I would like to know is your opinion. Is this a good approach to debugging? What kind of syntax would you use for consistency? Does a syntax even matter? And would you make any suggestions to how this method could be improved.


How do I get into R&D?

I'm beginning to think that I might be best suited for a job in R&D. The reason being that I like jobs that allow me to be creative and I generally am more interested in solving puzzles than building things. I really dislike jobs that just boil down to translating requirements into code. Here's the kicker though: I don't have a bachelor's much less a masters or phd. Is it possible for me to land a job like this?


How do you endorse/support a code project that you find helpful?

How do you endorse/support a code project that you find helpful, be it established, emergent or fledgling? I think there are some obvious answers, but hopefully there will be some novel suggestions too.


Is it legal to distribute a GPLv3 licensed binary through the apples' app store?

I wrote a small multiplatform app and I am considering publishing the osx version in apple store. I've licensed the app under a GPLv3 license. I sort of like the GPLv3 license but I also like the easiness of apple store. I'm worried about the GPL's "freedom to distribute a copy" requirement - which seems to be incompatible with apple store policies (I think there is a line that states that downloads are for personal use only). Is this a valid concern? Can I meet the requirements of the GPL by distributing the osx binary at the same place as the source, since I can't do it in the apple store? Or is this forbidden by the apple store policy (it seems to require that apple store software be downloadable only from apple store)? **edit** By apple store I mean mac app store (gpl is not compatible with iPhone's app store). **edit 2** I add a good clarification to the accepted answer from the comments by Abhi Beckert: > So, if you wrote all the code yourself then you do whatever you want > including releasing it on the Mac/iPhone App Stores. If you didn't write all > the code, then you need permission from anyone who ever wrote even one line. > All of the GPL apps which have been pulled, were pulled because one (or > more) of the developers demanded that it be taken down. Once that happens, > Apple must pull it, or they'd face criminal charges And in practice: remove all mercurial changesets that are not yours and make the program work after that (or ask for approval from the person who wrote the changeset).


Should I accept a job if pair programming is required?

I have been offered an interesting job, but there's a big caveat for me: they use pair programming. I hate the idea of pair programming, and I'm probably not suited for it: I like to do frequent pauses, I hate to see someone programming (I would constantly poke the pair away to code myself), I have to be in full control of the machine I'm working on, I like to work listening music, and basically I don't like to being tied to someone else. I'm not even a social person. I have however never actually worked with true pair programming (besides few times for a short time to help someone else or to solve a complex task together)... so it is pair programming really that bad? And given my attitude, should I refuse the job or should I leave my current one and give a try? * * * For people that asked about it: I'm looking for a job where formal design and development are used, as I hate my current job where we are "coding in the wild". The company is very interested in my technical profile so they insisted even when I specified I never worked with pair programming and that I probably wouldn't like it (besides being an unsociable loner programmer, I don't like and believe the very concept of pair programming).


Proper way to structure JSON for front-end consumption

Having worked on several different web application code bases, I've seen some divergence in how back-ends serving JSON to front-ends structure that data. In particular, when a backend wants to return a number of objects of the same structure. Do you just wrap up all of the objects in an array? What about the "key" of the first array? What should that be? For example, say my back end wants to return a number of "image" items. Each image item is structured like this:               {         "id" : 123,         "filename" : "someFile.jpg",         "caption" : "some image or other",         "gallery" : 123     }      How would I structure a grouping of these items properly for consumption by a javascript front-end?


Clarification about Polymorphism / Inheritance

I am trying to better my understanding of polymorphism. Say I have a base class called `baseClass` with one method called `foo()` and I have three derived classes called `derived1` , `derived2` and `derived3` which all override the and implement their own versions of the `foo()` method. If I have an array of `baseClass` objects can it contain objects that are derived from that base class like so:               baseClassArray: [ derivedObj1, derivedObj2, derivedObj3];      Also if I pull an object out of this array and called the `foo()` method would it call the method defined in baseClass or the method defined in the respective derived class? Or does this depend on the programming language this is implemented in?


What one should look for when choosing a cross-platform C++ GUI library?

As a learning C++ programmer, I am trying to select a GUI framework or library for my own projects. I have some experience with Qt: it's very straightforward, it has a very good documentation, and provides a lot of tools, but it seems to duplicate a lot of the standard library. Are all C++ GUI libraries like this? What should I be looking for in a GUI library? How do I determine which one would be best given a particular problem? Should I focus on one specific library, or is it worth it to know several of them as they might serve different purposes?


Is big-O really that relevant when working in industry?

In every interview I have been in, I have been quizzed on mathematical analysis of complexity, including big-O notation. My question is, how relevant is this test to development in industry? How often do you reeeally use it, and how necessary is it to have a honed mindset for the problem?


Design considerations on JSON schema for scalars with a consistent attachment property

I'm trying to create a JSON schema for the results of doing statistical analysis based on disparate pieces of data. The current schema I have looks something like this:               {         // Basic key information.         video : "http://www.youtube.com/watch?v=7uwfjpfK0jo",         start : "00:00:00",         end : null,              // For results of analysis, to be populated:         // *** This is where it gets interesting ***         analysis : {             game : {                 value: "Super Street Fighter 4: Arcade Edition Ver. 2012",                 confidence: 0.9725             }             teams : [                 {                     player : {                         value : "Desk",                         confidence: 0.95,                     }                     characters : [                         {                             value : "Hakan",                             confidence: 0.80                         }                     ]                 }             ]         }     }      The issue is the tuples that are used to store a value and the confidence related to that value (i.e. `{ value : "some value", confidence : 0.85 }`), populated after the results of the analysis. This leads to a creep of this tuple for every value. Take a fully-fleshed out value from the `characters` array:               {         name : {             value : "Hakan",             confidence: 0.80         }         ultra : {             value: 1,             confidence: 0.90         }     }      As the structures that represent the values become more and more detailed (and more analysis is done on them to try and determine the confidence behind that analysis), the nesting of the tuples adds great deal of noise to the overall structure, considering that the final result (when verified) will be:               {         name : "Hakan",         ultra : 1     }      (And recall that this is just a nested value) In .NET (in which I'll be using to work with this data), I'd have a little helper like this:               public class UnknownValue<T>     {              T Value { get; set; }         double? Confidence { get; set; }     }      Which I'd then use like so:               public class Character      {         public UnknownValue<Character> Name { get; set; }     }      While the same as the JSON representation _in code_ , it doesn't have the same creep because I don't have to redefine the tuple every time and property accessors hide the appearance of creep. Of course, this is an apples-to- oranges comparison, the above is _code_ while the JSON is _data_. Is there a more formalized/cleaner/best practice way of containing the creep of these tuples in JSON, or is the approach above an accepted approach for the type of data I'm trying to store (and I'm just perceiving it the wrong way)? Note, this is being represented in JSON because this will ultimately go in a document database (something like RavenDB or elasticsearch). I'm _not_ concerned about being able to serialize into the object above, because I can always use data transfer objects to facilitate getting data into/out of my underlying data store.


API Server Client Setup

Suppose you have a setup where there is an API Server and all interaction revolve around the API. There is the admin, public and third party components that interact with the API server. Suppose we have an e-commerce model, the components' have the following capabilities: Admin - ability to manage products, orders and customer information Public - ability to manage customer and order information belonging to the user Third Party - ability to retrieve list of products, view orders - create orders in behalf of the user (meaning must have authorization from user) - view customer info (need authorization from user) My concern is regarding authorization. I'm familiar how to handle the third party through the OAuth workflow. But I'm confused with the Admin and Public components. The said two components doesn't seem to fit the OAuth workflow were there are typically 3 actors: the server, consumer and user. For example for the public component, it's the front facing application where your users can manage their profiles, order and view products. Are we going to treat this component as special from the API authorization perspective. The same goes with the admin component which offers the ability to manage almost all aspect of your application, even set API keys. Just like Facebook, Twitter, etc.. They offer an API. But internally do they communicate using some sort of API as well? Should these core components (UI for admin and public) NOT be decoupled from the API Server in the first place?


How Facebook's Ad Bid System Works

When you are creating an ad on Facebook, you are provided with a " _suggested bid_ " range (e.g., $0.90 - $2.15 USD). According to this page: > The suggested bid range is there to help you pick a maximum bid so your ad > will be successful. It’s based on how many other advertisers are competing > to show their ad to the same audience as you are. I'm interested in understanding what's actually going on (technically) under the hood here. Say a user logs into Facebook. On the server-side, it the HTTP request that the user's browser sent (as part of the login) is handled, and the server needs to figure out which ad to display back to the user. I _assume_ this is where the "bidding" system comes into play? Say that, based on this user's demographics, and based on the audience targeting that several competing advertisers designed their campaign with, let's pretend that Facebook sees a pool of 20 different ads it could return. How does this bidding system help Facebook determine which of the 20 ads it returns to the client-side? I'm guessing that advertisers who "bid more" get prioritized over those who "bid less". But when does this bidding take place? How often does an advertiser need to re-bid? How long is a bid binding for? Once I understand these usage-related concepts behind ads, it will probably be obvious between which of the following "selection strategies" the backend is using:   * Round robin   * Prioritized round robin   * Randomized (doubtful)   * History-based   * MVP-based Thanks to anyone who can help point me in the right direction and explain what these suggested bid systems are and how they work.


Is premature optimization really the root of all evil?

A colleague of mine today committed a class called ThreadLocalFormat, which basically moved instances of Java Format classes into a thread local, since they are not thread safe and "relatively expensive" to create. I wrote a quick test and calculated that I could create 200,000 instances a second, asked him was he creating that many, to which he answered "nowhere near that many". He's a great programmer and everyone on the team is highly skilled so we have no problem understanding the resulting code, but it was clearly a case of optimizing where there is no real need. He backed the code out at my request. What do you think? Is this a case of "premature optimization" and how bad is it really?


Which is the best Software to Create a Social Networking Community with CMS Software?

Please take a look at the several options listed in the following link: http://www.allwebdesignresources.com/webdesignblogs/graphics/best-software-to- create-a-social-networking-community-with-cms-software/ I am keen on the idea of "open source platforms" (such as Drupal and Elgg), but I am not sure which one is best and why. I am not so keen on the idea of a "Licensed" packaged software (a COTS) that, irrespective of the alleged claim of full flexibility offered by the Software House (such as Social Engine), would, in reality, limit my flexibility at an annual cost. Has anyone had any previous experience with any of the listed softwares? If yes, any feedback on their respective Pros and Cons will be much appreciated. Many tks!


Basic PHP Object Oriented Design Review

I am attempting to learn object oriented programming by designing a simple web application related to the Catholic liturgical calendar. I have very little formalized training in programming, but I have been able to more-or-less successfully learn basic programming concepts and the purposes/syntax of a couple languages. I was hoping that I could receive feedback on the following design I have worked out and implemented in testing. The basic use case is to be able to find the calendar details of any date and time through both application logic and some database queries. I have developed the classes as such:               class Year         create several DateTime objects for important movables feasts for a year          class Season extends Year         create several properties for each liturgical season based on the DateTime         objects from Year and additional application logic          class Day extends Season         contains an array of Hours objects since a liturgical day is not necessarily         the same as a 24 hour temporal day          class Hour extends Day         determines the liturgical hour details including the feast being celebrated         and DateTime objects representing the start and stop times of the hour since         and "hour" <> a temporal hour of 60 minutes      With this design, I can create an Hour by passing a single parameter ($date). The Hour needs to know which liturgical season it is for some application logic, so it creates a Season object based on $date. The Season object, however, cannot be created until it knows when certain important feast days occur in any given year (e.g. Easter determines the start and stop dates for several liturgical seasons), so it creates a Year object. Is this a "desirable" pattern such that to create a single desired object (Hour) two other objects (Season and Year) are created? Is it "proper" to extend classes to reflect a hierarchical relationship such as I have (i.e. the largest temporal period is "at top", followed by the largest subdivision of that, etc...down to the smallest temporal period of hour)? The primary purpose of this web application will be to display religious facts and literature based on the current liturgical hour. Thus, the Hour is the most important piece to the end user - but this cannot be determined successfully without the "larger" periods of Season and Year. The Day object will be used for navigation/information purposes only (e.g. what are the important religious occurrences at all the liturgical hours today?) and will likely not include any actionable events within it. In testing, I have created a year's worth of Date objects which results in 2,920 Hour, Season and Year objects (365 * 8 for each object type = 8,760 total objects). The application logic is correct and produces desired data results. However, this seems like an incredibly high number of object instantiations for such a simple system, so I would like to know if I am misusing objects or totally misunderstanding their purpose. I think it may be more desirable to be able to create a single Year object which would produce 13 Season objects that could then be referenced by each Hour that I need to create...thus creating only 2,934 objects (2,920 Hour, 13 Season and 1 Year). Any thoughts would be appreciated!


Designing Nested List<Class> Property in a Class

I'm currently in the class modeling phase of my project. Real life Scenario: Let's say I have a Project that is composed of Main Components and each Main Component is composed of Sub Components and each of Sub Components use multiple Materials. I created a class based on the entities:               public class Project     {         public List<MainComponent> MainComponents {get; set;}         // other properties..     }          public class MainComponent     {         public List<SubComponent> SubComponents {get;set;}         //other properties..     }          public class SubComponents     {         public List<Material> Materials {get;set;}         //other properties..     }          public class Material     {         //properties..     }      However I will be having a hard time accessing a Material because I will have to go through a nested `foreach` loop Let's say projectAlpha is an existing Instance of a Project class               foreach(MainComponent mainComponent in projectAlpha.MainComponents)     {         foreach(SubComponent subComponent in mainComponent)         {             foreach(Material material in subComponent.Materials)             {                 //do something with material here..             }         }     }      What are efficient ways of designing a class that are based on entities that are designed like this? (Avoiding nested loops).


What is deconcatenation?

I heard this mentioned and wanted to find out more. It does exist in google searches but I found no 'introduction'. I also found no information in the php manual or in my usual resources (like here). I'm looking for a succinct answer and/or a link.


Where does the name "psycopg" come from?

Apologies if here is not the place to ask, but so far google, the documentation and the faq page are not giving me an answer.


Keep track of knowledge about techniques/bugfixes/workarounds

I'm trying to bring more structure in my worklife by trying to maintain my 'knowledge' of new techniques/bugfixes/workarounds. I find them on google (sometimes after a while of searching) and fix my bug/learn new stuff... I don't really expand my 'library' with this knowledge. So after a while, when I encounter the same bug, i need to search it again and this can be time intensive. How do you guys keep track of this knowledge? I mean, most of us are on a busy workplace, with no time to memerize every bugfix/piece of knowledge about a product/language. I want to be able to reference this information in my own library. While trying to keep links, texts and code snippets organized and maintainable, rather then a textfile/Evernote for each subject, making it almost impossible to find and organize this information...


Zooming options terminology

I've come up with 4 different ways to fit an image inside a viewing region, but I'm trouble coming up with names for them. Perhaps someone can suggest some?   1. Fit image in viewing region, do not enlarge if image is smaller   2. Size image so it fits snuggly inside the viewing region (enlarge if necessary) -- the image is as large as possible while still fitting within the viewing region   3. Size image so that it fills the entire viewing region -- the image will be the same size or _bigger_ than the viewing region   4. 1:1 ratio; 1 pixel in the image corresponds to 1 pixel on screen All zooming options maintain aspect ratio. Stretching is just ugly, so it's not an option :)


Software design for non object oriented paradigm

I'm currently working on a project where I'm writing the firmware for an electronic system in C, and have been asked to produce documentation on the development/evolution of the software for the embedded devices. Having developed software in the object oriented paradigm I know to use UML to document the software such as class diagrams with objects, however this does not work for documenting the development of my embedded system. So what should I produce to document the development of my firmware?


tcp retransmission queue

I'm trying to understand how tcp retransmission queue works so I can implement it in my application that uses TCAP over SCTP. What I understood from the TCP queue is that every message is saved in retransmission queue with with a time, when the timer reaches 0 the message will be sent again. My question is how to check the time on that message, is it like a thread that constantly checks the retransmission queue or is it something else?


Web API design best practices - having many (similar) operations

I have a web service (axis2) and the server performs 4 primary operations: createX, removeX, getX and updateX Where X is represented by a combination of 4 values: id1, id2, id3 and id4 So, to simplify developer life, we created 3 extra helper functions: removeXForId, getXForId and updateXForId where we represent the set of 4 values as 1 Identifier so that the developers who are calling us do not need to pass all those 4 values again and again and just store the unique identifier on their end. But, we cannot also completely remove removeX, getX and updateX operations completely abd just rely on the unique identifier as some use cases need to pass all 4 set of values. **So, now we have around 7 operations where half (3) of them are duplicate operations with different input values.** Operations:               /createX     /getX {input: id1, id2, id3, id4}     /getXForId {input: id1234}     /removeX     /removeXForId     /updateX     /updateXForId      Is this a good practice? **UPDATE:** _getX is exactly the same as getXForId in terms of behavior except the input arguments._ getX takes in 4 inputs: val1, val2, val3 and val4. But getXForId takes in just 1 ID which represents (val1, val2, val3 and val4) val1, val2, val3 and val4 are some how related to each other, they in combination represent a unique link to a product in our system. So we tried to club them together.


What can a technically proficient senior software developer study to keep improving

Say you have been programming for over 10 years. You know many languages, with few of those at very detailed level. You have been designing architecture for solutions, worked on and delivered larger projects. You have been studying patterns, best practices, effective coding guidelines, unit testing, multi- threading, etc. And then you slowly develop a feeling that most of the books you read, give less and less valuable information per 100 pages of text. So they start giving diminishing returns. You still learn, but you no longer improve by leaps and bounds. Why does learning become less productive compared to how it was before? Back then, it used to change your way of thinking, taught you new things and broadened your horizons that later improved either your current profession, or allowed to invent/manage/build something new. Why is it no longer the case?


Game Netplay Rollback System

Can one explain the specifics and details of a netplay framework for a game that optimizes connection through a "prediction / rollback" mechanic, as seen in games where speed is a priority (first-person shooters, modern fighting games since Street Fighter IV, etc)? I have previously studied this article as an example: Source Multiplayer Networking, which describes Valve's techniques used in their shooters on a high, abstract level. However, it is simply too high-level and theoretical to be of use to me. Other similar articles follow this same pattern; none offer code samples or working examples. I have previously crafted netplay systems that use unoptimized TCP/IP, which is obviously horrendously slow and non-useful for anything except LAN play. Although I have taken a college course on network programming, I am only confident and experienced enough to have made this system through approximate copying of other pre-existing code.


Progressing past CRUD applications in PHP?

I've been programming in PHP for about a year and am at the following stage:   * Have a good 'feel' for the language   * Can create CRUD applications competently   * Can utilize an MVC structure to allow for future expansion of code   * Using the points listed above, I've created a number of my own applications for practise - including but not limited to; a forum, social network etc. My question may be a little vague but should hopefully be answerable. I feel as though there isn't anything else I would need to know about PHP to allow me to create websites, though I'm sure I'm wrong. **What advanced/complex PHP topics could I look at that have a real-world use and will allow me to enhance both my skill as a programmer and applications in general?** Recently I've looked a lot more at javascript/jQuery allowing me to give my applications a richer user interface which has been a great learning experience and proving very useful.


I'm 15 years old. What would you recommend for resources?

I'm a 15 year old kid who seems to excel in all of his classes, likes talking in 3rd person, and wants to learn more about programming and a little about html/php stuff. I already know a little python and I'm hoping to eventually learn Java/Javascript and C. I've been looking around and I've found some online lectures like this and some other tutorials that are so mind numbingly boring and difficult to understand. I was wondering if any of you knew of any good books or other resources that would actually teach me everything I'd need to know incrementally?


What is the point of double check locking?

I have been reading the Wikipedia article on double check locking and one thing that's not clear from it (at least to me) is what the pattern achieves. What is the reason for making the two checks below? Why not have triple checked locking? Wouldn't that be even better?               if (mySingleton == null) { // 1st check                 lock (myLock) {                     if (mySingleton == null) { // 2nd (double) check                         mySingleton = new MySingleton();                     }                 }             }


Inserting validation in Data Driven Tests

I am working on a testing tool that provides image comparisons. For test data insertions, I am using excel and csv files that supply the tests with text that is used by the tool to mock actual user interactions - in filling up of forms/screens in the tests. After the insertion, there is a need for verification to ascertain whether the test has functioned properly or not. What mechanism should I apply to ensure proper validation for the tests ? As the screens will differ widely, I cannot use a hard coded error/success validation string/image. One approach that I am considering is generation of images based on inputs(OCR) for different tests, which will be used to validate the instance of test where the specified input was executed. Can anyone comment/share any other technique for doing this ?


Emacs/Vim/Vi - do they have a place in modern software development ecosystem?

Watching all those screencasts (and listening all those podcasts) with more- or-less famous hackers/programmers I hear that many of those use emacs/vi(m) for their daily work. Now, I myself tried using both emacs and vim, and I honestly cannot understand why would anybody use these for any kind of serious development. The most advertised feature is something along the lines of "you'll be able to work with text (meaning cutting, pasting, duplicating, moving, etc) up to ten times faster than with conventional IDEs", but I don't buy that. When has the success of a software project been defined by how fast a programmer can juggle lines in a text editor or by saving a couple of keystrokes here and there? Plugins and extensions? I bet nothing comes close to R# or IDEA in terms of refactoring support ("Rename" refactoring implemented by means of "Search and Replace" is not a refactoring IMO); others are trivial. Ubiquitous and available everywhere? So what? How often do you find yourself editing files over a 300 baud connection on an esoteric *nix installation without a VCS? So here goes: do said editors have a justified place in a modern software development ecosystem?


Methodologies for Managing Users and Access?

This is something I'm having a hard time getting my head around. I think I might be making it more complicated than it is. What I'm trying to do is develop a method to store users in a database with varying levels of access, throughout different applications. I know this has been done before, but I don't know where to find how they did it. Here is an example of what I need to accomplish:               UserA - Access to App1, App3, App4 & can add new users to App3, but not 4 or 1.      UserB - Access to App2 only with ReadOnly access.     UserC - Access to App1 & App4 and is able to access Admin settings of both apps.       In the past I've just used user groups. However, I'm reaching a phase where I need a bit more control over each individual user's access to certain parts of the different applications. I wish this were as cut and dry as being able to give a user a role and let each role inherit from the last. Now, this is what I need to accomplish. But, I don't know any methods of doing this. I could easily just design something that works, but I know this has been done and I know this has been studied and I know this problem has been solved by much better minds than my own. This is for a web application and using sql server 2008. I don't need to store passwords (LDAP) and the information I need to store is actually very limited. Basically just username and access.


What are the tools/frameworks used to build C# ASP.net applications?

I am basically a java programmer who wants to move to .net. I haven't worked in .NET companies so I don't have any idea about the tools they use. In a Java company people use Maven, Hibernate and frameworks such as JSF or Tapestry. My questions are: What are the tools/frameworks that .NET/C# companies use? Do they use ASP.NET MVC? Do they use any ORM tool? Do they use any framework? I will be happy if someone could tell me about this.


Is there a supported way to run .NET 4.0 applications natively on a Mac?

What, if any, are the Microsoft supported options for running C#/.NET 4.0 code natively on the Mac? Yes, I know about Mono, but among other things, it lags Microsoft. And Silverlight only works in a web browser. A VMWare-type solution won't cut it either. Is there any semi-authoritative answer to why Microsoft just doesn't support .NET on the Mac itself? It would seem like they could Silverlight and/or buy Mono and quickly be there. No need for native Visual Studio; cross-compiling and remote debugging is fine. The reason is that where I work there is a growing amount of Uncertainty about the future which is causing a lot more development to be done in C++ instead of C#; brand new projects are chosing to use C++. Nobody wants to tell management 18–24 months from now "sorry" should the Mac (or iPad) become a requirement. C++ is seen as the safer option, even if it (arguably) means a loss in productivity today.


Situations that require protecting files against tampering when stored on a users computer

I'm making a 'Pokémon Storage System' with a Client/Server model and as part of that I was thinking of storing an inventory file on the users computer which I do not wish to be edited except by my program. An alternative to this would be to instead to store the inventory file on the server and control it's editing by sending commands to the server but I was wondering if there are any situations which require files to be stored on a users computer where editing would be undesirable and if so how do you protect the files? I was thinking AES with some sort of checksum?


Question regarding code readability

I would like to know, is it considered a common practice to use constructions like `|=`, `&&`, `||`, `!=` altogether in the single line of code? E.g. `hasErrors |= vi2!=null && vi2.hasErrors() || vi.hasErrors();` What can be done to make the code more readable? The programming language is Java, if it matters.


Integrating with a payment provider; Proper and robust OOP approach

### History We are currently using a so called redirect model for our online payments (where you send the payer to a payment gateway, where he inputs his payment details - the gateway will then return him to a success/failure callback page). That's easy and straight-forward, but unfortunately quite inconvenient and at times confusing for our customers (leaving the site, changing their credit card details with an additional login on another site etc). ### Intention & Problem description We are now intending to switch to an integrated approach using an exchange of XML requests and responses. My problem is on how to cater with all (or rather most) of the things that may happen during processing - bearing in mind that normally simplicity is robust whereas complexity is fragile. ### Examples   * User abort: The user inputs Credit Card details and hits submit. An XML message to the provider's gateway is sent and waiting for response. The user hits "stop" in his browser or closes the window.      * ignore_user_abort() in PHP may be an option - but is that reliable?     * might it be better to redirect the user to a "please wait"-page, that in turn opens an AJAX or other request to the actual processor that does not rely on the connection?    * Database goes away      * sounds over-complicated, but with e.g. a webserver in the States and a DB in the UK, it has happened and will happen again: User clicks together his order, payment request has been sent to the provider but the response cannot be stored in the database. What approach could I use, using PHP to sort of start an SQL like "Transaction" that only at the very end gets committed or rolled back, depending on the individual steps? Should then neither commit or roll back have happened, I could sort of "lock" the user to prevent him from paying again or to improperly account for payments - but how?   * And what else do I need to consider technically? None of the integration examples of e.g. Worldpay, Realex or SagePay offer any insight, and either my search engine or my search terms weren't good enough to find somebody else's thoughts on this. Thank you very much for any insight on how you would approach this!


How best to store images on a file system

Developing an application in which users have to upload images. I have not really got much experience with file uploads in an application so I am wondering what the best way is for storing images which are uploaded by users to the file system.


How to execute a Ruby file in Java, capable of calling functions from the Java program and receiving primitive-type results?

I do not fully understand what am I asking (lol!), well, in the sense of if it is even possible, that is. If it isn't, sorry. Suppose I have a Java program. It has a `Main` and a `JavaCalculator` class. `JavaCalculator` has some basic functions like               public int sum(int a,int b) {        return a + b     }      Now suppose I have a ruby file. Called `MyProgram.rb`. `MyProgram.rb` may contain anything you could expect from a ruby program. Let us assume it contains the following:               class RubyMain       def initialize         print "The sum of 5 with 3 is #{sum(5,3)}"       end       def sum(a,b)         # <---------- Something will happen here       end     end          rubyMain = RubyMain.new      Good. Now then, you might already suspect what I want to do:   * I want to run my Java program      * I want it to **execute** the Ruby file `MyProgram.rb`     * When the Ruby program executes, it will create an instance of `JavaCalculator`, execute the `sum` function it has, get the value, and then print it.     * The ruby file has been executed successfully.   * The Java program closes. **Note** : The _"create an instance of`JavaCalculator`"_ is not entirely necessary. I would be satisfied with just running a `sum` function from, say, the `Main` class. My question: is such possible? Can I run a Java program which internally executes a Ruby file which is capable of commanding the Java program to do certain things and get results? In the above example, the Ruby file asks the Java program to do a sum for it and give the result. * * * This may sound ridiculous. I am new in this kind of thing (if it is possible, that is). **WHY AM I ASKING THIS?** I have a Java program, which is some kind of game engine. However, my target audience is a bunch of Ruby coders. I don't want to have them learn Java at all. So I figured that perhaps the Java program could simply offer the **functionality** (capacity to create windows, display sprites, play sounds...) and then, my audience can simply code with Ruby the logic, which basically justs **asks** my Java engine to do things like displaying sprites or playing sounds. That's when I though about asking this.


How can I get my own encryption algorithm tested?

I've just developed a block cipher symmetric-key algorithm and I am using it in some of my products. I want to put it to real test. How would one go about entering their encryption algorithm into an international encrytption contest?


Which language is more suitable heavy file tasks?

I need to write a script (based on basic functions) to process /image/audio/video files. The process is mainly filesystem tasks and converts. The database of files has been stored by mysql. The script is simple but cause heavy tasks on the system; for example renaming/converting/copying thousands of file in a run. The script does not read the content of files into memory, it just manage the commands for sub-processes. The main weight is on the communication with filesystem. The script will be used regularly for new files. My concern is about performance. I am thinking of   1. Shell script   2. a complied language like C Please advise which programming language is more suitable for this purpose and why? **UPDATE:** An example is to scan a folder for images, convert them with `ImageMagick`, move files to destination folder, get file info, then update the database. As you can see, the process has no room for optimization, and most of languages have similar APIs for popular programs like `ImageMagick`, `MySQL`, etc. Thus, it can be written in any language. I just wish to reduce resource usage by speeding up the long loop. _NOTE:_ I know that questions about comparing languages are not favorable, but I really had problem to choose, because the problems can appear in action.


How do you handle your Project Manager

I currently work for a company that has recently downsized. I do all in-house work, client installs, builds, QA, and, well, basically all the in-house work. My direct boss is VERY nontechnical and lately I have found it VERY hard to deal with his lack of knowledge. The biggest issues I have had are as follows:   * I am on many deadlines at a time. I get stopped to put together a half fast quote as I cannot be late on the deadline, in the meantime, three support calls comes in, I give quote, time too much in quote so they outsource it. I then I have to fix everything the vendor broke which puts me behind. The worst is if I eat "His buffer" on a project I wasn't even on I am expected to complete everything already scheduled while all these other things come up.   * I get asked, when an issue arrises, why is the issue occurring and explain in detail, yet that detail means absolutely nothing to him.   * All he cares about are deadlines, yet he is the one who schedules everything.   * "I am a programmer not a graphic designer, means nothing to him"   * I was hired as a .NET programmer, yet they let a vendor choose wordpress for many sites(yeah I had to learn all about it quick) I guess I can go on and on, but has anyone had to deal with this type of project manager? What is some advice, other than finding another job? I cannot leave my job at this time as I cannot lose my insurance right now as my wife is very ill with MS. I am looking for the best way to deal with my manager. Thanks in advance, and I made this a wiki, so please don't close. Here is another situation that happened today. We have a friend of mine who assists me on projects. He asked us "BOTH" to quote out a job and give a rough estimate. I came back to him and said" 7 weeks 6 hours day a day using my friend as a resource." He gave it to the client and added 10% buffer(24 hours). He then tells me that is all I get my friend for on the project. I wasn't asked how much time he was available for during the 7 weeks. Worst part is they already gave the quote to the client and didn't even have me review. His view is well you either get it done in the time I told him or find another job.


Is O(1) random access into variable length encoding strings useful?

I remember reading that there are no existing data structures which allow for random-access into a variable length encoding, like UTF-8, without requiring additional lookup tables. The main question I have is, is this even a useful property? I mean, to look up and replace random single _codepoints_ in O(1) time.


Suggestions for html tag info required for jQuery Plugin

I have written a tiny bit of jQuery which simply selects all the `Select` form elements on the page and sets the selected property to the correct value. Previously I had to write code to generate the `Select` in php and specify the `Selected` attribute for the option that was selected or do loads of `if` statements in my php page or smarty template. Obviosly the information about what option is selected still needs to be specified somewhere in the page so the jQuery code can select it. I decided to create a new attribute on the Select item               <Select name="MySelect" SelectedOption="2">  <-- Custom Attr SelectedOption     <option value="1">My Option 1 </option>     <option value="2">My Option 2 </option> <-- this option will be selected when jquery code runs     <option value="3">My Option 3 </option>     <option value="4">My Option 4 </option>     </Select>      Does anyone see a problem with using a custom attribute to do this, is there a more accepted way, or a better jquery way?


Debugging framework for domain specific language

I want to know if there are any tools/tool-kits which aid in building source level debuggers for domain specific languages ? (I work on a proprietary DSL, which doesn't have any tools and sometimes debugging will become difficult, so, if in case there are any such tool-kits, wanted to try)


Vendor Support for OpenStack (that's not a rip-off)

I'm beginning to see that there is a game being played where cloud support is either "host inside our cloud at low cost (so we lock you in)" or "we will support your private cloud provided that it's huge like 5000 nodes and you pay for our premium support ~$5000/month"so where are the are the support options for OpenStack that aren't trying to play this game?


Computer vision algorithms (how is this possible?)

I recently stumbled across a company that has created what appears to be a computer vision technology that is capable of detecting shoplifting automatically and alert its users. LINK Watching some of the videos and examples provided by the company has left me completely baffled and amazed as to how on earth they may have achieved this functionality. I understand that no-one here will be able to tell me exactly how this may have been achieved but is anyone aware - and could point me to - research in this field or alternatively perhaps provide details as to how something like this could be implemented or guidance of where one might start? My understanding was the computer vision algorithms were many years away from being this sophisticated. Is this sort of application really possible? Anyone willing to hazard a guess at how they achieved this?


Is it possible to create a 2d game for both linux and windows with next to no changes?

I'm starting a project with friends which would preferably reach both audiences of windows and linux. The only problem is that none of us have any experience of linux porting or linux coding any way. Thus, I'm asking for information here if it'd be possible to use the same code for both platforms. If it's some choices we had to make while coding it to be for both platforms. Our preferred coding language is C++, but if enough support is gained towards another one, a switch is possible. We haven't chosen a graphics nor a game engine yet because of this fact. With the minimum effort we'd like this to be as close as possible to a "uniplatform" game. :)


Creating a Predicate Builder extension method

I have a Kendo UI Grid that I am currently allowing filtering on multiple columns. I am wondering if there is a an alternative approach removing the outer switch statement? Basically I want to able to create an extension method so I can filter on a `IQueryable<T>` and I want to drop the outer case statement so I don't have to switch column names.                   private static IQueryable<Contact> FilterContactList(FilterDescriptor filter, IQueryable<Contact> contactList)         {             switch (filter.Member)             {                 case "Name":                     switch (filter.Operator)                     {                         case FilterOperator.StartsWith:                             contactList = contactList.Where(w => w.Firstname.StartsWith(filter.Value.ToString()) || w.Lastname.StartsWith(filter.Value.ToString()) || (w.Firstname + " " + w.Lastname).StartsWith(filter.Value.ToString()));                             break;                         case FilterOperator.Contains:                             contactList = contactList.Where(w => w.Firstname.Contains(filter.Value.ToString()) || w.Lastname.Contains(filter.Value.ToString()) || (w.Firstname + " " + w.Lastname).Contains( filter.Value.ToString()));                             break;                         case FilterOperator.IsEqualTo:                             contactList = contactList.Where(w => w.Firstname == filter.Value.ToString() || w.Lastname == filter.Value.ToString() || (w.Firstname + " " + w.Lastname) == filter.Value.ToString());                             break;                     }                     break;                 case "Company":                     switch (filter.Operator)                     {                         case FilterOperator.StartsWith:                             contactList = contactList.Where(w => w.Company.StartsWith(filter.Value.ToString()));                             break;                         case FilterOperator.Contains:                             contactList = contactList.Where(w => w.Company.Contains(filter.Value.ToString()));                             break;                         case FilterOperator.IsEqualTo:                             contactList = contactList.Where(w => w.Company == filter.Value.ToString());                             break;                     }                          break;             }             return contactList;         }      Some additional information, I am using NHibernate Linq. Also another problem is that the "Name" column on my grid is actually "Firstname" + " " + "LastName" on my contact entity. We can also assume that all filterable columns will be strings. **EDIT** Remember this needs to work with **NHibernate** Linq and AST.


Function names - "standardized" prefixes

Imagine you have such routines               /*just do X. Fail if any precondition is not met*/     doX()          /*take care of preconditions and then do X*/     takeCareOfPreconditionsCheckIfNeededAtAllAndThenDoX()       A little bit more concrete example:               /*create directory. Most probably fail with error if any precondition is not met (folder already exists, parent does not exists)*/     createDirectory(path_name)          /*take care of preconditions (creates full path till folder if needed, checks if not exists yet) and then creates the directory*/     CheckIfNotExistsYet_CreateDirectory_andFullPathIfNeeded(path_name)      How do you name such routines, so it would be clear what does what?       I have come to some my own "convetion" like:               naiveCreateDirectory, ForceDirectoryExists, ...      But I imagine this is very standard situation. Maybe there already exists some norms/convetions for this?


Is it ok to become junior at 27?

I'm having a computer unrelated job right now, but I want to become a programmer, I have some objective-c and iOS knowledge, studying hard in my free time, etc. I'm looking into getting a junior iOS developer position. It will probably pay half what I earn in my current job, and I am not sure if I will like that. But I am really tired of my job and want to get experience in this field. Also, working as iOS developer is great position, since they are in great demand. My country is Russia. What do you think? Or Should I just do it in my free time, get some programs out in Appstore and look for better position? What would you do?


Is Perforce as good at merging as DVCSs?

I've heard that Perforce is very good at merging, I'm guessing this has to do with that it tracks changes in the form of changelists where you can add differences across several files in a single blow. I think this implies Perforce gathers more metadata and therefore has more information to do smarter merging (at least smarter than Subversion, being Perforce centralized). Since this is similar to how Mercurial and Git handle changes (I know DVCSs track content rather than files), I was wondering if somebody knew what were the subtle differences that makes Perforce better or worse than a DVCS like Mercurial or Git.


Cloud computing / web hosting solution suggestion

I am in the initial stage of analyzing a platform for my startup and I am exploring both the cloud computing and web hosting before I initiate developement. I am quite proficient in both .NET and the java platform and hence I am hoping to get your feedback for helping me with some ideas/directions. Here are is the feature set that I am looking for   * Robust platform (must have)   * Persistence a.l.a {Big table/Cassandra style or RDBMS} ( must have)   * Message queueing frameworks like ActiveMQ (Must have)   * Full text search and advance features - Lucene and Solr (Must have)   * Memcached (Must have)   * Background/Offline services (Must have)   * Hosted SSL (Must have)   * Ability to support RESTful webservices (Must have)   * Support for fast prototyping and deployment (Must have)   * Storage on file system (Nice to have)   * Easy administration, support for scaling, monitoring and profiling (Must have)   * Transparent billing and accounting (Must have) I have looked at Google App engine and although it looks quite appealing, I don't think it supports full text search (what an irony) or messaging which would be dealbreakers for me. I have also looked at hosting solutions ( e.g. www.justhost.com) and they too don't offer messaging and support for indexing/full text search etc. So I am wondering what are my options. Do I need to buy own server farm and talk to my ISP? If so, are there any ISPs that you can recommend? Please advise on how I can go about selecting an appropriate platform Thanks -Venu


Why might an ASP.Net website load slowly?

Anecdotally, I've visited many .aspx website that require a significant amount of load time for each page. Is my experience unique? If not, why might an ASP.Net website load slowly?


So with HTML5 what exactly.....is "supposed" to become phased out

So I know HTML5 is the "replacement" for Flash...however it's obviously not mainstream just yet......but what else is it supposed to replace. I ask this because web-dev has always been a secret kinda side-passion of mine (even though I a firmware programmer mostly doing C/Java stuff). And anyway I want to pursue a side thing at doing web design (I know basic XHTML/CSS + some CSS3) But what exactly is I guess...."pointless" to study? JavaScript I assume will always be a huge part of web design? (HTML5 isn't replacing that is it?) What about Ajax and CSS itself?) And then there's Flash....not sure if thats really worth putting effort into? Also there's Adobe Flex/Air......I'm a bit confused if you can't tell.


VPN system to analyze users traffic (onavo-like)

I would like to develop a system that is able to analize the network traffic of people using it. I am interested in the URLs that the users request. Let's say the users targeted are on iOS or Android (a PC would be too easy you had guessed!). I first imagined I could use web history to find out the relevant information I am looking for. It seems that it is not possible to do this because of the apps being sandboxed. (Rooting/Jailbreaking phones is not an option there). This being impossible, I am looking for another way to achieve my goal. I see that Onavo Extend - an app that allow users to have their data shrinked - is able to have their user's traffic sent to their servers. From what I understand, they setup a VPN connection to their servers which act like proxies. I thought I could use a similar system to be able to analyse my users' traffic but I am totally lost in all the VPN sorts and protocols. I was not able to find what kind of exact technology Onavo is using. I guess I would have to implement a VPN server with which I can extract the information I am looking for. Sadly, I have not been able to find relevant information helping me do this. So here are my questions:   1. Is there a simpler way to achieve my goal than setting up all the VPN structure?   2. If not, could you advise my on the type/technology of VPN I could use and/or point me to links that would help me build the server-side application that does the VPN proxing or just to relevant information that could help me in any way? PS: I am just trying to build a mockup to do this, not a top of the line service able to handle thousands of users. PPS: I am more focused on the server-side as I was able to find information on how to deploy profiles and setup VPN settings to the end users. I will focus on the client side once the server is ready. * * * Edit: What I want is not about real time monitoring, but more like being able to parse the requested URLs and store them (say, to a database for instance, or files, this is just a mockup) to analyze them later. As I am not able to access the user's web history, the idea is to be able to parse the traffic to build the history myself.


After SICP? Interested in Web and Desktop programming

As a complete newbie, I am curious as to what I should undertake after finishing _Structure and Interpretation of Computer Programs_ (along with the MIT course). I am primarily interested in building desktop applications, and secondarily interested in web development. How do I grasp the essence of desktop programming? And web? Are there any particular books or courses that survey the various areas of programming and the tools I need to build something solid?


Choosing a Programming Language

i've taking part in some conversations around here and it seems like choosing a programming language is an event like, wether you like coca-cola or pepsi, you cant like both. Sometimes its even worse, some people dont consider there are any other programming languages there expect the ones they prefere. Well my question is: Is THAT important the programming language decitions? Or maybe its a marketing scheme where companies buy it and then programmes suffer it? And further more, it should not be the other way around, companies ask for general developing skills and then train their human resources to accomplish a goal ( if the problem is concurrent, then use your concurrrent skill to develop in this specific language)?


Working environment

I realise that this might not be the right place to ask questions about employment and that the question my raise debate etc. The company I work for recently decided that rather than having one web developer working on sites from a branch it would be better to make that person come into head office and work in the middle of a busy call centre. Also they're expecting the developer to answer the phone if it rings and take messages. Does anyone find that strange? Is it really the right place for a programmer to work? Thanks for the advice


On improving commit practices

I was thinking about ways to improving my commit practices. Is there any co-relation between no. of source code lines and no. of commits? In a recent project that I was involved in, I was going at 30 commits per 1000 lines. One typical file from the project has these stats               language: JavaScript     total commits that include this file: 32          total lines: 1408     source lines: 1140     comment lines: 98          no. of function declarations: 28     other declarations: 8      Another file has these...               Language: Python     total commits that include this file: 17          total lines: 933     source lines: 730     comment lines: 80          classes: 1     methods: 10      I also think that no. of commits is more related to no. of features or no. of changes to the code and less to the no. of lines. The general git community motto is make short commits and commit often. So, do you really think about you commit strategy before you start the project. For that matter, is there anything like commit strategy? If so, what's yours?


Maximum nesting for loops and conditionals?

I've written some code that has some fairly deep nests (one time, I wrote something that was a conditional check inside a forloop inside a conditional check inside a forloop inside a forloop). Is there a general guideline on limits to the number of nested for loops/conditionals you have?


What will happen if I don't follow robots.txt while crawling?

I am new to web crawling and I am testing my crawlers. I have been doings tests on various sites for testing. I forgot about robots.txt file during my tests. I just want to know what will happen if I don't follow the robots.txt file and what is the safe way of doing the crawling?


How can I write the code to get all the properties of a class?

I have a program, where I want to create a new instance of the object depending on a value, I take the value and then search the list and using that list I create a new instance. Well, it goes perfectly well. But there is a problem, that I have to write them all manually and it takes a long time. I wanted to know whether there is a better way of doing this or not, here is the C# code I am having               public Account (int userId) {         // here is look for the account         // inside a List<Account> which returns the account         // then I update the values for that instance,          this.AccountLockedSince = account.AccountLockedSince;         this.AuthenticationToken = account.AuthenticationToken;         this.CreateDate = account.CreateDate;         this.IsLocked = account.IsLocked;         this.IsVerified = account.IsVerified;         this.PasswordResetDate = account.PasswordResetDate;         this.PasswordResetToken = account.PasswordResetToken;         this.RequireEmailVerification = account.RequireEmailVerification;         this.TokenExpires = account.TokenExpires;         this.UserId = account.UserId;     }      .. as you can see, these are all the properties of the Account class and I have updated them, but this is not the efficient way of doing this. Any built- in feature in the C# .NET framework to handle this?


What CS courses should I take as a data miner

guys, I am a data miner, most time I use R, SAS to do modeling and data mining work. But some times the packages in R are not what I want. It will be perfect If I could develop my own packages. But my background is not Computer Science and I always want to learn some coding techniques or dig deeper in computer science, which might help me better understand how to code and do data mining. Could any one give a comprehensive book/course list for me to learn, which will be helpful for data mining? thanks


Why doesn't Google use Courgette for Android updates?

Google has an advanced diff tool specifically designed for compiled binaries called Courgette. Is there any reason why they wouldn't use this in Android and the Google Play Store to download updates? In my basic understanding of Java, it seems like it shouldn't be any more difficult (perhaps even easier?) to create 'diffs' like this because of Java's "bytecode" nature. Am I wrong? Are there any security reasons? **Note:** I know that unless someone from Google responds, we won't know for sure. But I'm asking for any obvious reasons - I'm an Android developer and sometimes get notes from people complaining about frequent updates, so it is somewhat relevant to me. :)


¡Advice Needed! - Node.js, PHP or Python to make a high performance Real Estate website similar to Zillow or Trulia?

First of all sorry for my bad english and sorry for my novice/beginner question, I'm doing my best with the help of google translator. To develop a Real Estate Site similar to Zillow or Trulia what language of this three with its respective ecosystem of tools and frameworks is more suitable( best tool for the job) for this type of Websites and why, Node, PHP or Python. Main concerns:   1. Development productivity. What development stack allow faster development for a site like the mentioned above.   2. HTML render speed, page load speed and general performance in the visitors devices(smartphones, Desktop PC, etc) when many concurrent users visit the website.   3. For a specific level of performance, which of the two development stack require less server resources, number of servers, and CPU, memory per server. I appreciate any advice


What technologies are typically used to implement enterprise services in .NET?

I'm trying to get an idea as to how what I currently do (implementing enterprise services in Java) would be done in a .NET environment. In .NET, would it typically be done using:   * IIS as the server?   * C# as the language and WCF as the framework?   * BizTalk as the enterprise service bus, with MSMQ as the gateways? Has anyone implemented services in both Java and .NET, and if so, are there any major paradigm differences or is it pretty similar?


Why did Apple remove Python support in Mavericks, aka Mac OS X 10.9?

In a rather unceremonious way - Apple has _removed_ Python support (at least from the SDK) in 10.9. Python IS still installed on the system in...               /System/Library/Frameworks/Python.framework      but trying to _link to it_ under the 10.9 SDK fails. Even with the "CLI Tools" installed, there is no Python in...               /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks      I'm no _Pythonista_... but I do find it interesting that Apple has removed a part of the Developer Toolchain that has been around for so long, and was once so promising (on the Mac platform). Apple often tries to steer the focus towards certain "methodologies"; but historically, when the plug has been pulled - it's over - at least in Apple's eye. Is this _a statement_ by Apple, along the lines " _People aren't using Python very much anymore.. we're gonna phase out support_ "? Or simply, " _Adoption of PyObjC is anemic, maybe we can reduce the size of the SDK by 3.1Mb_ "? Whatever the motivation, it's likely a change that is here to stay. Are there suggestions on workarounds to maintain compile and runtime-compatibility, or insights into why the decision was made?


What is a good integration test strategy?

I'm getting started on a project wherein I want to have pretty thorough test coverage, and I have the luxury of driving the test strategy. I've settled on a workable plan for unit testing, and I've also settled on using Gherkin to describe features and a port of Cucumber to run the scenarios as end-to-end acceptance tests. The problem is that I sense that there is a gap in between those two layers. I can test all my units in isolation, and I can test that my features work, but I can think of other things that I'm going to want to test. I'm also coming from a different project with (poorly-implemented) automated tests that are a very brittle and are a maintenance nightmare, the goal of these tests being to mostly replace manual regression testing. Writing more maintainable tests is a must, but at a higher level I'm not sure that our tests are the right ones. As an example, given a web application, say there's a form to add an event with start and end dates. As an end-to-end test, we can validate that you can, in fact, add an event. But if your start date is after your end date, then you get an error message, and I wouldn't think that how a trivial user input error is handled belongs in a feature file. On the other hand, there seems to be a pretty strong belief that unit testing the UI isn't worth it; instead, one should do automated integration testing. So what do I do for this code? Do I unit test the components related to error messages in general, as well as that this form is going to show them, and skip automating that they actually appear? Do I do the above and then automate that just one error message somewhere shows as intended, and assume the rest will work? Do I try to automate every different potential failure case for every form? This hits the middle ground of integration testing, of which I am leery. Based on my experience, maintaining a large number of integration tests does not seem worth the value. On the other hand, there is functionality above the unit level and below the feature level that I would ideally like tested, both in the UI and outside of it. And I'm concerned about what kind of confidence automated regression can bring if it isn't hitting everything. I am perfectly willing to write integration tests, but in the context of when to write tests, what tests to write, and how many to write, what is a good approach to addressing this problem?


Firefighting allocation problem

I'm trying to develop a model to work on an assignment problem in the firegifhter area. Given n firefighters, m trucks and z ongoing fires, each with a danger level, try and allocate the resources in the best way. Is there some work on this i can read to try and understand how should i formulate my problem (costs, and so on)? **EDIT:** I have more details on the model. For each danger level there is a minimum number of firefighter that should be guaranteed, giving priority to the higher levels. Trucks have capacity and firefighters can only be allocated if there is a truck to take them to the fire. There's also a constraint saying that a fire can be abandoned if one with 2 or more levels above doesn't have the minimum number. Does this look like knapsack? **EDIT 2:** I am adding this because it might be of help to someone facing a similar problem. I opted to solve this using a tree. If you would like details feel free to contact and i can explain the algorithm in detail. Disclaimer: i am familiar with assignment algorithms, like the Hungarian, for instance, and what i am looking here is not help with the algorith per se but with the formulation.