title: What do you do when one thinks the code isn't complicated enough?

text: After six months of development on a project, our stakeholders have had a "gut check" and have decided that the path that we've been walking (a custom designed application framework and data access layer) is holding us (the developers) back from quickly developing the features they would like to see. After several days of debate management and the development team have decided to scrap the current incarnation and start over using ASP.net MVC, with Entity Framework as the bases of the a 'quick and dirty', lets just get it done project. In days following, our senior developer who has never worked with MVC or Entity Framework has finally gotten into a sample project and done some work. His take on ASP.net MVC, "this is not software engineering". So my question is this; what do you do, when one doesn't think the code is complicated enough?


title: A Unicode sentinel value I can use?

text: I am desiging a file format and I want to do it right. Since it is a binary format, the very first byte (or bytes) of the file should _not_ form valid textual characters (just like in the PNG file header1). This allows tools that do not recognize the format to still see that its not a text file by looking at the first few bytes. Any codepoint above `0x7F` is invalid US-ASCII, so that's easy. But for Unicode it's a whole different story. Apart from valid Unicode characters there are _private-use characters_ , _noncharacters_ and _sentinels_ , as I found in the Unicode Private-Use Characters, Noncharacters & Sentinels FAQ. **What would be a sentinel sequence of bytes that I can use at the start of the file that would result in invalid US-ASCII, UTF-8, UTF-16LE and UTF-16BE?**   * Obviously the first byte cannot have a value below `0x80` as that would be a valid US-ASCII (control)character, so `0x00` cannot be used.   * Also, since _private-use characters_ are valid Unicode characters, I can't use those codepoints either.   * Since it must work with both little-endian and big-endian UTF-16, a _noncharacter_ such as `0xFFFE` is also not possible as its reverse `0xFEFF` is a valid Unicode character.   * The above mentioned FAQ suggests not using any of the _noncharacters_ as that would still result in a valid Unicode sequence, so something like `0xFFFF` is also out of the picture. What would be the future-proof sentinel values that are left for me to use? * * * 1) The PNG format has as its very first byte the non-ASCII `0x89` value, followed by the string `PNG`. A tool that read the first few bytes of a PNG may determine it is a binary file since it cannot interpret `0x89`. A GIF file, on the other hand, starts directly with the valid and readable ASCII string `GIF` followed by three more valid ASCII characters. For GIF a tool might determine it is a readable text file. This is wrong and the idea of starting the file with a non-textural byte sequence came from Designing File Formats by Andy McFadden.


title: Career change question: going from systems analyst to embedded systems development

text: How should I go about making a switch from doing help desk type work to embedded software development or any type of development that is done at a lower level? I will finally finish my degree in December and really want to get started building systems. My degree is an Applied Computer Science degree. I have taken classes in Assembly, C++, VB.NET, and Java but have not been able to use any of these to a great extent in any of my jobs. If anyone has advice on how to go about getting into the embedded development field that would be great.


title: Fastest way to find the closest point

text: I have a list in Python 2.7 of about 10000 point co-ordinates, like               [(168, 245), (59, 52), (61, 250), ... (205, 69), (185, 75)]      Is there a faster way to search for all the points in a bounding box, instead of just iterating over the entire list each time and checking if the co-ord is inside the 4 sides??   I'm using this "algoritm" to see if any point, which is randomly moving, has come inside the stationary bounding box..(if it helps)


Which programming language first introduced 'Hello World' as a first program to code for beginners?


title: Job Interview Challenges

text: I'm not entirely sure if this belongs here, so feel free to move/close it, if necessary. The other day, in our PHP class, our teacher gave us a challenge used by a friend of his in job interviews. It works in every programming language, so it's not limited to PHP. He said that his friend uses this 'riddle' to weed out the people who can't think of a fast answer when it comes to logical challenges. The people that don't solve it won't get a job, of course. The riddle is as follows:                   $a = 3;         $b = 7;              echo "a = $a";        // has to become 7         echo "<br />";         echo "b = $b";        // has to become 3      You basically have to switch the contents of both variables without doing lame things like `$b = $a + 4`. You **cannot** use a temporary variable either! I struggled with this, I have to admit that; I was like 'oooh yeah' when we finally got the answer. I don't want to spoil this for anyone, so instead of posting the solution I'll just put a link. Now, as for my question. I was wondering if there are more riddles like these out there, that people (that's you, SO) use in job interviews, etc. Perhaps even a bit harder than this one. My goal is to train my logical thinking a bit and get better in solving issues like this. Perhaps there are any books or websites out there devoted to stuff like this?


title: What web development frameworks questions should I include in my thesis?

text: I'm busy working for my thesis about Web Development Frameworks. I want to write about frameworks that have been used in the past and frameworks that have a good chance of lasting in the future, such as JQuery and PrimeFaces for example. I also want to do a survey and I am looking for good questions to ask on this survey. My questions is what web developers themselves are most interested in answering and what you think would be good questions in this survey to ask? For example, I was thinking about giving a list of current technologies and giving the possibility to give a score from 1 tot 10 to indicate which they prefer the most.


title: Is there a pattern or logical structure I can follow for Event Log Numbers?

text: What are some ideas or structure I can use when assigning EventID to events that will be saved to the Windows Event Log? ![enter image description here](http://i.stack.imgur.com/UT2UA.png) Some options I've considered   * Sequential (0... int.Max)   * Multiple of 10, where the "0" is replaced with how noisy the debugLevel is set.   xxx0 may represent exceptions, critical information, start, stop etc.   * ...? What numbering approach gives you the most insight when a user describes the event in an email or phone? What is the most useful to support staff?


title: Good use of try catch-blocks?

text: I always find myself wrestling with this... trying to find the right balance between try/catching and the code not becoming this obscene mess of tabs, brackets, and exceptions being thrown back up the call stack like a hot potato.  For example, I have an app I'm developing right now that uses SQLite. I have a Database interface that abstracts the SQLite calls, and a Model that accepts things to go in/out of the Database...  So if/when an SQLite exception occurs, it has to get tossed up to the Model (whom called it), who has to pass it off to whoever called the AddRecord/DeleteRecord/whatever...   I'm a fan of exceptions as opposed to returning error codes because error codes can be ignored, forgotten, etc., whereas an Exception essentially has to be handled (granted, I _could_ catch and move on immediately...)   I'm certain there's got to be a better way than what I've got going on right now. **Edit:**  I should have phrased this a little differently.  I understand to re-throw as different types and such, I worded that poorly and that's my own fault.   My question is...   how does one best keep the code clean when doing so?   It just starts to feel extremely cluttered to me after a while.


title: Do you use debugging in rails application? Why, when and how?

text: In Java, C and C++ I see people using intensively debugging strategies (because mostly they don't know about TDD). On the other hand, debugging too can help to understand software abstractions. So, when and how do you use debugging in Rails applications?


title: What does "Human Readable" mean? Is it a misnomer?

text: Two examples spring to mind:   * One of the reasons that .Net programmers are encouraged to use .config files instead of the Windows Registry is that .config files are XML and therefore human-readable.   * Similarly, JSON is sometimes considered human-readable compared with a proprietary format. Are human-readable formats actually readable by humans? In the example of configuration data:   1. The format doesn't change the underlying meaning of the information - in both cases, the data represents the same thing.   2. Both registry and .config file are stored internally as a series 0s and 1s. To that extent, the underlying representaion is equally unreadable by humans.   3. Both registry and .config file require a tool to read, format and display those 0s and 1s and convert them into a format that humans can read. In the case of configuration stored in the Windows Registry, this is a Registry Editor. In the case of XML it could be a text editor or XML reader. Either way, the tool makes the data readable, not the data format. So, what is the difference between human-readable data formats and non-human- readable formats?


title: Give advice from experienced to beginner programmer on reinventing my wheel(solution)

text: i ve just tried to do coding bat exercise. There are posted solutions to the problem i tried to solve. However, I was stubborn, i ignored them and tried to code it up my own way(basically reinventing my own wheel - square,bad working wheel). After 4 hours it looks nasty and fails some tests. Now i realize that my logic was totally wrong and wasteful. So the question :   * When do you start to give up solving problem your own way(reinventing the wheel) and start to look around to see other solution?    * How long should a developer be 'stubborn' in trying to find his 'unique' or complicated solution?    * When do you give up and begin to search for another logic?


title: Complexity limits of solutions created in Google Spreadsheets

text: I am creating a solution where I essentially put all rules regarding communication with customers (including automatic invoicing, reminder emails, welcome emails, etc.) into a Google Sheets and use Ultradox to create emails and PDFs based upon Google Docs templates. For the three automatic emails I have currently implemented this is working out really well, the whole thing is very transparent to our organization since even non-technical people can inspect and correct the "Excel"-formulas. My concern is that in 2-3 years we will probably have 200 unique emails and actions that we need to send out for the various occasions and given the various states that customers can be in. Of course I could aim at limiting the number of emails and states that our customer can be in, but this should be choice based upon business realities and not be limited by the choice of technology. **My question** is therefore, what are the limits of complexity (when will it become unmaintainable) that can be reasonably implemented in a solution based upon Google Apps Scripts and Google Sheets, given that I will attempt to expose as many of the rules as possible to Google Sheets? And what pitfalls should I be aware of when basing myself on a spreadsheet formulas, and what strategies should I follow to avoid the pitfalls? **Some of my own strategies** So far I have come up with the following strategies to increase maintainability:   1. Using several Google Sheets, each with its own purpose, each with its own dedicated "export" and "import" sheets so it is clear, which columns are dependent on the Google Sheet. Such sheets also help maintain referential integrity when inserting columns and rows.   2. Using multi-line formulas with indentation for formula-readability   3. Experimenting with the "validation" function to reduce the variability of data   4. Experimenting with Arrayformulas to ensure that formulas will work even if additional rows are added   5. Potentially offloading very complex formulas to Google Scripts and calling them from spreadsheet formulas   6. Using Named Ranges to ensure referential integrity Please notice that I am not asking about performance in this question, only maintainability. Also, I am unsure of how software complexity can be measured, so I am unsure of how to ask this question in a more specific way.


title: Server should accumulate several requests and to retrurn response for all

text: For example I have a server [c#] and 4 clients. When the first client sends a request to the server I want to push a notification to the other 3 clients that they should send a request to the server with some required data. After I receive requests from all clients I want to send the same response to all of them. What is the best way/pattern to implement something like this?


title: What is the main goal of MVVM pattern?

text: Could you tell me what is the goal of the MVVM pattern? What are the arguments or the reasons I can give to a team and product owner to respect and develop according to this pattern? I would like a simple answer. Something in one sentence or one word. Is it for   * maintenance   * security   * testing   * something else?


title: Are Persistence-Ignorant objects able to implement lazy loading?

text: _Persistence Ignorance_ is an application of single responsibility principle, which in practice means that Domain Objects ( **DO** ) shouldn't contain code related to persistence, instead they should only contain domain logic. a) I assume this means that the code which contacts lower layers ( ie persistence layers ) lives outside of the domain model in other classes ( **OC** ) of a business logic layer? b) If my assumption under _a)_ is correct, then **DO** , say `Customer`, never contains methods such as `GetCustomers` or `GetCustomerByID`? c) If my assumptions under _a)_ and _b)_ are correct, and assuming `Customer` domain object uses lazy loading for some of its properties, then at some point `Customer`'s internal logic must contact **OC** , which in turn retrieves deffered data. But if `Customer` needs to contact **OC** to receive deffered data, then we can't really claim that Domain Objects don't contain logic related to persistence?! Thank you **REPLYING TO jkohlhepp** 1) I assume `OrderProvider` and `CustomerProvider` classes are contained within business logic layer? 2) I gather from your reply that my assumptions under _b)_ are correct? 3) > ... I would check to see if some private orders field was populated or if it > was null. If it is null ... But as far as I can tell, as soon as domain code needs to check whether private `order` field was populated, and if it isn't,contacting OrderProvider, we are already violating **PI** principle?!


title: Organising data access for dependency injection

text: In our company we have a relatively long history of database backed applications, but have only just begun experimenting with dependency injection. I am looking for advice about how to convert our existing data access pattern into one more suited for dependency injection. ### Some specific questions: Do you create one access object per table (Given that a table represents an entity collection)? One interface per table? All of these would need the low level Data Access object to be injected, right?   What about if there are dozens of tables, wouldn't that make the composition root into a nightmare? Would you instead have a single interface that defines things like `GetCustomer()`, `GetOrder()`, etc? If I took the example of EntityFramework, then I would have one `Container` that exposes an object for each table, but that container doesn't conform to any interface itself, so doesn't seem like it's compatible with DI. ### What we do now, in case it helps: The way we normally manage data access is through a generic data layer which exposes CRUD/Transaction capabilities and has provider specific subclasses which handle the creation of `IDbConnection`, `IDbCommand`, etc. Actual table access uses `Table` classes that perform the CRUD operations associated with a particular table and accept/return domain objects that the rest of the system deals with. These table classes expose only static methods, and utilise a static `DataAccess` singleton instantiated from a config file.


title: What are your experiences selling on the Android Market? 1 year on

text: Follow up to this question So a lot has changed in the smartphone market in the last year (Specifically Androids market share, OS updates and marketplace updates). Given these changes I think it is appropriate to ask this question again. I would love to quit my job and write Android apps fulltime. :-) Is this yet feasible for the average lone developer? What have volumes been like? (Happy to turn this into a community wiki before all the Grinch's start moaning but looks like I don't have the option)


title: How much storage space do developers really need on work systems?

text: > Not Counting the OS And the requirements to run the Development software. > The storage space required. Strictly speaking from work perspective(company setup and not freelancers).A individual developer ( not considering a build system) unless into areas of video,audio processing( huge raw files) 3d/graphics development. How much storage space would be required.   * Even if we account for the software trials to download or reading material.is it Right or Safe to assume 20GB would most suffice and any thing more would be a waste and or would be improperly utilized?.   * What is the typical hard disk space allotted per developer in an office setup.This may differ per role or specific requirement and on what type of work the company is into. but on an average for a developer/programmer how much space is normally allotted. Edit: **To Clarify Intent** These are questions i had faced by business/management people.I only wish to understand more in this regard to give an answer(or better answer)the next time i come across them. I am neither making assumptions or intend to give offense to any one in this regard.It would be helpful if some links to data online were provided in this regard. Edit 2:   * The issue as i understand was restricting the storage space to only the saving of work files to discourage extraneous usage...    * Not about scrimping/cost saving on hardware.


title: Changes in licence in forked project what are my rights?

text: Hi I'm intrested in using the apparently now defunct app-mdi libray in a flex application for a paying customer. http://sourceforge.net/projects/appmdi/ It appears that the app-mdi project has been forked from flex-mdi and indeed the code has so much in common it would appear almost identical to the origional code. Now in the original source flex-mdi the following licence appears in the source code > /* Copyright (c) 2007 FlexMDI Contributors. See:   >  http://code.google.com/p/flexmdi/wiki/ProjectContributors Permission is > hereby granted, free of charge, to any person obtaining a copy of this > software and associated documentation files (the "Software"), to deal in the > Software without restriction, including without limitation the rights to > use, copy, modify, merge, publish, distribute, sublicense, and/or sell > copies of the Software, and to permit persons to whom the Software is > furnished to do so, subject to the following conditions: The above copyright > notice and this permission notice shall be included in all copies or > substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", > WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED > TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF > CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ However in the app-mdi library on the same file the following licence appears. > Copyright (c) 2010, TRUEAGILE All rights reserved. > > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions are met: > >   * Redistributions of source code must retain the above copyright notice, > this list of conditions and the following disclaimer. >   * Redistributions in binary form must reproduce the above copyright > notice, this list of conditions and the following disclaimer in the > documentation and/or other materials provided with the distribution. >   * Neither the name of the TRUEAGILE nor the names of its contributors may > be used to endorse or promote products derived from this software without > specific prior written permission. > > > THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" > AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE > LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF SUCH DAMAGE. */ Now I've no problem with the licence except for the line. > Redistributions in binary form must reproduce the above copyright notice, > this list of conditions and the following disclaimer in the documentation > and/or other materials provided with the distribution. The copyright notice in its entireity makes no sense in binary material. Specifically talking about redistobutions in the binary form. Finally the question is what exactly has to be shown on web clients who access softare that utilises this library? Also is changing the licence in this manner actually allowed?


title: Anybody using VB with ASP.net MVC?

text: When a .net project use newer technologies like ASP.net MVC or Silverlight, is VB.NET being used? Or it is used just in the legacy projects? What is the situation now?


title: Am I violating LSP if the condition can be checked?

text: This base class for some shapes I have in my game looks like this. Some of the shapes can be resized, some of them can not.                  private Shape shape;              public virtual void SetSizeOfShape(int x, int y)         {             if (CanResize()){                 shape.Width = x;                 shape.Height = y;             }             else {                 throw new Exception("You cannot resize this shape");             }              }         public virtual bool CanResize()         {             return true;         }      In a sub class of a shape that I don't ever want to resize I am overriding the `CanResize()` method so a piece of client code can check before calling the `SetSizeOfShape()` method.                   public override bool CanResize()         {             return false;         }      Here's how it might look in my client code:                   public void DoSomething(Shape s)         {             if(s.CanResize()){                 s.SetSizeOfShape(50, 70);             }         }      Is this violating LSP?


title: Is there a difference between fibers, coroutines and green threads and if that is so what is it?

text: Today I was reading several articles on the Internet about fibers, coroutines and green threads, and it seems like these concepts have very much in common, but there are slight differences, especially when we talk about fibers and coroutines. Is there a concise, correct summary of what makes them different from each other?


title: Implementing Settings/Preferences in JavaScript

text: I am making a simple web app mostly in JavaScript. I was wondering as to how do I deploy settings/preferences? Do I just store user preferences somewhere and make use of if...else... statements all over the code? I think that there must be a better alternative. I am know JS, jQuery & PHP and willing to learn anything new if at all required. I have already made the app, only the settings are remaining. I know what options to give users and how to program them in js. What's the most optimal way? How is it done in professional web apps and software made by companies (I am independent Student Developer - this is my first "BIG" project)? **EDIT:** For all the modifications that the settings are supposed to make (in this particular app), the whole js code base would litterally be filled with many branches of if...else...statements and I think that would make the code a lot harder to read and maintain. In my app, the whole database table to be fetched from the database and the number and types of HTML DOM manipulation to be done, new elements to be added to HTML dom and whether some are visible or not would change. How do I deal with all that?


title: Should I split out synchronization from my class and what's it called?

text: When thinking about testability and modular code, I recently thought about whether I should split out the synchronization part of a class from the actual behavior part. By example: The app "needs" this:               class Mogrifier { // Mogrifier accesses are thread safe     private:       unsigned int m_state;       mutex m_sync;     public:       Mogrifier()       : m_state(0)       { }            unsigned int Mutate() {         lock_guard<mutex> lock(m_sync);         const unsigned int old = m_state;         m_state += 42;         return old;        }            :::     };      Seems simple enough, except that locking and the actual stuff the class does aren't really related. So I though about whether it's a good idea to split this up:               class Mogrifier { // Mogrifier is *not* synchronized     private:       unsigned int m_state;     public:       Mogrifier()       : m_state(0)       { }            unsigned int Mutate() {         const unsigned int old = m_state;         m_state += 42;         return old;        }            :::     };          class SyncedMogrifer {     private:       mutex m_sync;       Mogrifier m_;     public:       unsigned int Mutate() {         lock_guard<mutex> lock(m_sync);         return m_.Mutate();       }     };        * Would you do this?    * Will it help with unit testing?   * I'm awful with Pattern names ... what is it called?   * Is there a simple way to "generate" such a wrapper in C++ for an arbitrary calls?


title: using a wiki for requirements

text: I'm looking into ways of improving requirements management. Currently, we have a Word document published on a Web site. Unfortunately, we cannot (to my knowledge) look at changes from one revision to the next. I would greatly prefer to be able to do so, much like with a wiki or VCS (or both, like the wiki's on bitbucket!). Also, each document describes changes devs are expected to meet by a given deadline. There is no collection of accumulated app features documented anywhere, so it's sometimes hard to distinguish between a bug and a (poorly- designed) feature when trying to make quick fixes to legacy apps. So I had an idea I wanted to get feedback on. What about:   1. Using a wiki so that we can track who changed what when (mostly to even see _if_ any edits were made since the last time one looked).   2. Having one, say, wiki page per product rather than one per deadline, keeping up with all features of the product rather than the changes that should be implemented. This way, I can look at a particular revision of the page to see what the app should do at a given point in time, and I can look at _changes to the page since the last release_ for the requirements to be implemented by the next deadline. Waddayathink?


title: Specific reasons to create own array class over using std::array?

text: What specific conditions or requirements should you create your own array over using `std::array`? Here is my background: I'm developing a small simple library that a small group of people will use and _hopefully_ build upon. The current structure allows for both `std::vector` and `std::array` using `iterators`, however, a lot of the people do not like and cannot seem to use `std::array` and find the notation confusing to work with the library. I have attempted to make my library work for better for `std::array` however, it dawned on me that maybe I should provide my own and adding in the functionality needed? For example: `library::array<int, 2> myArray; myArray.fill(1, 100);` and I thought it would be a good project in order for me to develop my skills, particularly in `templates` and other `sorting` algorithms.


title: Onsite Interview : QA Engineer with more Emphasis on Java Skills

text: I'm having a onsite interview for QA engineer with Startup. While phone interview the person said he would want to test my JAVA, JUnit and SQL skills on white board with more importance on Object-oriented skills, So what all can i questions can i expect ? **One more important issue : How do i overcome the fear of White board interview ?. I'm very bad at White board sessions, i get fully tensed. Please suggest me tips to overcome my jinx**


title: Can someone help me understand this GPL license

text: I can't understand the last line of this GPL license. > Copyright (C) 2011 Some Name > > This program is free software; you can redistribute it and/or modify it > under the terms of the GNU General Public License as published by the Free > Software Foundation; either version 2 of the License, or (at your option) > any later version. This program is distributed in the hope that it will be > useful, but WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General > Public License for more details. > > You should have received a copy of the GNU General Public License along with > this program; if not, write to the Free Software Foundation, Inc., 51 > Franklin St, Fifth Floor, Boston, MA 02110-1301 USA > > Linking SOMEAPP statically or dynamically with other modules is making a > combined work based on SOMEAPP. Thus, the terms and conditions of the GNU > General Public License cover the whole combination. > > **In addition, as a special exception, the copyright holders of SOMEAPP give > you permission to combine a portion of SOMEAPP with other binary code > ("Program") under any license the copyright holders of Program specified, > provided the combined work is produced by SOMEAPP.** I want to know can I use this code in a shareware application.


title: how to map controllers , models, and views as a todo list

text: Before starting on a current project I was wondering if there is a terminology for what I am planning on doing? Basically what I want to do is map out every object in layers such as all the controllers and what they'll be called, the methods that will exist under the controllers and their purpose; Including, the models that the methods will be interacting with and the views that will be displayed based on certain actions. This way I've created a detailed to-do list and can catch any duplicates and make them as one call. I've heard of something called doctrine but I'm not sure if it will be what im looking for since i dont know how to use it but have heard of it having to do with documentation.


title: Are there presently any standardized "grammar" rules for HTML & CSS?

text: Over the years I have assigned values to classes and html elements in all sorts of ways:   * myClass   * MyClass   * my_class   * my-class . . .and so on. As I am always trying to hone my craft and make my code more readable for others, I am going to discipline myself to stick to one convention moving forward. I am leaning towards all lower case and hyphenated, but that is a purely subjective choice. So I wanted the input of the SE community--is there a standard or recommended convention already in place? Thanks!


title: What's a propeller-head coder?

text: What's a propeller-head coder?


title: Leaving for the desert soon, need suggestions

text: I just got the news that I'm (finally) getting to spend the next few months in Afghanistan with my fellow AF maintainers, and I was hoping to get some suggestions of good offline content to learn from. I've got a few textbooks from ck12.org, downloaded the offline versions of the MSDN docs for VCS Express 2010, but I would love to have something more general to learn from, maybe that covers data structures and algorithms (specific to C# would be awesome. Oh, and if anyone knows of any good offline WPA tutorials that would be even better.


title: Using GPL licensed jQuery scripts on website with ads

text: I'm making a web application that will generate revenue from displaying ads. The system is meant for me to run and not sold/distributed to anyone else. My questions are:   * Can I use GPL licensed jQuery scripts on the website?   * Can I use GPL licensed scripts while generating ad revenue from the page?   * Do I need to provide my sites source to everyone if I use GPL licensed scripts?


title: Is it better to save output from command in memory and store later or save in a temporary file and then move to final location?

text: I hope this is not off topic. I have to save output from a command to file, but only if length of this output is positive. I've thought about two solutions:   * save output to a python variable, check length, if positive save to destination file;   * save output to a temporary file, check length, if positive rename to destination file. Is there any best practice for this little problem, or which one usually performs better between my proposed solutions? Typical configuration:   * file length is usually 1KB   * we are not using ssds, usually 7200rpm hard disk   * average RAM is usually 10-20 GB    * I don't know if filesystem is important, anyway ext3 I know this is a bit unclear, but I was hoping there was some best practice to apply in this case. Thanks


title: Should I blog about specifically about programming in English or in my native language?

text: I had a blog which was written in my native language, but now I'm wondering if I should switch to english because of a wider audience given that the technical field's default language is English. For sure, I want to share my knowledge, but at the meantime I'd like to get hired or be recognized from my peers. Reputation can be important and it can help in making my professional network larger. Do you have any feedback? Btw, my native language is french if that matters.


title: Feature branches, beta branches, and scrapped features

text: I've been thinking a lot about best practices regarding branching in distributed version control systems such as git an mercurial (the two dvcs's I have experience with and use on a daily basis). The way I've been doing it is slightly different in each of these, but generally follows these guidelines:   * master branch - concurrent with production code   * development branch - concurrent with "beta" code   * feature branches - for feature development Development is done in a feature branch (usually created off of the master branch, so we know we're working with a stable code base), and when dev is completed, reviewed, and developer-tested, it's pushed/merged into the development/beta branch, put out on a beta server, and tested. If all goes well, the feature is approved, and we can merge it into the master/stable branch, stage it, do final testing, and get it into production. If it doesn't go well, though, things break down. If, for instance, a feature is scrapped or just delayed indefinitely, we probably want to remove it from the dev/beta branch. However, since merges from master/stable (hotfixes, content changes, etc.), and other new features have probably been put into the dev branch, it becomes difficult to remove a single feature from that branch. I'm coming to the conclusion that this workflow is just broken, but it seems like it should work. So, specifically:   * Is it possible to remove a particular feature from this type of branch?   * Is this just a broken workflow? And more generally:   * Given long-term development of features, and a need to have a branch concurrent with live, what are the best practices involved in dvcs?


title: Design pattern to dynamically create patterns found in a list of links

text: Can anyone help me think of a way to dynamically generate the patterns section of a tool I am creating? I'm not sure how to store and generate these "patterns" dynamically. What the program does is take a big list of links (100,000), puts them in a database, groups them by domain and then curls a page from each domain looking for backlinks. Here is the database scheme, you can see that the Domains table is were most of the information is stored because we group the URLs together by the domain: http://sqlfiddle.com/#!2/9a4d7 So now we know that some domains are live (and have a backlink) and some are dead (no backlink). This is relatively easy but now for the fun part. I need to derive "patterns" from the live links. For example find a list of all live link domains that have more than 25 links from that domain. So if joesblog.blogspot has 33 pages that link to my domain that matches this pattern. Here is my list of patterns:   * Domains that include a homepage link   * Domains grouped by top level domain (.com, .org etc)   * Domains that returned a 405 header response   * URLs with matching directory structures   * Domains that contain the word _ _ _.   * URLs that contain the word _ _ _ in their path.   * Common anchor text.   * Common title tags.   * Common backlink targets (what page of your site does the link point to). The problem is that the patterns are changing CONSTANTLY. There being moved around, added, edited, removed and anything else you can think of. I really need a to build a content management system of sorts to handle these patterns. But how would I store something this intricate in a database? Has anyone ever delt with a similar problem and how did you solve it? If I could just store whole functions and MySQL statements in the database that would be great (but horrible wrong). (PHP, MySQL, JavaScript / JQuery) DISCLAIMER: This is an internal tool. Please don't ask me why I'm building this or claim that the requirements are wrong. This was designed by my manager and its my task to make it work because I am a developer at the company that needs this tool. Thank you!


title: Decrement operator difference between C++ and Java?

text: Please tell me why the same piece of code behaves differently in C++ and JAVA. **Ok first I implement a function to calculate the factorial of an Int RECURSIVELY** In JAVA:               int f(int x)         {                  if(x==1)return 1;             return(x*f(x-1));         }      System.out.println(f(5)); -----> outputs 120, ok that makes sense. JAVA METHOD 2:               int f(int x)         {                  if(x==1)return 1;             return(x*f(--x));         }      System.out.println(f(5)); -----> outputs 120, ok that makes sense too. But here is a twist in C++: C++ METHOD 1:               int f(int x)     {         if(x==1)return 1;         return (x*f(x-1));          }      cout << f(5) ; -----> outputs 120, ok now keep reading! C++ METHOD 2:               int f(int x)     {         if(x==1)return 1;         return (x*f(--x));          }      cout << f(5) ; -----> outputs 24. This is surprising. But Why?? I have tried tracing this multiple times and have failed. It makes sense in java because each recursive call gets its own piece of memory and pre decrement operator -- will decrease and yield the decreased value. Why does it work as expected in JAVA but not In C++?


title: Understand how the TLB (Translation Lookaside buffer) works and interacts with pagetable and addresses

text: So I am trying to understand this TLB (Translation Lookaside Buffer). But I am having a hard time grasping it. in context of having two streams of addresses, tlb and pagetable. I don't understand the association of the TLB to the streamed addresses/tags and page tables.               a.  4669, 2227, 13916, 34587, 48870, 12608, 49225     b.  12948, 49419, 46814, 13975, 40004, 12707                    TLB     Valid   Tag Physical Page Number     1   11  12     1   7   4     1   3   6     0   4   9                    Page Table     Valid   Physical Page or in Disk     1   5     0   Disk     0   Disk     1   6     1   9     1   11     0   Disk     1   4     0   Disk     0   Disk     1   3     1   12      How does the TLB work with the pagetable and addresses? The homework question given is: Given the address stream in the table, and the initial TLB and page table states shown above, show the final state of the system also list for each reference if it is a hit in the TLB, a hit in the page table or a page fault. But I think first i just need to know how does the TLB work with these other elements and how to determine things. How do I even start to answer this question?


title: Should we use an outside CMS?

text: I work at a web design/development shop. Everything we do is centered around the Joomla! CMS. I'm a bit worried-if anything goes wrong with Joomla (major security flaw revealed, Joomla folds and ceases development) we're sunk. I'm meeting with the CEO to plan the next few steps for our company. Should I recommend that we create our own in-house CMS or am I just being paranoid about a single point of failure?


title: What does a typical programming journal entry consist of?

text: I read that a lot of people seem to favor the journal, or diary, form to keep notes on their work related activities. I've had a more structured approach myself, which involves outlines and categorization.   While this has its advantages for information retrieval, I find it can become an hindrance when it comes to entries of a broad, subjective or reflective nature. I've been thinking about using a more diary-like format for this purpose, but since I've never held one before, I wonder about what sort of information it would contain. Can anyone give an example of their typical journal/diary entry's content ?   What do you keep notes of, and how do you structure it ?


title: Why appending to a list in Scala should have O(n) time complexity?

text: I am learning Scala at the moment and I just read that the execution time of the append operation for a list (:+) grows linearly with the size of the list. Appending to a list seems like a pretty common operation. Why should the idiomatic way to do this be prepending the components and then reversing the list? It can't also be a design failure as implementation could be changed at any point. From my point of view, both prepending and appending should be O(1). Is there any legitimate reason for this?


title: Matching users based on a series of questions

text: I'm trying to figure out a way to match users based on specific personality traits. Each trait will have its own category. I figure in my user table I'll add a column for each category:               id    name    cat1    cat2    cat3     1     Sean    ?       ?       ?     2     Other   ?       ?       ?      Let's say I ask each user 3 questions in each category. For each question, you can answer one of the following: `No, Maybe, Yes` How would I calculate one number based off the answers in those 3 questions that would hold a value I can compare other users to? I was thinking having some sort of weight. Like:               No    -> 0     Maybe -> 1     Yes   -> 2      Then doing some sort of meaningful calculation. I want to end up with something like this so I can query the users and find who matches close:               id    name    cat1    cat2    cat3     1     Sean    4       5       1     2     Other   1       2       5      In the situation above, the users don't really match. I'd want to match with someone with a +1 or -1 of my score in each category. I'm not a math guy so I'm just looking for some ideas to get me started.


title: Working with Git on multiple machines

text: This may sound a bit strange, but I'm wondering about a good way to work in Git from multiple machines networked together in some way. It looks to me like I have two options, and I can see benefits on both sides:   * Use git itself for sharing, each machine has its own repo and you have to fetch between them.      * You can work on either machine even if the other is offline. This by itself is pretty big I think.   * Use one repo that is shared over the network between machines.      * No need to do git pulls every time you switch machines, since your code is always up to date.     * Never worry that you forgot to push code from your other non-hosting machine, which is now out of reach, since you were working off a fileshare on this machine. My intuition says that everyone generally goes with the first option. But the downside I see is that you might not always be able to access code from your other machines, and I certainly don't want to push all my WIP branches to github at the end of every day. I also don't want to have to leave my computers on all the time so I can fetch from them directly. Lastly a minor point is that all the git commands to keep multiple branches up to date can get tedious. Is there a third handle on this situation? Maybe some third party tools are available that help make this process easier? If you deal with this situation regularly, what do you suggest?


title: Developing an analytics's system processing large amounts of data - where to start

text: Imagine you're writing some sort of Web Analytics system - you're recording raw page hits along with some extra things like tagging cookies etc and then producing stats such as   * Which pages got most traffic over a time period   * Which referers sent most traffic   * Goals completed (goal being a view of a particular page)   * And more advanced things like which referers sent the most number of vistors who later hit a goal. The naieve way of approaching this would be to throw it in a relational database and run queries over it - but that won't scale. You could pre-calculate everything (have a queue of incoming 'hits' and use to update report tables) - but what if you later change a goal - how could you efficiently re-calculate just the data that would be effected. Obviously this has been done before ;) so any tips on where to start, methods & examples, architecture, technologies etc.


title: Rendering design. How can I effectively deal with forward, deferred and transparent rendering?

text: I have many objects in my game world that all derive from one base class. Each object will have different materials and will therefore be required to be drawn using various rendering techniques. I currently use the following order for rendering my objects.   * Deferred   * Forward   * Transparent (order independent) Each object has a rendering flag that denotes which one of the above methods should be used. The list of base objects in the scene are then iterated through and added to separate lists of deferred, forward or transparent objects based on their rendering flag value. The individual lists are then iterated through and drawn using the order above. Each list is cleared at the end of the frame. This methods works fairly well but it requires different draw methods for each material type. For example each object will require the following methods in order to be compatible with the possible flag settings.               object.DrawDeferred()     object.DrawForward()     object.DrawTransparent()      It is also hard to see where methods outside of materials, such as rendering shadow maps, would fit using this "flag & method" design.               object.DrawShadow()      I was hoping that someone may have some suggestions for improving this rendering process, possibly making it more generic and less verbose?


title: What can Haskell's type system do that Java's can't and vice versa?

text: I was talking to a friend about the differences between the type systems of Haskell and Java. He asked me what Haskell's could do that Java's couldn't, and I realized that I didn't know. After thinking for a while, I came up with a very short list of minor differences. Not being heavy into type theory, I'm left wondering whether they're formally equivalent. To try and keep this from becoming a subjective question, I'm asking: what are the major, non-syntactical differences between their type systems? I realize some things are easier/harder in one than in the other, and I'm not interested in talking about those. And to make it more specific, let's ignore Haskell type extensions since there's so many out there that do all kinds of crazy/cool stuff.


title: Best github repository layout for snippets in multiple programming languages

text: I have to create a github-presence for an open-source organization. The aim is to distribute _code snippets_ and _reference implementations_ in **different** programming languages. These contributions are going to be (ideally) created by people outside of the organization and should be collected. I know that good practice is to create **one repository per project**. To this end, each implementation (in a specific programming language) should be considered a standalone project and should get its own repository. The point is that this approach makes hard for external people to contribute, because github pull-requests can only be made against existing repositories. By creating a **single repository** with a subdirectory per programming language code contribution becomes easier, but I'm afraid that some IDEs may complain about the directory layout. I'd like to know whether someone already solved this very specific problem in a satisfactory way.


title: Need Advice on PHP Search Functionality

text: I'm coding a Linux/PHP site for an organization. The site has two views, activated by a login $_SESSION variable indicating whether one is logged in as a member or not. I need to provide search functionality for both the public and for members. The members area is private. Note that Google Custom Search can't be used here in that case. Does anyone have any recommendations on F/OSS scripts (or perhaps cheap scripts I can purchase) that would provide this functionality with two separate indices, one public and one private, and which would provide paginated results and a keyword search form? Otherwise, I guess I'll have to code one myself. I'm trying to save time, and therefore keep more money in my pocket. P.S. Note I can't ask this on StackOverflow because they want programmer questions there. This isn't a "how do I code this?" question, but "what F/OSS scripts or cheap sitescripts would solve this problem?" type of question. Note also that this won't help me either. I mean, look at the answers of that question.


title: simple 'defrag' logic that minimizes changes?

text: edit: so clearly I didn't explain this well, so let me try again with examples. I have a 'pipe' of a given size with signals routed through it at given offsets. The pipe can get fragmented with signals in different offsets making it impossible to fit a new signal. I want an algorithm that will tell me how to arrange the signals to defragment the pipe; but with a minimal number of signals actually being moved! So for the example.. Say I have a pipe of size 16. It has the following signals with the sizes and offsets described.               offset 0: A (size of 4; fills slots 0-3)     offset 5: C (size of 2, fills slot 5-6)     offset 8: B (size of 4, fills 8-11)     offset 14: D (size 2, fills 14-15)          Pipe: AAAA_CC_BBBB__DD      In this case I have 1 slot open at offsets 4 & 7, and two at offset 12-13. Now lets say I want to add a size 4 signal to this pipe. There is no continuous space for it now, but I know I have enough space for it if I defragment. The 'obvious' solution is to group all the signals together at the 'top' like this:               offset 0:  A (size 4, fills 0-3)     offset 4:  B (size 4, fills 4-7)     offset 8:  C (size 2, fills 8-9)     offset 10: D (size 2, fills 10-11)          Pipe: AAAABBBBCCDD____      this leaves slots 12-15 free for my new signal. However, to do this I repositioned 3 signals(B-D). For each signal I moved I have to send commands down to hardware and wait for a non-trivial amount of time. If I was smarter I could realize there is another approch. I could reposition like this:               offset 0:  A(size 4, fills 0-3)     offset 8:  B(size 4, fills 8-11)     offset 12: C(size 2, fills 12-13)     offset 14: D(size 2, fills 14-15).          Pipe: AAAA____BBBBCCDD      I can now fit my new signal in offsets 4-7; AND I only had to reposition one signal(B). Thus saving on hardware calls. I'm wondering if there is a good algorithm to detect sitations like this; where I can 'fit' a signal onto a pipe with the minimum number of signals moved. The aproch thta comes to mind is an N! algorithm; which basically amounst to "generate every possible distribution, calculate how many moves it resulted in". I'm loking for a faster approch. The approch does _not_ have to be 100% perfect, I'm looking primarily to minimize the average case, so long as the worst case isn't made too horrendous. I know that I will never have more then 255 signals on a given pipe; so I may be able to 'get away' with N! as bad as that sounds. I also know each signal's size is a power of 2, as is the pipe size. also, are there any briliant algorithms for placing of signals that minimize fragmentation? * * * Question answered; see below. I wanted to expain on the answer slightly to better explain how defragmentation would occure for anyone reading; buddy does explan it I wanted to point out a simpler approch to conceptualize and explain the defraging part in more detail since that was the original question. I'm explaining my approch, which is a slightly different/simpler approch but effectively keeps the 'buddy' concept. I'm not precomputing blocks or labeling them, this is too much effort to implement and maintain. For me the CPU cost of calculating where a signal will go is pretty trivial compared to actual placing/deletion of signals; so I can afford to lose a tiny, linear, amount of CPU by not pre-computing to simplfy my logic. So the process is: for insertion: All signals are kept in signal boundaries equal to the signal size, so a signal will start on offset where offest % signalsize=0. For actuall offset we walk through and figure out intervals that keep this boundry. So if my signal is size 4 on a 16 size pipe I'll look at intervals 0-4, 5-7, 8-11, 12-15. For each interval check if all space in that interval is free. In the simple case we have a interval with no signals in it and we just put the signal at that interval. Important, we look at the intervals in order and place our signal in _the first free_ interval, this ensure we break the smallest possible 'block' (using buddy terms) when we add our signal. This should be equivlent to the buddy approch described by im3l96; except without precomputation of blocks. if no interval is completely free we have to defrag. For this we find the the signal with the most unused slots. If multuple intervals have the same number of slots unused select the first interval. We then find the largest signal in this interval and recursively call same insert algorithm for the smaller signal (except mark the interval we selcted to insert our first signal as unavailable somehow). This moves the signal to somewhere else that it will fit. We then find the next smallest signal in our selected interval and do the same until we moved all signals. Worst case of 2^n-1 signals moved; where N is the number of potential signal sizes <=our signal (assuming signals are multuple of 2 then N=log2(signalSize)). Here is an example. * stands for a slot marked as unavailable when we recursively call this method (ie the interval that the calling method wanted to place it's signal in, and thus doesn't want the recursive call to try to place a signal into) Here is an exaple, simplest case I could come up with that still demonstrates full complexity. Note: the following structure would be hard to create, but _could_ result from the buddy approch if someone tried very very hard.               FFFFFFFF__AA_B__EEEE_HGGCC_DII_J      Someone passes in a signal Z of size 8 we select offset 8: defragInsert(z, size 8)               effective structure: FFFFFFFF__AA_B__EEEE_HGGCC_DII_J          placing signal in interval: __AA_B__      defragInput(A, size 2)               effective structure: FFFFFFFF********EEEE_HGGCC_DII_J     place signal in interval (offset 20)  _H      defragInput(H, size1)               effective structure: FFFFFFFF********EEEE**GGCC_DII_J     place signal between C & D      return defragInput(H, size1)               effective structure: FFFFFFFF********EEEE__GGCCHDII_J     place H at offset 20 now that it's open      return defragInput(A, size 2) effective structure: FFFFFFFF_ ___ _B__EEEEAAGGCCHDII_J move B now... defragInput(B, size1) effective structure: FFFFFFFF* ****** *EEEEAAGGCCHDII_J place B between I & J return defragInput(B, size1) effective structure: FFFFFFFF_ **__** _EEEEAAGGCCHDIIBJ add B return defragInsert(z, size 8)               fianl structure: FFFFFFFFzzzzzzzzEEEEAAGGCCHDIIBJ


title: Is there a simple, flat, XML-based query-able data storage solution?

text: I have been in long pursuit of an XML-based query-able data store, and despite continued searches and evaluations, I have yet to find a solution that meets the my needs, which include:   1. Data is wholly contained within XML nodes, in flat text files.   2. There is a "native" - or at least unobtrusive - method with which to perform Create/Read/Update/Delete (CRUD) operations onto the "schema". I would consider access via http, XHR, javascript, PHP, BASH, or PERL to be unobtrusive, dependent on the complexity of the set of dependencies.   3. Server-side file-system reads and writes.   4. A client-side interface element, accessible in any browser without a plug-in. Some extra, preferred (but optional) requirements include:   1. Respond to simple SQL, or similarly syntax queries.   2. Serve the data on a bare bones https server, with no "extra stuff", either via XMLHTTPRequest, HTTP proper, or JSON. A few thoughts: What I'm looking for may be possible via some Java server implementations, but for the sake of this question, please do not suggest that - unless it meets ALL the requirements. Java, especially on the client-side is not really an option, nor is it appealing from a development viewpoint.* I know walking the filesystem is a stretch, and I've heard it's possible with XPATH or XSLT, but as far as I know, that's not ready for primetime, nor even yet a recommendation. However the ability to recursively traverse the filesystem is needed for such a system to be of useful facility. At this point, I have basically implemented what I described via, of all things, CGI and Bash, but there has to be an easier way. Thoughts?


title: Duplication in parallel inheritance hierarchies

text: Using an OO language with static typing (like Java), what are good ways to represent the following model invariant without large amounts of duplication. I have two (actually multiple) flavours of the same structure. Each flavour requires its own (unique to that flavour data) on each of the objects within that structure as well as some shared data. But within each instance of the aggregation only objects of one (the same) flavour are allowed. FooContainer can contain FooSources and FooDestinations and associations between the "Foo" objects BarContainer can contain BarSources and BarDestinations and associations between the "Bar" objects               interface Container()     {        List<? extends Source> sources();        List<? extends Destination> destinations();        List<? extends Associations> associations();     }          interface FooContainer() extends Container     {        List<? extends FooSource> sources();        List<? extends FooDestination> destinations();        List<? extends FooAssociations> associations();     }          interface BarContainer() extends Container     {        List<? extends BarSource> sources();        List<? extends BarDestination> destinations();        List<? extends BarAssociations> associations();     }          interface Source     {        String getSourceDetail1();     }          interface FooSource extends Source     {        String getSourceDetail2();     }          interface BarSource extends Source     {        String getSourceDetail3();     }          interface Destination     {        String getDestinationDetail1();     }          interface FooDestination extends Destination     {        String getDestinationDetail2();     }          interface BarDestination extends Destination     {        String getDestinationDetail3();     }          interface Association     {        Source getSource();        Destination getDestination();     }          interface FooAssociation extends Association     {        FooSource getSource();        FooDestination getDestination();        String getFooAssociationDetail();     }          interface BarAssociation extends Association     {        BarSource getSource();        BarDestination getDestination();        String getBarAssociationDetail();     }


title: Resources for writing a parser combinator library

text: I often use parser combinator libraries, but I've never written one. What are good resources for getting started? In case it matters, I'm using Julia, a functional (but not lazy) language.


title: With a small development team, how do you organize second-level support?

text: Say, you have a team of 5 developers and your inhouse customers demand a reasonable support availability of say 5 days a week, 9am-6pm. I can imagine the following scenarios:   * **the customers approach the same guy** , every time. Downside: single point of failure, if the guy is unavailable.   * **each developer is assigned one week of support duty**. Downside: how to you distribute the work evenly in times of planned (vacation) and unplanned (sickness) unavailability?   * **each developer is assigned one day of support duty**. Downside: similar to above, but not as bad.   * a **randomly picked developer handles the support request**. Downside: maybe not fair, see above. What is your experience?


title: Why rails use yaml to config database instead of plain ruby code?

text: Most of configuration files in ruby such as Gemfile, gemspec, are just ruby code itself. Why database configuration file in rails is the exception?


title: Why the recent shift to removing/omitting semicolons from Javascript?

text: It seems to be fashionable recently to omit semicolons from Javascript. There was a blog post a few years ago emphasising that in Javascript, semicolons are optional and the gist of the post seemed to be that you shouldn't bother with them because they're unnecessary. The post, widely cited, doesn't give any compelling reasons _not_ to use them, just that leaving them out has few side- effects. Even GitHub has jumped on the no-semicolon bandwagon, requiring their omission in any internally-developed code, and a recent commit to the zepto.js project by its maintainer has removed all semicolons from the codebase. His chief justifications were:   * it's a matter of preference for his team;   * less typing Are there other good reasons to leave them out? Frankly I can see no reason to omit them, and certainly no reason to go back over code to erase them. It also goes against (years of) recommended practice, which I don't really buy the "cargo cult" argument for. So, why all the recent semicolon-hate? Is there a shortage looming? Or is this just the latest Javascript fad?


title: Why did Microsoft dropped the RESX model for RESW in Windows Store applications?

text: Why did Microsoft choose to change the resources management system from .NET's RESX files? RESX had useful code generation, providing developers auto-completion for resources names and outputting IMHO very readable code. The new RESW format is as far as I know, the same bare XML files, but without any code generation, forcing developers to write more code, and depriving them of compile time error detection.


title: Learning path for web developer .NET or Java

text: I am interested to know how many real world web application servers are hosted by windows? I am going to learn C# and ASP.NET and want to convert my self from an embedded developer to a web app developer. My friends told me that there are ways more Linux based servers than windows servers. He also mentioned the Java skills stack is much more useful than .NET in the world of web application. My experience of Java and C# are rougly the same. I am an experienced C++ developer though. Can anyone give me some suggestion about it? Many thanks


title: Programming Test

text: > **Possible Duplicate:**   >  Good interview programming projects We are looking to hire some more Java developers onto our team, and plan to test their coding abilities with a test. We currently use a web-based Java test that automatically compiles and runs the code, but it is very flaky and we're having problems with our candidates losing their work on this site. Not only is this frustrating for everyone, it makes us look like we don't know what we're doing. Is there a popular testing suite out there? What do you use? I'm **not** interested in dogmatic arguments on whether or not I should be testing my candidates in this way, I'm looking for a tool that will help me do it.


title: Design for using your own API

text: So I'm planning to use APIs for my host app. But the APIs are built such that it requires a sessionkey for every request. So my question is, how would I dogfood my API? Cause, apparently I'm thinking in the line of creating a "special" key for my host app (cause it makes no sense to request for a key for my own use), but, anyone inspecting the headers of the request could find this key and literally use it and bypass requesting their own keys. Maybe there's a best practice for dogfooding our own API without a special key or someway to differentiate whether the request is coming from the host app or the public. I couldn't use IP to differentiate too, cause the public could be using the same server to call the APIs. That's just the way it is, and is a one of the constraints to keep in mind.


title: C++ Commitee Members?

text: I have been searching the web for information regarding what people (and their backgrounds) are in the C++ commitee. However, to my surprise I have not found any such information. Where can I find information about the C++ commitee members?


title: How to manage large scale project in node.js keeping everything Asynchronous?

text: I have a large module which have to process more than 10k request/ response per second. Every request has a json and need to process it and verify it on the database and generate the response on the basis of the db query. Here is an example                Function 1           function  ('/get' , fucntion (req1 , res1 , next ){            //to process the req data        processData(req1 , res1 );           });                Function 2               processData(req1 , res1 ){                var J = JSON.parse (req1.body)          //it has to read db three times           //process the json build the response and return                      condtionCheck(J , res1){                              var a = someVlaue(){                         //select a value from a collection set of nosql which have                          //more than 1000 document and                          //i have to itrate a for loop to check the condition .....etc                          //...........                                }                         ........                                dataRead(var a , res1){                  // is it possible to send response for the req1 object here                              res1.send({value b: abcd123})                         }                        }                }               Function 3 ..... and so on       The major problem is all the code i have written inside the process data is synchronous. Bacaue each code depends upon the previous call back and there are so many condition check are used in several times. So It is good to put such a large processing in synchronous way inside node ? If i write the code using async some times all scenario got in a deadlock condition How to avoid such behavior? Does async or function like step have affect on performance ? On such a series of function how can we reduce latency ?


title: Why should CS teachers stop teaching applets?

text: Why should CS teachers **stop** teaching Java applets? As a veteran of applets and forums, I think it is high time to make a call that teachers should stop teaching applets in general, & especially AWT based applets. Applets are an advanced and specialized type of app. that has little place in the real world around us (most things that are done by applets can instead be better achieved using Javascript and HTML 5).


title: How to program something with the expectation that it will work the first time?

text: I had a friend in college who programmed something that worked the first time, that was pretty amazing. But as for me, I just fire up the debugger as soon as I finally get whatever I'm working on to compile - saves me time (kidding of course, I sometimes hold out a little bit of hope or use a lot of premeditated debug strings). What's the best way to approach the Dijkstrain ideal for our programs? -or- Is this just some sort of pie-in-the-sky old fools quest for greatness applicable only to finite tasks that no one should hope for in our professional lives because programming is just too complex?


title: What HR policies prevent you from finding skillful programmers?

text: During our interview process we give the candidate a programming test as well as a programming design problem. Our HR department has told us to stop administering the programming test due to legal concerns. This would really hinder our ability to screen candidates. Are there other HR policies that prevent you from hiring capable programmers?


title: How does a stack VM manage with only one stack?

text: Lately I've been asking a lot of questions here about VMs. Here's another one: I understand that often stack based VMs use only one stack - the call stack - for everything. E.g. it is also used for evaluation of arithmetic expressions. What I don't understand is, how doesn't this complicate things a whole lot? I'll demonstrate what I mean with an example. Please consider the following psuedocode program:               func main:         funcA()          func funcA:         2 + 4 * 8      This would compile to the following bytecode:               main:     call funcA     end     funcA:     push 2     push 4     push 8     mult     add     end      (In this bytecode, the program starts at `main:`. `call` pushes the program counter onto the stack and jumps to the specified label. When an `end` is reached, the top of the stack - assumed to be a line number - is popped and we jump there.) So let's see what happens here: In `call funcA`, we push the program counter (i.e. next line number) onto the stack. Then we jump to `funcA`. In `funcA` some computation is made. After the computation, the number `34` is left at the top of the stack. When we reach `end`, we pop the top of the stack, assuming it's the line number we should return to But it isn't, the line number to return to is buried underneath. How should `end` know about this? To avoid all this mess, we can just have a separate data stack and call stack, and not mix the two. So my question is: why do some VMs (such as the JVM) use one stack for everything, and when the do: how do they handle situations such as the one described above?


title: Open Source-Only license

text: I want to know if a license exists that is similar to GPL but allows only source distribution (that is no binary distribution). Why do I want this? The idea is that I want fellow programmers to be able to have the benefits of open source software BUT also retain control over the consumer binary distribution. Specifically I want to prevent my software to be picked by organazations like the linux distributors. I want the users of my software to dowlnload binaries only from my site. Is this possible? Thanks


title: Silverlight support from Microsoft

text: I heard Silverlight will not be supported any more by Microsoft. It is true? If so, could anyone share with me Microsoft announcement? And if there are already application developed by Silverlight, what is the new technology to migration to? thanks in advance, Lin


title: Should you hard code your data across all unit tests?

text: Most unit testing tutorials/examples out there usually involve defining the data to be tested for each individual test. I guess this is part of the "everything should be tested in isolation" theory. However I've found that when dealing with multi tier applications with a lot of DI, the code required for setting up each test gets very long winded. Instead I've built a number of testbase classes which I can now inherit which has a lot of test scaffolding pre-built. As part of this, I'm also building fake datasets which represent the DB of a running application, albeit with usually only one or two rows in each "table". Is it an accepted practice to predefine, if not all, then the majority of the test data across all the unit tests? **Update** From the comments below it does feel like I'm doing more integration than unit testing. My current project is .net MVC, using Unit of Work over EF Code First, and Moq for testing. I've mocked the UoW, and the repositories, but I'm using the real business logic classes, and testing the controller actions. The tests will often check that the UoW has been committed, e.g:               [TestClass]     public class SetupControllerTests : SetupControllerTestBase {       [TestMethod]       public void UserInvite_ExistingUser_DoesntInsertNewUser() {         // Arrange         var model = new Mandy.App.Models.Setup.UserInvite() {           Email = userData.First().Email         };              // Act         setupController.UserInvite(model);              // Assert         mockUserSet.Verify(m => m.Add(It.IsAny<UserProfile>()), Times.Never);         mockUnitOfWork.Verify(m => m.Commit(), Times.Once);       }     }      `SetupControllerTestBase` is building the mock UoW, and instantiating the `userLogic`. A lot of the tests require having an existing user or product in the database, so I've pre-populated what the mock UoW returns, in this example `userData`, which is just an `IList<User>` with a single user record.


title: Does the pattern of passing in one object instead of many parameters to a constructor have a name?

text: If you have a constructor that takes a lot of parameters, like this:                 public OrgUnitsHalRepresentation(List<OrgUnitSummaryHalRepresentation> orgUnitSummaryHalRepresentationList,       int count, int providedCount, int total, int page, int filterLimit, boolean hasNextPage, boolean isDefaultCount)      You can use a separate class that takes nothing in the constructor and set these parameters using setters and pass in this into the constructor instead:               public OrgUnitsHalRepresentation(Pagination(Name of pattern) p)      Does this have a name so that I can use it in my class name?


title: Collocation in Code

text: Quite some time ago I remember reading an article from 'Joel on Software' that mentioned collocation of information in code was important. By collocation, I mean that relevant information about the code is present when the code is. I'm currently writing an article that has a small bit in it about collocation so I went searching for sources and found the quote in the article 'Making Wrong Code Look Wrong' > In order to make code really, really robust, when you code-review it, you > need to have coding conventions that allow collocation. In other words, the > more information about what code is doing is located right in front of your > eyes, the better a job you’ll do at finding the mistakes. When you have code > that says For me, collocation isn't just about the code itself, but the tool used to view the code. If it can help with the 'collocation factor' (term coined by me?) I believe it can help with the programmers productivity. Take for example the modern IDEs that show you the variables type by hovering over it. **Are their any other articles written about collocation in code and/or are their other terms that this is known by?**


title: Any empirical research comparing IT project failure rates to other domains?

text: IT projects are legendary for high failure rates, cost overruns, and schedule overruns. Hence the motivations for questions like this. Is there any actual empirical research that compares the failure rates of IT projects to those in other domains, in particular to engineering domains? For example, has anybody compared cost and schedule overruns in IT projects to construction projects of comparable scope? There should be publicly available data here from government projects, but I'm not aware of anybody who's gone and done comparisons.


title: Is it possible to use RubyGnome2's/QtRuby's HTML renderers to make UI for a Ruby script?

text: I'd like to make a graphical user interface for my script, instead of running it from the console. I'm aware there's a wealth of UI libraries for Ruby, but I'm quite familiar with HTML and CSS and I'd like to use them for building an interface. So the question is: Is it possible to use a HTML rendering library to make such an UI? From what I understand, it's relatively easy to put in a HTML rendered view of something, but is it possible to communicate back with the script? Like when I push that big red button, it actually tells the script to act on it? Obviously it's possible if the script run on the server side, but I'd like to run it as a desktop application.


title: Why would programmers ignore ISO standards?

text: One of the things I run into often is problems caused by programs which don't conform to ISO standardss. One example would be not using the ISO country tables but making up their own shorthands, which goes okay for the United States (US), or the Netherlands (NL) but goes spectacularly wrong for the United Kingdom (GB, not UK) or Spain (ES, not SP) and a lot of other countries. As another example, internal date notations. Why would anyone store a date as 01/02/2014 ever? It is completely unclear whether that is 1st February or January 2nd, whereas if you use the ISO standard you just store 2014-02-01* and it's unambiguously February 1st. My question: When and why should a programmer make up their own constructs when there is an ISO standard available? * Store 2014-02-01, and format the date accordingly when showing it to an end user.


title: Why use Pascal with Cocoa/Cocoa Touch?

text: I'm surprised to find that it might be possible to use Pascal with the Cocoa and Cocoa Touch frameworks. This is an interesting turn of events, as Pascal was the favored language for Mac development for a short while early in the history of Macintosh. It looks like someone has gone to a lot of trouble to make Pascal work with Objective-C frameworks like Cocoa and Cocoa Touch, but I'm not sure I see the point. Is this mainly a refuge for Pascal developers coming from other development environments like Delphi, or are there compelling reasons to use Pascal in place of Objective-C or other languages. I don't mean to ask which language is "better." I'm just wondering if there's a reason beyond language preference that one would choose to use Pascal for MacOS X or iOS development.


title: How would you create a mobile (android) offline wiki site?

text: My apologies in advance if this is not a good forum for this question; pointers to others happily accepted. On the off chance it matters, I'm not going to commercialize this idea or anything; if anything in here is interesting to you, use it as you see fit. My basic problem is this: My favorite place to do non-code writing (essays, fiction, etc) is on my Android phone when I'm traveling. Said traveling often causes the phone to lose all signal/web connection. I would like a system that auto-syncs with the phone in some fashion, can be written in a fairly wiki-ish style (i.e. links are supported but I don't have to actually type out also be edited easily at a regular computer when needed. I'd prefer the editing on the phone be as close to plain text as possible, because fine manipulation like that required to set something to bold or whatever is a pain; I'd rather just be able to type things out. Nice-to-have is the ability for other people to collaborate on documents. Very-nice-to-have is authentication so that some documents can be private, without having to get into the auth quagmire myself. There really doesn't seem to be any such thing out there. The two options I've thought of for implementing this:   1. Now that there exists a proper 2-way sync dropbox app ( https://play.google.com/store/apps/details?id=com.ttxapps.dropsync ), I could just use a plain-text editor on the phone and have a simple web app that presents the text via a wiki markup library of some kind out of the relevant dropbox folder. Advantages: Dead simple. Disadvantages: No easy auth or collaboration.   2. I could use Google Docs, and have a not-so-simple Web app that pulls documents from there, treats them as wiki text, maybe does some cashing, and presents them as a coherent-ish web site(s). Advantages: If I can get the auth to pass through properly, auth and collaboration are free. Disadvantages: Much more complex, and this is just a one-off personal project. I'm curious as to whether I've missed anything, any other easier ways to solve this problem. I'm actually a little surprised that no-one seems to have thought of backing a wiki on Google Docs; there's the Google app wiki stuff, but that pretty much requires a browser AFAICT, whereas there are several Google Doc apps on pretty much everything with offline sync options.


title: Given an idea for an application, how should I decide which web technologies to use?

text: Background: I'm an experienced Java developer, know basic Javascript, HTML, and CSS (and find it easy to figure out how to do something), and have a little experience in Python. I've seen Ruby before and edited a few lines of existing scripts. I'm curious not so much about any given technology, but mainly about what my thought process should be when deciding which technologies to use. Let's take a simple application - maybe an online address book where I can enter contact information, and create groups of contacts. How should I go about evaluating the options that are out there? The number of frameworks out there is daunting to say the least. This should be a learning experience for me, but also I want the knowledge that I gain to be relevant, and I'm afraid of using something that I'll never use again.


title: Is it justifiable for a prospective employer to ask you to make a decision without full information?

text: ## The Story I am currently in the process of finding a new job. Several days ago I had two interviews with prospective employers, both of which expressed interest for a second meeting.   * Company A asked me to come over to talk today. There was no further interview, they simply made me an offer and explained terms.   * Company B has scheduled me for a hands-on evaluation tomorrow, after which I will know their final answer within a week. I am fully confident they will also make me an offer and moreover that it will be financially preferable to that of Company A. Since Company A offered first, I told them that I cannot evaluate their offer before Company B also let me know of their decision. This did not sit well with the person I was talking with (the COO). Here are his two main objections and the gist of my answers:   * _"We do not want to be anyone's second best option"_ I explained that in fact they were my first option, in that all other things being equal I would prefer to work for them. In addition, since the meeting was chronologically first there was really no way for me to be honest with them without letting them know; so this is not a matter of being my second option but rather of me being level at the negotiating table.   * _"We cannot wait for you to make up your mind"_ I explained that as they surely understand, making a decision without evaluating all alternatives would be me acting against my own best interest. In addition, the skill and modus operandi of evaluating before deciding is definitely something they will expect of me on the job (and something that factored into their decision to make an offer). Finally, there is a hard limit on how long they would have to wait for an answer (a week); I also volunteered to tell company B "I would appreciate it if you could inform me of your final decision as soon as possible, since I am also considering another offer". ## The Facts At this point I am fairly certain that Company A just want to intimidate and pressure me into making an uninformed decision. Evidence towards this conclusion include:   * Their playing hardball during the first interview, which was quite intense and slightly uncomfortable. Initially I justified this as a result of their sense of technical excellence, but after this second meeting I have reconsidered. After all, if the reason for their behavior was the bar being too high for me then making me an offer without any other intermediate step would not be logical.   * The first interview being conducted mostly in "senior personnel" mode (they only asked two questions having straight and definite technical answers, which took maybe a minute out of almost two hours total time), but their offer being for a lower-ranked position.   * Their ominous references to how bad the employment situation is right now in Greece where I live; things like "we always pay on time and in euros" (with the obvious suggestion that in case of Greece defaulting they will not be affected because they only do business with customers in the US). This I regard as pure FUD.   * Their insistence that I need to give them an answer by tomorrow at most. I am fairly certain (due to other information I have) that they are not considering any other employee for the same position; rather, for them it's a question of "do we pick this guy up or not?". Also, what kind of employer would agree to sign you up today but turn you down next week? And why would they ask me to behave in a manner that actually gives you away as someone they _wouldn't_ want to hire? It does not make sense. In fairness, I should also mention that these people _look like_ they have achieved a high Joel Test score in an environment where the median score is either zero or one (for using version control). They look like their conduct of everyday operations is dramatically better than most other IT shops around here. And they only work with US customers, which implies they achieve a level of professional standard shall we say, _uncommon_ here in Greece. ## The Moral? Is there any convincing justification of why they would require an answer within two days at most? Especially since I told them I 'm expecting another offer _and_ the _worst_ case scenario is an answer within a week? Or am I correct in reconsidering if I want to work for them at all? Thank you for your valuable input.


title: What is the proper jargon to refer to a variable wrapped inside a function closure?

text: In JavaScript, there is no such thing as a "private" variable. In order to achieve encapsulation and information hiding in JavaScript, I can wrap a variable inside a function closure, like so:               var counter = (function() {             var i = 0;         var fn = {};         fn.increment = function() { i++; };         fn.get = function() { return i; };         return fn;     {)();         counter.increment();     counter.increment();     alert(counter.get()); // alerts '2'      Since I don't call `i` a private variable in JavaScript, what do I call it?


title: Custom Request Templates

text: What kind of information do you require from the project management team before you can proceed on a project? Is there a certain format they utilize on Programming Requests which helps you to understand exactly how the development team can succeed with this project. Example: I always like it when project managers mock up forms. It helps significantly to know how they are visualizing the UI for many tasks. Any suggestions on how we can assist the Project Management team in issuing Programming Requests that are as clear as day will be greatly appreciated. Thanks.


title: Why does the .Net world seem to embrace magic strings instead of staticly typed alternatives?

text: So, I work in .Net. I make open source projects in .Net. One of my biggest problems with it isn't necessariyl with .Net, but with the community and frameworks around it. It seems everywhere that magical naming schemes and strings is treated as the best way to do everything. Bold statement, but look at it: ASP.Net MVC: Hello world route:                       routes.MapRoute(                 "Default",                                              // Route name                 "{controller}/{action}/{id}",                           // URL with parameters                 new { controller = "Home", action = "Index", id = "" }  // Parameter defaults             );      What this means is that ASP.Net MVC will somehow look up `HomeController` in your code. Somehow make a new instance of it, and then call the function `Index` apparently with an `id` parameter of some sort. And then there are other things like:               RenderView("Categories", categories);     ...or..     ViewData["Foobar"]="meh";      And then there are similar things with XAML as well. `DataContext` is treated as an object and you have to hope and pray that it resolves to the type you want. DependencyProperties must use magic strings and magic naming conventions. And things like this:                 MyData myDataObject = new MyData(DateTime.Now);             Binding myBinding = new Binding("MyDataProperty");       myBinding.Source = myDataObject;      Although it relies more on casting and various magical runtime supports. Anyway, I say all that to end up here: Why is this so well tolerated in the .Net world? Aren't we using statically typed languages to almost always know what the type of things are? Why is reflection and type/method/property/whatever names(as strings) prefered so much in comparison to generics and delegates or even code generation? Are there inherit reasons that I'm missing for why ASP.Net's routing syntax relies almost exclusively on reflection to actually resolve how to handle a route? I hate when I change the name of a method or property and suddenly things break, but there don't appear to be any references to that method or property and there are of course no compiler errors. Why was the apparent convenience of magic strings considered "worth it"? I know there are also commonly statically typed alternatives to some things, but they usually take a backseat and seem to never be in tutorials or other beginner material.


title: Proposal for a new position at work

text: I have an idea at work for a new Product Manager position at our office. I work with several developers, and it would be helpful to have someone working in a type of "Scrum Master" capacity, dividing out assignments and making sure they get complete. This position does not currently exist, however I feel that I have enough evidence to indicate that it be very helpful for our business. What is the best way to present this proposal to my boss? Is there a specific template that you know of for new position? It should be able to describe the qualification for the position, their responsibilities, and what metrics we would use to measure them. **UPDATE** With Anna's suggestion, I gave more details about this specific position. However, I would ideally like the most generic way to present a new position to my boss.


TODO indicates "task to be completed", FIXME to be fixed etc. Is there a code tag to indicate "need improvement" on code comments?


title: Proper Git setup between designers and developers?

text: Basically we now have 2 developers for an iOS project, 2 developers for an Android project and 1 designer doing designs for both projects. Right now, the way we exchange designs and images is through mail...so not very advanced or efficient. We're switching to Dropbox, but I feel like we could go a step further and somehow integrate the process into Git. For the iOS project, we are using Git, and I'm thinking that it might be a good idea to introduce the designer as well to Git. The problem is that, being a designer, it might be a bit difficult for him to understand source version control. As the 2 iOS devs, we'll probably be doing a lot of commits, branching, merging, but the designer will most likely only have to update images every now and then. We'd like to keep the setup as simple as possible (especially for the designer). We are using GitHub, so their OSX application might come in very handy for this. Does anyone else have experience or best practices about how to set up the branching/merging and integrating a designer into a technical Git project? Articles, blog posts etc. are welcomed as well.