If I release a program under GPL, do I have to continue to do so?

Consider this scenario:   * I am developing a program FooSuite that uses a GPL-licenced library QuuxTools   * I release the program FooSuite 1.0 under GPL Later on I discover that, for some reason, I need to licence the program to someone on different terms.   Hence:   * I remove the dependency on GPL via QuuxTools, by either...     * rewriting the program not to use this library any longer     * obtaining a different licence for QuuxTools (if it's dual-licenced; see PyQt)   * I release FooSuite 1.1 under a non-GPL licence. However, _FooSuite 1.1 is still a derivative work from FooSuite 1.0_. I understand that it's not legal for a stranger to do what I did, but am I myself - as the owner of FooSuite - free from this restriction?


Java editor/IDE for beginners?

I teach some beginners the fundamentals of Java these days and they need to see the output for their small programs such as Hello world, etc. I need basic editor that contains code highlighting and contains the compiler with it so they can quickly run and see the result of their programs. What would you recommend?


Translating variables into english

I have recently came across some code where the variable names are in french, I could not use google translate because only part of the code needs translated, and it would not be that practical to copy and paste each of the variables into the translator. How can i easily translate the variable names? what translator could i use? Here is some french that i tried to translate.               #include <stdio.h>          int main()     {         unsigned int nombre;         unsigned int diviseur;         unsigned int reste;              for (nombre = 2; nombre != 0; nombre++)         {             for (diviseur = 2, reste = 1; (diviseur < nombre) && (reste > 0); diviseur++)             {                 reste = nombre % diviseur;             }             if (reste > 0)             {                 printf("%d\n", nombre);             }         }              return;     }      But when i tried to translate the code using google translate i got this bad translation.               # include stdio.h          int main ()     {         unsigned int number;         unsigned int divisor;         unsigned int left;              for (count = 2, number = 0;! number + +)         {             for (divisor = 2, left = 1, (divisor <number) && (rest> 0) + + divider)             {                 remainder = number% divisor;             }             if (left> 0)             {                 printf ("% d \ n", count);             }         }              return;     }


to teach or not to teach GUI for beginners in CS

I have been teaching an OOP course for almost one year from now. The premise of the school is to use Java by using NetBeans for the programming part. I have seen the following scenarios:   * The students get overwhelmed by the amount of information about the different controls to use, so they lost focus on the programming paradigm taught (in our case OOP)   * They rely on their memory, mainly of the different Java GUI tools Is the best approach to teach the OOP topics by making use only of console and with little or no use of the Net Beans GUI? Could that help the students to focus more on the logic of the program and maybe to learn how to do quick tests? Thanks


Is it okay to add time for "unexpected delays" to a time estimate?

I've landed my first contract (hooray, self employment!) and the company is asking for time estimates. Programmers are notoriously bad at time estimates, and I know I've been laughably wrong before. It's fixed bid, so I'm not concerned about charging. I'm just concerned about expectation management. So far I've itemized the work I need to do, estimated the time it would take, then significantly padded that time. I'm still nervous about it, though. Is it acceptable to write in time for "unexpected delays"? I've estimated 4 weeks, and I'd like to add a 5th week for problems I haven't thought of. Is that something people do? Would you balk if someone gave you an estimate with that in it?


Memoization Memory

Memoization is definitely a powerful technique. But Dynamic Programming is slightly better IMO, since it does not involve the memory strain (in a recursive program, the parameters occupy memory and this memory increases as we go deeper into the recursion). But speed-wise, both are pretty equal. But definitely memoization is a lot more straight-forward than Dynamic Programming. My question: Is it somehow possible to use memoization without the memory constraint ?


How is machine learning incorporated into search engine design?

I am currently building a small in-house search engine based on Apache Lucene. Its purpose is simple - based on some keywords, it will suggest some articles written internally within our company. I am using a fairly standard TF-IDF scoring as a base metric and built my own scoring mechanism on top it. All of these seem to be working excellent except for some corner cases where the ranking seems messed up. So what I am planning on doing is to add a small Relevant/Not Relevant link to the search results page so that users can click on one of those depending on their perception of whether that result should have been included in the first place. # My Idea   1. Treat these Relevant/Not Relevant as labels and create a training data.    2. Use this data to train a classifier (such as SVM)   3. Incorporate this model into the search engine i.e., every new result will pass through the classifier and will be assigned a label on whether it is relevant or not. This approach seems intuitive to me but am not sure whether it will work in practice. I have two specific questions:   1. What all features should I extract?   2. Is there a better way to integrate the machine learning component into the search engine? My final goal is to "learn" the ranking function based on both business logic as well as user feedback.


Is more dependency inversion always better?

Is there any situation in industrial object-oriented programming when the dependency inversion principle should not be used?


What data should QR-Code contain to serve both my own and external QR-Code reader

My webapplication uses codes (in form of `http://www.url.com/code/105820582020204`), that I want to encode as QR-Code. I assume that such generated QR-Code will be scanned by both people using my mobile application (and bundled built-in QR-Code scanner) and by some 3rd party, external scanners. Exactly what data should I encode to support both of them -- code itself only or full URL? First scenario fails with external QR-Code reader. It will decode a QR-Code to just a long number and will get no idea, what it should do with such number. Only my own, mobile application QR-Code scanner will know, that it should exchange data with server, using decoded code. In second scenario, I assume that external QR-Code reader open up entire URL, so the whole thing will work as supposed, while my on, in-app QR-Code reader will extract code itself from the URL, and also be able to use it (just as in first scenario). So, second scenarion seems to be the only one to support both kinds of QR-Code readers. The problem is, that I read in this answer, that I shouldn't encode entire URLs in generated QR-Codes.


High Level Configuration of Constructor Injection in C++

My questions are specifically dealing with dependency injection through the constructor. I understand the pros/cons of service locator pattern, constructor/setter injection, and their flavors, however there is something I can't seem to get past after choosing pure constructor injection. After reading many materials for testable design, including a thorough perusing of Miško Hevery's blog (specifically this post) I'm at the following situation: Assume I'm writing a C++ program, and I have correctly injected my dependencies through their constructors. For readability I have given myself a high-level object which has a single Execute() function called from main:               int main(int argc, char* argv[]) {         MyAwesomeProgramObject object(argc, argv);         return object.Execute();     }      Execute()'s responsibility is to simply wire up all required objects and kick off the highest level object. The highest level object requires a couple dependencies and those objects required a few objects and so on and so on, implying a function that looks like this:               MyAwesomeProgramObject::Execute() {         DependencyOne one;         DependencyTwo two;         DependencyThree three;              MidLevelOne mid_one(one);         MidLevelTwo mid_two(two, three);              // ...              MidLevelN mid_n(mid_dependencyI, mid_dependencyJ, mid_dependencyK);              // ...              HighLevelObject1 high_one(mid_one, mid_n);         HighLevelObject2 high_two(mid_two);              ProgramObject object(high_one, high_two);         return object.Go();     }      From what I take from Miško's blog (and I would ask him, but figured he wouldn't have time to get back to me), this is the only way to satisfy pure constructor injection of dependencies. In the blog post mentioned, he states we should have factories on a per object lifetime level, but this is essentially what Execute is doing, making my code look identical to his example:               AuditRecord audit = new AuditRecord();     Database database = new Database(audit);     Captcha captcha = new Captcha();     Authenticator authenticator =         new Authenticator(database, captcha, audit);     LoginPage = new LoginPage(audit, authenticator);      ## Questions:   * Is this the standard approach?   * Is this a pattern that I'm not aware of (seems similar to Maven's context.xml)?   * For pure constructor injection, do I simply suffer the cost of "upfront" allocation?


Was there ever a serious push for partial classes in java

was there ever any serious attempt/demand to introduce C#-style partial classes to the java language? an abandoned JCP? a mailing-list flame-war? anything? or was this never even suggested?


Learning Smalltalk as a Java programmer

I am a Java programmer willing to learn smalltalk. As of now I am working within the Pharo environment. Trying to switch from Java to Smalltalk is being a bit of a headache, honestly. I would like to learn Smalltalk with the help of a code base available but I believe that there aren't many Smalltalk example projects available on the web. So are there any particular websites that involve learning Smalltalk (Pharo) based on some simple examples? Currently I am taking the help of Pharo By Example doc but I feel it is just not sufficient for me. I am looking for more some code examples in Smalltalk.


What are the advantages of having a built-in datatype in a data interchange format over not having it?

Due to the requirement of a project we had to develop a data interchange format with a built in data types. The format served the purpose well in the scope of that project. But I was thinking that does it have any advantages of having a built-in type system (int, long, bool, string etc.) in a more general scope of data interchanging? Take XML as an example. It has been serving the purpose very well, but if XML would have a built-in data type system (forget about dtd/xml schema), would that be of any extra advantage than its currently having? e.g, we generally use xml for serialization, during the operation if we would be able to store the datatype along with the data, would that be more helpful?


We need a DVS. They need an SVN repo. What should we do?

We are a team of two people who need a versioning system for their university project. Due to administration issues, the graders need us to register on a site that happens to only support SVN; however, we cannot commit to SVN from inside the university as the required protocols are filtered out by the proxy (including the HTML extensions that would make SVN checkins over HTTP possible). Sigh. Is it possible to have a hg repo for ourselves that can then be converted to SVN for purposes of hosting on this site? * * * **Please note that practically all students commute to university,** so the "we can't commit from university so we can't do this" is not as strong of an argument as you'd think.


Measuring risk of source code changes?

My manager asked me to write a estimation of work hours and a risk estimation of source code changes for a defined task. While the first is no problem for me and there are many resources on the web, I cannot get my head around the latter one. I already asked for a clearer description of risk estimation and got the answer that the risk for the need of "follow-up code changes due to the changes made" and "potential loss of stability of the overall software" should be stated. How can I approach this task (thumb rules, documents about risk estimation, ...)?


What are good Information System design resources?

After taking a class about information systems, I want to find additional resources for learning the various patterns, concepts, and examples of their implementation. The course did focus on Martin Fowler's Principles of Enterprise Application Architecture and had a project that attempted to implement some of them. Basically, where can I learn more about Information System design and implementation?


Algorithm to Select Sequential Subarrays from an Array

I solved my problem by using simple nested loops and comparisons but I'm wondering if there is a well known Selection Algorithm to solve my problem. Let's say I have an array such as [1, 10, 250, 9, 8,8, 249, 249, 248, 247, 2, 4, 9, 10, 9, 7, 6] I need to find subarrays [6,7,8,9,10] [8,9,10] [247, 248, 249, 250] Subarrays should be min. 3 length size. I dont want a solution but a similar algorithm would help me refactor my code. I'm currently doing this with nested loops and using buffer collections.


What is the best way to prepare for CSDA-like certification exams?

I am interested in taking the IEEE CSDA exam. What are some of the better, individual strategies for learning software engineering practices in preparation for the exam?


Can rabbitmq client have its own exchange and queue in client environment itself?

Is that possible to create exchange and queue in client environment by the client? Below is the quote from http://blog.dtzq.com/2012/07/amqp-exchanges-and- rabbitmq.html > AMQP clients are free to create their own exchanges or use the predefined > defaults. Or exchange and queue can be only at the server where the broker is?


How does user confirmation box work?

How does the client know to send request to server only when the confirmation box result is ok and stay on page if cancelled? Also, is this mechanism any different in ASP.Net and ASP.Net MVC? I want to know the internal working of when user clicks OK/cancel what happens internally. How does browser come to know it has to proceed to server call or close itself and do nothing? What I have researched so far tells me, that on a web forms page, the Page.IsValid property is somehow responsible for browser to determine the outcome.Is it correct? Also what happens with MVC?


Open source: what is the definition of "derivative work" and how does it impact copy-left

I am a commercial software developer and I want to make use of open-source in my proprietary software. As I understand the concept of copy-left, it uses the original authors copyright to ensure that their ultimate end users (which would include my customers) are not deprived of benefits of the original work that the original authors of the OS components intended for them to have. I also understand that there is an incentive to produce more free software and I often find that sites that clarify and recommend various licensing terms are mixing the legalities with the ideology. All I am asking for is a clear picture. The people who want to create OS exclusively for other OS projects should be allowed to do so. The people who want to put code out there for anybody to use should be allowed to do so. Also, there are many claims which have no legal precedence and are not as clear cut as authors of OS interest sites would like them to be. And we all know that code is not just code. There is a difference between:   * Copying somebodys source code into your source code.   * Consuming a library compiled as-is from github.   * Consuming a library compiled from a locally altered version from github. Let's pretend that I use an open source library for accessing Excel spreadsheets. It makes sense that I would contribute back bugfixes/additions etc that had anything to do with the general problem of accessing excel spreadsheets. This is to make an excel plugin for an application that already accepts XML, SQL db etc as alternative input mechanisms for the same data. ** Does this mean that the application is considered "derivative" even when it does not expand into the problem domain of importing excel sheets? **


What makes Agile software development so appealing?

Agile software development is becoming a pretty fun buzzword these days. As a developer, I understand the pragmatic value of iterative development, but (most often) it isn't a developers choice to embrace an Agile approach to software development. It's a top-down management choice! Whether it is crystal, agile methods, dsdm, rup, xp, scrum, fdd, tdd, you name it. It's not a developer choice. For all the managers out there, **what are the biggest reasons for choosing to do Agile development** when (in my experience) most managers haven't even touched a piece of code in their life!


Why does it seem so hard for non programmers to understand versioning?

In the past I have worked with designers, BAs and project managers, all who regularly produce project artifacts, yet very really do they understand the concept of versioning. When I try to explain it to them (even in its most simple form of mulitple differently named files) they seem to have some kind of mental block. Why do you think this is?


Future-proofing myself when learning to program

I want to learn to program in a 'future-proof' manner, if you like. Whilst Windows dominates the desktop OS marketplace (for now), obviously there is a lot of value in learning its languages/frameworks/API's and so on - this might be subject to change as new devices emerge or Windows shoots itself in the foot (over-friendly previews of Windows 8 don't look too appealing...). Would I be right in thinking that having a solid knowledge of C/C++ for back- end logic/low level programming and the like, combined with an extremely portable language like Java for GUI's and so on, would be a good basis for software development that will prove useful on the most amount of systems? - I'm talking desktop PC's, tablets, phones.


Advantages to Multiple Methods over Switch

I received a code review from a senior developer today asking "By the way, what is your objection to dispatching functions by way of a switch statement?" I have read in many places about how pumping an argument through switch to call methods is bad OOP, not as extensible, etc. However, I can't really come up with a definitive answer for him. I would like to settle this for myself once and for all. Here are our competing code suggestions (php used as an example, but can apply more universally):               class Switch {        public function go($arg) {           switch ($arg) {              case "one":                 echo "one\n";              break;              case "two":                 echo "two\n";              break;              case "three":                 echo "three\n";              break;              default:                 throw new Exception("Unknown call: $arg");              break;           }        }     }          class Oop {        public function go_one() {           echo "one\n";        }        public function go_two() {           echo "two\n";        }        public function go_three() {           echo "three\n";        }        public function __call($_, $__) {           throw new Exception("Unknown call $_ with arguments: " . print_r($__, true));        }     }      Part of his argument was "It (switch method) has a much cleaner way of handling default cases than what you have in the generic __call() magic method." I disagree about the cleanliness and in fact prefer call, but I would like to hear what others have to say. Arguments I can come up with in support of `Oop` scheme:   * A bit cleaner in terms of the code you have to write (less, easier to read, less keywords to consider)   * Not all actions delegated to a single method. Not much difference in execution here, but at least the text is more compartmentalized.   * In the same vein, another method can be added anywhere in the class instead of a specific spot.   * Methods are namespaced, which is nice.   * Does not apply here, but consider a case where `Switch::go()` operated on a member rather than a parameter. You would have to change the member first, then call the method. For `Oop` you can call the methods independently at any time. Arguments I can come up with in support of `Switch` scheme:   * For the sake of argument, cleaner method of dealing with a default (unknown) request   * Seems less magical, which might make unfamiliar developers feel more comfortable Anyone have anything to add for either side? I'd like to have a good answer for him.


How do you structure computer science University notes?

I am completing a year of postgraduate study in CS next semester. I am finishing a law degree this year, and I will use this to briefly explain what I mean when I refer to the 'structure' of University notes. My preferred structure for authoring law notes:   * Word   * Two columns   * 0.5cm margins (top, right, bottom, middle, left)   * Body text (10pt, regular), 3 levels of headings (14/12/10pt, bold), 3 levels of bulleted lists   * Color A background for cases   * Color B background for legislation I find that it's crucial to have a good structure from the outset. My key advice to a law student would be to ensure styles allows cases and legislation to be easily identified from supporting text, and not to include too much detail regarding the facts of cases. More than 3 levels of headings is too deep. More than 3 levels of a bulleted list is too deep. In terms of CS, I am interested in similar advice; for example, any strategies that have been successfully employed regarding structure, and general advice regarding note taking. Has latex proved better than Word? Code would presumably need to be stylistically differentiated, and use a monospaced font - perhaps code could be written in TextMate so that it could be copied to retain syntax highlighting? (Are notes even that useful in a CS degree? I am tempted to simply use a textbook. They are crucial in law.) I understand that different people may employ varying techniques and that people will have personal preferences, however I am interested in what these different techniques are. **Update** Thank you for the responses so far. To clarify, I am not suggesting that the approach should be comparable to that I employ for law. I could have been clearer. The consensus so far seems to be - just learn it. Structure of notes/notes themselves are not generally relevant. This is what I was alluding to when I said I was just tempted to use a textbook. Re the comment that said textbooks are generally useless - I strongly disagree. Sure, perhaps the recommended textbook is useless. But if I'm going to learn a programming language, I will (1) identify what I believe to be the best textbook, and (2) read it. I was unsure if the combination of theory with code meant that lecture notes may be a more efficient way to study for an exam. I imagine that would depend on the subject. A subject specifically on a programming language, reading a textbook and coding would be my preferred approach. But I was unsure if, given a subject containing substantive theory that may not be covered in a single textbook, people may have preferences regarding note taking and structure.


How to handle or prevent all Admins and users being removed

I have a website that stores all users in a database. A user can log on to the website and if they have sufficient privileges can add/delete users, as well as change their privileges. How do I ensure there is always at least one Administrator (to create/edit/delete users) in the system or that an administrator can easily be added to the system. Surely I can put rules in place so that the Admin can't delete himself, or other rules like that. But what if someone deletes all the users in the SQL table. The passwords are hashed so it's not as if the DBA can just go in and add a new user with Admin rights. Do I hardcode some special username/password that automatically gets added to the system if no Admin exists?


How to handle "can you add just a few more fields" type of requests from customers?

Very commonly we have feature requests for fields that only one customer wants. This, at best, clutters the application's code. Often when we look in their database a few months after adding the fields, we can see that they are not actually even using the extra fields. Also, it's quite an old application so adding a single field requires multiple code changes, changing reports, and making sure that it doesn't affect other customers who do not need to see the field.   * How can we make sure that a customer actually needs these feature requests?    * How do we politely say "you don't really need that"? Currently we are beginning to charge for certain feature requests. (Previously, feature requests were free usually) Is there anything else we can do?


C++ Performance vs. Java/C#

My understanding is that C/C++ produces native code to run on a particular machine architecture. Conversely, languages like Java and C# run on top of a virtual machine which abstracts away the native architecture. Logically it would seem impossible for Java or C# to match the speed of C++ because of this intermediate step, however I've been told that the latest compilers ("hot spot") can attain this speed or even exceed it. Perhaps this is more of a compiler question than a language question, but can anyone explain in plain English how it is possible for one of these virtual machine languages to perform better than a native language?


What are good unit tests to cover the use case of rolling a die?

I'm trying to get to grips with unit testing. Say we have a die which can has a default number of sides equal to 6 (but can be 4, 5 sided etc.):               import random     class Die():         def __init__(self, sides=6):             self._sides = sides              def roll(self):             return random.randint(1, self._sides)      Would the following be valid/useful unit tests?   * test a roll in the range 1-6 for a 6 sided die   * test a roll of 0 for a 6 sided die   * test a roll of 7 for a 6 sided die   * test a roll in the range 1-3 for a 3 sided die   * test a roll of 0 for a 3 sided die   * test a roll of 4 for a 3 sided die I'm just thinking that these are a waste of time as the random module has been around for long enough but then i think if the random module gets updated (say i update my Python version) then at least i'm covered. Also, do I even need to test other variations of die rolls e.g. the 3 in this case, or is it good to cover another initialized die state?


Is HTML5 more secure to develop for than Silverlight?

I'm learning Silverlight, and I know that if I master it, I can apply the same concepts to WPF, which means I can do either web or desktop development pretty easily. But I've read articles and followed the discussion online, and I understand HTML5 is gaining traction for being cross-platform, and a lot of people seem to be moving to HTML5. From my understanding, any HTML5 application would be built with HTML and JavaScript (or Flash). But is it secure? It seems like anyone can easily use their browser's "view source" option and grab your code. Is this something I should be worried about, or is there a way to protect against it?


How should I manage a team with different skill levels?

I'll be working on a software project with some friends of mine, and I've been appointed technical lead. None of these guys is a bad programmer at all, but I do have significantly more experience than them. I need to be able to distribute the work among everyone on the team, while also making sure that we don't tread on one another's toes; that they meet the relatively high standards of quality and scalability that we need to make this project successful, without requiring me to review everything they commit. How should I maintain standards while avoiding micromanagement? Is it enough to make some diagrams, schedule some code reviews, and trust that I'll be able to fix anything that they might break, or should I go the TDD route and write explicit tests for the team to satisfy?


What is a reasonable number of threads for a Java program?

In Java (or probably most other languages targeting the JVM) what is a reasonable number of threads to use? Presumably, this will be expressed as a ratio to the number of cores/processors available, is that correct? At least initially, it seems like twice as many threads as cores might make sense, but 20+ times as many seems unreasonable. Is the ratio likely to be affected by the type and/or architecture of the software? Are there types of software and/or situations in which a much larger number of threads really makes sense? [And yes, I know that's phrased as a number of separate questions, but I think they're closely enough related for a single answer to cover all of them, since they're all really about how many threads make sense under what circumstances.]


How do you help your fellow programmers to grow?

As a team lead, how can you help your programmers to grow? The reason I ask this is because there are a few programmers working with me, and I really want to "turn them on the loose", to realize their maximum potential, and to keep them happy. But I don't quite know how to do this, do I have to   1. Interact with them frequently, or give them quiet time, leave them undisturbed?   2. Ask them to follow coding guidelines, such as enforcing unit tests, coding styles, or let them do whatever they see fit?   3. Be lenient with them. Such as don't really care whether they really come into office for 8 hours or 4 hours, or need to enforce some "disciplines" in the work place? Guess what, each positions have their own points, and different people would argue for different things. Such confusions make managing people indefinitely harder. What do you think?


How Do You Handle Non-Functional Work With Scrum in Embedded Systems?

I have two issues with scrum in embedded systems. First, there are many tasks to do, especially in the early stages, which are not demonstrable. We started with a dev board, no OS, no display, no serial comms, etc. We didn't have our display for 6 sprints. The first 4 sprints were:   * Getting the RTOS up and running    * Creating tasks Writing network and serial drivers   * Writing interrupt routines for buttons, comms, etc   * Writing the primary database classes and methods   * Writing a serial debug menu Most of these tasks are not well suited for user stories. In fact, the only interface into the whole system was the serial debug menu, built in sprint 3 so there was nothing to demonstrate at the end of the sprints. Even the serial menu was meant for internal use and not an end user. Never the less, I still want to track and manage these development activities via scrum. We ended up writing "user stories" phrases like, "As a developer...", which I'm not happy with but in using Target Process (www.targetprocess.com), there is no concept of a backlog item which is a task or chore. Second, how do you handle releases and testing? It's a real pain for us because the testers don't have the hardware debuggers so we have to build flash versions of the code and burn them on their dev boards to test. The testers are not technically as sharp as the developers and often require a lot of support in getting things working in the early stages (resetting the board, connecting the serial comms, etc), or even in understanding the output. Finally, regarding the definition of done, a sprint can't be complete until all stories are complete. All stories aren't complete until verified by the testers. There is no way to avoid "robbing" developer time to give to the testers. In other words, if the last 3 user stories in the sprint will take 5 days to test, they must be coded and unit tested 5 days before the end of the sprint. What's the developer supposed to do, stop working? I'm being facetious but it is a real problem trying to conform to the rules. Now, I'm fine with bending the rules but the issue I have is, it screws up all my burndown metrics if I can't mark things done until their tested. I'd love to hear how others have handled these situations.


What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future?

I have been going through interview questions and I saw one which made me stop and think for a while. It starts with a quote and asks about your interpretation and whether you agree or not. "For infrastructure technology, C will be hard to displace." Dennis Ritchie From a bit of background reading you can find that he was the mastermind behind C language as well as the UNIX OS. At the time it was a phenomenal improvement and at the forefront of cutting edge techniques. I feel that C++ and Java are becoming increasingly popular languages, but C will always be an important language. What do other languages offer when it comes to infrastructure technology that could indicate its advantage over C in the future. On a side note, does anybody know which year this quote was made? I just want the opinions of people who use these languages a lot, I myself use python language and would love to learn a bit more about the framework around C and it's importance firsthand.


Can you get fired from a work-for-hire contract with no pay, and a lawsuit?

The story is like this: I was hired under a work-for-hire contract that didn't specify what the pay is going to be. I was told it would be on the 15th of every month, depending on what work was completed. On the 15th of the first month, I was told it was going to be at the end of the project. Then the project got halted (required client response on some matter). Then another project was given to me, one that would take at least two months to complete. Few weeks after that, I have told the boss that I will refuse to do any work until at least a partial payment is made. I got fired and got promised a lawsuit. We're in different countries. He's from US. Contract doesn't have his signature in original, in my country this would render it invalid. There are a few questions here, the main one is how to handle this from this point forward? Maybe you could give me some advice to avoid this in the future? Does this lawsuit have any chances to be taken seriously?


how do I write a functional specification quickly and efficiently

So I just read some fabulous articles by Joel on specs here. (Was written in 2000!!) I read all 4 parts, but **Im looking for** some methodical approaches to writing my specs. Im the only lonely dev, working on this fairly complicated app (or family of apps) for a very well known finance company. I've never made something this serious, I started out writing something like a bad spec, an overview of some sorts, and it has wasted a LOT of my time. Ive also made 3 mockup-kinda-thingies for my client so I have a good understanding of what they want. Also released a preview (a throw away working app with the most basic workflow), and Ive only written and tested some of the very core/base systems. I think the mistake Ive been making so far is not writing a detailed spec, so Im getting to it now. So the whole thing comprises of   * An MVC website (for admins & data viewing)   * 2 Silverlight modules (For 2 specific tasks)   * 1 Desktop Application Im totally short on time, resources and need to get this done quick, also, need to make sure these guys read it up equally quick and painlessly.   * So **how** do I go about it, **Im looking** for any tips, any real world stuff, how do you guys usually do it?   * Do you make a mock screenie of every dialog/form/page? Im thinking of making a dummy asp.net web forms project, then filling in **html** files in folders and making it look like my mvc url structure. Then having a section in the spec for the website and write up a page for every URL Ive got with a screenie. For my win forms app, Ive made somewhat of a demo Win Form project, **would I** then put in a dialog or stucture everything as I would in the real app and then screen shot it? * * * For some background into this question. I've always been a crazy jump-to-code kinda guy, which has worked ok, but for the app I'm working on, its not only complex, its for a very very reputed and large company and I have to get it right! (And it has been going well so far, today I gave a demo of the preview version which a lot of people liked!! =D ) If I do get the initial design right I will also have a great business with this company, there are already many thinking about new "awesome" features which they're ready to pay for.


How can I organize my implementation notes to use as a future reference?

How should I document my designing of the app better so that I avoid programming by coincidence? How can I structure notes so that it is clear how an app works so that when I refer to it a year later I'm not lost for the first 3 days?


Why does Java compiler decide whether you can call a method based on the "reference" type and not on actual "object" type?

I was just wondering why does Java compiler decide whether you can call a method based on the "reference" type and not on actual "object" type? To explain I would like to quote an example:               class A {         void methA() {             System.out.println("Method of Class A.");         }      }          class B extends A {         void methB() {             System.out.println("Method of Class B.");         }         public static void main(String arg[]) {             A ob = new B();             ob.methB();       // Compile Time Error         }     }      This will produce a Compile Time Error that method methB() not found in class A, although Object Reference "ob" contains an object of class B which consists of method methB(). Reason for this is that Java Compiler checks for the method in Class A (the reference type) not in Class B (the actual object type). So, I want to know whats the reason behind this. Why does Java Compiler looks for the method in Class A why not in Class B(the actual object type)?


What is a first class connector?

I was reading Towards Architecture-based Self-Healing Systems, and came upon the term `first-class connectors`. What are they? Searching some more finds this paper Systematic Construction of Software Architecture Supported by Enhanced First-Class Connectors, which looks like it might have an answer, and I might read it in detail later, but regardless, it would be useful to have the question up here with an answer shorter than that paper. :) An example of why having a connector being first class might also be relevant.


What is the best setup for distributing a PHP application?

What is a recommended setup in terms of source control, builds, testing, bug tracking, and deployment for a downloadable PHP application (a la Wordpress, phpBB, Magento, etc.)? As a developer working on the application, what would you expect? What about as a user of the application? Please describe a setup and workflow, as well as any resources you think might be relevant or helpful.


Why don't people use white space inside parentheses?

Clearly, this:               if( foo( 5, 6, 7 ))       do_something( arr[ 5 ]);      if more readable than:               if (foo(5, 6, 7))       do_something(arr[5])      yet very few people use whitespace inside their parens. The venerable **indent** program doesn't really provide useful options for this behavior (the option to include whitespace inside parens adds a space between consecutive occurrences, which is pretty hideous), and certainly some people will argue that it's a waste of horizontal space (but those same people would probably omit the spaces after the comma as well, so their opinion is clearly suspect), but surely there's some valid reason that this style is not more popular. Why don't you use any whitespace inside your parentheses and/or braces?


What are the real life use cases for tagged pointers? This is mostly coming from reading about small 64-bit systems and possible uses of 64-bit word pointers. To my understanding tagged pointers are addresses which can containing extra information in bits due to possible address space on that particular architecture is much smaller. But then, is it possible to use tagged pointers beyond trivial cases? Any cool ideas / examples? Are there popular libraries, frameworks taking advantage of 64-bit pointers via tagged pointers? Is that possible on every hardware?


When to use private methods in Python

I have a class, but every method in it should be private (apart form `__init__` and `__str__`). Should I denote every method with a double underscore, or is that deemed bad practice?


Mocking static methods

Having recently returned from a Test Driven Development (TDD) course I had the following thought. While writing unit tests using Mockito we came up against of the problem of mocking static methods. It was suggested by one developer we use PowerMock, which allows mocking of static methods, and then we got into a big discussion on how we should approach this problem. However, in my experience static methods should only really be used as utility type methods. The classic example in java being Math.random(). So a static method should only, execute one defined action regardless of any interaction with a class instance. If this is not the case, and you require class instance interaction, your method should not be static and you need to rethink your design. So my question is, with this in mind should you need to mock static methods at all? If they are always performing a simple action, then surely you should just call them as you would in real code.


How representative is Ohloh?

My colleague recently pointed me to Ohloh, a website providing statistics on FOSS based on versioning repositories. It's quite a fun procrastination tool, e.g. to compare programming languages by active projects: ![enter image description here](http://i.stack.imgur.com/ekEZT.png) Which makes me wonder: how representative is such a comparison? Can we draw conclusions from this such as "Javascript is the most used programming language in FOSS, followed closely by Python, Java and C++"? Or are there some big caveats to take into account?


PHP file_put_contents File Locking

**The Senario:** You have a file with a string (average sentence worth) on each line. For arguments sake lets say this file is 1Mb in size (thousands of lines). You have a script that reads the file, changes some of the strings within the document (not just appending but also removing and modifying some lines) and then overwrites all the data with the new data. **The Questions:**   1. Does 'the server' PHP, OS or httpd etc. already have systems in place to stop issues like this (reading/writing half way through a write)?   2. If it does, please explain how it works and give examples or links to relevant documentation.   3. If not, are there things I can enable or set-up, such as locking a file until a write is completed and making all other reads and/or writes fail until the previous script has finished writing? **My Assumptions and Other Information:**   1. The server in question is running PHP and Apache or Lighttpd.   2. If the script is called by one user and is halfway through writing to the file and another user reads the file at that exact moment. The user who reads it will not get the full document, as it hasn't been written yet. (If this assumption is wrong please correct me)   3. I'm only concerned with PHP writing and reading to a text file, and in particular, the functions "fopen"/"fwrite" and mainly "file_put_contents". I have looked at the "file_put_contents" documentation but have not found the level of detail or a good explanation of what the "LOCK_EX" flag is or does.   4. The scenario is an example of a worst case scenario where I would assume these issues are more likely to occur, due to the large size of the file and the way the data is edited. I want to learn more about these issues and don't want or need answers or comments such as "use mysql" or "why are you doing that" because I'm not doing that, I just want to learn about file read/writing with PHP and don't seem to be looking in the right places/documentation and yes I understand PHP is not the perfect language for working with files in this way.


How can I make the transition from being a beginner to an Intermediate/advanced level iPhone developer?

I've been programming for the iPhone for quite some time now. I have read books like Beginning iPhone 4 Development by Jeff LaMarche and Programming in Objective C by Stephen Kochan. Right now I am pretty comfortable with view controllers, table views, gestures, GCD, Core Data etc. I am now seeking to build a career in iOS (instead of a hobby as it has so far been). How can I take my knowledge to the next level so that I can be hired as a profesional iOS developer. What are the other technologies I must be familiar with in order to be comfortable building enterprise level applications for different industries like banking, telecommunications etc? Are there any good books that talk from the perspective of enterprise architecture for mobile applications ?


How can I work on my reverse-engineering skills?

I would like to start building up some software reverse engineering skills, and I'm looking for exercises or "challenges" to work on. Are there definitive or go-to sites, like Project Euler, specifically for reverse engineering? For example, exercises where I have to figure out why a program is crashing or behaving incorrectly.


Can non-IT people learn and take advantage of regular expressions?

Often times, not-IT people has to deal with massive text data, clean it, filter it, modify it. Often times normal office tools like Excel lack the tools to make complex search and replace operations on text. Could this people benefit from regexps ? Can regexp be taught to them ? Are regular expressions the exclusive domain of programmers and unix/linux technicians ? Can they be learned by non-IT people, given regexps are not a programming language? Is this a valid or achievable goal to make some users regexp-literate through appopriate training ? Have you have any experiences on this issue? and if so, have it been successful ?


How to wrap console utils in webserver

I have a big dataset (100Mbs/day) and a bunch of console a TCL/TK tools to view it - I want to turn it into a web app that I can build, and others can maintain. * * * In long: my group runs simulations yielding 100s of Mbs of data daily, in multiple (mostly but not only) text forms. We have a bunch of scripts and tools, mostly old school 1990's style stuff requiring a 5-button mouse, as well as lots of ad-hoc scripts that engineers build out of frustration every month or so. These produces UIs, graphs, spreadsheets (various sizes), logs, event histories etc. I want to replace (or at least supplement) the xwindows / console style UI with a web-based one, so I need the following properties:   * pleasant to program   * can wrap existing command-line tools in separate views (I don't need to scrape GUIs or anything)   * as I port logic from the existing scripts I can create a modularised and pleasant codebase to replace it   * I can attach a web-ui to navigate between views - each view is likely to contain keys which might make sense to view in another I am new to building systems that have logic on the back-end and front-end of a web-server. from that point of view, they do this:   * backend wraps old-school executables, constructs calls into them and them takes the output and wraps it up, niceifies it and delivers it to the web client. For instance the tool might generate a number of indexed images (per invocation) which I might deliver all at once or on-demand. May (probably) need to to heavy stats on some sources.   * frontend provides navigation connecting multiple views, performs requests from one view for data from another (or self to self), etc. Probably will have some views with a lot of interactivity. Can people please point me towards viable solutions for this? I know it's a bit of an open question so as answers come in I hope to refine the spec until we have a good match. I guess I expect to see answers like "RoR!" "beans!" "Scala!" but please give an indication of why those are a good fit; I know nothing! I'm not asking for _which is best, Scala or RoR*, but rather which have been a good fit for people doing what I'm trying to do? * * * I got bumped off SO for asking an open-ended question, so sorry if its OT here too (let me know). I take the policy that I use the best/closest matched language for a project but most of my team are extremely low level (ie pipeline stages and CDyn) so I don't have the peer group to know where to start.


Scrum for Embedded system devices

In our company, we are going to deliver a new product which will be used for mass notification, so it is an embedded software project and we are going to use the SCRUM as a framework for the product. We have started to write down the product backlog. Based on what I understood the product backlog should reflect a business value for each item. The nature of embedded software is that it has a lot of technical details that will consume a large amount of time to create drivers for microcontrollers, like the SPI, UART, ethernet, WIFI, so on. for example the System is sounding by playing message for notification, so it is pretty obvious that playing a message is a business value but to achieve this goal i have to write down the -requirements which are what also not how - for many drivers like the SPI, MP3 decoder chip driver, SD card driver and finally the FAT, so all of the previous drivers have requirements that should be written in the product backlog, such that the requirements started with a one business value requirement while it has a lot of technical sub- requirements. These don't reflect a business value for the client; can someone tell me how am I going to create my product backlog?


Why are there no package management systems for C and C++?

There are some programming languages for which exist their own package management systems:   * CTAN for TeX   * CPAN for Perl   * Pip & Eggs for Python   * Maven for Java   * cabal for Haskell   * Gems for Ruby Is there any other languages with such systems? **What about C and C++?** (that's the main question!) Why there are no such systems for them? And isn't creating packages for `yum`, `apt-get` or other general package management systems better?


Is the Adapter the correct design pattern for this situation?

I have an instance of a class `UntouchableClass` of which I need to access the member variables to use in my DotLiquid template. Problem is, `UntouchableClass` has to inherit from `Drop` if I want to use it in my template, but I can't change it since it is from an existing library. I've read about the Adapter pattern, but `UntouchableClass` does not have an interface from which to inherit the Adapter. Also, I can't use multiple inheritance (I would create a class which inherits from both `UntouchableClass` and `Drop` but this is C# and from what I know this isn't possible). Is there a design pattern that would suit this situation? Or is there a particular way to do this using DotLiquid?


Correct Seam for Stub

In Chapter 3 of his book The Art of Unit Testing: with Examples in C#, Roy Osherove illustrates the issue of undesirable external dependencies in code under test. He shows this with a method named `IsValidLogFileName` which takes in a filename string as an argument, reads in a config file from the local filesystem and checks whether the given filename extension exists in the config file. Here's what such a class would look like:                  public class LogAnalyzer         {             public bool IsValidLogFileName(string fileName)             {                      string [] extensions = System.IO.File.ReadAllLines(@"C:\Users\Public\ext.config");                      foreach (string ext in extensions)                 {                     if (fileName.EndsWith(ext))                     {                         return true;                     }                 }                 return false;             }         }      The issue here is that testing `IsValidLogFileName` has a dependency on the local filesystem. The author introduces the concept of **stubs** as a means of removing this dependency. In particular, he describes the following design: Create an interface:                   interface IExtensionManager         {             bool IsValid(string fileName);         }      an implementing production class:                   class FileExtensionManager : IExtensionManager         {             bool IsValid(string fileName)             {                 string [] extensions = System.IO.File.ReadAllLines(@"C:\Users\Public\ext.config");                      foreach (string ext in extensions)                 {                     if (fileName.EndsWith(ext))                     {                         return true;                     }                 }                 return false;             }         }      a stub:                   class FakeExtensionManager : IExtensionManager         {             bool IsValid(string fileName)             {                 string [] extensions = { "txt", "c", "cpp", "cs"};                      foreach (string ext in extensions)                 {                     if (fileName.EndsWith(ext))                     {                         return true;                     }                 }                 return false;             }         }      refactor `LogAnalyzer` as follows:                  public class LogAnalyzer         {             IExtensionManager em;                  public LogAnalyzer(IExtensionManager extensionManager)             {                 em = extensionManager;             }                  public bool IsValidLogFileName(string fileName)             {                 return em.IsValid(fileName);             }         }      run production code like this:                   LogAnalyzer la = new LogAnalyzer(new FileExtensionManager);      and test code like this:                   LogAnalyzer la = new LogAnalyzer(new FakeExtensionManager);      The part I don't understand is why we have to extract the validation logic from the original `IsValidLogFileName` by making an `ExtensionManager` interface. Wouldn't it make more sense to create something like a `ConfigManager` interface and refactor as follows: interface:                   interface IConfigManager         {             string [] GetFileExtensionConfig();         }      an implementing production class:                   class LocalConfigManager : IConfigManager         {             string [] GetFileExtensionConfig( )             {                 return System.IO.File.ReadAllLines(@"C:\Users\Public\ext.config");             }         }      a stub:                   class FakeConfigManager : IConfigManager         {             string [] GetFileExtensionConfig( )             {                 string [] extensions = { "txt", "c", "cpp", "cs"};                 return extensions;             }         }      refactor `LogAnalyzer` as follows:                  public class LogAnalyzer         {             IConfigManager cm;                  public LogAnalyzer(IConfigManager configManager)             {                 cm = configManager;             }                  public bool IsValidLogFileName(string fileName)             {                 string [] extensions = cm.GetFileExtensionConfig( );                      foreach (string ext in extensions)                 {                     if (fileName.EndsWith(ext))                     {                         return true;                     }                 }                 return false;         }      run production code like this:                   LogAnalyzer la = new LogAnalyzer(new LocalConfigManager);      and test code like this:                   LogAnalyzer la = new LogAnalyzer(new FakeConfigManager);


What's that rule where you aren't supposed to give visibility into an object called?

I forget the name of it but there's a rule that you aren't supposed to allow visibility into an objects inner makeup. It has to do with not allowing more than one dot in the implementation like this for example:               return world = foo.bar.hello.world();


Applications Architecture - fewer big systems vs more smaller systems

re: Applications Architecture, that is, " _the science and art of ensuring the suite of applications being used by an organization to create the composite application is scalable, reliable, available and manageable._ " When looking at a range of applications in an organisation, I can see various reasons for merging apps together, but sometimes also good reasons for keeping them separate. _In general_ , what are the pros and cons of having fewer big systems versus more smaller systems (bearing in mind that many of the systems will exchange information). I'm thinking things like: fewer, bigger apps means less plumbing between apps, but more smaller apps means more flexibility for individual departments. Is there any literature on this, or has anyone got a list of pros and cons that they've discovered? edit: In my scenario, a lot of the apps might be customisable off-the-shelf ones rather than in-house developed, but feel free to consider more general scenarios.


Establish connection between parent and child class

Assume you have two classes, a `Manager` who holds a set of `Client`s and the `Client` holds a backreference to the `Manager`.               class Manager {     public:         void addClient(Client* client) {             m_clients.push_back(client);             client->setManager(this);         }     private:         std::list<Client*> m_clients;     };          class Client {     public:         void setManager(Manager* manager) {             m_manager = manager;         }          private:         Manager* m_manager;     };      The confusing, probably even dangerous feature of this API is that Client exposes a setManager() method that can be called by anyone, yet should only be called by the Manager::addClient() method. `assert(manager->hasClient(this))` in setManager() would prevent wrong calling at runtime, however I would prefer a solution that doesn't allow the user to call methods he isn't supposed to call. What would be common solution? I don't   * want to use `friend` to expose all of Clients members to Manager so that he can establish the binary connection in `addChild()`   * want both classes to share some kind of Composite base class. They should remain unrelated inheritancewise.


c# naming - What are common conventions for a suffix to distinguish between read-only and writable interfaces

Assume an interface that allows queries on a spatial tree               public ISpatialTree     {         int FindChildIndex(Vector point);         bool IsLeaf { get; }         ICollection<ISpatialTree> Children { get; }     }      and another one that allows changing the tree:               public ISpatialTreeWriter : ISpatialTree     {         void Add(Vector point);         bool Remove(Vector point);         void Clear();     }      I am looking for a name to denote the writeable interface. Ideally it would be reasonably short and readable word. It's not only for this example, but I would like to use a convention for all code in the project because this is a common case. Does anyone know of a good convention for this problem? What conventions are used in other projects? Words that were discussed include Writer (ambiguous, often used in other contexts), Mutator (confusing), Rw (unreadable, not a word). A good solution would be a single word, not longer than 6-8 letters and that makes it obvious that this is the writer interface.


ruby-idiomatic hashes vs arrays

So I am still fairly new to ruby, though I have noticed that it is very hard to create 2d-array and that hashes seem to be more of the go to data structure than arrays. I was wondering why the Ruby community is so focused on Hashes and maybe if there is something more ruby-idiomatic than a 2d-array when trying to create something like a game board.


Name for intentionally assertless unit test

I have a tool that is going to be run as part of commit stage on Continuous Integration server to check whether all unit tests run do have an assert. Its main purpose is to eliminate silly mistakes like using `Equals` method that just returns bool instead of `ShouldEqual` assertion method. But there are sometimes cases when tests are intentionally (or at least semi- intentionally) written without asserts - with an assumption that if the code doesn't throw, the test should pass. I'd argue about readability and explicness of that kind of tests, but there are some suites that do this all the time. I'd like to have a possibility to mark that kind of tests with special attribute, so that if someone really wants to have a test without explicit assertion, he would at least need to say it explicitly. I'm wondering what would be a good name for such an attribute. My two (fairly different) ideas by now are:   * `[SmokeTest]` - as "passes when no exception thrown" kind of tests is only looking for smoke and not testing any outcome, this name sounds right, and it also suggests that this is not a full-fledged unit test - as is my intent,   * `[ExpectedNoException]` - this one is much more obvious in its meaning and corresponds pretty well with standard `[ExpectedException]` attribute provided by some of the most popular .NET unit testing tools. Or maybe it would be the best to have both possibilities? But the result of both will be exactly the same, so it can be confusing which one to use. As naming things is one of the hardest thing in Computer Science, I hope for some good suggestions. **EDIT** First answers suggest adding try-catch and `Assert.Fail` in catch. This would do the trick, right, but somehow I feel that an obligation to add meaningless code just to satisfy the build process is a bit smelly. The attribute is not much different, but I treat it more as "metadata" than the code. At least this is my personal opinion - you could disagree and I will be grateful for saying this, too :) What I seek for is not a way to have a dummy assert in each test, I'm looking more for the generic term I could call that kind of tests.


Where to check that a function actually did what I told it to?

Consider this function intended to kill all running instances of a subprocess:               killAllFoobars()     {         pids = getRunningFoobars();              foreach ( pids as p ) {             killOneFoobar(p);         }              return TRUE;     }      Where should I check that in fact all Foobars were killed? Should killOneFoobar() check that its Foobar is now killed? Should killAllFoobars() check that there are no more running Foobars before returning TRUE (seems a bit disingenuous to return TRUE without checking). Should the function calling killAllFoobars() check? Consider that the check is an expensive operation, so should not be done 'just whenever' but rather only when necessary.


MVC 3 Page design; split pages into Many partials?

I am currently working on an MVC 3 Web app project where I need to display a lot of information on the front page. I am relatively new at web page layout and design so I have hit a wall in terms of how to structure the code behind for this page. My first thoughts were to split the page up into as many partials as possible so the View Models are smaller and easier to manage. Although I am not sure if this is the correct way of going about it. Or should I try to fit all the needs of the page into one view model that will display all the information I need? My question: **Should I split my pages up into a lot of small partials or just make it one big page?**


Good uses for VBScript?

What are some good uses for VBScript? Is it still a widely used language today?


A* with possible multiple paths

Greetings I am currently studying pathfinding and I came across A* algorithm from this site https://github.com/qiao/PathFinding.js I tried to test A* with bi-directional and it is working great. ![enter image description here](http://i.stack.imgur.com/H9fz7.png) What I wanna do now is increase the path that it can make without adding more nodes in the openlist. For example is that the algorithm was able to find a path but as you look at the results it can still generate one more path without touching the other path. ![enter image description here](http://i.stack.imgur.com/bDeSj.png) Any ideas? Thank you so much


Can a programming language make you happy?

Some language designer create a language that focus on developers so they can be happy. Can a programming language make a programmer happy? In what way a programming language make a programmer happy? In the end all programming language is the same isn't it? You also have the burden to do the work which might not make you happy anymore.


Is learning C# as a first language a mistake?

I know there are similar questions on here, which I've read, but I recently read this post by Joel Spolsky: How can I teach a bright person, with no programming experience, how to program? And it got me thinking about my way of learning and whether it might actually be harmful in the long run. I've dabbled with various languages but C# is my first serious one, I've read "Head First C#" and created a few projects. But after reading the post above I've found it a bit disheartening that I may be going about it all wrong, obviously I respect Joel's opinion which is what has thrown me a bit. I've started reading "Code" as recommended in the reading list and I'm finding it pretty hard going, although enjoyable. I feel like it's taken the shine off of my "noobish hacking about" in Visual Studio. So now I'm unsure as to what path I should take? Should I take a step back and follow Joel's advice and start reading? I guess my main aim is just to become a good programmer, like everyone else, but I don't want to be going into bad practice by learning a .NET language when someone who's opinion I respect thinks that it is harmful. Thoughts?


Want to learn/dive into Java Web Development—where to start?

I want to dive into Java Web Development, but I don’t know where to start because I am overwhelmed with Frameworks, JSRs, modules and the like. Coming from a PHP and Ruby (on Rails) background, it may seem awkward to go the other way ’round—still there are a lot of places where Java is (and probably will be) prevalent. I know basic Java concepts, syntax and OOP, and I have done (too much) nonsense in existing projects in JSP. I am already using SVN and GIT, but like coding PHP and Ruby mostly via VIM, i’ve also done versioning from the command line. But this time I want to learn to build a new project from the ground up, in a more, let’s say, academic way (instead of the hackery to date). Looking at e. g. Eclipse frightens me. Then there is Struts, Spring, JPA, Hibernate, Seam, just to throw in some buzzwords, that I cannot put into clear relation to each other. Can you point me to some tutorials or books that could help me? What are the technologies you absolutely have to know, the JSRs that are widely implemented in the industry? Or, if you are an employer: What does a “Junior Java Web developer” have to know? Thanks for your suggestions!


software for spying on staff?

I have worked as a junior help desk sys admin, and in those days the only option for "monitoring" what other people was doing was by "shadowing" their screen , like windows remote desktop, RDP. Now I'm working as a mobile developer[iOS Android], and in the contract I saw a clause, where I accept to be monitored. So my question is what software is out there to monitor silently [with out the developer (me) knowing]. Would they see my screen?, or take snapshots? It's not that I waste time or do "illegal" activities, I'm just wondering if this is normal? and how to notice it? I'm using a Mac - if that makes any difference.


Creating an a project-site for an open source project

So I have an open source project that I would like to promote and I want to create a project-site for it where I will host the documentation, etc. (preferably something that integrates with github for handling downloads, issues, etc). The project-site should be just like a typical. Is there anything out-of-the-box for this or do I have to code it from scratch? Thank you.


Vim key mappings / plugin XCode?

I'm a developer who mostly does web stuff in ruby and C#. I'd like to start tinkering with iOS and Mac development. Over the last few month i've been trying to get fluent in one set of key bindings (vi / vim because it just feels right). I have the awesome ViEmu installed for visual studio on windows which gives me a ton of the vim awesomeness side by side with visual studio power toys. Is there anything like this for xcode? I know I could set up MacVim as the default editor, but I'm not too interested in this as it means losing all of xcode's cocoa awareness. The other option of course would be to go for the lowest common denominator and switch to emacs (as the mac keybindings are based massively on emacs) but let's not think about that for too long. :P


What to do when you are not doing what you are supposed to at work?

First off, I think my title is maybe a bit vague, so feel free to edit. My current situation is as follows. I recently decided to leave the previous company I worked for due to a number of reasons, but considering the work I was doing there I was never unhappy. Now, however, at my new job, it is a different story. When I interviewed here to be a developer, the world was promised. _"Yes, you will be coding, designing, etc. etc."_ , but that is definitely not the case. As a developer, when assuming a role as a primary developer (to clarify, primary here means I should be primarily coding, not a lead developer), I would expect the following breakdown:   * 50% - 60% actual coding   * 20% design   * the rest - testing / admin etc. Is this an unrealistic expectation? Currently, my breakdown is as follows:   * 1% actual coding   * 95% testing / upgrading / wondering why everything is breaking that the previous guys have done   * 4% drinking coffee, as the boredom is killing me I realize that for some people that might be what they want to do, but coming from quite an academic background, I enjoy problem-solving and grappling with a problem until you figure it out. And off-course, doing a lot of coding. It has actually reached a point once or twice where I was told to roll back changes I have made (for the better!) becuase: _"Yes, I know it's better, but revert because it wasn't the task assigned to you!"_ And I mean, it's not like it took me a day of work which I could have spent otherwise, it was 5 minute changes. Now, my real question is this. Seeing as I'm feeling that I will not grow as a developer here, how fast should I get out of this? Should I stay a while longer and see if things change? I have spoken to some of the other developers here and they say that this is just the way things are. A group of about 10 people write about 99% of the code, and they have all been here for about 10 years. My two concerns are:   1. I would probably have to take a pay cut if I move, since they pay quite generously here.   2. Having a company for 2 - 3 months on your CV doesn't always look good. I could really use some help from someone who has some experience in this? Maybe someone has had a similar situation? Thanks!


What considerations should be given for and against "super" sites?

My company is considering consolidating all their tier-1 (i.e. top end production) applications and sites into one all-encompassing code base. The theory is that their permissions, design and overall functionality can be homogenised and centrally managed. I have no end of concerns about this approach since the data structures underpinning each application are very different, the business rules are complex and unique to each application and the overall code bases for the existing applications are extremely disparate and very neglected. **EDIT** : The current environment consists of three ASP.Net 1.1 sites that have barely seen any real love since first being written (due chiefly to an absence of experienced developers in the company) and one MVC2 application that was also an ASP.Net 1.1 site before being upgraded last year. We write exclusively in C#. The company is a fairly small one, with about 50 staff; three of whom are actual developers. Management (even IT management) do not have any IT background or experience other than project management of IT projects (and therefore some passing knowledge of terminology and business impacts). The applications are chiefly online services to support the products sold by the company. The company doesn't sell any software directly. So to phrase this whole situation in a reasonably specific and answerable question: What are some compelling reasons for and against trying to pull all your systems together into one over-arching solution given the current conditions (i.e. old code base, complex business systems and rules)?


Why dynamically typed languages do not let the developer specify the type?

The dynamically typed languages I know never let the developers specify the types of variables, or at least have a very limited support for that. JavaScript, for example, doesn't provide any mechanism to enforce types of variables when it is convenient to do so. PHP let you specify some types of method arguments, but there is no way to use native types (`int`, `string`, etc.) for arguments, and there is no way to enforce types for anything other than arguments. At the same time, it would be convenient to have a choice to specify in some cases the type of a variable in a dynamically typed language, instead of doing the type check manually. Why there is such limitation? Is it for technical/performance reasons (I suppose it is in the case of JavaScript), or only for political reasons (which is, I believe, the case of PHP)? Is this a case for other dynamically typed languages that I'm not familiar with? * * * **Edit:** following the answers and the comments, here's an example for a clarification: let's say we have the following method in plain PHP:               public function CreateProduct($name, $description, $price, $quantity)     {         // Check the arguments.         if (!is_string($name)) throw new Exception('The name argument is expected to be a string.');         if (!is_string($description)) throw new Exception('The description argument is expected to be a string.');         if (!is_float($price) || is_double($price)) throw new Exception('The price argument is expected to be a float or a double.');         if (!is_int($quantity)) throw new Exception('The quantity argument is expected to be an integer.');              if (!$name) throw new Exception('The name argument cannot be an empty string.');         if ($price <= 0) throw new Exception('The price argument cannot be less or equal to zero.');         if ($price < 0) throw new Exception('The price argument cannot be less than zero.');              // We can finally begin to write the actual code.         // TODO: Implement the method here.     }      With some efforts, this can be rewritten as (also see Programming by contracts in PHP):               public function CreateProduct($name, $description, $price, $quantity)     {         Component::CheckArguments(__FILE__, __LINE__, array(             'name' => array('value' => $name, 'type' => VTYPE_STRING),             'description' => array('value' => $description, 'type' => VTYPE_STRING),             'price' => array('value' => $price, 'type' => VTYPE_FLOAT_OR_DOUBLE),             'quantity' => array('value' => $quantity, 'type' => VTYPE_INT)         ));              if (!$name) throw new Exception('The name argument cannot be an empty string.');         if ($price <= 0) throw new Exception('The price argument cannot be less or equal to zero.');         if ($price < 0) throw new Exception('The price argument cannot be less than zero.');              // We can finally begin to write the actual code.         // TODO: Implement the method here.     }      But the same method would be written as follows if PHP would optionally accept native types for arguments:               public function CreateProduct(string $name, string $description, double $price, int $quantity)     {         // Check the arguments.         if (!$name) throw new Exception('The name argument cannot be an empty string.');         if ($price <= 0) throw new Exception('The price argument cannot be less or equal to zero.');         if ($price < 0) throw new Exception('The price argument cannot be less than zero.');              // We can finally begin to write the actual code.         // TODO: Implement the method here.     }      Which one is shorter to write? Which one is easier to read?


Good practices every startup should follow

A couple of friends at work an me are going to set up a little startup / create our own software, probably moonlighting at first, since we cant yet afford to quit our day jobs. Neither of us has have this experience, we've all worked for other companies before, where a set of guidelines are set, and I think this is the time to establish good practices to follow (like avoiding meeting-itis). For people that have gone this way, what piece(s) of advice would you give us? I'm looking more for the technical side of things, things such as:   * Is it worth to have some kind of build server or is that going to far ahead?    * Would you do extensive TDD or do you think it would be too much overhead for a small team that is not too experienced with it? But wouldn't mind to listen to the management side of things. * * * The project is a web application done in ASP.NET MVC, I'm thinking of using Mercurial and BitBucket or Kiln + FogBugz or some other online project tracking tool, since we are going to be working remotely.


How do you prevent getting stuck in "research-mode" on a big project you're unfamiliar with?

I'm in a situation where there's a big project that I need a lot of background know-how to accomplish. yet I'm not moving fast enough in the research/study phase - and seeing myself off-track frequently. What it amounts to is procrastination, except it's mixed with simply being overwhelmed and delaying the necessary background study. How do you extract yourself from that limbo? My intuition says I should quickly study the material and start a tiny part of the whole project. I appreciate any tips or advice.


Can you point me to a nontrivial strategy pattern implementation?

We are faced implementing a registration workflow with many branches. There are three main flows which in some conditions lead to one another. Each flow has at least four different steps; some steps interact with the server, and every step adds more information to the state. Also the requirement is to have it persistent between sessions, so if the user closes the app (this is a mobile app), it will restore the process from the last completed step with the state from the previous session. I think this could benefit from the use of the strategy pattern, but I've never had to implement it for such a complex case. Does anyone know of any examples in open source or articles from which I could find inspiration? Preferably the examples would be from a live/working/stable application. I'm interested in Java implementation mostly; we are developing for Java mobile phones: android, blackberry and J2ME. We have an SDK which is quite well separated from platform specific implementations, but examples in C++, C#, Objective-C or Python would be acceptable.


Ideas for developer management software?

(I posted this at serverfault and it was suggested I post here instead) I'm looking for an application recommendation to help me keep track of the discussions I have with the members of my team during our weekly 1-on-1 meetings. A windows desktop app would probably be best. For features, it should be able to manage goals, training, performance, reviews, and incidents. It should have an easy to use interface, but not as clunky as some of the tools like http://www.managerassistant.com/products.html word/notepad or excel just doesn't seem like a good fit... any ideas?


Learning event driven programming

I want to learn more about event driven programming. Especially where and why I would consider using events. What resources/books should I consider reading to this end? (note: I'm indifferent to language. )


Event based logging. Is it a good idea and is it ok to pass a handle to a "logged" object?

Hi I have fairly complex program that is doing computations in a quite large loop. I want to log some basic statistic about the run to be able to analyze its performance over time and vs loop number. For now I am outputting a set of numbers, about 5 or 6, each loop. The problem is the number of loops is quite large so the log files are big. Also putting 10^6 of measurement points on a plot is kind of pointless. I thought of "filtering" the results by for example printing every 1k'th loop but I would lose some points-of-interest. I also cannot log only POIs, because I would lose track of general progress. I decided to switch to an event based logging. Primarily the events I have in mind are combination of the two aforementioned things: improvement of current solution and some progress over the loops. The Implementation I have in mind is to write a simple `StatLogger` that would be responsible for outputting the data to the log stream. The main program would just issue a `log()` method whenever an event occurs. The events can occur simultaneously and it does not make sense to log the state twice, so the class would be responsible for not outputting the stats twice. My questions are:   1. Is this a good or common approach and pattern?   2. Is it better to pass a handler to the number cruncher object, so the logger can get all the interesting stats like `StatLogger::log(const RunEnviroment *this)`, or is better to make another structure to hold all the interesting stats and make a `StatLogger::log(const Stats& stats)` method.   3. If my approach is bad, what are common solutions in similar cases?


Convention for writing Python without newlines or whitespace?

Is there a convention for writing Python when deprived of newlines and whitespace? For example, stackexchange comments, Twitter, text messages...


Equivalent of Domain Driven Design for functional programming languages

I really love the idea of domain driven design, however, as I'm learning Go, I'm wondering if there's the equivalent of DDD that's aimed at an effectively more functional language?


MVVM light Communication

I am working on a large MVVM application. I am using the MVVM light toolkit for this. The application is like a web browser with back and forward buttons. The main view is an user control. I laid the back and forward buttons in the main view user control. The main view in turn has user controls. The user controls change when the back and forward buttons are clicked. The main ViewModel keeps track of the current user control and loads the next one depending on the button click. All these user controls are loaded depending on the selection(ID) made on the first step. Lets say, the main view is a search screen and we select a customer. The next screens would be Address, Billing, Requests, etc. These screens does not share any data. But the data is for the same customer. So, is it a good practice, to store the customer ID in the main view? If I do this, I should have a UserControl_Loaded event bound to a command, where I would then request for Address and Billing Info. Or I can move the buttons(back and forward buttons) to each user control instead of the main view, Pass the customer ID with the message which would load the next view. Which is better?


Models should match table structure, Viewmodels match how the data need to be displayed?

I have a database table with many columns, that I want to display over several pages, similar to a turbo tax style information collection form. With only 1 or 2 items per page. Is it right to create 1 model, then a viewModel with only certain properties per ViewModel for each section I want to create in this workflow?


How can I distinguish between one-worded expressions and two-worded expressions?

I was told to create two lists concerning most frequently used words from a plain text (10 Mb arbitrary texts) as monograms (for single worded expressions such as human, water, is) and bigrams (for two-worded expressions such as basketball team, united states and etc) I am stuck here and don't know how I can go about it! And how I can distinguish between these two? My domain is not English, I only gave those examples to make my intention and meaning more clear.


Difference between the Adapter pattern and the Proxy pattern?

As far as understand, the **adapter pattern** is creating a wrapper object for our real object of interest, simply one more level of indirection, which provides flexibility. the flexibility is in that, if the real object's interface is changed, then we change the wrapper interface pointing at the real object, leaving the client-side exposed interface unchanged. The **proxy pattern** is the same, with the difference that every proxy wrapper provides only a coherent subset of the real object's functionality. Why would this be useful, when we strive to make "one class for one purpose" is beyond me. _Have I gotten this correctly?_


All images in one folder for a website?

When creating websites, is it better to have a lot of images in one folder, or have them separated? It's something that has always been in my mind but I never researched enough about it, and googling didn't give me many answers. So I have been building mostly sites for real estate agencies since I started, and I always liked to organize the images by folders, lets say in webroot/photos/$propertyId/ but sometimes I've seen websites storing all the images in a folder, and differencing them mainly by the name. I never had to build a huge website, so this has been in my mind but didn't concern me too much, but I would like to know, generally which of the 2 ways is a better approach. Is there really a human noticeable performance difference when performing different action like searching/deleting those files? Keep in mind that sometimes there's not a images limit on the galleries, so having one column per image path/name in the property's row is not often an option for me, I would have to use another table to relate them. Also I would like to mention that for example in my last project I had to manage tens of GB's of images, we had like 300000 properties and they had lets say an average of 10 pictures per property.


How much sense does it make for a veteran .Net developer to move to ROR professionally?

I consider myself a moderately skilled (definitely not stupid) .Net developer. Over the past 5 years I've been working with ASP.Net, ASP.Net MVC, SharePoint, WPF, Silverlight, RDBMS (SQL Server and Oracle). I maintain/contribute a couple of .Net OSS. I've also picked up F# and Haskell over the previous year. I am currently employed at one of the better (best) software firms out there and would surely love to continue working here. However over the past 6 months opportunities in .Net have mostly dried up and all new work is headed towards ROR (and whatever is left towards Java). I have never been apprehensive about learning a new stack/language for fun and have previously picked up Haskell and Python in my free time. I am however apprehensive as to what impact moving to a new entirely different stack would have on my career. What would you do:   * Change jobs if you don't find anything on .Net soon.   * Try out the ROR stack for some time. If you find that its not your cup of tea, move back. (How would this impact my career and job opportunities in the longer run?) Also it would be very helpful if there are any ASP.Net MVC folks who have switched over to ROR professionally who can share their experiences. **Edit:** I have not done any development on a *nix box before. I've however used Ubuntu for fun and games. Sorry if this sounds subjective.


if i have many calls of single method that returns field value, is it better to make a local variable?

In a method, i have calls of single method of another object that returns field value, like `foo.value()`, which is defined like `Field value() {return this.value;}` Is it better to make a local variable, like `Field value = foo.value()` and use it. Or use many method calls of a single method? Why? How does it correlate with number of method calls, like for 3, 5, 10 what will be better and why it may be a concern? Edit: field doesn't change anyhow during the flow of a method, just the same value all the time. Edit2: does it depend on programming language? If it's important, it's java.


Online vs Web - write once application

I have been asked to write an application (visual application) that can be run both online and locally. This application contains a lot of external data (video, images and audio) files so the main issue I have is deploying this over the web. I want to architect this so that I only have to write 1 system and not a separate code base for the online version. What I and a colleague have come up with so far is;   * Tomcat/Application server - for the code logic   * HTML Pages for the delivery of the content   * A number of small Silverlight Scenes depending on the page that is severed. I have only got a few months so writing 2 sets of applications is not efficient for me. Is this a scalable approach? Are there better ways to write/deploy this type of application?


Are there any "best practices" on cross-device development?

Developing for smartphones in the way the industry is currently doing is relatively new. Of course, there has been enterprise-level mobile development for several decades. The platforms have changed, however. Think of:   * from stylus-input to touch-input (different screen res, different control layout etc.)    * new ways of handling multi-tasking on mobile platforms (e.g. WP7's "tombstoning") The way these platforms work aren't totally new (iPhone has been around for quite awhile now for example), but at the moment when developing a functionally equal application for both desktop and smartphone it comes down to developing two applications from ground up. Especially with the birth of Windows Phone with the .NET-platform on board and using Silverlight as UI-language, it's becoming appealing to promote the re- use of (parts of the UI). Still, it's fairly obvious that the needs of an application on a smartphone (or tablet) are very different compared to the needs of a desktop application. An (almost) one-on-one conversion will therefore be impossible. **My question** : are there "best practices", pitfalls etc. documented about developing "cross-device" applications (for example, developing an app for both the desktop and the smartphone/tablet)? I've been looking at weblogs, scientific papers and more for a week or so, but what I've found so far is only about "migratory interfaces".


How to write "good" unit tests?

Triggered by this thread, I (again) am thinking about finally using unit tests in my projects. A few posters there say something like "Tests are cool, if they are good tests". My question now: What are "good" tests? In my applications, the main part often is some kind of numerical analysis, depending on large amounts of observed data, and resulting in a fit function that can be used to model this data. I found it especially hard to construct tests for these methods, since the number of possible inputs and results are too large to just test every case, and the methods themselves are often quite longish and can not be easily be refactored without sacrificing performance. I am especially interested in "good" tests for this kind of method.


Better way to create samples

I've done this piece of code for creating bernulli samples, but I think that it is a so heavy algorithm because every time I call this recursive function I create a new vector that is passed to it. Is there a way for making this algorithm faster? Here is the algorithm and the description: As already said, this function creates bernulli samples recursively. If `n`, that is the number of elements that should be found, is equals 0 I print the sample. Else to the sample that is passed I add every element of the population (I have to create a vector for everyone of this new samples), and I call the function with this new sample and n(the number of element to be found) decremented.               private static void distribuzioneBernoulli(int n, Vector<Float> population, Vector<Float> sample){         // exit condition, when n equals 0 the fuction doesn't self-calls         if(n==0){             JOptionPane.ShowMessageDialog(null, campione);         }              // Every element of the population is added to the sample,         // and is recalled the function         for(int x = 0; x < population.size(); x++){             Vector<Float> aggiunta = new Vector<Float>(sample);             aggiunta.add(population.elementAt(x));             distribuzioneBernoulli(n-1, population, aggiunta);         }     }


Facebook authentication with an Authoritative Server for a Flash Game

I'm working on a multiplatform game in Flash. This game utilizes Photon Server for authoritative physics and user statistics tracking. I'm looking to leverage Facebook authentication as an alternative to creating a domain specific account. I'm curious if I can use the Flash SDK for Facebook to indirectly authenticate a user on the Photon Server application. I've not made anything for Facebook, though I've looked through several different sources of information and have yet to find a solution which seems applicable. For example I've looked at the javascript libraries which outline the returned data, such as user id, and the access token. This seems to be all of the data I need to track for the players. I also know that the access token is for short term authentication, and primarily used to utilize Facebook functionality post-authentication. Given this, tying the data to the account is done with the Facebook user id. It also transmits an expire date. I can leverage message encryption using the Photon Server framework. The users are linked to game accounts using an inherited entity derived from an abstract PlayerData class in a server-side Entity Framework model. This entity contains the information for Facebook authentication. **Can third-party authentication be done safely by forwarding the encrypted user access token and user id to the server from the Flash client, after authenticating with the Flash API for Facebook?** **What methods are available for determining that the Facebook credential are still active, so that the client can be disconnected from the server should they log out of Facebook?**


Can an aggregate root hold references of members of another aggregate root?

I know that outside of aggregates I can't change anything inside an aggregate without passing by his root. That said I would like to know if an aggregate root can hold references of members (objects insides) of another aggregate root? (following DDD rules) Example : a **Calendar** contain a list of **phases** which contain a list of **sequences** which contain a list of **assignations** Calendar is root because phases and sequences and assignations only work in context of a calendar. You also have **Students** and **Groups** of student (called groups) It is possible (following DDD rules) to make Groups holding references of **assignations** or it need to pass by the root for accessing groups from assignations ? Thanks.


How to test state of the object

I have a class `DataImport` with only two public methods               public void fromStream(InputStream inputStream);     public ImportCommand getImportCommand();      When I test it I send some test data to `fromStream` method               dataImport.fromStream(some stream with data...)      Only way how to test the result of this method is to get the `ImportCommand` from `getImportCommand` and test if this object is in the state according to the input I provided. But what if `ImportCommand` has only one method?               public ImportResult execute();      I could test `ImportResult` (after invoking `execute()` which would involve some mocks and additional setup) because it has some state exposed. But this way I am testing `ImportCommand` and the `DataImport` class in one unit test which does not feel right to me. But exposing inner state of the classes I am testing or accessing their private fields/methods also is not good thing. Does this mean that my design is not ok (how should I change it) or is there some way how to solve this situation? Related: TDD anti-patterns on SO


Should I create separate work and personal GitHub accounts?

I'm fairly new to programming, and I've been working on many personal projects, which I'm concerned can come across as silly and unprofessional. The kind of projects I have are a Reddit Image Downloader and a tool for GMs to use in roleplaying games. I want to start building up a GitHub account for projects in my chosen field of data analytics, but I'm not sure how to organize projects on my GitHub account. Should I create a "professional" GitHub, mainly containing different analytical scripts and have a separate "personal" account for fun little projects of mine? Or am I just overthinking this, and should I just maintain one account?