Writing Acceptance test cases

We are integrating a testing process in our SCRUM process. My new role is to write acceptance tests of our web applications in order to automate them later. I have read a lot about how tests cases should be written, but none gave me practical advices to write test cases for complex web applications, and instead they threw conflicting principles that I found hard to apply:   * **Test cases should be short:** Take the example of a CMS. Short test cases are easy to maintain and to identify the inputs and outputs. But what if I want to test a long series of operations (eg. adding a document, sending a notification to another user, the other user replies, the document changes state, the user gets a notice). It rather seems to me that test cases should represent complete scenarios. But I can see how this will produce overtly complex test documents.   * **Tests should identify inputs and outputs:** : What if I have a long form with many interacting fields, with different behaviors. Do I write one test for everything, or one for each?   * **Test cases should be independent:** But how can I apply that if testing the upload operation requires that the connect operation is successful? And how does it apply to writing test cases? Should I write a test for each operation, but each test declares its dependencies, or should I rewrite the whole scenario for each test?   * **Test cases should be lightly-documented:** This principles is specific to Agile projects. So do you have any advice on how to implement this principle? Although I thought that writing acceptance test cases was going to be simple, I found myself overwhelmed by every decision I had to make (FYI: I am a developer and not a professional tester). So my main question is: What steps or advices do you have in order to write maintainable acceptance test cases for complex applications. Thank you. **Edit** : To clarify my question: I am aware that Acceptance testing should start from the requirement and regard the whole application as a black box. My question relates to the practical steps to write the testing document, identify the test cases, deal with dependencies between tests...for complex web applications


Continuous integration never results in build errors

I'm working with a variety of Java EE websites which use internal libraries we've developed. For each website, we only upgrade to new versions of our internal libraries as needed, and before committing we make sure that the site compiles fine. What this means is that when TeamCity does a build of one of our sites, the site compiles fine, but later when the site is updated to the latest version of internal libraries, there might be a compile error. Is there a good way to handle this? We're not using Maven yet; would using Maven mean that our websites could automatically use the latest version of internal libraries? Thanks. **Clarification:** What we sometimes run into is this:   1. Project A depends on a library, and is currently using library version 1.0   2. Project B also depends on that library. I make changes to the library so that it is now version 1.5. Project B now uses 1.5.   3. Project A and project B have both been built just fine by the CI server (TeamCity)   4. Working on project A again, I update to 1.5 and discover that 1.5 has breaking changes in it. Is there a way for the CI server to discover these kinds of breaking changes?


How to keep your third party libraries up to date?

Let's say that I have a project that depends on 10 libraries, and within my project's trunk I'm free to use any versions of those libraries. So I start with the most recent versions. Then, each of those libraries gets an update once a month (on average). Now, keeping my trunk completely up to date would require updating a library reference every three days. This is obviously too much. Even though usually version 1.2.3 is a drop-in replacement for version 1.2.2, you never _know_ without testing. Unit tests aren't enough; if it's a DB / file engine, you have to ensure that it works properly with files that were created with older versions, and maybe vice versa. If it has something to do with GUI, you have to visually inspect everything. And so on. How do you handle this? Some possible approaches:   * **If it ain't broke, don't fix it**. Stay with your current version of the library as long as _you_ don't notice anything wrong with it when used in your application, no matter how often the library vendor publishes updates. Small incremental changes are just waste.   * **Update frequently in order to keep change small.** Since you'll have to update some day in any case, it's better to update often so that you notice any problems early when they're easy to fix, instead of jumping over several versions and letting potential problems to accumulate.   * **Something in between.** Is there a sweet spot?


Is it ever OK to commit non-working code?

> Is it good idea to require to commit only working code? This commit doesn't need to leave the repository in a working state as:   * ... we are in early design stages, the code is not yet stable.   * ... you are the sole developer on the project. You know why things aren't working. Furthermore, you are not stopping anyone's work by committing broken code.   * ... the code currently doesn't work. We are going to make a big change to it. Let's commit, in order to have a point to revert to if things get ugly.   * ... the chain is long, no trouble if broken code exists in the local branch. I.e.     1. local files     2. staging area     3. commits in local branch     4. commits in remote personal feature branch     5. merge with remote `develop` branch     6. merge with remote `master` branch     7. merge with remote `release` branch   * ... commit early,commit often. So in the above-linked question, the majority of answers say that committing not-compilable code is no problem in local and feature branches. **Why?** What is the value of a broken commit? * * * Added: There are a couple of highly-voted comments, saying that on a local brach one can do whatever one wants. However, I am not interested in the technical side of the question. Rather, I would like to learn the best practices - the habits, that people who have worked many years in the industry, have hound most productive. * * * I am amazed at the vast amount of great answers! They lead me to the conclusion that I am not adept enough at using **branches** to organize my code.


Using Autoincrement Primary keys as Foreign Keys

When creating a table, there is an option for us to set the numeric primary key as autoincrement where it's value increases whenever a new data in inserted. This primary number can be used for setting the relationship of a table where it is assigned as a foreign key to that table. So my question is it a good practice for us to use the autoincrement numeric primary as foreign key or should we use the programmatically generated code. **e.g.** for a table 'products' we have the fields 'id' (autoincrement primary key), 'productCode' (program generated unique item code. field property also set to unique), 'Description'. and we are going to create a relationship to a transactions table. What field should be used as foreign key, the 'autoid' or the product code?


Is blogging a good platform to get into freelancing from a completely unrelated job?

**Quick background** \- I work in a bank doing financial modelling where I need to do some domain specific programming, but otherwise it's only statistics and presentations. **Situation** \- Software has always been my first "love", but due to various circumstances I did not take up a career in the software industry. I have a very good graduate degree in Theoretical Computer Science - so I understand what it means when people talk about traveling salesmen, lambda calculus or whether P=NP (examples). I intend to get into programming full time in the next couple of years. **Chosen path**   1. Get really good at something - I have chosen the HTML5 "ecosystem" comprising HTML, Javascript and CSS. Over the years I have programmed in C, Haskell, Erlang, C++, Javascript, Common Lisp, Basic and Logo but not sufficiently proficient in any of them.   2. Establish myself as an expert in the community primarily through blogging and participating in projects / forums / events related to the same. Then I can try and establish some freelancing business or convince a startup to hire me. **Questions** \- Are there any well known examples of people who have taken a similar path after working in a completely unrelated field for years (7, in my case)? Am I completely delusional and two years is too short a time?


What's the web framework to use on a front-end web application?

What do you consider a good client web framework to use on interface business application? jQuery? YUI!? Another? Some plugins useful? The application will be use mostly internally replacing a desktop application for data entry and lots of queries/views.


why control + alt + delete couldn't be intercepted by any application

The secure attention key is designed to make login spoofing impossible, as the kernel will suspend any program, including those masquerading as the computer's login process, before starting a trustable login operation. Why other programs cannot simulate `control + alt + del`? What is stay behind this?


What's the next level of abstraction?

Since programming languages initially only used lines of code executed sequentially, and it evolved into including functions which were one of the first levels of abstraction, and then classes and objects were created to abstract it even further; what is the next level of abstraction? What's even more abstract than classes or is there any yet?


Develop open-source library and get donations for it?

I have a nice open-source library in mind to write. It would take a few months to develop properly and I would need to stop supporting myself though other projects. Could anybody share experiences and best-known-methods to get some sort of financial support through the Internet whilst developing free, open- source code? Or, phrased more directly: which systems apart from "PayPal" are in use by programmers to get donations for open-source code? Provide a list. Optionally, sort the list as if it were a recommendation in descending order of positive experiences made with each system. Optionally, share a tidbit of your success story getting this kind of financial support. Optionally: give an indication as to how much money can be made that way? (I heard Vim's author could support himself just with donations at some point?)


Why am I seeing so many instantiable classes without state?

I'm seeing a lot of instantiable classes in the C++ and Java world that don't have any state. I really can't figure out why people do that, they could just use a namespace with free functions in C++, or a class with a private constructor and only static methods in Java. The only benefit I can think of is that you don't have to change most of your code if you later decide that you want a different implementation in certain situations. But isn't that a case of premature design? It could be turned into a class later, when/if it becomes appropriate. Am I getting this wrong? Is it not OOP if I don't put everything into objects (i.e. instantiated classes)? Then why are there so many utility namespaces and classes in the standard libraries of C++ and Java? **Update:** I've certainly seen a lot examples of this in my previous jobs, but I'm struggling to find open source examples, so maybe it's not that common after all. Still, I'm wondering why people do it, and how common it is.


LGPL License in commercial application

I have searched around but I don't seem to be able to get a clear answer on my questions that I understand. I want to use the Xuggler library in my application, which is licensed either GPL or LGPL depending on whether I compile it myself. I don't intend to edit the library If I compile it myself and thus get a LGPL version of the library, can I use it in a commercial application without having to distribute the source code of my application? Furthermore, do I have to give my application the LGPL license as well? What other problems might using this library give me?


How often should we launch SONAR analysis?

I successfully installed Jenkins and then Sonar to go with continuous integration. The firsts reports are not that good in term of rules violations ,comments, code duplication ... I set Jenkins to get java classes, run tests with cobertura and then launch SONAR once every night during week days. I then asked the developers to put some time and effort in correcting rules violations, and try to re-factor the code using SONAR data. However it seems they would like to see their corrections in SONAR almost as they commit them. So I got different choices :   * Let the SONAR launch to once a day   * Allow developers to launch sonar task themselves   * Decrease Jenkins time between builds (like every 1h) 2nd solution : I'm afraid of the number of snapshot that will appear in the SONAR history and the fact that it'll make the "compare since last build" a lot less useful. 3rd solution : A bit of the 2nd solutions problems adding that Jenkins will have a lot of builds, most of them irrelevant. What are your experiences on these problems? Thanks


What is a Munger

I am reading the source code of ObjectListView and there is a Munger class. What is Munger? Does Munger mean anything general in programming jargon? Afaik, the Munger in the source code wraps the methods to do map string to object properties through Reflection (C#). Thanks.


Why did Git get so much hype? ...while others don't?

In the recent years, the hype around Git raised greatly. Everybody knows about Git, nobody knows about alternatives. Other ones like Mercurial seem to be unnoticed. Both have been released in 2005, and provide similar functionalities. Moreover, Mercurial is generally considered to be easier to use, more intuitive and had for a long time better UIs. Therefore, it could be assumed that this would be a popular alternative, especially for those new to distributed version-control. Yet, it seems unknown to most people, unlike Git which succeeded pretty well. The point of this post is to try to understand this phenomenon better. How comes Git gets all part of the cake? Did they somehow use better marketing? Is it because its community is more ...ahem ..."verbose"? Is it because of the "Linus" name? Is it because of its geeky image? What's your opinion?


How to secure a Django application's source code?

I have developed a Django application for a company. Now I am about to ship it to my customer. After reading through online articles and books, I understood that securing the source code of any web application is a challenge. Is there anything that I can think to secure my Django applications's source code? This will be my last chance to try. My customer has servers that runs on Windows and Linux. Please help. Efforts made till date:   I tried different techniques like variable mapping in the code, url designs and even folder protection in the server. Now the latest attempt is that I created a VM of my application with username and password being private. This VM will be maintained by me. This approach has its own pros and cons. Any suggestions? Saas is not a solution to my problem as my application should be deployed at the customer's server and served through intranet.


Securing PHP source code from illegal copy

my IT boss asks what is the best way to secure the PHP source code against illegal copy of the code once it is deployed to clients. Is there a PHP compiler that will make the final codes unreadable? By the way, i work for a software development company using PHP.


Is the singleton pattern prone to thread safety problems? If so, what are the best methods to work around them?


Career change: from programming into more human-oriented area

I have been a software developer for approximately 9 years, starting with part-time work during my graduation year at uni. During these years I worked for number of companies, sometimes changing places twice or three times a year. They say it takes 10 years to reach 'expert' level, and while I don't think I am an expert by any measure and I have certainly met lots of people who are more knowledgeable, smarter and more focused than I am, I think I can safely say that I had my fair share of the whole programming trade and would like to move on to something else. I still enjoy programming, discovering new techniques and learning new technologies, although it got kind of repetitive - I can already see patterns in this process. It was fun to crack open things like say python, node.js, HTML5 etc. but after some time it lost its appeal. Psychology and behaviour was always something I was interested in, especially the practical, applicable bits of it. Recently I've been to some communication skills training and I realised that I have been missing out on the great deal of fun stuff - how people work and communicate, especially in subconscious, non-verbal area. Currently I am thinking of making a career change - ideally to move somewhere my technical skill would still be beneficial in some shape or form, or at least could serve as a bridge while I am transitioning there, you know, the whole gradual, bit-by-bit approach versus swim-or-drown one. I would like to hear your thoughts on this matter and to learn from you what are the possible transitions I can take.


Where to put custom validation while using Entity Framework

I am using MVC3 and Enitty Framework 4 with the Database first approach. It created the context template with its own validation for the fields based on the database. My question is where should I put the other validation based on the buisness logic. Should I put it in the Context.tt file, should it go in the controller or should it go in a seperate model?


Best way to throw exception and avoid code duplication

I am currently writing code and want to make sure all the params that get passed to a function/method are valid. Since I am writing in PHP I don't have access to all the facilities of other languages like C, C++ or Java to check for parameters values and types               public function inscriptionExists($sectionId, $userId) // PHP      vs.               public boolean inscriptionExists(int sectionId, int userId) // Java      So I have to rely on exceptions if I want to make sure that my params are both integers. Since I have a lot of places where I need to check for param validity, what would be the best way to create a validation/exception machine and avoid code duplication? I was thinking on a static factory (since I don't want to pass it to all of my classes) with a signature like:               public static function factory ($value, $valueType, $exceptionType = 'InvalidArgumentException');      Which would then call the right sub process to validate based on the type. Am I on the right way, or am I going completely off the road and overthinking my problem?


What to do about team member who threatens to leave all the time and is difficult to work with?

I work in a small development group with 3 developers. We are loosely managed and have no structure to the team. There is no designated team leader and the manager is fairly hands off. The Senior developer has been with the company for 4 years, in that time he has had a huge hand in setting up systems and keeping them running. He is not a very good developer but is a great cowboy coder and understands the network in a way I never could. He has taken the role of "lead developer" and "systems architect" because he has seniority and feels he is better at his job than the rest of us. My problem is that he threatens to quit all the time. Yesterday he informed me that in 6 weeks he will move up another level in the 401k vesting program and is planning to leave after that. When I asked him why, he said that it is because our manager (a man) and the team (the team being me) are “demasculating” him. He feels that he "deserves" to have been made the development manager based on his seniority. He doesn't like me because I keep pushing for things like bug/issue tracking software and because I am good at my job. Last time he threatened to quit I took him seriously and started to plan my work around him leaving. Then he changed his mind and told me that the work I was doing was his responsibility. He lost his temper with me and tensions ran really high for a while. Here are some of the different ways I have approached the situation:   1. Just do what he asks: This lowers tensions but then nothing gets done and the users get upset.   2. Take control and get stuff done: This keeps the users happy but then he gets angry at me and shuts down, he won't talk to me or work with me to get the things done that only he knows about. He won't give me access to the systems I need to get into to do it myself.   3. Work more closely with higher management: He has no respect for higher management and they don't want him to leave the company so they coddle him. One option I haven’t moved forward with yet is to leave the company: I haven't been there a year yet and don't like the idea of leaving. Overall the job meets most of my requirements in a position. Ideas? Suggestions? Conversations? Options I haven’t considered? **Update 5/11/2012:**   I finally decided to leave. It was a good decision. Between the original post and now he got better but still was not what I consider to be a good developer, much less good management material. I respect him for his knowledge but am glad I don't need to work with him any more.


How to organize my site's file system properly?

Doing some reading on Stack Overflow, I've found a lot of information suggesting that proper organization of a file system is crucial to a well- written web app. One of the key pieces of evidence is high-frequency references to "separation of concerns" in questions related to keeping programs organized. Now, I've found some information on organizing file systems (Filesystem Hierarchy Standard) from 2004. It raises only two concerns: first, the standard's a bit dated, so I believe it may be possible to do better given the changes in technology over the past 8 years; second, and most important, my application is very small compared to an entire Linux distro. I think that the file system should be organized very differently because of that. Here's what I'm looking at, currently:               /backup     /databases     /scripts     /www        /www/dev         /www/dev/login.php         /www/dev/router.php         /www/dev/admin pages (php files)         /www/dev/sites           /www/dev/sites/content types (php/html files)           /www/dev/sites/static pages (php/html files)           /www/dev/sites/modules             /www/dev/sites/modules/module-specific-media           /www/dev/sites/includes           /www/dev/sites/css           /www/dev/sites/media       /www/production         /www/production/login.php         /www/production/router.php         /www/production/admin pages (php files)         /www/production/sites            /www/production/sites/content types (php/html files; not a directory)           /www/production/sites/static pages (php/html files; not a directory)           /www/production/sites/modules             /www/production/sites/modules/module-specific-media           /www/production/sites/includes           /www/production/sites/css           /www/production/sites/media


How can QA prevent defects?

Also according to **Software Testing By Srinisvasan Desikan, Gopalaswamy Ramesh** or ISTQB text books. Quality assurance is e.g. reviewing products, inspections, walkthroughs to see if all standards are being followed. This is preventive activity. I cannot see how this can be preventive? * * * For the references: > defect prevention (Quality Assurance) **Software Testing By Srinisvasan Desikan, Gopalaswamy Ramesh** > Quality Assurance (QA) tries to go one step further. Instead of > concentrating on post- facto defect detection and correction, it focusses on > the prevention of defects from the very start. Managing Global Software Projects - Page 110 > QA deals with prevention of defects in the product being developed. Software Testing and Quality Assurance


Do I need to go back and learn HTML 5 and CSS 3?

I have been working on learning as much as I can before starting college to change my career, and I noticed on the w3schools site that there is now html and html 5, css and css 3. Do I need to go back and learn those newer languages before moving onto PHP and MySQL?


How do I document roles and responsiblites

When working on a requirements document, how do I capture system roles and responsibilities? E.g. "I'm a manager and I will only use the system to generate reports on xyz". I was looking for an example online but couldn't find one.


How to plan development

I am a self-taught 17 year old who knows Java and C# as well as I can, be learning them for over a year but I have never coded anything so therefor no experience.Me and my friend are working together on a program, I am coding the server and he is coding the client but my mind just goes blank, I have no idea where to start apart from maybe outlining some of the class structures, for example a package of packets that will be sent back and forth. How do I start to get my head around this? My mind just goes blank, I don't know what to do? I am desperate now as I want to get on in developing this but have no idea where to start, any tips will be appreciated!


Capturing window the GDI way, question about SaveCapturedBitmap();

I want to make a program that takes a screenshot of the desktop window including overlapping windows and then scans the bitmap for certain pixels at specific locations to identify. I read this is how you do it from: http://www.codeproject.com/Articles/5051/Various-methods-for-capturing-the- screen               Void CaptureScreen()     {         int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);         int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);         HWND hDesktopWnd = GetDesktopWindow();         HDC hDesktopDC = GetDC(hDesktopWnd);         HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);         HBITMAP hCaptureBitmap =CreateCompatibleBitmap(hDesktopDC,                                  nScreenWidth, nScreenHeight);         SelectObject(hCaptureDC,hCaptureBitmap);          BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,                hDesktopDC,0,0,SRCCOPY|CAPTUREBLT);          SaveCapturedBitmap(hCaptureBitmap); //Place holder - Put your code                                     //here to save the captured image to disk         ReleaseDC(hDesktopWnd,hDesktopDC);         DeleteDC(hCaptureDC);         DeleteObject(hCaptureBitmap);     }      I dont understand what it means by placeholder at SaveCapturedBitmap and I don't know what SaveCapturedBitmap does, can't find anything searching for it at msdn..


Need help identifying a league scheduling algorithm

I am trying to create a sports league scheduler. I am having trouble identifying an algorithm to help me efficiently fill in each slot. Sample data to build the schedule would be:   1. 10 teams   2. Each team plays each other 1 time (45 total games required)   3. Each team plays no more than 1 time per day   4. In my testing I am using 9 days with 5 slots per day. **Combo Table (contains 45 combos)** ID Team1ID Team2ID bitAssigned **Schedule Table (contains 45 time slots)** scheduleID homeTeamID awayTeamID GameDate GameTime Right now my existing procedures fill about 90% of the slots leaving 10% of my slots empty to a scheduling conflict based off the rules above. I loop over my schedule table in ascending date/time order. My first slot could be Saturday at 8am. I query a list of teams that haven't been scheduled yet. I then make an array of possible combinations of those teams. I then use that array to pull 1 random record from my combinations table from of combinations that haven't been scheduled yet and I place those teams on the schedule. I then set that combination as used. I repeat the loop over and over again and each time my list of available teams gets smaller and my array as a result is smaller too. I'm finding that some days go fine, and on other days my final last 2 remaining teams have already played in a previous week so they are not added to the schedule again. The only thing I havent tried yet is to "reset" the conflict days and try them over again to see if I get better placements. Does anyone have any suggestions?


Converting VB6 app to ... what?

I've been tasked with getting rid of a VB6 application. It's heavy with data input forms, tabs, modal dialogs etc. I see my options for the UI as:   1. rewrite as-is in Winforms    2. rewrite as-is in WPF    3. redesign UI completely and write in WinRT XAML    4. redesign as web app using ASP.Net MVC    5. redesign as web app using Angular All of these except Winforms will require much of a learning curve for me and my team, but I assume Wnforms is dead. What are others doing and why?


Function pointers to object instance returned by function pointer

Im new to c++. I want to make a std::map with strings of get-method names mapped their respective get-method. These are to be looped over and present the value obtained by the get-methodtogether with the method name. I will loop over several instances of the type A. I have found that boost/function is very useful for storing the get-methods in A. However, A also has an instance of type B, with its own get-methods. How do I access the get-method in B? Here is my current code (The line `mapping["B_Nine"] = &B::(&A::getB)::nine` is wrong, but my best guess so far)...               #include <boost/function.hpp>     #include <boost/bind.hpp>     #include <boost/ref.hpp>     #include <iostream>     #include <map>     #include <string>     #include <functional>          class B     {     public:         B();         ~B();         int nine() {return 9;}     };          B::B()     {          }          B::~B()     {          }          class A      {     public:         A();         ~A();        int one () {return 1;}        int two () {return 2;}        B getB() {return b;}        B b;     };          A::A()     {           b = B();     }          A::~A()     {          }               typedef std::map<std::string,boost::function<int (A*)>> str_func_map;          int main()     {              str_func_map mapping;              mapping["One"] = &A::one;         mapping["Two"] = &A::two;          mapping["B_Nine"] = &B::(&A::getB)::nine //This line is wrong - how should                                                    //it be done correctly??              A* a = new A();              for (str_func_map::iterator i = mapping.begin(); i != mapping.end(); i++)         {             std::cout<< i->first << std::endl;             std::cout<< (i->second)(a) << std::endl;         }              system("pause");     }


Using the same keyboard shortcuts in every editor

I want to configure each IDEs/editor I use to have exactly the same key shortcuts. By default each IDE/editor has slightly different set of key bindings - even simple "close current tab" is bound either to CTRL+W or CTRL+F4. Is there already a set of config files (one for each IDE, editor, etc) with the same key binding configured?


Where does jQuery fit-in with frameworks like JavaScriptMVC, BackboneJS, SproutCore and Knockout?

I have been happily using **JQuery** for the last 2 years and have been quite sucessful creating some really cool functionality with it...so I am very comfortable with it. I also beleive the future of the web will continue on the current client-side path. **However...** The next challenge seems to be coming in the form of various controller frameworks: **KnockoutJS**, **BackboneJS**, **SproutCore**, **JavaScriptMVC** (the list goes on). Additonally, there are some great **AMD Loader** tools for use like **RequireJS** or **LabJS** etc. However, jQuery now has `define` and `then` capabilities baked-in. **It's getting harder-and-harder to keep track of it all...**   And now, my task seems to be to evaluate/decide-on a strategic-direction for using some form of either an MVC or MVVM framework client-side...but I have so many questions.   * Where does **JQuery** **fit-in** with the various controller-frameworks mentioned above?   * Is **JQuery** **used alongside** each or do some of them have their own ' **JQuery**-styled version' baked-in?   * Are tools like **RequireJS** **still needed** if you implement one of the various controller-frameworks mentioned above?   * Does the `define` and `then` capabilities baked-into **JQuery** **now supercede** the AMD Loader mentioned above?   * Which one seems most modular? (see notes below) **NOTES:**   One thing I don't want in any future-framework is the requirement of having to take-in vast amounts of functionality that I don't use. Meaning, I would rather use a framework that is truly modular. For example, to use jQuery UI you have to take-in a lot other core libraries that you might not actually use. I will be experimenting with each one, but some REAL feedback would be great. I've seen some 'similar' questions, but none have really answered the above skew. Thanks in advance!


Workflow for obfuscated PHP code with PHP protect

Let's say I have a database-driven web application written in PHP. After obfuscating the code with PHP protect it will be copied to a web hosting server. And here is the question. What is the workflow of a programmer when there is a bug in an application and he needs to edit the PHP code to repair it? It's clear, that he can't debug (and edit) directly the obfuscated code.


Mobile cross-platform SDK for computationally intensive apps

I am aware of the PhoneGap toolkit for creating mobile applications for virtually all mobile platforms with a significant market share. However, the code in PhoneGap that is shared between the different platforms is written in JavaScript. While I like JS, I think it's hardly appropriate for computationally intensive tasks. The situation with Titanium is pretty much the same. **So, is there any way that I can create a cross-platform mobile app that has the computationally intensive code shared between the platforms?** Some context: Obviously, I don't want to implement the time consuming algorithm in many different languages, since this violates DRY, increases the chance for bugs slipping in at least one version and require boilerplate code to work. I've looked at Xamarin's MonoTouch and Mono for Android tools, but while they cover iOS and Android, they're not nearly as versatile for deployment as PhoneGap. On the other hand, (IMO) the statically typed nature of C# is more suited for intense computation than JS. Are there any other SDK/tools appropriate for the task that I don't know about or a point about the mentioned above that I've missed? Also, uploading data to a web service for processing is not an option, because of the traffic required.


memory and time intensive php task

Sorry if this question has been asked before, but I couldn't find anything usable. I'm working on a project for a client and currently I have to loop through the users table which is about 3000 records and still growing. I have to do some calculations on a nightly basis which I am going to be using cron/php. The calculations script uses about 3.5mb of memory and takes about 1 second to run. When loading individual users my current php setup handles this fine, but if I try and loop through the user list my php script execution time runs out. I've read after doing some searching that I can make the page reload itself after each user calculation and just keep my previous place in the loop and this sounds like a good idea, but I wanted to hear some opinions from others that have handled similar situations and how you handled these types of tasks. Thanks.


Why some Javascript code needs to be written in different tags and not embedded within the same

When I was using the modernizr file, I came across this problem where in I need to source a file and call the script.               <script src="js/modernizr-min.js"></script>     <script>     if (!Modernizr.input.placeholder){           $('input[placeholder], textarea[placeholder]').placeholder();     }     </script>        Why is that the script does not work when embedded within the same script tag. I have across this situation many time, but failed to understand what causes this problem. Is that the scripts have to be written in two different script tags to make it work or else what fails it.


What is the most inspiring speech from a developer you ever watched?

_Please put a direct link to it._ **Required** :   * Still available online (please put a direct link to it)   * Must be a speech from a current or former developer   * Speaker's popularity doesn't matter   * Target audience should be other developers   * It is not required that the topic is programming (the task). I'm more looking for subject generally developing here within P.SE rather than SO.   * Explain why it was inspiring _(please, native english speaker, edit my question)_


Can Windows Phone development be done remotely?

Can Window Phone 7 or 8 development be done remotely, such as on an Amazon EC2 instance or a rented VPS running Windows, via using an RDP or VNC client from a PC running Linux (or OS X, or maybe even an iPad)?


What are the best practices for phasing out obsolete code?

I have the need to phase out an obsolete method. I am aware of the `[Obsolete]` attribute. Does Microsoft have a recommended best practice guide for doing this? Here's my current plan: A. I do not want to create a new assembly because developers would have to add a new reference to their projects and I expect to get a lot of grief from my boss and co-workers if they must do this. We also do not maintain multiple assembly versions. We only use the latest version. Changing this practice would require changing our deployment process which is a big issue (have to teach people how to do things with TFS instead of FinalBuilder and get them to give up FinalBuilder) B. Mark the old method obsolete. C. Because the implementation is changing (not the method signature), I need to rename the method rather than create an overload. So, to make users aware of the proper method I plan to add a message to the `[Obsolete]` attribute. This part bothers me, because the only change I'm making is decoupling the method from the connection string. But, because I'm not adding a new assembly, I see no way around this. Result:               [Obsolete("Please don't use this anymore because it does not implement IMyDbProvider.  Use XXX instead.")];             /// <summary>             ///              /// </summary>             /// <param name="settingName"></param>             /// <returns></returns>             public static Dictionary<string, Setting> ReadSettings(string settingName)             {                 return ReadSettings(settingName, SomeGeneralClass.ConnectionString);             }                  public Dictionary<string, Setting> ReadSettings2(string settingName)             {                 return ReadSettings(settingName);// IMyDbProvider.ConnectionString private member added to class.  Probably have to make this an instance method.             }


WWDC 2012 announced features on iOS 5?

I am relatively new to iOS development, so after watching a bunch of WWDC videos announcing new awesome features for the iPhone SDK, I still got a few questions regarding their support for older devices. Specifically:   * Do the new compiler features (such as literals support, auto-synthesize, etc) require iOS 6 on the target device, or can the new style code be deployed to iOS 5 devices?   * Auto-layout for iOS, same question. Will it only be supported on iOS 6, or 5 as well? If it's 6 only, what kind of fallback are we expected to implement? Would really appreciate if someone could clarify this for me, as I'm thinking about rewriting my older unfinished project and I would love to use some of that improved SDK functionality.


Turning a problem into a data

OK, I have an app that I'm creating but I'm just really not sure about how to approach the problem. The idea is fairly simple. I'm just not sure how to wrap it in a data model (or even if I should). TBH I feel like I'm making it more complicated than it needs to be. How it works. The app will have circles along the top in a row that need to be connected to circles along the bottom in a row. 10 circles at the top. 10 at the bottom. One connection per pair of dots. Anyway, I can get the dots to connect I'm just not sure how to wrap it in a data model so that I can analyse what has been connected and see if it is right or not. The circles will be questions and answers. I can make an array of `question` objects with a `question` and `answer` properties. I can then display these as the dot pairs. I'm just not sure how to record which questions have been connected to which answers. It is valid for a user to connect a wrong answer as they all get checked at the end. I was thinking of using SpriteKit but this isn't a restriction. I could use UIKit or something else. TBH, this question is fairly language free as I'm just after a way of modelling it.


How to present a stable data model in a public API that allows internal data structures to be changed without breaking the public view of the data?

I am in the process of developing an application that allows users to write C# scripts. These scripts allow users to call selected methods and to access and manipulate data in a document. This works well, however, in the development version, scripts access the document's (internal) data structures directly. This means that if we were to change the internal data model/structure, there is a good chance that someone's script will no longer compile. We obviously want to prevent this breaking change from happening, but still want to allow the user to write sensible C# code (whilst not restricting how we develop our internal data model as a result). We therefore need to decouple our scripting API and its data structures from our internal methods and data structures. We've a few ideas as to how we might allow the user to access a what is effectively a stable public version of the document's internal data*, but I wanted to throw the question out there to someone who might have some real experience of this problem. NB our internal document's data structure is quite complex and it could be quite difficult to wrap. We know we want to expose as little as possible in our public API, especially as once it's out there, it's out there for good. Can anyone help?   * How do scripting languages / APIs decouple their public API and data structures from their internal data structures?    * Is there no real alternative to having to write a complex interaction layer?  If we need to do this, what's a good approach or pattern for wrapping complex data structures that include nested objects, including collections? I've looked at the API facade pattern, which looks like it's trying to address these kinds of issues, but are there alternatives? *One idea is to build a data facade that is kept stable across versions of our application. The facade exposes a set of facade data objects that are used in the script code. These maintain backwards compatibility and wrap access to our internal document's data model.


Should you always pass the bare minimum data needed into a function in cases like this

Let's say I have a function `IsAdmin` that checks whether a user is an admin. Let's also say that the admin checking is done by matching user id, name and password against some sort of rule (not important). In my head there are then two possible function signatures for this:               public bool IsAdmin(User user);     public bool IsAdmin(int id, string name, string password);      I most often go for the second type of signature, thinking that:   * The function signature gives the reader a lot more info   * The logic contained inside the function doesn't have to know about the `User` class   * It usually results in slightly less code inside the function However I sometimes question this approach, and also realize that at some point it would become unwieldy. If for example a function would map between ten different object fields into a resulting bool I would obviously send in the entire object. But apart from a stark example like that I can't see a reason to pass in the actual object. I would appreciate any arguments for either style, as well as any general observations you might offer. I program in both object oriented and functional styles, so the question should be seen as regarding any and all idioms.


What are some Java patterns well-suited for fast, algorithmic coding?

I'm in college, and I've recently started competing in programming competitions with my friends. These competitions involve solving algorithmic problems quickly. It's a lot of fun, but there's one problem: I'm forced to use Java. (My teammates use Java.) **Background:** I'm a self-taught JavaScript programmer, and it hurts to write Java code. I find it very verbose and inflexible, and I feel slowed down when having to declare types and decide which of the eighty list data structure to use. I'm also frustrated about the lack of functional programming features and how verbose using regular expressions, arrays, and dictionaries are. As an example, consider the problem of finding the length of the longest string of consecutive characters in a given string. So the string `XX22BBBBccXX222` would give `4`, for the string of four `B`s. In Java, I'd have to loop through and manually count characters and manually keep track of the maximum. (That's at least as far as I'm aware -- I'm not as familiar with Java as I am with JavaScript.) In JavaScript, I'd find it like this:               var max = Math.max.apply(Math, str.match(/(.)\1*/g).map(function (s) { return s.length; }));      Much quicker and simpler, in my book. **The question:** what are some Java features, techniques, or patterns well- suited for fast, algorithmic coding?


Is there a Design Pattern for preventing dangling references?

I was thinking about a design for custom handles. The thought is to prevent clients from copying around large objects. Now a regular handle class would probably suffice for that, but it doesn't solve the "dangling reference problem"; If a client has multiple handles of the same object and deletes the object via one of them, all the others would be invalid, but not know it, so the client could write or read parts of the memory he shouldn't have access to. _Is there a design pattern to prevent this from happening?_ * * * Two ideas:   1. An observer-like pattern where the destructor of an object would notify all handles.   2. "Handle handles" (does such a thing even exist?). All the handles don't really point to the object, but to another handle. When the object gets destroyed, this "master-handle" invalidates itself and therefore all that point to it.


Storing documents in Database vs CMS in JSF, Seam, Hibernate application on cloud

I am about to start with an application using JSF 2, Seam 3, Hibernate and Hibernate search with the following characteristics:   * Users will be uploading documents (pdf, doc).   * There can be millions of documents.   * The application will be deployed in the cloud. Here are my questions:   1. What will be the best place to store the documents: a database or a content management system (CMS)?   2. If choosing a database, should I go with document oriented db?   3. Is there any integration between Hibernate and document oriented databases or CMS to fetch the documents and index it in Lucene? Basically I am looking for an approach that will be good for storing documents in the cloud, easy accessibility of documents for indexing and keeping performance in mind. Any suggestions / experience or link on this will be good.


Should I follow an open source project's documentation patterns even if they are bad?

I've considered making modules and the like for various languages and other open source things. Where documentation is not specified but rather is communal de facto standard or entirely ad hoc; should I try to improve from that standard in my code if it is not in-line with what I've learned to be good documentation from reputable sources ( _Code Complete_ et al)? Or should I maintain consistency over all, regardless of quality?


How to write a command interpreter/parser?

Problem: Run commands in the form of a string.   * command example: `/user/files/ list all;` equivalent to: `/user/files/ ls -la;`   * another one: `post tw fb "HOW DO YOU STOP THE TICKLE MONSTER?;"` equivalent to: `post -tf "HOW DO YOU STOP THE TICKLE MONSTER?;"` Current solution:               tokenize string(string, array);          switch(first item in array) {         case "command":             if ( argument1 > stuff) {                // do the actual work;             }     }      The problems I see in this solution are:   * No error checking other than nested ifs-else inside each case. The script becomes very big and hard to mantain.   * Commands and responses are hardcoded.   * No way of knowing if flags are correct or missing parameters.   * Lack of intelligence to suggest "you might wanted to run $command". And the last thing I can't address is synonyms in different encodings, example:               case command:     case command_in_hebrew:         do stuff;     break;      The last one might be trivial, but well, what I want to see is the solid fundations of this kind of program. I'm currently programming this in PHP but might do it in PERL.


Forward and backward fourier transform image in java

Can anyone suggest a java library to perform forward and backward Fourier transform on images? Either RGB or gray-scale or binary , that doesn't matter since I've converted the image to all these ;) I do searched but most of the image processing libraries like marvin, JAI etc don't have Fourier transform. So I thought anyone who have done this earlier could suggest me one


How to : Nextag and such other dynamic data pulling website

Yesterday, I came across Nextag which is a website for comparing prices of various products from different retailers. **Is this site automated?** Can the process of data pulling from various sites can be automated for comparison with each other. I tried understanding a hell lot, but could not realize this fact and now think that they ought to be manually managed because on every other retailer site, the product name was different and it was very hard to recognize a similarity for a specific product. I have made such a system in which one can add a product and then add the respective retailers and their pricess. Every thing is manual in here. Today, I will be entering the data into the system, but thought it would be better to know if there is a way to automate this thing. Or I am going the right way as there can't be an automation for such system, because the data has no similarities.


Design RESTful API to update a resource that belong to another resource

I'm developing an ASP.NET MVC Web Api with C#. I have the following two resources. Group:               public class Group     {         public int GroupId { get; set; }         public string GroupName { get; set; }              public User Owner { get; set; }              public List<User> Members { get; set; }              public List<Message> Messages { get; set; }     }      Message:               public class Message     {         public int MessageId { get; set; }         public string Body { get; set; }         public DateTime DateSent { get; set; }         public Group ToGroup { get; set; }              public User Sender { get; set; }         public User Recipient { get; set; }              public List<Link> Links { get; set; }     }      And I also have these two URIs. This one to expose `Message` resource:               "api/messages/{id}"      And this one to expose Group's Messages:               "api/groups/{groupId}/messages/{messageId}"      I use the second one to access directly to a group's message (I don't know if it is a good design). Now, I'm thinking which URI do I have to use to add a new message for a group. I think that I have to use the second URI to get a group's messages. And the first URI to add new messages. What do you think?


Confusion of the "stack" in Assembly-level programming

What is the "stack" exactly? I've read articles, tried comprehending it through my understanding, experience, and educated guessing of programming and computers, but I'm a bit perplexed here. The "stack" is a region in RAM? Or is it some other space I'm uncertain of here? The processor pushes bits through registers on to the stack in RAM, or do I have it wrong here? Also, the processor moves the bits from the RAM to the register to "process" it, such as maybe a compare, arithmetic, etc. But what actually can help understand, in some visual or verbal description or both, of how to implement the idea of a "stack" here? Is the stack actually the same in terminology with a "machine stack" meaning it's in RAM? * * * I know what a software stack is. I know about LIFO, FIFO, etc. I just want to gain a better understanding of the assembly level stack, what it is, where it is, how exactly it works, etc...


Storing IEnumerable as instance variable - is it a code smell to expect it to change?

I have something that works like a fixed size list - it's actually called `FixedSizeStack<T>` in my program. I will use it to represent the X last occured events. This event list will then be examined by different observers, and if they detect patterns they will trigger some action. Naturally, I see no reason for them to know of `FixedSizeStack<T>` \- to me it makes sense to present it to the actions as IEnumerable. I am considering giving them this event list in their constructors, then calling something like `PreviewEvent(Event e);` and `EventOccured();` and they will iterate over this IEnumerable. I feel a little queasy enumerating this IEnumerable multiple times, and making it part of the contract that the enumeration changes - do you think this is a reasonable method?


Should I put calculation logic in an Entity or in the Business Layer?

Recently I was faced a question about whether a simple calculation should be put in the Entity layer, or should the Entity be pure for just storing the raw data and leave the calculation logics in the business layer. So my question is whether it is sensible to encapsulate simple calculations in the properties in an entity class?


What is the difference (if any) between (null != $object) and ($object != null) when using PHP?

I am used to Java and therefore always think conditions are interpreted from left to right, i.e. there is a vital difference in `null != $obj` and `$obj != null` Now this seems not to be the case with PHP. Can I do something wrong in PHP when I always start with `null` on the left- hand side? Can I keep my behaviour from Java or do I need to train myself to do something else when dealing with PHP conditions?


What languages are the kids of today actually programming in? Does anyone have real data?

Back in the 80s colleges were teaching Pascal because it is easy to learn, while myself and many others like me were learning BASIC because it was not only easy to learn but accessible and also fashionable (for an extremely liberal definition of fashion) It has just occurred to me that empirical data on the actual programming languages kids are choosing to use should be a good indicator of which language would be the ideal first choice for educators. Please note that this question is not "what do you think is a good programming language for kids?"


Where do you optimize?

There are two areas to possibly optimize for speed in:   * Where the most time is spent   * The code that is called the most Which is the best place to start optimizing? Often code that is called the most often has low execution times already. Do you optimize the slower, less called areas or spend time optimizing the faster, heavily used areas?


Worst coding standard you've ever had to follow?

Have you ever had to work to coding standards that:   * Greatly decreased your productivity?   * Were originally included for good reasons but were kept long after the original concern became irrelevant?   * Were in a list so long that it was impossible to remember them all?   * Made you think the author was just trying to leave their mark rather than encouraging good coding practice?   * You had no idea why they were included? If so, what is your least favorite rule and why? * * * Some examples here


Is it good to review programs with seniors and boss even if it is working fine?

In my company, before delivery of any project, my boss asks my seniors to review programs written by me or other team members or sometimes boss also sits with us for review. I think it is a good way of getting knowledge, but sometimes when programs are working fine, they don't work same after review and I need to look again into my program. They says that review helps to optimize program and query execution, but can we prefer optimization over actual functioning of program?


Are "customizable" programming languages more widely used than not as "customizable" ones?

Are languages which are very customizable, like Python (see for example goto in Python, lightweight Python type-checking) and Javascript (see jQuery for one example of this) more widely used than languages which cannot be customized very much?


What is a widely accepted term for a string variable that would probably contain a file path and file name?

For functions that need to index files in a directory and rename them FileName0001, FileName0002, etc... I often need to write a function that splits the file name from the file path and rename the file. When I put the file name and file path back together, I don't have a very good name for the variable that contains both of them and I usually just wind up concatenating them every time I want to use them (usually using them as parameters for functions labeled either filename or filepath) so I never really know what I'm doing until I notice a lot of files being written in the same directory as my binaries. Anyway, what do I call a file name and a file path? I don't want to call it File, because that usually means the binary information behind the file. I don't want to call it URI because that usually means I've got some sort of protocol, which I don't. I just want a good way to denote "c:\somedir\somedir\somedir\somefile.txt" so as to deconfuse this mess I've just realized I'm in. * * * Please don't just list your personal preference. I think an excellent answer should "'site its sources". (as in, provide a link to a repository with a good example of the code being used as I described)


Approach on working with many programmers on one module/feature

How can 2 or more developers code a certain feature/module of a software? Let's assume that the module is big and feature rich. How would they prevent each other from overlapping their code? Say, we have the same method but is implemented in a different way. Do you think it might be better to have one focused at a specific feature only? Is a version control system like Git would help solve the problem? Is it correct that it allows developers to have these "branches" and then merge it later on? What's your take on this?


What applications for self-adaptive programs can you think of?

Hey everyone! By self-adaptive programs, I mean the programs which are able to adapt to specific situations. For example they are able to repair them selves or are able to change their behavior according to user's needs. Obviously they need some sort of A.I modules like Intelligent Agents or so on. My question is, what applications for these programs can you think of/exist? An obvious destructive (!) application could be a malicious program/virus which can change its strategy in attacking its victim based on some factors. The reason for this question is that I want to do some research on this topic as a university project and I want to know about different stuff and uses that could come into mind! Any response is greatly appreciated! :-)


Which is better: for valid buffer length?

This is a basic question. But, I think understanding this would be helpful to play with buffers in 'C'. Thanks. ## Scenario Just a sample snippet               char *test_buff = (char *) malloc(512); //allocate 512 bytes in heap memory.     bzero(test_buff, 512); //Reset buffer instead of Junk/garbage.     /* random code here to fill-in the buffer called "test_buff"...*/     ...     /* Send data to another host/system [this doesn't matter though]      * using buffer "test_buff".      */      sendto(sock_descriptor, test_buff /*buffer to send data*/, sizeof(*test_buff) ,...,...);  // option-1     /* OR */      sendto(sock_descriptor, test_buff /*buffer to send data*/, 512 /* actual malloced size*/ ,...,...); // option-2      ## Question   1. Which one of the two is better [between option-1/option-2] way of using buffer? I hope option-1 makes sense, as it has length/size of valid data bytes of send buffer or "test_buff" in this case. Thanks for your time and input.


What and all the areas of Linux a PHP developer should know about? (Like just commands of it or something advanced)

I've developed a website using PHP but I implemented it on Windows OS and hosted it on Windows server. I just searched the PHP job market to know the on-going technology requirement and to keep my knowledge up-to-date accordingly with the job market. I see more are asking for LAMP stack. I understand the sort of skills required for a developer in PHP and MySQL. But coming to the Linux and Apache what kind of the skills exactly companies expect from a developer? On what should I be focusing in case of Linux, Apache whilst developing my website using these LAMP stack? I am going to develop a new website and want it to be using LAMP. But I want to know what difference it makes? Why LAMP stack got more demand in the job market compared to WAMP ? Edit: Sorry I thought my question is creating confusion ... so I put my question in different words as What and all the areas of a Linux a PHP developer should know about? (Like just commands of it or something advanced) Note: I am Linux newbie


Is it wise to ask about design decisions made on a product during an interview?

I've been thinking about interview questions lately and I've been reflecting on bad interview experiences I've had in the past. One of particular note is where I had asked the interviewer why the team chose to use EJB 3 over Spring in their product. The interviewer pretty much tore my face off, yelling "Because Spring is not the be all and end all of Java software development, do you want this job or not?". In response to this, I told him that this probably wasn't the job for me and I promptly walked out of the interview. I was informed at the beginning of the interview that the company had high staff turnover, the product they were working was initially created in Modula-3 then ported to Perl and finally to Java. I was handed a 10 page booklet of technical questions covering Java, EJB, SQL and JDBC and I was asked questions about the technology stacks I've worked with. When prompted to ask questions, I felt it was reasonable to ask them about their technology stack and and get reasonable answers back, not to send the interviewer into flames. **Question:** Is it a good idea to probe on architectural choices taken in an interview? If not, why? From my own point of view, an interview is a two-way process. If the interviewers are testing me on my technical skills, I've got every right to ask them the same questions to: 1) Figure out what their mindset and attitudes towards developing software are. 2) Determine if their approach is in line with how I would approach problems of that kind. It's possible that the interviewer who got angry had poor interviewing skills and forgot that an interview is a two-way exchange. If I was asked this, I would have given a reasonable answer, but I certainly wouldn't have tried to put an interviewee in a state of meek capitulation where the head just bobs up and down with no conversation.


anyone familiar with these analytic questions?

So...my recruiter just called me to confirm my interview on Thurs. He also mentioned that I am going to be asked to answer for two analytic questions. He gave me a little bit about those questions.   1. There are eight balls. One of them is defective.    2. There are three incandescent light bulbs inside a room, but switches are placed outside. These are all he said. I think that these are not completed question. Anyone knows what questions these are?? Does my question belong to programmer.stackexchange.com? I thought it would because it is related to interview questions.


Syntax extension in weakly typed lanuages?

I like languages that give me the ability to extend the syntax of the language. At the same time, all the languages that I know will let me extend the syntax have relatively heavy type systems. Are there lighter-weight languages that allow the same sort of syntax extensibility? Or does flexible syntax require that you would be able to define new data types (and operations on those types)? Basically, I want the syntactic flexibility of Haskell without Haskell's type system. Is there a way to get this, or does that syntactic flexibility require the assistance of a type system? Examples of languages where I know the type system can be used to create new syntax are Haskell, C++, and Python. Possible examples of where syntax could be modified without a strong type system maybe Scheme, Forth, and Common Lisp. However, while I can see how to overload operators in the first list to generate new syntactic constructs, I don't know enough to know how to do it in the second list. Maybe the answer is for me to go read up on macros in Common Lisp. What I would like is a language with the conceptual simplicity of C, Lua or Erlang, but with the ability to create additional syntactic operators as desired. TLDR - basic summary of question: Is it possible for weakly typed language to support syntax extension, or does the ability to extend the syntax of a language (from within the language itself) require a type system to implement?


Working as a contractor--questions part II

This is a follow-up to this discussion: Working as a contractor--questions I still would like to get more info on the following points, when working as a contractor as opposed to direct employee:   * Housing: for short-term contracts (let's say 6 months or less) that are not in your home area, where and how do you search for short-term, flexible housing? Especially since an employer would typically want you to start immediately, so you don't have the time to go out and explore. Also, would you typically look for furnished apartments because the cost transporting your own furniture for a few months is not justified?   * Work hours and pay: are contractors more strictly supervised (as far as getting specified work done) because they get paid by the hour? There are also supposed to get overtime pay (at a higher rate) if they work more than 40 hours per week, does this really happen? Or do they work unpaid extra hours just like many regular employees?   * Some potential employers have mentioned paying the "per diem", which is essentially a non-taxable daily allowance, which is supposed to be used for living expenses. This money gets subtracted from you per-hour rate, but the advantage is that you pay less tax. However, from the information I have seen, the per diem can only be paid if you maintain a "permanent" residence you intend to return to. Is this checked in practice, and if yes, how?


Will adopting a DVCS mean there will be a positive impact on development speed?

I was wondering how safe is to say that —because developers are free to version and have better and more organic workflows— code will be delivered faster. A big factor here is team size of course, and I'd say the team is big enough to see this benefit (10-15 core devs, and maybe 5 to 15 more contributors to the common codebase). **Edit** : How development speed can be affected:   * Merging hell could be one of the cases that slow down people (DVCSs are much better at merging).    * Better workflows that ~~can pretty much only work~~ work more naturally on a DVCS **Integration Manager** ![Integration Manager](http://i.stack.imgur.com/IxVc7.png) **Dictator & Lieutenants** ![enter image description here](http://i.stack.imgur.com/63H5O.png)   * Ability to use version control (i.e. committing) without inflicting potentially unstable changes to everybody  I just want to know if anyone has seen such things help the overall speed of teams/projects as a whole.


Can I (reasonably) refuse to sign an NDA for pro bono work?

A friend of mine (let's call him _Joe_ ) is working on a promising project, and has asked me for help. As a matter of friendship I agreed (orally) not to discuss the details, but now he has a potential investor who wants me to sign a non-disclosure agreement (NDA). Since thus far all my work has been pro bono I told Joe I am not comfortable putting myself under documented legal obligation without some kind of compensation for the risk. (It needn't be strictly financial. I would accept a small ownership stake or possibly even just guaranteed credits in the code and documentation.) Is my request reasonable, or am I just introducing unnecessary complexity?


My colleague doesn't understand things he works with. What to do?

I've spent 3 days debugging one very obscure bug in a library made by my colleague, this bug happens very infrequently. After all I found that this bug happens due to cross-thread access to an object without any lock. Actually this is not a first bug of this kind, there were similar bugs before. He just runs his unit tests, and if something fails puts somewhere a lock. And if nothing fails, ughm, then his code is perfect. It seems he has no idea about threading safety. I'm 100% sure there are many similar bugs that just haven't surfaced yet. It seems PM doesn't understand threading stuff too.   The problem is, he works much more time in the company than I do. Anyway, I can't just say "this guy is incompetent in this area", because this always shows you as a "bad team player", etc.   Any ideas, what I can do?


Don't structure data all the way down

In the blog post Don't structure data all the way down, the author discusses different ways to structure a circle datatype and how to implement the parameters to a Radius function.               area({circle, {point,0,0}, 17.4})      Kind of messy. What about a function to build a circle for us? Then we could do this:               area(make_circle(0, 0, 17.4))      We could also have a shorter version of make_circle that only takes a radius, defaulting the center point to 0,0. Okay, stop, we're engineering ourselves to death. All we need is a simple function to compute the area of a circle:               area(R) -> math:pi() * R * R.      He is talking about the functions in the Erlang language, which is functional and not object oriented (OO). My question is, does this argument hold for OO languages, and does it hold for functional languages?


Release Planning in Agile/Extreme Programming

I've been studying couple of books of how to exactly implement agile. I am confused about release planning. Our application is a Insurance System consisting of different modules (Quoting, Policy Management, Claims management etc). During the first phase we are just planning to release Quoting and we are estimating approximately 4 months for it. Now my question is, do we have to identify user stories for overall system (including all the other modules) first before start working on our first release (i.e quoting)? Or is release planning is an iterative process too?


Flow Chart - While Loops process

I'm having difficulties understanding whether or not this is the right process to use for a flow chart which illustrates the processes involved in an algorithm. For this, assume the following: A 1D `X = [0, 1, 2, 3,........]` data block is split into 2D blocks:               x = {[0 1]}          {[2 3]}      For each of these blocks, the total energy is counted, if the total energy is less than the threshold value the block is removed. If the energy is higher, then it is kept and the algorithm moves onto the next block. Here's my flow-chart: ![enter image description here](http://i.stack.imgur.com/B2mcq.jpg) Now the way I look at this is that, I start the algorithm split the signal into frames, calculate the energy for each signal (2D) if the energy < theshold remove the frame AND THEN end the algorithm. If the energy is higher than the threshold, then, it looks that the signal block (2D) is passed back into the algorithm, the energy for the signal is re- calculated. My questions:- 1) Should there be a while loop that says "If at the end of the block"? 2) Should I specify that blocks of `x[n][n]` could be passed into the calculate energy? Alternatively, does this look fine and I should apply some description of how the process works in written text? Any help would be greatly appreciated :)


Scanning a billion rows in an ultra-fast database

## Background A local database contains nearly 1.3 billion unique rows. Each row is indirectly associated with a specific latitude and longitude (location). Each row has a date stamp. ## Use Case The problem is as follows:   1. The user sets a starting/ending date, and a range of values (e.g., 100 to 105).   2. The system gathers all the rows that match the given date, grouped by location.   3. The system performs determines the locations that, during those dates, have a statistical likelihood of falling into the given range of values.   4. The system displays all matching locations to the user. This is a problem of speed and scale. ## Question What is the least expensive solution architecture you can imagine that would allow such a system to retrieve results for users in under five seconds? ## Current System The environment is currently:   * PostgreSQL 8.4 (upgrade is possible; switching databases is not an option)   * R and PL/R   * XFS   * WD VelociRaptor   * 8 GB RAM (Corsair G.Skill; 1.3 GHz)   * Quad core GenuineIntel 7 (2.8 GHz)   * Ubuntu 10.10 Hardware upgrades are acceptable. ## Update - Database Structure The billions of rows are in a table resembling:               id | taken | location_id | category | value1 | value2 | value3        * id - Primary key   * taken - Date assigned to the row   * location_id - Reference to the latitude/longitude   * category - A description of the data   * value1 .. 3 - The other values the user can query The `taken` column is typically consecutive dates per `location_id`, sometimes each location has data from 1800 to 2010 (about 77,000 dates, many of them duplicated as each location has data in the same date range). There are seven categories and the tables are already split by category (using child tables). Each category contains ~190 million rows. In the near future, the number of rows per category will exceed a billion. There are approximately 20,000 locations and 70,000 cities. The locations are correlated to city by latitude and longitude. Assigning each location to a particular city means finding the city's boundaries, which is not a trivial task. ## Ideas Some ideas I have include:   * Find a cloud service to host the database.   * Create an SSD raid stripe (great video).   * Create a table that amalgamates all the locations by city (pre-calculation). Thank you!


After 15 years of programming, how does one get out of it?

> **Possible Duplicate:**   >  I no longer want to be a developer This might seem like an odd question, but I think I've just about had it with programming. I used to enjoy back when I was 11 years old (I'm 31 now), and I actually got to be really great at it at an early age. In high school, I had already knew c++, design patterns and all sorts of things and was building fairly sophisticated stuff. Then web development became all the rage, and like a lot of people, I sort of got sucked into that - to the point where that's all anyone really wanted. To be honest, I've never liked it. After learning so many technologies and languages year after year, I'm a little sick of relearning the same sorts of things that I knew how to do before but differently. I am sick of learning the new bugs, design errors and idiosyncrasies of the new technologies over and over again. Sometimes it seems like we are regressing rather than progressing. The amount of languages you need to know just to get a web application up and running now is just disgusting. It's way more bloated then it should be. Things have just gotten a lot more complex now too. While I appreciate a lot of the frameworks out today that _try_ to make your life easier, it seems that debugging and knowing what's going on has become a lot harder. I've never come across more bugs in other people's code than I have in the last 1.5 years in my entire 15 years of programming. It is annoying, it sucks out a ton of my energy. I am just not passionate about this anymore. Learning and working with the technologies for their own sake is just a means to an end - it's not fun. I actually don't care about any of it anymore. Despite how simple things some things have gotten, it is amazing how trivial problems blow up into solutions that require 4 or 8 hours to fix... and these things have nothing to do with your actual application requirements - it's just fixing crap that other people got wrong. We're also in a era where frameworks and libraries need to hype their tools and they need to prove to you how easy they are compared to things that have come before... but they almost always make you jump through a billion hoops to doing something complicated. By the time you figure out how to achieve the complex requirements in the new tool, you've lost a lot of time that was more- or-less equivalent to the time it would have taken in the old technology. So what was the point of learning the new technology in the first place? While the old technology required more code, it was more generic and flexible. You could argue that learning the new quirks for these complex requirements build intellectual capital that can be used later, but by the time you need to utilize this knowledge a second time, there comes yet another new technology that makes this knowledge obsolete. With websites basically needing to be super rich client applications now, these beasts have become extremely hard to test. No longer can you just write the bulk of your code in a single language, and getting amazingly good at Javascript seems like a monumental task all on its own. We are in the era of mass specialization now, and that doesn't interest me because any projects I want to work on, I have to do by myself. How do I get out? I have decided that I'm just done with it all. I really want out. I have just invested so much time and energy into being a great software developer for most of my life, it seems sad that I'm basically going to throw it all away. **EDIT** After reading some of the comments, I think these are also problems. 1) Burnout. Regardless of how long I take a break, I have no interest in working on programming stuff when I need to start back again. 2) Not caring about writing "good" software anymore like I used to. You don't get rewarded for doing a job better than 99% of the programmers out there. Nobody cares if you do it well either. It's actually kind of amazing that skill and craftsmanship and care is not a value to most people in this industry. 3) Boredom. Writing mindless queries, business logic and pumping data to a view for so many years is just not interesting. After working on 1500-2000 database tables and the application logic that worked on them, I don't find any of this kind of stuff interesting or challenging. 4) Producing value. Nothing I work on really matters. Sure, it matters for the clients, but it doesn't really matter to me.


Need advice on making the transition from a .NET development shop to a Java shop

For almost all of my professional development career (15+ years) I have been working on or managing development teams that primarily use Microsoft technologies (VB6, ASP, ASP.NET, C#, SQL Server, etc.) I've recently been approached by a company that seems very interested in me for a job managing their development team, which happens to be a Java shop. Although I did recently take some college level Java courses, it was the typical programming academic environment, that is, lots of theory,excessive focus on syntax, and mostly console type apps, with only a trivial app at the end of the course with anything remotely resembling a modern Windowed UI. I'm not worried at all about the syntax elements, picking up new programming languages isn't all that difficult and C# is so similar to Java that I think it should be fairly seamless in that respect. However, thinking back over all the tools, frameworks and platform specific knowledge, lingo that I have amassed for MS development, I worry about how quickly I can get up to speed enough to be productive in that environment and earn the respect I will need to manage effectively a team of veteran programmers, who potentially may have biases against MS developers. Have any of you made the transition from a .NET shop to a Java shop? If so what were the toughest aspects of making the shift? Also, did you find it harder to get street cred on the team based on your experience in another platform? For those of you who already work on a Java team, how would you feel if a veteran .NET programmer/manager took over the reins of the team? What could that person do or say to make you feel more comfortable trusting them?


How do you keep track of your past projects?

After having hard time trying to remember details of my past projects several years ago I was wondering how programmers usually keep track of that? This kind of information comes handy with job interviews etc. Do you write down technologies used, challenges faced etc to some kind of "jumbo CV"? Or do you just trust your memory?


Objective-C As A First OOP Language?

I am just finishing the second semester of my CS degree. So far I learned C, all the fundamental algorithms and data structures (e.g., searching, sorting, linked lists, heaps, hash tables, trees, graphs, etc). Next year we'll start with OOP, using either Java or C++. Recently I got some ideas for some iPhone apps and got itchy to start working on them. However I heard some bad things about Objectice-C in the past, so I am wondering if learning it as my first OOP language could be a problem. Not to mention that I think it will be hard to find books/online courses that teach basic OOP concepts using Objective-C to illustrate the concepts (as opposed to books using Java or C++, which are plenty), so this could be another problem. **In summary** : should I start learning Objective-C and OOP concepts right now by my own, or wait one more semester until I learn Java/C++ at university and then jump into Objective-C? **Update** : For those interested in getting started with OOP via Objective-C I just found some nice tutorials inside Apple's Developer Library -> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/OOP_ObjC/Introduction/Introduction.html


How to appear very professional on my first freelance project?

I need some help on appearing very professional on my first freelance project. How / What should you do to achieve this? * * * **Background** : I started as a full time web developer 18 months ago, two promotions later I am now a senior software engineer. I've never had any problems with designing / developing / coding a complicated system. I thought I could use some help for Christmas and I started bidding for a project and now I have one - from a very reputable lawyers association in London. _I have no problem dealing with the actual implementation of the system, but I have no idea how to appear professional throughout the whole process._ **About the project** : This lawyers association are starting a distant training courses and in addition to having a website to show off all their clients etc, they want a students area where their students would log in, download course materials allocated to them etc.. and an admin section where they assign courses to students / create new ones / upload materials etc.. * * * ## Questions breakdown: 1) How should I start with the requirement gathering? Is using scrum a good idea, or should I use something like Volere Template - and what should I do with it? should I submit a copy to the client etc.. 2) How often should I meet the client? Would once a fortnight would be good? 3) What are the processes / protocols that I need to follow so that they would be satisfied with me and think that I am very professional 4) How much should I charge for the product? 5) How should I get a quote / contract / receipt for the whole project? **6) What are the steps that professional freelancers go through, during the life cycle of a project?** * * * **My Research so far** Looking at How much should I charge doesn't help.. I live in London, zone 1, though I have no idea how much a project of this size would cost. Help on this would be appreciated. How to be professional articles talks about the work / time management etc and not the actual process, what would real people do etc.. it's like academia theory, but not practical. * * * If this needs revising, please let me know, do not close it because of whatever reason, I will edit the question or details to fit the needs. Thanks for reading a lengthy question.


What modern alternatives to Numerical Recipes exist?

In the past, the Numerical Recipes book was considered the gold standard reference for numerical algorithms. The earliest Fortran Edition was followed by editions in C and C++ and others, bringing it then more up-to-date. Through these, it provided reference code for the state-of-the-art algorithms of the day. Older editions are available online for free nowadays. Unfortunately, I think it is now mostly useful only as a historic tome. The "software engineering" practices seem to me to be outdated, and the actual content hasn't kept pace with the literature. What similarly comprehensive yet approachable references should the modern programmer look at instead?


Why does HashMap allow only one null key?

A `HashMap` allows only one `null` key. Is it because it allows only unique keys? Or is there another reason?


What is the rationale behind entering email twice for registration?

Many web sites ask users to enter their email address twice, sometimes taking the trouble to disable copy-pasting. What is the logic behind this? Is this e.g. a security measure?


Is there a resource that explains the benefits of layered programming?

Let's say we have a winform application with a buttonclick event. The buttonclick handles everything from the UI configuration to the database call and data manipulation. So you end up with a method that is 100's of lines of code long. Outside the fact that this code can't be considered test-able for various reasons, this style of programming is fragile to change. I can talk bout OO, Anti-patterns, etc. The problem is that any distinct topic I can dream up requires a great deal of explanation to understand the potential benefits. Outside of finding a new job ( **lots** of businesses program this way), how can I teach these kinds of developers how to write better code? Obviously we can't sit around a round table and discuss pro's and con's all day due to time constraints and real work that has to be done. Although, training and intense training is the only thing I can think of to fix these problems. Not to say I write perfect code, I most certainly do not. I do believe there are certain best practices that should be followed as a rule E.G. OO in the context of .NET. The most common excuse I hear is "we can't write code fast enough if we do it like that".


Looking for a distributed locking pattern

I need to come up with a custom recursive object locking mechanism\pattern for a distributed system in C#. Essentially, I have a multi-node system. Each node has **exclusive write** permissions over _n_ -number pieces of state. The same state is also available in **read-only** form on _at least one_ other node. Some writes/updates must be atomic across all nodes, while other updates will eventually become consistent thru background replication processes, queues, etc... For the atomic updates I'm looking for a pattern or samples that efficiently allow me to mark an object as locked for **writes** which I can then distribute, commit, rollback, etc... Since the system has high-levels of concurrency, I'm assuming I'll need to be able to stack-up locks which will either timeout or be unrolled once the locks are released. The transaction or messaging pieces are not the focus of this question, but I've provided them for some extra context. With that said, feel free to articulate what messages you think would be needed if you like. Here is a vague sample of what I was envisioning although I'm open to any new ideas aside from implementing whole new products               thing.AquireLock(LockLevel.Write);          //Do work          thing.ReleaseLock();      I was thinking of using extension methods, which might look something like this               public static void AquireLock(this IThing instance, TupleLockLevel lockLevel)     {          //TODO: Add aquisition wait, retry, recursion count, timeout support, etc...           //TODO: Disallow read lock requests if the 'thing' is already write locked         //TODO: Throw exception when aquisition fails         instance.Lock = lockLevel;     }          public static void ReleaseLock(this IThing instance)     {         instance.Lock = TupleLockLevel.None;     }      To clarify a couple details...   * All communications are TCP/IP using a binary request/response protocol   * There are no intermediary technologies such as queues or databases   * There is no central master node. In this case, the locking arrangement is defined by the initiator of the lock and the partner which will honour the request with some form of timeout to govern its behaviour Anyone have any suggestions?


How to implement gestures to a toolbar made from custom view in Android or is it recommended approach?

I would like to develop a re-usable component of horizontal Slidable tool bar. I would like to try to develop a custom view instead of ActionBar.   My Custom-View extends VieGroup contains and custom image button class as child views. The custom-view contains multiple tool buttons. Is it recommended approach please? or do we have any better approach without using ActionBar. Minimum android version should be 4.0 and target is 4.x and one of the screen resolution is 480X640 in 4.7 inches screen. The re-usable toolbar would be used in different screens/views with in same and multiple apps. I understand that Action bar comes with many standard features of a tool bar including various gesture features.


Algorithm for pinning joints for use with inverse kinematics

I'm part of the development team for a 2D animation program. One of the key features of the program is the ability to pose figures using Inverse Kinematics. Although we have that part down, we need to be able to pin joints in their place so moving another joint won't move the pinned one, or any past it. This is currently working for single joint pinning with the current algorithm we're using. However it's a necessity for us to be able to pin multiple joints at once and the algorithm we're using just isn't designed to work with it, and everyone on the team is stumped as to a solution. Are there any algorithms out there for joint pinning for use with inverse kinematics, while keeping in mind that it will have to work for any kind of non-closed figure?


Strategy for code review before merge to master from feature branches

Me and my team use feature branches (with git). I'm wondering which is the best strategy for code review before merge to master.   1. I checkout a new branch from master, lets call it fb_#1   2. I commit a few times and than want to merge it back to master   3. Before I merge someone is supposed to make a code review Now there are 2 possibilities: 1st   1. I merge **master to fb_#1** ( **not** fb_#1 to master) to make it as up-to-date as possible   2. A teammate reviews changes between master head and fb_#1 head   3. If fb_#1 is ok we merge fb_#1 to master   4. Pros: no obsolete code in review   5. Cons: if someone else merges something between "1." and "2." his changes appear in the review, though they belong to another review. 2nd   1. A teammate reviews changes between the point of checkout (git merge-base master fb_#1) and fb_#1 head   2. Pros: we see exactly what was changed during working on the feature branch   3. Cons: some obsolete code may appear in the review. Which way do you think is better and **why**? Maybe there is another more suitable approach?


Should if/else statements be arranged by rareness of cases or difficulty of dealing with them?

In some code I'm writing right now, I have something like this:               if (uncommon_condition) {         do_something_simple();     } else {         do();         something();         long();         and();         complicated();     }      Part of me thinks "It's fine the way it's written. Simple cases should go first and more complicated cases should go next." But another part says: "No! The `else` code should go under the `if`, because `if` is for dealing with unusual cases and `else` is for dealing with all other cases." Which is correct or preferable?


Should I Aggregate Web API Errors?

### The Situation We are writing a REST API that performs validation up-front. The code is written such that it tries to find as many errors as possible. However, each error might correspond to a different HTTP status code. Additionally, the client (the HTML) doesn't have a convenient way to parse/display the errors. ### The Question Is it better to just throw as soon as the first error occurs? Or should we do our best to aggregate the errors somehow? By the way, there is no requirement to try to handle as many as possible at once. I am not looking for an opinion. I was curious if there was a standard practice in REST. ### Why It Matters The current code is really complex. Some validation can only be run if other pieces are valid. So there is this explicit dependency between tests. It is complex enough that it warrants using a 3rd-party library. But I would rather just eliminate the cause of the complexity if I am going to spend time on it.


Why do so many hashed and encrypted strings end in an equals sign?

I work in C# and MSSQL and as you'd expect I store my passwords salted and hashed. When I look at the hash stored in an nvarchar column (for example the out the box aspnet membership provider). I've always been curious why the generated Salt and Hash values always seem to end in either one or two equals signs. I've seen similar things while working with encryption algorithms, is this coincidence or is there a reason for it?


Is there a name for the 'break n' construct?

In a conversation earlier this week I was discussing certain language features, and I realized I don't have a good word / phrase to describe a particular feature. Some languages, such as PHP, have a language construct which allows `break` and `continue` statements to accept a numeric parameter indicating which block should be affected. For example:               for ($i = 0; $i < 10; $i++)         for ($j = 10; $j > 0; $j--)             if ($j == $i)                  break 2;     echo $i;      Because `break 2;` causes the outer loop to break, the output is `1`. If this were `break 1;` or just `break;` the output would be `10`. C# does not have any such construct. The equivalent would something like this:               for (i = 0; i < 10; i++) {         bool broken = false;         for (j = 10; j > 0; j--) {             if (j == i) {                 broken = true;                 break;             }         }         if (broken)             break;     }     Console.WriteLine(i);      But of course, this could also be accomplished using a `goto`. So my question is, what do you call this? Is there a specific name for this "break _n_ " construct? I'd like to be able to say " _Language X has parametric break and continue statements_ ", or something like that.


What is your favourite/ideal development environment?

If you could describe your ideal development environment, what would it be? There are numerous things to take into consideration, including but not limited to:   1. Hardware   2. Software ( _Operating System of Choice_ , Paid vs. Free Software, ...)   3. Physical Environment (lighting, open-plan, location, ...)   4. An endless supply of coffee...   5. ... In other words, if you could tell your company what they could do to make your development experience there better, what would it be?


When interviewing programmers, are algorithm problem solving skills relevant for a job were solving such algoritm problems isn't normally needed?

Software created for some business domains don't require heavy use of algorithm problem solving skills on the job from the programmers working there. For example, a JEE developer might most of the time only need to move data from system to system, doing data transformations, then crunch that data for various reports, designing systems with well defined boundaries etc. As a programmer you are a problem solver and you should know how to solve algorithm problems. But some programmers haven't really been doing that since school if their domain of expertise hasn't required that skill, so the skill isn't up to date. For such domains, does it still make sense to have an interview selection that requires candidates to solve algorithm problems (like math problems, string manipulations, sorting arrays etc) or should the interview be focusing only on the skills needed for the particular domain?


How would you want to see software intellectual property protected?

Reading answers to this question \- and many other discussions of software patents - it seems that most of us as programmers feel that software patents are a bad idea. At the same time we are in the group most likely to lose out if our work is copied or stolen. So what level of Intellectual Property Protection does code and software need? Is copyright sufficient? Are patents necessary? As software is neither a physical object nor simple text, should we be thinking of a third path that falls somewhere between the two? Do we need any protection at all? If you had the facility to set up the law for this, what would you choose?