Can You Have "Empty" Abstract/Classes?

Of course you can, I'm just wondering if it's rational to design in such a way. I'm making a breakout clone and was doing some class design. I wanted to use inheritance, even though I don't have to, to apply what I've learned in C++. I was thinking about class design and came up with something like this: GameObject -> base class (consists of data members like x and y offsets, and a vector of SDL_Surface*      MovableObject : GameObject -> abstract class + derived class of GameObject (one method void move() = 0; )      NonMovableObject : GameObject -> empty class...no methods or data members other than constructor and destructor(at least for now?). Later I was planning to derive a class from NonMovableObject, like Tileset : NonMovableObject. I was just wondering if "empty" abstract classes or just empty classes are often used...I notice that the way I'm doing this, I'm just creating the class NonMovableObject just for sake of categorization. I know I'm overthinking things just to make a breakout clone, but my focus is less on the game and more on using inheritance and designing some sort of game framework.


Are corner and edge cases too often ignored or disregarded and why?

I have the feeling that a lot of developers disregard corner and edge cases. Often they tend to just ignore these. I was once working on a logistics project. In the order management of the application there was a case where about 5-10% of the orders had to be specially handled. One colleague said that we just shouldn't handle that case automatically, which would have lead to a high manual workload of the applications users. I think this has somewhat to do with a bad attitude. Another example I noticed shortly was in a comment to one of my answers here. Since this was just a comment, I think the reason for that was just, that the commentator did not pay too much attention for it. Have you made similiar expierences? Is this something you see very often? Is this just a matter of attitude or are there other reasons? btw: I had problems finding good tags for this question. Any suggestions would be appreciated.


What's the easiest way to comply with open source licenses?

I'm really confused by all the open source licensing details like _"I wrote a web application, which should run on a computer not owned by me. My software uses the library/language xxx. Is this considered a software redistribution of xxx?"_. Looking at the first four pieces of used software reveals four different licenses (MIT, BSD, Apache, Apache/Eclipse dual). It looks like all of them require about the same, i.e., list them and link to their license. So I thought I could simplify my life by simply voluntarily listing _all_ the software used. The list is not that long and it'd call it fair. But there are obstacles like copyrighted names, trademarks and such stuff. I've tried to google for an example, but found nothing but the EPSON list (which is for a piece of hardware). Does anyone know an example of software list for a web application? I'm especially curious what's the best solution for Java (run on a computer not owned by me).


Does anyone knows a good minimal php mvc framework?

I've been developing using frameworks since the last year, and is true that those pieces of software really help me and improve my development, that's until you need to fulfill your client's dreams, like, the app needs to fly to the moon and back and collect information about the sun. Or he has an app that needs a basic crud functionality but doesn't need the other 90% of the framework. I know I can handle dependency management using composer, but what if the client has an specific need to be coded over the previously developed app? That's why I'm asking here if anyone of you guys knows a minimal MVC framework?, that can be improved as needed. I just need some base to start my new projects, and the cleanest and minimal, the better. Main charasteristics I'm looking for. \- Obviously mvc design. \- Database integration. \- Built in basic Crud operations. \- Security. \- Code readability Would like: \- Template engine (like smarty) integration. \- Helper classes. Also it has to be easily expandable. I've looked at yupp, but I don't find it complete and also a little bit buggy for development purposes. Thanks.


Where to start when digging into an existing J2EE codebase?

I work for a company that produces enterprise applications to be used by schools and districts to manage all of their tests and standards data. Their existing application is written in J2EE and is very large. I personally am a seasoned PHP and Ruby = RoR developer and I have been asked to attempt to implement easily added but crucial features to an existing J2EE codebase. I am very familiar with Java SE and know the architecture of a web application well. What I am asking for is, will this suffice for the task ahead and what tips can you give me in digging into the code base and actually efficiently adding these new features? Is there anything important I need to know before beginning and what can I expect in terms of problems and issues coming from a Java SE, PHP, RoR background? Time isn't too much of an issue, I should have plenty of time to familiarize myself with J2EE.Please also note, syntax will not be a problem here.


Which would be a better way to load data via ajax

I am using google maps and returning html/lat/long from my MySQL database ## Currently   1. A user picks a business category e.g; "Video Production".   2. an ajax call is sent to a CodeIgniter controller   3. the Controller then queries the db, and returns the following data via JSON      1. Lat/Long of the marker     2. HTML for the popup window     3. this is approximately 34 rows in the database across two tables per business   4. the ajax call receives this data and then plots the marker along with the html onto the map The data that is returned from the controller is one big json object... This is done for all businesses that exist in the Video Production category (currently approx 40 businesses). As you can see, pulling this data for multiple categories (100s of businesses) can get very very taxing on the server. ## My question is Would it be more beneficial to modify the process flow as such:   1. a user picks a business category e.g; "Video Production".   2. an ajax call is sent to a CodeIgniter controller   3. the controller then queries the database for the location base information      1. lat/long     2. level (used to change marker icon color)     3. This would be a single row per business with several columns   4. the ajax call receives this data and then plots the marker on the map   5. when the user clicks a marker an ajax call is sent to a CodeIgniter Controller   6. the controller queries the database for the HTML and additional data based on business_id and if not, what are some better suggestions to this problem? **In summary this means rather than including the HTML and additional data along for each business, only submitting minimal location information and then re-query for that information when each business marker is clicked.** ## Potential Downsides   1. longer load times when a user clicks a marker icon   2. more code??   3. more queries to the database


Handle all authentication logic in database or code?

We're starting a new(ish) project at work that has been handed off to me. A lot of the database sided stuff has been fleshed out, including some stored procedures. One of the stored procedures, for example, handles creation of a new user. All of the data is validated in the stored procedure (for example, password must be at least 8 characters long, must contain numbers, etc) and other things, such as hashing the password, is done in the database as well. Is it normal/right for everything to be handled in the stored procedure instead of the application itself? It's nice that any application can use the stored procedure and have the same validation, but the application should have a standard framework/API function that solves the same problem. I also feel like it takes away the data from the application and is going to be harder to maintain/add new features to.


How many second chances have you got in an interview?

A few days ago I had an interview for a medium company (130 people) for a developer job position, and at some point the interviewer gave me a wild bunch of question regarding TCP, Network flows and many other things that I didn't had clear on my memory. Needless to say, I failed the interview because according to them, I had to understand **in detail** how networking protocols worked to apply as a junior developer. I felt ashamed of my ignorance, and get to it, in one week I managed to refresh all the knowledge of networkings I had and even expanded them, my question is, with this in mind... How possible is to _reapply_ for a job interview, since my only problem in the interview was that part... Thanks in advance... **PS** : I think this is quite hard, but I just wanted to hear from other people with more experience...


Indenting/breaking jquery chains for readability

I'm curious as to how other people indent/break long jQuery chains, as I can never decide what is more readable (particularly when using .end() to "close" a block of methods e.g.               $(this).not(":has(.pointer)").append(pointerHtml)                     .end()                 .closest("li").toggleClass("selected")                 .siblings().removeClass("selected")                 .andSelf().removeClass("pre-selected").animate({                                      left: 12                                      opacity: 0.5                                 })                     .end().end()                 .filter(".selected").prev().addClass("pre-selected")                                 .end().children().load("/homepage.html", function() {                                            //code                                  }).end().end().addClass("processed");      How would YOU format this? *edit included a method with a callback to make it a bit more interesting


Alternatives to Java Applet for interactive Websites

**In short** I am searching for an alternative to Java applets for making some interactive parts like minigames etc. on my website **Facts:**   I´m developing an e-learning website for children. This site has following main functions:   * practice part where children can do grammar test and receive points for good answers.   * tamagotchi like pet which moves around, has to be fed and so on   * shop in which gotchi stuff can be bought As a framework I'm using Ruby on Rails. At the moment I am using Java applets as a "quick and dirty solution" for nearly everything on the site as I totally freaked out over Flash after some years not using it and learning java in the meanwhile... (yes I also use applets for the practices which are not much more than some textfields an dropboxes in some text..) Now I'm searching for a cleaner solution as applets seam to me to be really slow. I already read some things in the internet but I'm searching for some opinions on my special problem. **My findings until now:**   1. JavaScript seems somehow nice, but many users deactivate it so would it be wise to use it?    2. Flash really drove me crazy, but if anyone can give me some reasons for it I will take it in mind again. Here is what happened when I tried to use it: I learned Flash some years ago and I liked it very much but now I am somehow lost as it seems to me to be not really good programming and I always mix it up with Java commands and I was missing code completion and this stuff. My main problem when I totally dropped the idea of Flash was that I wanted to read the practices out of some xml file or maybe a database (having in mind creating some programm in which teachers can produce their own practices in some later version) and it seemed somehow near to unsolveable to create some individual buttons in some sort of loop out of this extern data. also the community seemed to be more designer like than programmer like and wasn´t too helpfull on my questions (100 times yes I know I can drag it from the library but thats not at runtime possible)   3. Java applets are pretty slow I don't think I should use them in next versions I welcome all hints and ideas how to solve my task.


Using empty subclasses to add to the semantics of a class hierarchy?

I was wondering whether using (almost) empty derived classes to give additional semantics to a class hierarchy was a good idea (or practice) ? Because a (not so short) example is always better than a long speech, let's assume we're writing a class hierarchy for SQL generation. You want to represent a data manipulation command (INSERT, UPDATE or DELETE), so you have two alternatives : **First version, with switch statement**               enum CommandType {         Insert,         Update,         Delete     }          class SqlCommand {         String TableName { get; }         String SchemaName { get; }         CommandType CommandType { get; }         IEnumerable<string> Columns { get; }         // ... and so on     }          class SqlGenerator  {         string GenerateSQLFor(SqlCommand command)         {             switch (command.CommandType)              {                 case CommandType.Insert:                     return generateInsertCommand(command);                 case CommandType.Update:                     return generateUpdateCommand(command);                 case CommandType.Delete:                     return generateDeleteCommand(command);                 default:                     throw new NotSupportedException();             }         }     }      **Second version with VisitorPattern** _(Note that the question is NOT about whether the Visitor pattern should be used or adding new operations)_               abstract class SqlCommand {         String TableName { get; }         String SchemaName { get; }         IEnumerable<string> Columns { get; }         // ... and so on         abstract void Accept(SqlCommandVisitor visitor);     }          class InsertCommand : SqlCommand      {         overrides void Accept(SqlCommandVisitor visitor)          {             visitor.VisitInsertCommand(this);         }     }          class DeleteCommand : SqlCommand      {         overrides void Accept(SqlCommandVisitor visitor)          {             visitor.VisitDeleteCommand(this);         }     }          class SqlCommandVisitor  {         void InitStringBuffer() { ... }         string GetStringBuffer() { ... }              string GenerateSQLFor(SqlCommand command)         {             InitStringBuffer();             command.Accept(this);             return GetStringBuffer();         }              void Visit(SqlCommand command) { ... }         void VisitInsertCommand(InsertCommand command) { ... }         void VisitDeleteCommand(DeleteCommand command) { ... }         void VisitUpdateCommand(UpdateCommand command) { ... }     }      With both examples we achieve the same result, but :   * In the first version, my code feels more DRY, even though polymorphism is generally preferable over a switch statement.   * In the second version, I feel like I'm needlessly deriving SqlCommand just so that the code carries more meaning. Another similar case is deriving a class from a generic class, just to give additionnal meaning to the collection, eg :               class CustomerList : List<Customer> { }      I'm left off wondering whether this is a good idea. Are there any pitfalls to doing so ? I personally prefer the second version exactly because it adds meaning to the code, and helps me when I read my code later... But I clearly lack the experience to see any downside to this pattern.


Two-Dimensional vector in C++ – inefficient with dynamic-sized sub vectors?

I know that `std::vector` uses a contiguous block of memory, but I often see people use vectors of vectors, _even when they modify the number of elements in these vectors contained within an outer vector_. Won't this lead to efficiency problems when an inner vector need to be resized as all the following vectors will have to have their elements moved as well? In other words, in the following code, won't growing `lists[0]` trigger the moving of the elements of the 99 sub vectors following it too, and not just `lists[0]`?               std::vector<std::vector<int>> lists;     lists.resize(100);          // use and grow sub vectors     // ...     lists[0].push_back(88); // ← !


Scrum Master in the organization

I'm wondering how to set up the organization with Scrum Masters. I would prefer to see real examples of where the scrum masters are located in the organization's hierarchy and how report-to / chain-of-command issues are handled. we are service company. We have one agile project done for agile customer where team manager of developers fulfills the role of delivery responsible. So far we had matrix organization where scrum masters were assigned to the project management team consisting of people working for other projects (not agile), but this was causing that they did not have much contact with agile culture in their PM team and goals were not always aligned with project. How should we structure Scrum Masters within our organization?


How to calculate the size of a project in the days-person unit of measurement?

Once in a while I have read here and there the size of a project expressed in a matter of `days-person` or `person-day`. I may understand what this means, but I don't know on what do people base themselves to calculate it.   1. What are the variables considered into this calculation?   2. How these variables are used in the calculation formula?   3. Otherwise, how to estimate it grossly, when something is missing from the formula's variables?


As I move forward in my career new jobs become more difficult to choose between. When I was starting out and for the first 8 years of my career I took the jobs that I could get that would keep me programming on the general technological path that I was on. I am a job hopper, I only stay with a company for between 2 - 3 years. I think that I do this because after 2 years I get bored and unless there are new projects to keep my busy I no longer find work interesting. Now that I am becoming more experienced it is more important for me to only apply for jobs that are interesting and will move my career and my skill set forward. My problem now is that I keep finding jobs where the projects appear to be interesting during the interview but once I get in the company I find the development environment is sub-par and the development team is disjointed. I feel like I am asking the wrong questions during the interview process and don't know what to look for to make sure that the environment I will be working in will be a good one. Now my question: **For those of you who are senior developers what do you look for in a new company and development team?** I am looking for the key qualities in a company and development team that you look for when interviewing with a company. These qualities are the ones that would give you hints that the company will be a good one to work for. **Update:** Here is a list of questions that I have created based on the comments left here. There are a ton more but this will be the start of my list. **Good characteristics in a new company:**   * Ability to offer dependability and stability to an employee looking for a place to stay for the long term.   * Financially stable. **Development enviroment:**   * SDLC   * What software and/or tools are used?   * What version control system is used?   * What kind of project manangement structure is used and what tools are used to maintain it?   * How do you ensure the quality of your products? **Development team:**   * How big is the team?   * What skill levels are people at?   * Where would you fit into the team?   * What was the turnover in your team and company in the last year? Why did people leave?   * How often and for what reasons is a person expected to work overtime?   * What kind of development environment does the company have? Flexible, ridgid, laid back, etc.   * Will my personal work practices be acceptable or will I be expected to conform to the rest of the team?   * What does the team do for learning new skills? Training? Education? Shows? Conferences?    * What was the last training that the company invested in for their developers?   * How is conflict between developers handled?   * How is conflict between developers and business users handled? **Joel test** :   * Ask the questions and find out what they will admit to.   * If you can find an employee or former employee ask them to take the Joel test for the company.


Release Management Tools with DVCS (Mercurial)

My development team is migrating from SVN to Mercurial. Having researched DVCS best practices, it has been suggested that we develop against feature branches of the repo mainline, test them separately, then cherry-pick the features we want in each release, before merging those selected branches into the mainline and eventually releasing it. **Question** : What I'm looking for is recommendations for some sort of software tool that will make my role of "software release manager" easier, in that it will allow me to control (cherry-pick) which branches (features, bug fixes, etc) are merged (using Git, or Mercurial) into which software releases (in each environment), and be able to produce the binary deployment artefact. Our applications are mostly Java Web apps, with a handful of Java Applications, and the projects built using Maven (v2). I've looked around for release management tools, but nothing really fits the bill. **NB** : Not all changes are released as soon as they are completed and pass QA - some are to be released at a later date, as part of a themed release Things dismissed so far (based on recommendations in similar questions, in other SE threads):   1. Trac (seems to be just PM type stuff, which we already have with the Atlassian OnDemand offering)   2. Jenkins (plus other CI tools) - am looking for something to manage my releases, rather than a CI tool (we have used Jenkins in the past).   3. Mercurial Patch-Queues - I may well need this, but was looking at some sort of "nicer" interface to help me manage it.   4. ERP offerings - TBH, I didnt look too much into this option, as my initial feeling was that they were too heavy-weight.   5. BuildMaster, by Inedo - This was the closest match, by far, but was not quite suitable due to its lack of VCS branch picking/merging functionality. I would say however that this is a very nice piece of software, and would recommend it, if it fits your use-case, and is sensibly priced, even for Enterprise use. Am currently evaluating the following tools:   1. Bitbucket Feature Branch management (since we use Bitbucket for our projects, seems prudent to evaluate their approach) Since DVCS is new to us, these things may have been dismissed prematurely, so feel free to re-educate me. :)


Can we pull future user stories in current sprint?

Suppose we have estimated 5 user stories to complete in a sprint and completed all of them with testing, buffer time and for expected bugs. Still we have 2-3 days left for one of the developer. Can we pull a future user story in current sprint knowing that only development or part of development can be completed in current sprint?


Proxying the multitons

I have an app which acts like a TCP server and accepts multiple connections. Each connection is made by a distinct device, with a unique ID (the ID is reported by the device in two different messages according to its protocol, but that's less important). Right now, whenever a connection is established, my app creates a new list of parsers for a bunch of messages the device can send, but at that point it doesn't know yet which device has been connected. The problem is that several messages can be parsed before device's identity is established. Since devices can disconnect and reconnect during app's lifetime, there are long lived objects (device statistics and various other data) that should not be discarded whenever a device disconnects, and therefore need to be reattached as the consumers of the parser pipeline once the device ID is established. Alternatively, if a device was never connected before, its fresh instances will become long lived. Does anyone have an overall idea of how this application should be rearranged? For example, one idea was to wrap the long lived objects into proxies, and then have the possibility to change the underlying implementation with a different instance, once a new device is connected. To make it clearer, these objects are not public singletons (multitons), but there is obviously a dictionary (by ID) somewhere in the business layer to keep track of per-device data. This all feels unnecessarily complex, but the code (like it always does) obviously evolved over time and now I feel I can't see the forest through the trees.


Organising MVC App with virtual model using external API

I am creating a rails app with following constraints   * It has no database   * It uses a web API to store and retrieve the data   * The connection to the web API is via a custom gem.   * The Gem has a basic functionality to make a web API call based on the parameters given.   * I have 2-3 different kinds of object that I can think of ( or may be more precisely virtual model ) How should the structure of my program be ?   * Should I incorporate all the method calls within the gem ?   * Should I create models and put the api related calls in there (then through the gem's basic method)   * Should I just ignore the model and put everything in the controller . ? The second method seems most appropriate , but then all the methods from model would be static and I would be calling all methods in essence without any objects.


Does Node.js actually increase scalability?

I've been reading about the C10K Problem, and of particular note is the part that refers to asynchronous server I/O. http://www.kegel.com/c10k.html#aio I believe this pretty much summarises what Node.js does on the server, by allowing threads to process user requests whilst relying on I/O interrupts (events) to notify threads of jobs that are completed, rather than have the thread be responsible for the full CPU job. The thread can get on with other things (non-blocking), and be notified of when a job is done (e.g. a file is found or a video is compressed). This subsequently means that a thread is more 'available' to sockets and therefore to users on the server. Then I found this: http://teddziuba.com/2011/10/straight-talk-on-event- loops.html The writer here claims that although the event driven framework (interrupted threading), may free up threads, it doesn't actually reduce the amount of work a CPU has to do! The rationale here is that if, say, a user requests to compress a video they uploaded, the CPU still has to actually do this job, and will be blocking while it does it (for simplicity's sake, lets forget about parallelism here - unless you know better!). I'm a straightforward coder, not a server admin or anything like that. I'm just interested to know: is Node.js a gift from the gods of 'cloud computing' or is it all hot air, and won't actually save companies time and/or money by improving scalability? Many thanks.


Should I teach my students alloca?

How widely used is `alloca` in the real world? Should I teach my students to use `alloca` when it makes sense? Or should I teach them never to use it? Coming from a C++ RAII background, the idea of not having to call `free` manually sounds promising, especially in functions with multiple exit points.


Implement FBP / Dataflow programming in VBA?

Intrigued by Flow Based Programming a la J Paul Morrison. I wonder if one can implement FBP in Excel/VBA. I searched quite a bit for a Basic-Lang FBP implementation to no avail. I've looked at some FBP implementation details in Python but I'm not grokking it. VBA is what I'm most familiar with, but I'm suspicious that VBA can do FBP at all, without having coroutines or (?). Code 2 simple components, an Info-Packet Buffer Class, and a linkage between them and I would get it. I can't see where to begin. Specifically I wonder:   1. What would be the In-Ports, Out-Ports, 'bounded-buffer' graph-edges, and code to link them up look like?   2. How to do message passing? Using raised application events?   3. No way the resulting beast is inherently parallel or asynchronous, right?   4. If it just can't be done in VBA, why not?


Help me deal with higher level languages

I'm trying to learn Scala (I have previously glanced at Erlang, Haskell, Ruby and had similar issues). I do enjoy it, but I feel bad about some things it does and I wonder if that's just due to all the time I've spent with C++. **1\. Keeping it clean** I'll start with a problem of my own. With anonymous functions and loops hidden in foreach I feel encouraged to put everything in one line. I quickly end up with something hideous. It's even worse in Ruby where variables don't need to be declared. It's a mess. I wonder if there are any guidelines that can be followed to improve readability or if this is something one just has to get use to when programming in a concise language? **2\. Basic control structures** While foreach, map, etc. methods work great in simple cases they fail me in more complex ones. Containers preserve order of objects, and in a way, these methods hide that order form me. Let's say, I want to build an array B from the elements of array A with prime indices. I could do               var i = 0     val B = A.filter( e => { i+=1; is_prime( i ) } )      but it doesn't feel right. There is a duplication of counters - one inside filter, and one of my own. I see no reason why there wouldn't be a function which knows the position of the element it is processing. Am I missing something or is there some logic behind it? Now I just feel encouraged to use the usual C style loops. **3\. Scala's hidden inconsistency** Scala seems to boast having so much of it declared in it's libraries. With all the rules Scala needs to make those libraries feel comfortable, the language becomes as big as any other, which seems like missing the point, but that isn't what bothers me. What I dislike is Tuple. With it's special syntax, it acts like a language construct rather than an ordinary class. It feels like Scala is denying that many things are built into it. I'd appreciate it if someone could explain to me why such synthesis of library and language is so often implemented (not only in Scala). **4\. Efficiency** Firstly, I understand the benefit of having immutable objects in parallel algorithms, but how often do you actually need the concurrency? There are issues with it other than shared mutable objects. My point is that concurrent design has it's limitations and using it everywhere, like functional languages seem to do, must be terribly inefficient.   Secondly, even if we do consider immutable state a necessity, some algorithms I've seen are ludicrous. I'm thinking about the ones that work with lists as head::tail. I find it hard to believe that an algorithm, described in that way can be efficient. Again, I feel encouraged to write more imperative code. Am I underestimating optimizations or should sensitive algorithms really avoid some concepts?


Get the ball rolling on TDD

I am part of a developer team that works with many other teams to maintain and improve an application that has been in use for at least 15 years. When it was first built and designed, TDD was unheard of. The application is fairly stable, and we rarely encounter a show stopping bug, but we do average about one or two bugs a week that seriously reduces the quality of service. These bugs take forever to find and fix, largely because of finger pointing, and the only testing we have is interface testing. Because there is a lot of wasted time hunting down where the bug is before it can be fixed, me and another developer plan to propose Test Driven Development. There is a new overhaul coming soon, and we would like to see near complete unit testing done on the new modules, we also plan to suggest building test units for any code we have to alter that is legacy (i.e., bug fix or feature implementation), but not to spend time developing test cases for code that hasn't caused problems. To me, this seems reasonable. This month we had a bug that took over two weeks to fix, but could have been identified before deployed if unit testing had been done. But to our managers it just looks like they're going to spend more money. How do I convince our clients that they want to spend the money for unit testing and test driven development? Are there any studies that show the ROI of unit testing?


What was your most difficult bug hunt and how did you find it and kill it?

This is a "Share the Knowledge" question. I am interested in learning from your successes and/or failures. Information that might be helpful... **Background:**   * Context: Language, Application, Environment, etc.   * How was the bug identified ?   * Who or what identified the bug ?   * How complex was reproducing the bug ?  **The Hunting.**   * What was your plan ?   * What difficulties did you encounter ?   * How was the offending code finally found ? **The Killing.**   * How complex was the fix ?   * How did you determine the scope of the fix ?   * How much code was involved in the fix ? **Postmortem.**   * What was the root cause technically ? _buffer overrun, etc._   * What was the root cause from 30,000 ft ?   * How long did the process ultimately take ?   * Were there any features adversely effected by the fix ?   * What methods, tools, motivations did you find particularly helpful ? ...horribly useless ?   * If you could do it all again ?............ These examples are general, not applicable in every situation and possibly useless. Please season as needed.


Rush to client-side in web development

In the past few months, I recognized a big excitement about client-side scripting in web development. But while server-side technologies are mature, stable and well accepted by backend-developers, client-side technologies are immature (i.e. compared to big server-side framework) and disliked by many long-established developers. Nevertheless everyone is doing client-side development these days. I personally expect those big server-side frameworks to disappear in like 2-5 years, watching the current trend. Why is that so? How could the new and "diffuse" client-side developing in HTML5/JS possibly be superior to big and well thought server-side solutions?


Are custom DSLs still viable?

Are custom DSLs in JavaScript still viable, Specifically ones written with Antler, Boo, or the former Microsoft Oslo? With the proliferation of open source JavaScript/ECMAScript engines (V8, IronJS, etc.), does it make more sense to write the functionality needed into one of those instead of writing an entirely new language?


I want to create an open data format... but I don't really know what that is

I have found a need for a standardization for storage and recording of data relating to diabetes information (I don't think there's any, but I may have missed it). To that end I made this github project because I want to create one.. but I don't really know how to go about it, or even for sure what I want to create is called. Do I need to pick a language (xml, json) or a database type (mongo, sqlite, mysql), or how 'unspecific' is possible with something like this. Is a data format as I describe here a thing? Are there other names for what I want to try to do? It's a bit of a strange task to accomplish compared to what I'm used to.


When designing an enterprise API, what level is appropriate for separating libraries?

Assume we are developing a REST system for an enterprise company to expose the companies resources in a Java based application. Ultimately you have one web application, and domain libraries. My question is to where components and services should live in these domain libraries and what should exist in the application itself. For a hypothetical company we may have several domain areas.   * Customer Relations   * Customer Sales Orders   * Manufacturing   * Product Structure   * Supply Chain   * Warehousing Given these domains we would have domain objects and object services for persistence. We could then further separate these into implementations   * Customer Relations   * Customer Relations - JDBC Impl   * Customer Sales Orders   * Customer Sales Orders - JDBC Impl   * Manufacturing   * Manufacturing - JDBC Impl   * Product Structure   * Product Structure - JDBC Impl   * Supply Chain   * Supply Chain - JDBC Impl   * Warehousing   * Warehousing - JDBC Impl Now it's starting to look complex only because of how many individual libraries we are managing. I'm wondering if we even need to separate to such a level and could simply have the three.   * Business - Interface   * Business - JDBC Impl   * REST Application My second part of my question relates to where service classes and management classes should live. Given our Warehousing above we need domain objects to represent pick-faces, a DAO class to manage the pick-face object and finally a service component for our rest application. For this we could see the following structure.   * Warehousing      * PickFace     * PickFaceDAO   * Warehousing - JDBC Impl      * JdbcPickFaceDAO   * ReST application      * PickFaceController On the one hand `PickFaceController` is best inside the ReST application as the application can then manage the services for this controller manually and may need to customise configuration. But, on the other hand the `PickFaceController` might be better inside the Warehousing project as it's only concerned to the warehousing module, yet the ReST application could theoretically use service locators to find services in other libraries. SO what are the successful approaches being used? When do you know when you've gone to far in separating or not done enough? How do you know the best place to put something?


Apache license in non-Apache licensed software; how to distinguish?

The Apache License states: "You must give any other recipients of the Work or Derivative Works a copy of this License;" So if you've copied a bunch of functions from some Apache-licensed code (so it's not just linking, you've borrowed code) into a product _that is not itself Apache-licensed_ , what's a good way to indicate that the license you included only applies to some bits of code in your product, not to the product as a whole? (To avoid the suggestion that the product as a whole is freely copyable.) Should a list of projects you've borrowed from and their various licenses be included in the "About" screen for the product, _insisting_ that the licenses only apply to those bits? I'm asking because that seems to make sense, but I don't recall seeing that anywhere.


Standard Java Error Reporting

I am currently working on creating a toolkit for work and I've gotten to the point where I'm wondering about error reporting. Basically all of my tools, which consist of a grouping of classes, will eventually be ran from a main method. Many of these tools will be doing operations on file like reading them in and converting them into some sort of array of objects or writing an object array to a file in a certain format. Whenever you are dealing with data that your program didn't create there is always room for error and those errors need to be known. With that said what would be a good method to document all of the errors that occur during the processing and allow them to be retrieved later? Considering that I may want to send these error information out later I don't think that Log4J would be a good fit. I was considering using a string builder in each of my processing classes and append all error to that builder and retrieve it later at my leisure. I was also thinking of using some sort of arrayList or something that would hold the different types of errors but I'm a bit at a loss. Does anyone have any good methods of doing this?


Are there any statistical information about what kinds of work programmers do?

I've been working as a Java developer for a while now. I usually work on business applications and I recently realized that my work mainly consists of   * writing an endless stream of _facade_ classes   * followed by an infinite array of _jpa queries_   * paired with countless hours of typing `mvn clean install -U` and waiting for the build Sometimes I get to work on more enjoyable stuff, but it's only 5-10% of my time spent at my workplace. I think that I should move on to some other segment of the industry because business application development usually lacks challenges. My problem is that after googling for a while, I couldn't find any exhaustive source about the distribution of programming jobs nor information regarding the supply/demand and/or segmentation of the industry. Does anyone know about some source of information about these matters? Even some pointers will do. I think there are others out there thinking about something like this. Don't constrain yourself to Java if you are answering because I'm willing to learn new technologies. **I do not want general information but grouped statistics across different segments of the industry.**


Why do some websites allow editing a post/blog-entry for a limited amount of time only?

There are numerous websites that allow users/visitors to post content (such as comments to blog posts or news). The published post can be edited by the poster, but only for some amount of time (typically in the order of minutes). After that, the "Edit" button no longer appears and the post can't be edited. My question is: what's the rationale for this behaviour? If it is technically possible to let the users editing their posts, why not offering this feature indefinitely?


Naming classes becomes debilitating

I'm not sure if this is an OCD trait or not, but I find that sometimes I get completely blocked unable to continue what I am doing when naming a class (or function, or namespace etc) that I believe is to be used outside of a given project. An API for example. Or a utility class library. If the naming isn't exactly right (in my mind) I just can't continue...I get stuck trying to come up with the right name. I've tried writing little apps that would use it to see what the names look like but that doesn't seem to help... I know it shouldn't matter, and it's against any programming mindset to assume you'd get it perfect first go...I just feel powerless to it... Any tips/ideas would be greatly appreciated...


Why is it impossible for Google to port V8 along with Chrome's codebase in C/Obj-C on iOS?

Google has given a reason that All apps on iOS have to run in the sandbox environment except for special apps by apple that get to tap into some private APIs. So Chrome on iOS uses whatever the UIWebView provides plus it might be doing its UI stuff and some external caching to add something extra to it. But Why does Google need access to Nitro engine that Safari on iOS has access to. Can't Chrome port the whole webkit engine and V8 for iOS ? Xamarin 2.0 manages to port mono (.net runtime) on iOS along with every app.


What are best practices for caching paginated results whose ordering/properties can change?

What is the best practice for caching paginated search results whose ordering/properties can be changed? Say, in my application, someone wants to see the last 20 discussion threads (out of 10,000). A request would be sent to the database, via `servlet`, to fetch the first 20 records from the discussion threads table as XML/JSON. If they then want to see the next 20, they go onto the next page of results and this fires off another request to get the next lot (limit and offset = 20, etc.). In order to reduce server load and client-waiting, I would like to cache the previous pages of results. However, I have two questions:   1. The table the results are shown in can be ordered by more than one attribute (i.e., thread-creation-date, thread-author, last-post-date). This means that a statement like 'first 20 results' makes no sense without context (i.e., what are we ordering by). How does the front-end, then, communicate to the back-end what it has already loaded? My first thought was to use IDs for each result but sending these back to the server on subsequent requests (and filtering results based on them) would just as time-consuming as sending everything back blindly. How can I do this?   2. What if an attribute of a previously returned result (i.e., most-recent-post-date) has changed? We then need a way of checking each result to see if it's been modified server-side since it was paged in. How can I do this?


Are there any good tools for visualizing refactoring work?

Many of my co-workers take pride in writing complex algorithms and programs, ones which take significant time to completely grok. I (strongly) tend towards the opposite end. I'm proud when I write a program which a novice (or client) can trivially see is correct, by reading my source code. I'll often take time to mercilessly re- factor, rewrite a given piece of code over, and over, and over, again, until I'm sure that it can be read quickly, requires as little knowledge of specialized APIs (or even references to an English dictionary) to parse as possible, and is as close to natural language as I can make it. This leads to some problems, though, when it comes to convincing (non- technical) clients and employers that my work is worth the money invested. Surprisingly, few people are willing to pay the extra money it takes to obtain code that they can verify for themselves is working as they think it works. In this context: **I'm wondering if there are any good tools for displaying refactoring work**. I usually **use git as a code repository** , and have an almost nervous tick around committing even the smallest changes to my local repo. I'm **fairly sure that most of the information required to show the re- factoring effort is recorded in my git history**.


What are some arguments AGAINST using EntityFramework?

The application I am currently building has been using Stored procedures and hand-crafted class models to represent database objects. Some people have suggested using Entity Framework and I am considering switching to that since I am not that far into the project. My problem is, I feel the people arguing for EF are only telling me the good side of things, not the bad side :) My main concerns are:   * We want Client-Side validation using DataAnnotations, and it sounds like I have to create the client-side models anyways so I am not sure that EF would save that much coding time   * We would like to keep the classes as small as possible when going over the network, and I have read that using EF often includes extra data that is not needed   * We have a complex database layer which crosses multiple databases, and I am not sure EF can handle this. We have one Common database with things like Users, StatusCodes, Types, etc and multiple instances of our main databases for different instances of the application. SELECT queries can and will query across all instances of the databases, however users can only modify objects that are in the database they are currently working on. They can switch databases without reloading the application.   * Object modes are very complex and there are often quite a few joins involved Arguments for EF are:   * Concurrency. I wouldn't have to code in checks to see if the record was updated before each save   * Code Generation. EF can generate partial class models and POCOs for me, however I am not positive this would really save me that much time since I think we would still need to create the client-side models for validation and some custom parsing methods.   * Speed of development since we wouldn't need to create the CRUD stored procedures for every database object Our current architecture consists of a WPF Service which handles database calls via parameterized Stored Procedures, POCO objects that go to/from the WCF service and the WPF client, and the WPF desktop client itself which transforms POCOs into class Models for the purpose of Validation and DataBinding. So my question is, is EF right for this? Are there any pitfalls about EF that I am unaware of?


YAML: translating free-flowing text from XML

I'm studying YAML as a replacement for XML, but I'm experiencing difficulties when dealing with elements containing free-flowing text with embedded elements. For instance, the following XML document:                   <text>         This is an example text, spanning multiple lines, and it has embedded elements         like this and this.  There is also a list:              <quote>                 <text>The text of the quote, spanning multiple lines, and it has                 embedded elements like <c p="value">this</c> and this</text>                 <author>The Author of this quote</author>             </quote>         Text continues here.         </text>      I don't know how to convert the embedded elements in YAML. My understanding is that the above XML document translates to something like this (except for the embedded elements):                   text: >                 This is an example text, spanning multiple lines, and it has embedded                 elements like this and this.  There is also a                 list:                      quote:                         text: >                                  The text of the quote, spanning multiple lines,                                 and it has embedded elements like <c p="value">this</c>                                 and this                         author: The Author of this quote                 Text continues here.      Also, is indentation not needed in some places? Thank you.


How to utilize Xcode project & target to manage products?

At first, hopefully following terms project and product won't be confused. Traditionally, we used to have a code base, which usually was a main project. For our products, we created one project for each product, and these projects surly depended on main project (code base). When product was released, we created release branch for archive and maintenance. Now I'm developing iOS applications, and I noticed there were specific terms for Xcode, project and target, which were similar to project and product. At first look, it's more easier to share configuration between products, to simplify product releases by taking advantage of target and target dependencies. Compared with traditional way, on the other hand, it's more difficult to manage source code, to branch, etc, if number of products goes really large. In practice, is anyone efficiently using this Xcode built-in structure to manage code and products?   I'm quite new at iOS & Xcode and looking for good advice, thanks.


Creating a Django development and production app

I just got started on some web development, and got my feet wet by creating a basic facebook app using Django. I am thinking of publishing the app, and consequently now need a development app that I could make subsequent changes to and roll them out to the production app. I'm completely new to this, and would be really thankful if someone could guide me on how I could go about this, and what the best practices are. (I also plan on letting my friend contribute to the app, so I would need to integrate git or some other vcs in the process right?) Thanks!


CSS practices: negative positioning

I'm somewhat of a novice to CSS. Anyway, I noticed that an extremely common method used in CSS is to have negative or off-screen positioning, whether it be to hide text or preload images or what have you. Even on SE sites, like StackOverflow and this website, have               #hlogo a { text-indent: -999999em }       set in their CSS. So I guess I have a few questions.   * is this valid CSS? or is it just a "hack"?   * are there downsides to doing things this way?   * why is this so common? aren't there better ways to hide content?


How to roll out a feature to only a select few users

A good example of what I'm trying to ask about would be Facebook's new Timeline feature. In the beginning, only a select few were allowed access to timeline. As the feature became more solidified in how it was working and bugs were fixed in it, additional users were allowed access to the feature. At a later date, a large group of users were allowed access to the feature and now, its a general feature to all users. How does a development team manage this type of feature roll out? I've played with the idea of using configuration settings to selectively control access if something is in testing or in production via a configuration file and conditional if statements in the code. Now while this okay for simple features, I believe that if we tried to implement this in a larger feature set it would become unmanageable. What would be the best way of managing feature roll outs in this manner?


Employer asking me to use API for entire website?

I'm working with an ASP.net developer, under a boss who doesn't have much technical knowledge. I'm doing the front-end work, and and a database expert doing the backend. However, recently, he said that he would be working on the API for our site- I asked why, thinking we should do the web version first, assuming the API was for mobile apps. However, he said that he would just make a single API to work for all the web and mobile apps, and I would do the front-end for that. Is it just me, or is this a little crazy? If I'm doing front-end, it means there's going to be _two back-ends_ , because I'm going to have to use PHP or something to curl his API to the site, which is twice the loading time as normal. Thank for any help in advance. Also, I happen to be "the intern", so I'll have some but not very much pull with this issue.


How can I help a 9-year-old learn to develop an application?

> **Possible Duplicate:**   >  What are some good tools for introducing kids to programming? My 9 year old is obsessed with developing an app, and I have no idea how to help him with this. Where/how should he start? Are there some simple yet useful online courses or tutorials? Does he need to know how to program? And if so, what type of programming courses should I look for? Thanks for any help!


Why isn't Java used for modern web application development?

As a professional Java programmer, I've been trying to understand - why the hate toward Java for modern web applications? I've noticed a trend that out of modern day web startups, a relatively small percentage of them appears to be using Java (compared to Java's overall popularity). When I've asked a few about this, I've typically received a response like, "I hate Java with a passion." But no one really seems to be able to give a definitive answer. I've also heard this same web startup community refer negatively to Java developers - more or less implying that they are slow, not creative, old. As a result, I've spent time working to pick up Ruby/Rails, basically to find out what I'm missing. But I can't help thinking to myself, "I could do this much faster if I were using Java," primarily due to my relative experience levels. But also because I haven't seen anything critical "missing" from Java, preventing me from building the same application. _Which brings me to my question(s)_ : Why is Java not being used in modern web applications?   * Is it a weakness of the language?    * Is it an unfair stereotype of Java because it's been around so long (it's been unfairly associated with its older technologies, and doesn't receive recognition for its "modern" capabilities)?    * Is the negative stereotype of Java developers too strong? (Java is just no longer "cool")   * Are applications written in other languages really faster to build, easier to maintain, and do they perform better?   * Is Java only used by big companies who are too slow to adapt to a new language?


How safe is it if I store passwords in app.config in C# .net 4

I am storing database passwords in app.config as plain text. I am also publishing the application. How safe is that password stored in app.config? Can I use a disassembler and find it?


why is it easy to break verification images if they are not distorted to the extent that humans can get them wrong too?

I don't understand why people like to say "Images had to be distorted otherwise they would be easily cracked". I'm talking about those verification images that we had to type to identify that we are humans. Exactly what steps must we take to break even a simple image? like this: ![enter image description here](http://i.stack.imgur.com/vmPUb.png) Ok so i'm guess we had to read all the bytes of the image and try to draw some sense out of those bytes? because if that's _really_ how it is done it does seem really pretty tough (so what's with that comment that it's _easily cracked_ ), or is there a better way to crack images (that make it so easy after-all) ?


what is Docking Framework

I searching for undestanding `Docking Framework` concept in web, but I don't understand its concept and benefit. I see exist several 'Docking Framework' in java such as `Netbeans Platform` or `MyDoggy` or `Sanaware` and etc but I don't understand its benefit. Do you can explain it? Thanks.


Which is better SICP or HTDP

I have read that SICP (Structure and Interpretation of Computer Programs) is hard and HTDP (How To Design Programs) is better as an introductory course. I would say I am fairly good in maths but not a genius.So how hard is SICP, is it harder than knuth or cormen.


How to call modern Pascal?

Should the developers who creates programs with Delphi, FPC, Lazarus agree with the name of the language? This struck me since every possible variation not only adds confusion for new programmers, also when I write or name each of them, I feel that it's not fully correct.   * Pascal. We know how Wirth dislikes OOP, so this plain naming is not correct. There were years where there were no objects in Pascal so it's also not correct to name it Pascal.    * Delphi ("please, give me a link to the code fragment in Delphi"). Seeing how strong fpc/Lazarus is while keeping the high level of compatibility, now it's also isn't completely correct.   * Object Pascal. Seems like a good choice, but the only places where it used noticeably is Delphi help and Wikipedia. And seems like there's even no badge "Object Pascal" at stackexchange/stackoverflow.  This also makes me sad because the developer of other languages don't hesitate at this moment. They can mention multiply compilers or dialects, but rarely hesitate in how to name the language.


Model-View-Controller -- Where does a factory class go?

I'm working (slowly) on a small Flask project. One of my models is a class called `Post`, which is a lightweight `namedtuple`. `Post` objects are created by a `PostFactory`, because creating a `Post` involves hitting a database. The `PostFactory` holds the necessary database connection, so the `Post` objects can be serialized. What part of the model/view/controller division does a factory object naturally fit in? Is it part of the models, since it's tightly coupled with `Post` objects? Or is it a controller, since it manipulates models?


How do you effectively develop the same application from multiple computers?

I've already read If you use multiple computers, how do you sync everything? \- but that was off topic... I am specifically thinking about this from a programming side. I have powerful desktops at home where I do personal projects and work where I obviously do work related projects... I also have a laptop that I use for programming when I get the chance. I use dropbox and other sync tools for the majority of my work, but, I have found no decent solution for programming projects. Recently, I started to use GIT and whilst I like it for source control, I don't like pushing in tiny changes as it feels a waste when there hasn't been many significant changes. So, I am just looking for some advice, people who work with multiple computers - how do you effectively develop on multiple machines? I am thinking at present that keeping my working folder in Dropbox may just be the easiest solution, however, I can't help but feel there is a better solution out there.


Which way to terminate reading loop is the preferred approach?

When you have to iterate a reader where the number of items to read is unknown, and the only way to do is it to keep reading until you hit the end. This is often the place you need an endless loop.   1. There is the always `true` that indicates there must be a `break` or `return` statement _somewhere_ inside the block.              int offset = 0;     while(true)     {         Record r = Read(offset);         if(r == null)         {             break;         }         // do work         offset++;     }        2. There is the _double_ read for loop method.              Record r = Read(0);     for(int offset = 0; r != null; offset++)     {         r = Read(offset);         if(r != null)         {             // do work         }     }        3. There is the single read while loop. _Not all languages support this method_.              int offset = 0;     Record r = null;     while((r = Read(++offset)) != null)     {         // do work     }      I'm wondering which approach is the least likely to introduce a bug, most readable and commonly used. Every time I have to write one of these I think _"there has to be a better way"_.


What is the difference between building and compiling ?

What's the difference between Building and Compiling.


Is it possible in C++ to define several methods at once?

Sorry for the confusing title of this question, but I can't think of an exact way to word it. I have a very long class with hundreds of similar methods and I am trying to find a way to construct it without so many lines of code and so many DRY violations. Each time I add a new property to my class I have to write two methods and update the copy function. There are already over 80 properties. Currently this class is written in Java but I was wondering if it were written in C++ if it could be done more efficiently. I think it can be done using preprocessor x-macros like described in wikipedia here but I am not a fan of macros and would prefer to do it using the language itself if possible. Here is a simplified snippet of my Java class:               class InMemoryPerson implements Person {         private HashMap<String,Object> values = new HashMap<String,Object>();              public InMemoryPerson copyFrom(Person p) {             setName(p.getName());             // more code to copy all the properties...         }              public void setName(String name) {             values.put("name",name);         }              public String getName() {             return (String)map.get("name");         }              // many more methods for all the different properties...         // each method may have a different type     }


How do I prepare for an interview with a jack-of-all-trades CV?

I have a CV with a vast array of different technologies that I've used at my former jobs. In my experience at those jobs, I employed parts of those technologies depending on what the job required, but never enough to be a master of all the remote parts of the technologies used. But as I've been interviewing for positions, employers see that I have experience in a technology, and ask very specific technical questions that, while I might've known when using them, I can't answer now. To learn everything about each of the technologies on my CV seems to be a gargantuan task that would be overwhelming. How do I prepare for job interviews where each prospective employer focuses on a different subset of my experience in great detail?


Languages and frameworks to build REST services

I'm currently in the process of developing a REST service that will be consumed by an iPhone app. Basically, the service wraps existing business logic. This business logic is written in c# and I'm writing the service in c#. From a purely curious point of view (not this project) my questions are: What other languages and frameworks exist to build REST services? If the technology choice was open which one would you choose and why? Can you wrap c# assemblies using non Microsoft languages? Would you ever do it? (If the development team was able to support it)


What is a good license for community submissions to commercial partially closed source software?

I am maintaining a small code base that I am considering selling– but I want to allow developers that use it to submit code for addition to the trunk. This way they can extend the framework and the community can benefit. I want them to retain copyright to their code, but to allow me to use it however I desire, for commercial and non-commercial purposes. I don't want to be obligated to release any submitted source(although as copyright holders they may). The end user product will be binary distributions of the compiled code base. Is there a good existing license for a project of this nature? I could compromise a little to use an existing license which does not fully match this, if it will save me the legal headache.


Should the internal naming (classes, methods, database tables, etc) of entities be changed if the marketing and UI naming changes?

We've had a long living product for about 8 years now. Over time, the names of concepts and entities change. Should we put the work in to rename all the code base and database tables and columns to match these new names? Is there a study made on this or some best practices published? Thanks


Communications regarding maintainability of code

I'm in search of good language or metaphors to discuss the maintainability of code with non-technical folks (PMs, business sponsors &c). In particular, I've recently created a few one-off, get-it-done-tonight, gets- the-job-done pieces of code. Everyone, including the internal sponsor, knew that we were saving a couple hours based on the premise that the code would be used once, for the immediate need, and not again. Then the inevitable: "Hey, remember that thing we did? Let's do it again, but with these minor changes." Of course, the minor changes aren't so minor, all the more so because the code was written as a big ol' procedural nastiness hinging on assumptions about the environment. [Yes, yes, I know, avoid the problem in the first place. Don't write bad code. Write everything as if it will be maintained by someone else, or me years from now. That's a different question, though. This is after it's happened.] So what are some good metaphors for the internal sponsor (non-technical) to quickly explain why the code isn't maintenance or minor-change friendly? The walls on a movie set: There's no garage there, it's just a door. -or- The doors are welded shut on this car. How do you describe this continuum? I want to find some terms for our group that will help talk about how much effort goes in up front and how that will improve maintainability: illustrating the trade-offs in "Do you want this tonight or do you want it maintainable?" (In writing this up, I realize this might be the same as defining 'maintainable' for non-technical stakeholders. Seems like explaining loose coupling to non-technical types may not be the best way out of this. If you've successfully done that, how?) Edited for answer: For now I will continue to use building construction metaphors. This will turn into the size and strength of the foundation: "Yes we can build that building on this, but we will need to rework the foundation to be larger and cover the right area."


How could one make a reasonably efficient, pointer-sized mutex?

I have my own ideas about how a pointer-sized mutex could be made: The integer is used as a set of flags, counter, index, and a spinlock that guards an entry in a table of pre-allocated kernel objects given to mutexes only when threads are contending, and released afterward (only need at most N table entries for N threads). Watching MS' SRWLOCK structure change leads me to believe they conditionally store the tail of an xor list (or a table index?) in the pointer when contested. The first 4 bits are flags of some kind. ### To clarify I was wondering if there were any other ideas about making a user mode mutex that is the size of a pointer and only requires the allocation of a kernel object if it is contested. My idea involves spinlocking, so I am hoping there exists something that does not.


Designing class methods: self contained or explicit calls?

I'm probably butchering the terms, if someone knows the appropriate terms - that'd be great. But my question is: should I design my classes so that their methods' parameters be accessible from the outside, or should they be all self contained? For example, I want to set a domain name for a class, which will served as the 'active' domain:               function setDomain($url){             if ($this -> domainUrl = parse_url($url, PHP_URL_HOST)){                 $this-> domain = $this->db->get_where('domains', array('host' => $this->domainUrl));                      return $this;             }                  return false;         }      and then go the route of:               function addDomain(){             $query = "INSERT INTO domains (host) VALUES ('$this->domainUrl')";             $this->db->query($query);             return $this         }      or I can abandon the entire route of setDomain(), and than just call the url explicitly, such as:               function addDomain($url){             $query = "INSERT INTO domains (host) VALUES ('$url')";             $this->db->query($query);         }      Which would you say is preferable and I guess - what is that dependent upon, because there might be cases where I'll need to call it explicitly.


How can I debug a memory leak in a service

I have a windows service program that is running on one of our servers. It has a memory leak of some kind within the program. When it first starts running it is using 20,000k memory. Within a few days it is up to 400,000k of memory. It is a fairly simple program that tracks running processes and writes the information to a database. I am unsure on how I can debug a program running on a remote machine to find out where the memory leak is coming from. What methods would you suggest I use in order to try and track this down? **Update**   The program has a lot of exception handling in place already. However, it has no logging whatsoever. What information should I be logging in order to track down the memory leak?


Package conventions for MVC app

Which (if either) of the below is the more conventional/acceptable way to structure packages in a J2EE app? I'm trying to follow an MVC pattern as much as possible.   * foo.bar.users      * foo.bar.users.servlets     * foo.bar.users.DAO     * foo.bar.users.Entity   * foo.bar.orders      * foo.bar.orders.servlets     * foo.bar.orders.DAO     * etc... or   * foo.bar.DAO      * foo.bar.DAO.users     * foo.bar.DAO.orders     * ...   * foo.bar.servlets      * foo.bar.servlets.users     * foo.bar.servlets.orders     * ...


Delivering and caching files in asp.net

The question is - what is an effective way to deliver files to users? Consider an asp.net application which gives an ability to view various files. A kind of image library or web file directory. Key points are:   * user can upload arbitrary files of size <= 10Mb   * files are stored on disk   * files never change   * user can remove a file   * there is a certain access check procedure for accessing a file So I'd need to find some balance between availability (i.e. caching) and security (i.e. access control). Currently user issues a request in a form `/attachment/{id}`, and a controller reads a file from a disk and sends it to a client:               if(HasAccess(user)) {        var data = File.ReadAllBytes()        return new FileResult(data);     }      I suspect that's not an optimal way: it involves asp.net application pipeline and uses disks a lot. Can be this way optimized? Can I store such files in Output cache? Are there other ways (not using Controller) to deliver files which should be considered?


What are the best practices to secure a web API?

I need to build a web service API for our mobile app to interact with our server & database (in ASP.Net MVC 4, but that's hardly relevant). Wile most actions do not need users to be registered with our service, we would like to restrict access only to users of our app. What are the methods to make sure that calls made from somewhere else (e.g. someone wanting all our data, or building an unofficial app) are rejected? My initial idea is for the device to ask the server for a token, which is randomly generated and sent as is. All other methods will check that the request headers contain a specific one that will be md5 hash of the salted token. The server knows the token and salt and is able to compute the hash and compares it with the one sent. In addition, the token as a limited lifespan, and the device must get another one every other hour. That seems quite easy to implement and although probably not 100% proof, that seems to be a good idea. What do you think?


Would scala be a good choice instead of Java?

We will be starting a new project which will involve training all the .net developers in Java (frameworks/ECO system etc). We have a lot of code written in C# and it seems that all of this will be wasted as we have to re-write it all in Java. The problem I see is that the first year or so (probably 2 years) we will have nothing to deliver as we will spend most of the time reproducing what we had before but now in Java. Since our team is distributed in different offices around the world and we have a large number of java developers (20 to 30) and 10 developers using .net, we want to get all the developers using the same language/platform so we can start to reuse components/modules. So I can understand managements point of view. Yesterday I came across Scala and was wondering if it would be better to use this with the current product (which is written in C#) and then at least we will have a working product in a year. Also in a year we have modules that can be used in the Java world whilst we migrate other parts of the product. Would Scala be a better choice than Java considering what we are trying to achieve?


Issues to be considered while loading jQuery?

1. I have seen many answers in SO regarding using Google's CDN to load jQuery instead of   loading it from the local server. In essence I understand this is the issue related with decreased latency, better caching. But I want to know the technical answer, perhaps an example mentioning why it is even an issue to just load a 30KB file. We see nowadays websites with rich multimedia features which do significant download from server, so in such light does this file size make any difference?   2. Also there are huge concerns regarding using such "heavy weight" library if all you are using is just a fraction of subset of features? And if you are going to use at all, it is recommended to use compressed version (30+ KB) instead of the uncompressed one(200+ KB)? I also know the usual answers to it, perhaps if someone can shed more insight to it? My both questions mentioned above are essentially trying to raise the same issue. I would be very grateful for answers that can provide the perspective to it rather than usual answers in SO?


What are some efficient ways to set up my environment when working on a remote site?

Hello fellow Programmers, I am still a relatively new programmer and have recently gotten my first on- campus programming position. I am the sole dev responsible for 8 domains as well as 3 small sized PHP web apps. The campus has its web environment divided into staging and live servers -- we develop on the staging via SFTP and then push the updates to the live server through a web GUI. I use Sublime Text 2 and the Sublime SFTP plugin currently for all my dev work (its my preferred editor). If I am just making an edit to a page I'll open that individual file via the ftp browser. If I am working on the PHP web app projects, I have the app directory mapped to a local folder so that when I save locally the file is auto-uploaded through Sublime SFTP. I feel like this workflow is slow and sub-optimal. How can I improve my workflow for working with remote content? I'd love to set up a local environment on my machine as that would eliminate the constant SFTP upload/download, but as I said there are many sites and the space required for a local copy of the entire domain would be quite large and complex; not to mention keeping it updated with whatever the latest on the staging server is would be a nightmare. Anyone know how I can improve my general web dev workflow from what I've described? I'd really like to cut out constantly editing over FTP but I'm not sure where to start other than ripping the entire directory and dumping it into XAMP.


How do I set up pairing email addresses?

Our team uses the Ruby gem hitch to manage pairing. You set it up with a group email address (e.g. `dev@mycompany.com`) and then tell it who is pairing:               $ hitch james tiffany      Hitch then sets your Git author configuration so that our commits look like               commit 629dbd4739eaa91a720dd432c7a8e6e1a511cb2d     Author: James and Tiffany <dev+james+tiffany@mycompany.com>     Date:   Thu Oct 31 13:59:05 2013 -0700      Unfortunately, we've only been able to come up with two options:   1. `dev@mycompany.com` doesn't exist. The downside is that if Travis CI tries to notify us that we broke the build, we don't see it.   2. `Dev@mycompany.com` does exist and forwards to all the developers. Now the downside is that _everyone_ gets spammed with every broken build by every pair. We have too many possible pair to do any of the following:   1. set up actual `pair-james-tiffany@mycompany.com` email addresses or groups (n^2 email addresses)   2. set up forwarding rules for `dev+james+tiffany@mycompany.com` (n^2 forwarding rules)   3. set up forwarding rules for `james+tiffany@mycompany.com` (n forwarding rules for each of n developers) Does anyone have a system that works for them? ## EDIT I obviously missed a very important piece: we use GMail Business for all our company mail. We can add and remove users and groups, and users can create filters, but we don't have control over the MTA itself.


Python scripts link to GUI using an IDE

I am studying python. Now I can write python scripts(codes) to some extent. I am interested in making GUI to those written programs.I like to do it using an IDE rather than using PyGTK or Tkinter. Can anyone help me how to start with this and link my scripts to a GUI. I downloaded a IDE called "glade". But I don't know how to use this IDE. I need some tutorial guide also. Can anyone help me.Please.Thank you!


70-506 - Silverlight Certification

I'm looking at the description for the 70-506 exam, and it looks like it doesn't count towards any MCPD exam. Is this correct, or am I looking at this incorrect? This is what I'm looking at: http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-506&locale=en-us


Upgrading from XP Pro to Win 7, anything I should worry about?

I do mainly .NET work so I assume that the framework is all fine and that. But have there been reports of various tools like .NET Reflector and the like not working properly with Win 7? This is a company-wide thing so there isn't much I can do about it, but once everything is reinstalled I'm hoping to not find anything shocking. Cheers.


Random number for HTTPS MAC

Recently I found that Netscape used quite simple algorithm to generate random number for Message Authentication Code to establish an HTTPS connection (Nestscpe used time, process identification number, and parent-process identification number). So now I wonder what source of seed do modern browsers use to guarantee true randomness?


Is it common to have downtime at a programming job?

At my company, I find that there are some days that there are very few tasks to do. I make it a point to do research to learn new things about my craft on these days. I would say that on average, I have about one day per week that there is not much to do (or some combination of time over the week). I would like to know if this is a common situation in software development environments, and does the answer to this question vary between full-time and contract work.


My coworker is a nice guy, but his performance is sub-par. Do I tell my boss?

I was placed on a project about three months ago that was until then under development by a single, newly hired developer because it was falling behind. To be fair, the project is an interface to a medical device that has a lot of subtleties and is relatively complex, so placing one person on the project who had no experience at the company was probably a bad decision from a managerial perspective. Anyway, once I started working on it I realized that... well, it just didn't work at all. The UI looked nice, but it didn't actually do much of anything, and what it did do it was doing incorrectly. Again, to be fair, much of this was due to the fact that this developer was not properly prepared to write an interface to our device. However, I also quickly realized that the code that was in place was brittle and extremely hard to maintain. Now I do not claim to be the best programmer in the world. I work with a lot of very smart people who are better developers than I. I do however try very hard to write code that is as simple as it can be and robust. I test my checkins. If I see that my code is getting messy and hard to work with early on I change it. I have had a few talks with my coworker in an attempt to help him write better code. This is a bit tricky because a) he has 20+ years of experience in the field and I have only 5, and b) he was hired as a so-called "UX expert" and others view him as an experienced individual. That said, I just don't see it. He is a very nice guy and he is reasonable, yet time after time he checks in code that is fragile, works only in the most optimistic of cases, and 9 times out of 10 I end up fixing bugs in his work. His code just seems amateurish and he obviously doesn't have the level of experience that he claimed to have when he was hired. It has come to the point where the extra hours I spend refactoring his code and fixing his bugs have taken a toll on me. The way I see it I have two options:   1. Do nothing, bust my butt to make sure this product goes out on time and is robust and wait for him to fail in the future (I will not be working with him on this project after the initial release.)   2. Tell my boss about his performance. My boss is a reasonable man, but I just feel awkward taking this approach. I don't like to 'bash' (for lack of a better term) my coworkers and I don't know how he will take it. So, that's about it. I have tried to work through this with my coworker by explaining why his implementation won't work or how his code could be made to be more maintainable, but he continues to make the same mistakes. I'm very interested to hear how others have handled similar situations, especially people in management currently. Thanks in advance for any advice you can offer to me.


How to brush up on general CS knowledge?

Just a heads up: this will be a repost from stackoverflow. As a person who's going to graduate very soon from the university (and who didn't always pay enough attention to what the teacher said) I decided to brush up my "university" CS knowledge (i.e. it's been 3 years since I took my Operating Systems course). I'd like to revise everything (or at least the important stuff) I learned in the past 5 years or so. The problem is that I don't really need to go through all the presentations/lectures I was given during my courses, since I already know most of that stuff and they tend to be rather lengthy and very detailed. Therefore I'm looking for a book/set of books/presentations that would, very briefly revise all the common CS problems. You know starting with the basics (the definition of an algorithm) and then moving to other topics like algorithms and data structures, programming, databases, networks, operating systems, numerical analysis, probability. Are there any such materials out there? I tried googling but I always end up finding rather detailed stuff. Obviously it won't be a 10 pages long booklet, but I'm not really looking for a set of 10 books each 1200pages long neither.


Slugify via helper or store slug on database?

I have a simple question: **Slugify via helper or store theslug on database?** I mean, let's suppose that I have `Guilherme Oderdenge` on database and I want to transform it into a human-readable URL such as `http://myapp.com/guilherme- oderdenge/`, what's the best way to perform this? Storing `guilherme- oderdenge` in the database or transforming `Guilherme Oderdenge` in a slug with a helper like `user.name.slugify`? I know there are some ways to reach the expected result, but which one is better? Or at least there is a better way? ### It depends of the technology that you're using -   I'm using Ruby On Rails with MySQL.


How to structure unit tests for a GUI app using C# and NUnit

I've been asked to do a small side-project to supply a simple application to one of our customers. Normally I would be working on back-end code where I have all of my testing needs figured out, and I've not yet had the dubious pleasure of writing tests for the GUI, so it's a little unclear to me how I should set up the testing code and tools for an EXE. My first instinct was to simply include the tests with the application code, however that would require supplying a number of test-specific dependencies, which I have been instructed to specifically not ship to the customer. I am also unable to squeeze out any cash for a purpose built test tool, so I need to use the tools I have at hand ( ** _StoryQ_** , **_RhinoMocks_** , and **_NUnit_** ), which really should be more than enough to test the behavior of a simple GUI app. So as far as I can see, this leaves me with trying to strike a good balance between keeping the design really simple, or purposefully over- engineering for the sake of the tests. It seems I'm either building the app with the business logic in a separate library and testing against the library as I usually would, or finding some other mechanism to allow me to the executable without breaking out additional modules that the application design doesn't really need. **Edit:**   Please note that this question is about how to structure the relationship between NUnit and my executable - as opposed to a DLL - and not about how to separate presentation and business logic.   **/Edit** So my question is:   1. Is there a specific/recommended method for configuring a simple GUI application with unit tests to allow me to adequately check state and behavior, using the tools I have at hand, and without resorting to over-engineering?    2. Have I missed something fundamental about the way NUnit should be invoked/configured when testing an EXE (as opposed to a DLL)?    3. Can you provide or point me in the direction of examples of how achieve all of this? I realize that there may be more than one way to do this so I'm looking for specific implementation guidelines based on your experience.


A bit of a blast from the past: Can RMI or CORBA operate over IP?

Question: **Can RMI or CORBA operate over IP?** _I don't think RMI can - does it not operate over IIOP?_


How to score a software architecture?

When discussing different architectural styles such as 3-tier, CQRS & co. you hear a variety of reasons why X is better than Y. Besides the fact that _better_ is never absolute but depends on the actual context, the arguments often are nothing but gut feelings (or _intuition_ , to use a more professionally sounding word). Now I was wondering how to actually score a software architecture professionally. I guess that I am not the first person on this planet who thinks about evaluating different architectures and comparing them. So what should I watch out for to get a feeling which architecture is better or worse suited for my specific case? This morning I though about it for a while and I came up with a variety of questions that help me. So far I have got the following items on my list:   * How testable is an architecture (tightly integrated systems are harder to test than loosely coupled ones, and some architecture support their own style of testing)?   * How much decoupling and cohesion does an architecture favor (decoupling is usually better than tight coupling, strong cohesion is usually better than loose cohesion)?   * How well does it scale (it should work in the small, but without any changes as well in the large)?   * How does the architecture influence performance (some architectural styles may come with performance benefits / penalties in specific areas)?   * How large are the things I need to change when requirements change (the less I need to change the better)?   * How extendable is it (an extendable system has pre-defined extension points and concepts for extension)?   * How well does it integrate with 3rd-party software (a good architecture is open to being connected to other system)?   * How does it respond to faults (fault tolerance and error handling are ideally already conceptually integrated)?   * How reliable is it (the system should survive outages, crashes, …)?   * How does the architecture behave with respect to the CAP theorem (at least if it's a distributed application, you may have a variety of focuses)?   * How understandable is it (the less I need to explain to someone new to the architecture, the better, in other words: strive for simplicity)?   * How well is it documented (a well-known and established solution is better than a newcomer)?   * How big is the community around it (a large community makes it easier to find people to work with, trainers, …)? What do you think of this list? Are these questions reasonable? What is missing? Or is my approach completely wrong?


Code Alteration During Runtime

Since Javascript is an interpreted language, entire functions can be changed during runtime. I have recently been contemplating a framework that would allow for dynamic code changes (such as UI plugins) to take effect without having to reload the page, while still providing enough information to undo the change if desired. I have begun to test this concept with small examples with success, but have not had the chance to test the idea for anything useful. Is there any common adverse side effects to changing code during runtime or is it considered bad practice?


Ledger or log design for a point-based system?

Right now creating a new service that will integrate into our company's existing platform. The service will be responsible for tracking "points" that a user can generate over time through certain activities. I am caught between two different methods of approach. I'm not sure whether to choose one of the following structures to continually manage points:   1. Create a "log" of points and instead keep one running total in the database, like a key/value field, where the value is the current points balance that is simply adjusted during each transaction.   2. Create a "ledger" system where each time the points are recalculated after a certain condition, but the _entire_ ledger is assessed to determine the most up-to-date points balance. Don't think it's relevant, but the backend DB is Riak. Which has the least drawbacks, or is there a better way? How does the StackExchange point system work in relation to the above? Many thanks for the input!


How do I write unit tests for robots (and other mechanical devices)?

I'm a member of my high school's robotics club, and am responsible for programming the robot. One suggestion I keep hearing from various adults is that I should be writing unit tests to help validate my code. The code base is getting a bit big, and I do agree that unit tests would be really helpful in helping me catch bugs quicker. However, I'm not entirely sure how I could accomplish this. To the best of my knowledge, unit testing is done by taking a function (or a subsystem of the code) and feeding it a set of input to make sure it comes out with the same output each time. The code that I currently have doesn't do any heavy data crunching, but rather directly manipulates the hardware components on the robot. Most of the complexity comes from making sure that the electronics are sound, that the code at the moment matches the actual hardware on the robot, etc. Often times, I can only see if there's a problem by loading the code to the robot itself, and attempting to run it. By extension, how can unit tests be written for code meant to operate any mechanical device? It seems to me that you can only catch errors by physically observing the operation of the machine. Or am I just misunderstanding how unit tests should work? ( _If it matters, here's thecode, it's written in C++, and I'm participating in FRC_)


Pseudocode for Appel's algorithm implementation

I'm trying to implement the version of Appel's algorithm for vector hidden line removal (i.e. I'd like to avoid any form of rasterization). I found the description of this algorithm here - http://wheger.tripod.com/vhl/vhl.htm but it doesn't mention how to actually deal with implementation and I'm having a difficulty with this... To be more precise - how can I write a code (well, even at least pseudocode) that in result will yield that "All the faces are subdivided into subfaces such that all points in the interior of this subface are either front facing or back facing"? And - "Hence when traversing an edge segment, the visibility increments when going under a body and decrements when coming out from underneath" - do I have to simulate "traversing" an edge? What is the idea in implementation that lays behind it? And, basically, this description is a bit overwhelming for me since it has scant images and pseudocodes so if you can share with me any of those, I'll be very grateful.


Can you change a license once you pick one?

I am working on a product that I don't feel is completely ready but I have a set of users that are very interested in using it now as "alpha" testers. I would like to give them the product now for free as "alpha" testers, but I would like to later license the software. Is this possible? Can anyone point me to any links/books/articles/etc? Thanks. **EDIT:** Due to the lack of my clarity and the reponses to the question I thought I should add this statement. I haven't decided if I am going to close-source or open-source this project yet. The user base that wants to get their hands on it now has kind of surprised me and I was concerned about what my options are as far as being able to give it to them now as open-source and later change to closed-source, or even vice versa. Thanks to everyone who has answered and commented. I appreciate it the insights.


What are the advantages of expressing information in the simplest possible format?

I want to apologize in advance if my headline is not specific enough, but I think this is a general question, although I have a very concrete example: In my team we maintain a test specification which we use every time we release software. The specification is written in Word and, as a consequence, we occasionally have compatibility problems, wrong formatting in some parts of the document and sometimes people use the heading levels incorrectly. Nothing major, but annoyances none the less. But essentially our specification consists of test cases which can be described simply as a headline with some numbered instructions. I think we would be a lot happier with using a lightweight markup language (e.g. AsciiDoc or Markdown) since it would be sufficient to describe the content. We would have other concrete benefits (add it to git, use diff tools, easily convert to other formats, not needing Word). This made me think - are there any advantages, in general terms, to expressing information in the simplest possible format?


How to set up a distributed version control that can commit to subversion

We have a trac server setup that works with the svn commits, so we can do things like "fixed #183" in the commit messages, and reference the changes involved. Right now I have eclipse with subclipse + trac plugins, and it works pretty well. But **I don't have internet all the time** and it becomes very difficult to commit to an inaccessible svn server. I would like to use some type of local repository for commits, and then push commits all at once, but individually to server. **Changing svn / trac isn't an option at this time**. Other developers can touch the svn server directly. Is there a way to cache the commits locally, and then send them when I have internet again? Take in mind that I can't just do one big commit of all my changes because it makes it a nightmare since I can't selectively merge. Basically is there **a way to do this with git/bzr/mercurialand still use svn/trac** as intended? I'd be willing to do some scripting, but I don't know where to start.


Multiple Display of a Document and persist each viewer change in a single document

i have a scenario where i have to make available a document for viewing and editing to multiple users, the users can edit and view the document at the same time. Now the problem arises here if for example user A and user B are viewing a document at the same time and if both the user change the state of the document and user A saves it at x instant of time and user B saves it at y instant of time where y>z in the time dimension. The changes by the user A will be overridden by changes made by the user B. Possible solutions that i have in mind (1) i'll keep a bit e.g. isViewedCurrently and only allow a single user to view/edit the document, (2) save changes of every user separately and then appoint a role who will merge those changes (impractical) please suggest some solution that i can implement, can anyone explain how google does it, the google docs are shared, viewed and edit by multiple users and changes of each user is persisted. im using SQL server 2008 R2 for persisting the application data. EDIT: google has implemented an editing surface from scratch and that too in JavaScript http://googledocs.blogspot.com/2010/05/whats-different-about-new-google- docs.html#!/2010/05/whats-different-about-new-google-docs.html http://googledocs.blogspot.com/2010/05/whats-different-about-new-google- docs.html#!/2010/05/whats-different-about-new-google-docs.html