what to do when UX asks for an ugly, convoluted event driven design and you don't know how to implement it in a clean manner?

I have been tasked with creating a desktop client application that fetches data from web apis and presents it to the user. During the last month or so, I've spent most of my time and energy bringing to life the functionality that UX described with two pictures. Looking at the pictures, it seems like a simple design. There are only 4 controls: One drop down list that fires a selection event. Another drop down list that is populated based on selected data from the first drop down list and also fires a selection event. Two radio controls that enable or disable the second drop down list. A third drop down list that, depending on which radio button was last selected, is populated with data based on either the first drop down list or the second drop down list. Doesn't seem hard. But then when I actually start implementing this design I find that I don't know, for example, what to do with if the user selects radio button B (which is supposed to enable the second drop down list) but the drop down list has no elements; in that case, do I force the first radio button A to be reselected? Do I display an error message? Do I prompt the user for action? It's these little 'corner' cases that don't necessarily jump at the people who request these designs that make me wonder if I'm in the wrong line of business or if I'm stuck working with people who don't have a clear picture of what they want or don't really know what they want but expect me to fill in the dots without actually doing the UX design myself. UX is about enhancing the user's experience, not the programmer's experience, I get it, but is this the kind of input that programmers are typically expected to receive from UX? Are programmers always expected to fill in the dots, even when the proper behavior hasn't been explicitly stated?


Real-time Dataflow Programming

## Background Recently, I have been fascinated about the possibilities of dataflow-based programming approaches - in particular, signal/event-based concepts as realized by functional reactive programming, Boost::Dataflow::Signals, and the like. ## Sample scenario: Consider a car that has four speed sensors, one at each of its tires. Let's simplify things and say that these sensors are analog sensors providing the measured speed at that tire. The car further has individual brakes on the four tires (the actuators) that one can program to break more or less strongly. There is no concrete task, but imagine having to realize things like detecting tires not turning due to aqua-planing, or ABS-support, or or or... In short: you have to evaluate the speed sensor data and control the actuators according to some logic. From a programming point of view, one could think of realizing this via a signal-network of the following sort:               timer ------------\     sensor1/2/3/4 -> logic -> brakes1/2/3/4      (That is, the timer triggers the logic, which takes the latest analog values of the sensors) Like this, the timer can be programmed to trigger in fixed intervals (especially important to ensure the real-time constraints). The advantage of the dataflow-approach here is that the above diagram is directly realized in the code, i.e. you have a logical wiring of signals and just need to provide an implementation that turns your actual hardward sensor's data into a signal (of the corresponding library you are using). When it comes to real-time requirements, the maximal signal path length can also be computed (or at least more easily derived from the source). ## The question Of course, all of this is just an application idea and I am sure several brilliant people have come up with this before. What I am looking for is the follow-up. Are there any hard problems with this scenario which make it unrealizable in practice? Are there experiences from real-world projects on following such a line of thought? Is there even existing literature on this? To make things clearer and more objective, I am looking for an answer that either shows an inherent fault in my line of thinking or provides reference to existing work/literature along with evaluations. Bonus points if real-time constraints are taken into account.


Copyright in a database schema using a licenced windows application

I work for a company that has bought a licence for a windows client software that allows only 20 running clients per company. I am trying to find a way around this 20 user restriction by programming a PHP web front end that connects to the existing database. This will allow unlimited users to access the database. The problem I have is that the licence states that no CRM type interface is allowed to be used with the package. Since I will not be using the windows binary in any way, what is to stop me from studying the database schema and developing my own front end? I would have thought that a schema that uses common tables, for example, customer addresses, materials, parts, orders etc could not be copyrighted by law otherwise a single company could have a monopoly over it. What makes a database general or distinct enough to warrant copyright? Any thoughts on this?


Is it a deal breaker if the HR person asks programming questions during an interview?

The title pretty much says it all, but the longer story is: I went to a job interview last year for a junior tester position. The first interview was with a person from HR. This is weird, in my opinion the technical interview should come first. We started talking HR specific stuff and some details about the company/job/etc. Then, out of the blue, she just started asking me very general and easy questions about object-oriented programming. Things like what is a class, what is inheritance, what's the difference between overriding and overloading blabla. Now, maybe it makes business sense to make the people in HR memorize some programming questions and answers in order to screen out completely idiot applicants. However, there are a few important setbacks about this:   * most of the time, the HR person will have absolutely no idea what he/she or the applicant are talking about at that moment. So if the applicant's correct answer differs from the one he/she memorized (which it probably will), then he/she will wrongfully consider (with very high probability) that the applicant has no idea about OOP.   * why not just have a senior developer do phone screening instead ? Seems much more effective (and also cheaper).   * my CV was pretty complete, it contained all my relevant skills and projects. Did he/she even bother read it ? Or, if he/she did read it, does he/she just assume that every applicant is lying on their CV ? In that case, why should I ever bother putting one together and sending it to them ? All this definitely raised some red flags in my mind for the reasons mentioned in the list above. We did not move forward for second and/or 3rd interview (the reason for this is irrelevant), but **is it reasonable to consider this a deal-breaker ?**


A good way to share knowledge of a new technology with team members when time is short?

We've been having constant requirement changes of having to choose which graphic rendering library to use for our project. In a team of about 10 members, two of us are exploring the new graphic library. The team lead expects that we learn what's necessary within 2 days and introduce it to the rest of the team ( _wants the two of us to give a value-add to the other teams by introducing it to them so they won't be lost_ ). We've told him that 2 days is ridiculous, so he asked us to give him our plan. We've already lost a few months in exploring some other graphic libraries, so the project is behind schedule. The other team members are developing algorithms that will make calls to the graphic library. They'll have to write some code using the graphic library too. In such a situation, what is a good way to share knowledge?   * Have brainstorming sessions everyday for an hour where they tell us their algorithm interfaces and we tell them the graphic library interfaces which they can use?   * Give them a short overview of the skeleton of how their interfaces would fit in with ours and let them figure out the graphic library code for themselves?   * Any other ways?


How to maintain a forked git repo with feature branches that upstream won't pull?

So here's a typical workflow on Github...   1. Like some project `->` fork it `->` `git clone https://github.com/you/someproject`.   2. Open project. Like what you see, but make some changes.    3. Having been careful to work only in a `feature-branch` (`git checkout -b some-feature`), you decide to make a pull request with the `upstream` maintainer - after having pushed your `feature-branch` to your Github fork.   4. Maintainer, for whatever reason, declines the pull. For example.. here is a failed pull request that I submitted that matches the above scenario... Now _typically_ , if the maintainer _HAD merged_ the pull... the workflow would be simple... On my local machine, I would commit any local changes on whatever `feature-branch` I was on at the time... `git fetch --all`, `git checkout master`, `git pull upstream --ff-only`. Then replay my changes on top of that, as desired... BUT... What if I decide that you want to continue working off the changes to my fork, regrdless... yet still want to be able to track + merge changes that happen `upstream`? Ordinarily, I would delete the feature branch, and go on my way.. How can you maintain a `master` branch that is able to be merged upstream, yet maintains your fork's features while being "permanently detached" from `upstream`'s `HEAD`?


Any suggestions how it would be good to promote software in a small company ?

Ok, I know if I am Red hat or other giant and offer some support etc. I can be profitable, in fact, Red Hat is doing quite well. However, what about a small company where I create a small program. e.g. an instant messenger for a windows or linux (just as an illustration) and I want to sell it. But how can I sell it if it is free and everybody can download it? Any advice? I like the idea of FSF by Richard Stallman, however I am missing the way how to sell my software under GNU/GPL licence. Any advice, how can I solve this problem? Any profitable small business software developers around with their opinion? Any links or names of small companies taht I can look at and study their model of business?


What to call requirements that are "assumed"/"invisible"/"very obvious"

I'm looking for an umbrella term for all the nitty-gritty requirements that it's helpful to have specified up front but which the client never thinks about in his excitement about the product. In the client's mind, they think of the headline requirements, the main user stories such as "I need to be able to view the status of all equipment" and "I need to receive automatically any notification equipment failure". But at times the mundane ones are there but the client never mentions them until the result differs from his unspoken expectations: "Well _of course_ a user must be able to change his own password" and " _Of course_ the user's session must time out after 30 mins" Any development team can anticipate what's likely to be needed but is there a name for this category of requirements? Obvious/infrastructural/boring/details?


Animation in Swing

I have a project written using Swing, and I want to make it more smoothly (like JavaFX is) by adding animation to some components(`JButton`, `JScrollPane`, `JSplitPane`) using `javax.swing.Timer`. **UPD:** That is not a game. I want to use the Timer for short animations like mouseHover events or dropdown, or scroll. But the problem is, a lot of Timer objects should be created. **Question:** What action does it perform for JVM? I would start and stop a lot of Timers during app session.


What are the key factors in choosing a Mocking Framework?

I'm looking to get started with objects in my unit tests. It seems there are tons of good mocking frameworks out there.   1. Do the different frameworks have different target audiences?    2. What factors should I consider when choosing which framework is right for my situation?


Are there any concerns with one user mapping a TFS project to two directories?

I'm planning to map some of my TFS projects to two different directories as discussed here. I'll be using two different workspaces, both with the same Computer and the same Owner. Is there any reason why this would be a bad idea? Are there any complications with merging or locks that one user with two mappings would run into, that are different from the normal complications that two users checking out a project run into? Basically, I want to keep all of my projects on a shared drive, all mapped to TFS, but then have additional second local mappings for the few projects I'm most actively working so that Visual Studio is faster. I'm using VS 2010 with the TFS Power Tools Extension.


I need to create an employee schedule/appointments program, but I don't know how to set it up

I work for a gym. I am the programmer, its just me, nobody else! Gets really frustrating when there's nobody to bounce conceptual ideas off of. I'm getting rid of our archaic paper binder systems for tracking appointments and what not. I've made a lot of things successfully already, now I'm trying to tackle the personal training department. What I want:   * Trainer information and work schedule   * Appointment booking that can be done by time slot with all available trainers for that time, or by trainer with all available hours for that trainer What I've tried so far:   * I started with an 'appointments' database, a 'trainers' database, and a 'schedules' database. This became so complicated trying to fit the schedule in that I scrapped it. Does anyone know know the best way to structure the tables for this and how to sort of make them communicate correctly? I don't need specific code, I just need help understand _how_ to make this thing!


How can I convince my managers to enforce documentation standards?

I'm trying to convince another group in my company— that's about to hand code off to my group—that they need to provide more documentation in their source code, but they're treating it as a "nice to have". In my view, it's a necessity. Of course, I also support intuitive naming conventions, but I think I'll have less difficulty getting the original authors to add comments than I would getting them to rename their functions and variables. I've run a source code analysis tool and it's showing about 10% comment line, but looking at the source code, most of that is coming from entire functions that the author has commented out. How can I convince my managers to enforce documentation standards on this other team? Have there been studies or work done to prove that code documentation increases profitability or productivity?


Redex and reduction strategies

I'm studying Types and Programming Languages, and have some trouble getting my head around the concepts of the 5th chapter, _The Untyped Lambda Calculus_. Specifically, _redex_ , _reduction_ and the various evaluation strategies are doing my head in. The following is what I understand put into my own words, in an attempt to explain things to myself and get more knowledgeable people to correct my mistakes / imprecisions. I am honestly unsure as to whether this is an acceptable format for stackexchange, and am open to suggestions to make this a better fit. Note that others have tried to answer a very similar question, but have still left me confused:   * Call by value in the lambda calculus   * Untyped lambda calculus: Why is call-by-value strict? ## Redex If my understanding is correct, a _redex_ is a reducible expression, that is, the application of a lambda term to a lambda abstraction. Or, more concretely, a redex is always of the form `(λx.s)t`. ## Redex reduction Reducing `(λx.s)t` is done by replacing all free occurrences of `x` in `s` by `t`. For example:               (λx.x + 2) 1     → 1 + 2     → 3      The process of reducing a lambda expression to its normal form is driven by an evaluation strategy: an algorithm for picking which redex to reduce first. In order to describe these however, we need some more vocabulary. ## Redex qualifications ### Leftmost and rightmost   * the _leftmost redex_ is the one whose abstraction is textually to the left of all other redexes.   * the _rightmost redex_ is the one whose abstraction is textually to the right of all other redexes. So, for example, in `(λx.x + 2) (λy.y + 1)`, we have:   * leftmost redex: `λx.x + 2`   * rightmost redex: `λy.y + 1` There can only be one leftmost and one rightmost redex in a given expression. I'm assuming that in an expression composed of a single redex, that redex is both the leftmost and the rightmost. ### Innermost and outermost   * an _innermost redex_ is one that contains no other redex.   * an _outermost redex_ is one that is contained within no other redex. So, for example, in `(λx.(λy.y + 1) x) 2`, we have:   * innermost: `λy.y + 1`, as it contains no other redex.   * outermost: `λx.[...]`, as it isn't contained in any other redex. I'm assuming that in an expression composed of a single redex, that redex is both outermost and innermost. ## Evaluation strategies Having defined this, we can talk about the two evaluation strategies that I'm struggling with: _call by name_ and _call by value_. ### Call by name In _call by name_ , the leftmost outermost redex is always picked for reduction. Additionally, no reduction can occur within a lambda abstraction. The example given by _Types and Programming Languages_ is:               id (id (λz. id z)) # the leftmost, outermost redex is the very first id     → id (λz. id z)    # the leftmost, outermost redex is still the first id     → λz. id z         # there is no outermost redex remaining, we're done.      I do not understand the need for the definition of the strategy to include _no reduction can occur within a lambda abstraction_ : is that not implied by the fact that only outermost redexes are eligible for reduction? ### Call by value In _call by value_ the rightmost outermost redex is always picked for reduction. The example given by _Types and Programming Languages_ is:               id (id (λz. id z)) # the rightmost, outermost redex is the second id     → id (λz. id z)    # the rightmost, outermost redex is the first id                        # (it's textualy on the left, but there is no redex to its right)     → λz. id z         # the only remaining redex is not outermost (it's contained within                        # an abstraction) and cannot be reduced.


Is there a correlation between complexity and reachability?

I've been studying cyclomatic complexity (McCabe) and reachability of software at uni recently. Today my lecturer said that there's no correlation between the two metrics, but is this really the case? I'd think there would definitely be _some_ correlation, as less complex programs (from the scant few we've looked at) seem to have 'better' results in terms of reachability. Does anyone know of any attempt to look at the two metrics together, and if not, what would be a good place to find data on both complexity and reachability for a large(ish) number of programs?


How to sell Agile development to (waterfall) clients

Our development shop would really like to do more agile projects but we have a problem getting clients on board. Many clients want a budget and a deadline. It's hard to sell a client on an agile project when our competitors do come up with waterfall-based fixed deadlines and fixed prices. We know their fixed numbers are bad, but the client doesn't know that. So, we end up looking bad to the client because we can't fix the price or a deadline but our competitors can. So, how can you get your sales force to successfully sell a project that uses agile development methods, or a product that is developed using such methods? All the information I found seems to focus on project management and developers.


What are the basic skills a beginner JavaScript programmer should have?

In NYC, we are working on creating a collaborative community programming environment and trying to segment out software engineers into differing buckets. At present, we are trying to define:   * Beginners   * Intermediates   * Advanced   * Experts (and/or Masters) Similar to an apprenticeship, you would need to demonstrate specific skills to achieve different levels. Right now, we have identified beginner programming skills as:   * Object - method, attributes, inheritance   * Variable - math, string, array, boolean - all are objects   * Basic arithmetic functions - precedence of functions   * String manipulation   * Looping - flow control   * Conditionals - boolean algebra This is a first attempt, and it is a challenge since we know the natural tension between programming and software engineering. How would you create such a skills-based ranking for JavaScript in this manner? For example, what would be the beginner JavaScript skills that you would need to have to advance to the intermediate training? And so on.


Microsoft Certified Solution Developer with .net Framework 4?

So I am confused when it comes to the .net framework 4. Is there a Microsoft Certified Solution Developer for .net framework 4? The Visual Studio 2010 Certifications Paths seemms to highlight MCPD 70-519 for one, which does not have pre reqs... Have I gotten it wrong? Is there still Microsoft Certified Solution Developer? and the Microsoft Certified Solution Developer Enterprise?


Prerequisites to compiler theory?

It's not meant to be subjective or get advice on what would be the best path to take, but an objective list of things that must be known in order for me to pick up a book on compiler theory and understand it. What level of mathematics, and related skills are required?


Ruby on Rails - branding

I am working on a website, which is to have multiple brands. The core functionality for all brands will be the same, however there will be a number of differences between them. Those differences may appear, obviously, in assets, models, views or settings. One example would be that one brand will have one extra field for one of our models. This means that we need to have an extra database column for this brand only, together with proper validations within the model and modified view. The question is, what would be the best way to implement this? There is a number of ways we can think of, none of them is perfect:   1. Conditionals (previous implementation): at the application start, set the global variable called `BRAND` and then fork our logic depending on that constant. This obviously is not what we are looking for, as it will clutter the code terribly as we are planning to have a large number of brands.   2. Load path precedence (current implementation): We can have one folder with core functionalities and another with brand specific overrides. On the application start we can prepend load paths with brand-specific folder path. This way it will always try to load brand-specific models and fall back onto core if none are defined there. The downside of this approach is that we need to duplicate each file we want to modify for given brand. So if we want to add an extra field to the brand, we need to copy the core view to the brand folder and modify it there. If at any point we would like to change the core view, this change needs to be added to this branded view as well manually.   3. Using git branches (proposed): The core implementation sits on git master branch and each brand occupies its own branch. Then any brand specific changes are committed to underlying brand branch. If we need to modify all the brands, we modify master branch and then we merge this change to all brands. Downside: for a large number of brands merging this change might be quite a long and conflict-prone process Are there any other ways to implement flexible branding for ruby on rails application? I am definitively in favour of the git option - are there any obvious `no-no`s for this solution?


How can I limit access for automatically generated files to specific users in a MVC setup?

I have a typical MVC based website, and I'd like to give some registered users the abillity to extract data from the database (in a variety of formats). The workflow is very simple:   * User logs in,   * User clicks export,   * A file is generated,   * User downloads the file. I'm trying to figure out a way to secure the last step and limit access to the file. In order for the user to be able to download the file, it should be in a publicly accessible folder. That, however, means that the file is accesible to everyone else that has access to its full url. I thought of a few possible solutions:   1. Email the export file Instead of having the user download the file, I could simply email it to their email (the one they used to register on the site). This seems like a decent option when the export files are small, but I don't think it'll be optimal for larger files.   2. .htaccess magic I could automagically generate an .htaccess in the export dir that would only let the user who requested the export access it. Also a decent option, but it's webserver specific and IP based. I don't know if Apache will always be the webserver of choice for the project, and I'm not sure an IP based solution is actually secure.   3. Store the export file in a private folder and have the user fetch it through ftp Secure, but not particularly user friendly. All my options seem to have problems, and I'm at that point where I'm completely stuck and can't shake the feeling I'm missing something obvious. Am I? Is there a better workflow? I'm more interested in a high level overview than technical details, the project is still in its early days and technical requirements haven't yet stabilized (e.g. we may not use Apache after all). The project is build in PHP, but I don't think that matters (does it?). Thanks.


Demoing Project

I'm an undergraduate student studying computer science. I have been working at a company as a student researcher and next week I am to demo my complete project to my boss and the other developers. It is the most complex and largest program I have developed. My questions are: What is the most effective way to demo? Are there any good articles concerning this issue? What are key points to show? How do you do demo? I began this project before I knew much of TDD so it was not developed this way. Most of my testing/validation was done as I wrote the program with print statements and myself just verifying results. I will want to prove the program works and based on my testing it is bug free. My only proof really is it does what it should do... This is a little disconcerting for me. Any question answers, comments, suggestions, links and all else greatly appreciated. Thank you!


Is it a bad idea to sell Android apps in the Android Market under your real name?

I'm just getting started in Android development and am working on a few small "practice" apps. As an example, one is a live wallpaper. The others are similar in terms of development effort. When these apps are done I would like to list them in the market. I may list them for free (or maybe not), and they're simple apps, but if things go smoothly I may try to build and sell larger and more ambitious projects in the future. My question is **is it wise to sell apps in the Android Market under my own name?** Looking around in the market, it seems almost everyone is selling under a company name, even if they're only a 1-2 man shop. I can definitely see the advantage of creating a company to sell my apps if they were big apps involving a team of people. But it seems like overkill to create a company, even if just in name and identity, just to list something like a live wallpaper. On the other hand, I don't want to expose myself to legal liability or other potential problems that I haven't foreseen. What's the best course of action here? For purposes of legal jurisdiction, I am in the United States. I understand that you are not my lawyer and answers are not legal advice. **Edit for clarification:** Just to be clear, what I want to ask is less about the advantages of forming a company, and more about potential dangers of _not_ forming one. In other words, are there likely to be situations where I'm beating myself up and saying "Oh, if only I had formed a company instead of listing this is as a personal project!".


What are the negatives of Development Managers as Scrum Masters?

It is commonly agreed that team managers should not be scrum masters, but I am struggling to see why. For context, I am an Application Development Manager with 4 devs in a Scrum Team. I come from a Scrum Master background, and have introduced scrum to the organisation. I have built the team from scratch and made it clear that everything I do is to facilitate the team, and that they make the decisions. As a team we are very open - they even silenced me at stand-ups for a while to eliminate the 'reporting' feel we were starting to get. A lack of openness is generally the biggest argument against the manager as scrum master, but handled well, is easily overcome with the right culture. I've been warned by experienced scrum coaches that this is a dangerous situation, and there are risks 'if things go badly'. The way I see it the 2 positions do not conflict, in both roles I have the same aim for the team and individuals. Scrum resolves conflicts within the team, which could traditionally be a managers role. The self-managing nature of sprints takes away the allocation of work a manager would traditionally do. All I really see left to pick up as a dev manager is making sure individuals needs are met, career objectives, workplace etc. I have a weekly catch up with each team member to raise any issues, and handle any admin tasks. A lot of this relates directly to the team, or my role as scrum master anyway. I understand in large organisations how this could be unmanageable and a separate role but for a small organisation we could certainly not justify another Scrum Master or Development Manager. Please enlighten me as to the pitfalls of Development Managers as Scrum Masters, excluding the points I raised above and have already overcome.


What the best way to wire up Entity Framework database context (model) to ViewModel in MVVM WPF?

As in the question above: What the best way to wire up Entity Framework database model (context) to viewModel in MVVM (WPF)? I am learning MVVM pattern in WPF, alot of examples shows how to implement model to viewModel, but models in that examples are just simple classes, I want to use MVVM together with entity framework model (base first approach). Whats the best way to wire model to viewModel. Thanks for answers.               //ctor of ViewModel      public ViewModel()     {      db = new PackageShipmentDBEntities(); // Entity Framework generated class          ListaZBazy = new ObservableCollection<Pack>(db.Packs.Where(w => w.IsSent == false));      }      This is my usual ctor of ViewModel, think there is a better way, I was reading about repository pattern, not sure if I can adapt this to WPF MVVM


Sharing source code of my online game?

So one of my long-standing projects is an online fan-game that's been running for a good four years now, and is at least somewhat well-known among the related community. To give you an idea, Alexa ranks my online game higher than the official website for the franchise my game is based on. One thing I've been wondering is, would it be a good idea to make the game's source code publicly viewable? The reasoning for the idea is that this will allow the more programmer- oriented people in the community discover how the game works internally, and research certain features to determine possible outcomes of events, and share this knowledge with other users. For instance, they would be able to discover the exact chances of various treasures appearing in Chests, rather than just having a statistical analysis. Major reasoning against it is "people can copy it", but honestly there are already copycat sites out there and many of them fall flat on their face simply because they try to be my game and either just don't get any attention in the first place, or get called out on being a rip-off by other members of the community. These two points have been like a see-saw in my mind, tipping back and forth between "I should totally do it" and "nowai, src iz myne!" (not really like that :p) So I was hoping that I might be able to get some advice here, perhaps someone else has been through this and might have seasoned advice to offer?


Updating GUI in 'realtime' using events

My Plan   * Have a system that holds some objects   * Have a winforms-form that displays some key values of these objects   * When certain changes occur(object gets add / removed / datat change): Update GUI My Idea   * subscribe my form to events in the objects   * update form when objects chamge (/raise events) My Troubles   * winforms (for good reasons) does not allow for changes coming from foreign threads   * an eventHandler is in fact run in the thread of the object calling   * hence .net throws an exception and I'm done. Question:   Is there a way to manipulate a form through events not raised by itself? Alternatively:   Is there a way I can "nudge" my form to say "hey, better check your data, there's something new", without having to constantly poll?


In C++ is casting to find bad pointers undefined behavior?

By accident I found that with a polymorphic type using dynamic_cast back to the derived class will throw a 'bad cast' error if the pointer is no longer valid. Is this undefined behavior or could this be a way to check for valid pointers without using smart pointers? I'm not really against using smart pointers as they serve a real need, but I dislike the syntax. I don't have anything against templated types but I find smart pointers to bloat the code and I'm not a fan of macro's to try and avoid that bloat. I wish C++ included something in the language syntax itself vs using the template feature **but with this question I'm more concerned about what is happening below and if this is a valid and defined way to checking for valid pointers as this gives an exception every time from my tests.**               #include <string>     #include <map>               using namespace std;          class Base     {     public:         virtual ~Base(){}     };          class Derived : public Base     {     public:         virtual ~Derived(){}     };          class Storage     {     private:         map<string, Base*> storage;     public:         void AddItem(string name, Base* base)         {             if (storage.find(name) == storage.end())             {                 storage[name] = base;             }         }              template <class T>         T& FindItem(string name)         {             if (storage.find(name) != storage.end())             {                 Base* item = storage[name];                      return dynamic_cast<T&>(*item);             }                  throw;         }     };          int main()     {         Storage store;              // force 'd' to go out of scope for our test         {             Derived d;                  store.AddItem("test", &d);         }              // this will throw a bad cast exception         Derived& test = store.FindItem<Derived>("test");                   return 0;     }


Import data and modify

I should build an importer in PHP. So below you can see how it should work or how it currently works. This is only a small example, the real importer is much bigger so the import() method is also very big :(               function import($src, $dest)      {         // Name         if(!$dest->nameFixed()) {             $dest->setName($src->getFirstName() . $src->getLastName());         }              // City         $city = City::searchByName($src->getCity());         if ($city instanceof City) {             $dest->setCityById($city);         } else {             $dest->setCity($src->getCity())         }              // Image         $now = new DateTime();         if ($src->getImage() && $now->diff($src->getBirthdate())->format('%y') >= 18) {             $image = myDowndloader::download($src->getImage());             $dest->setImage($image);         }              // Birthdate         $dest->setBirthdate($src->getBirthdate());         // ...     }      some ideas:               class Translate      {         protected $src  = NULL;         protected $dest = NULL;              public function __construct($src, $dest)          {             $this->src  = $src;             $this->dest = $dest;         }              public function importName()          {             if(!$this->dest->nameFixed()) {                 $this->dest->setName($this->src->getFirstName() . $this->src->getLastName());             }         }              public function importCity() {             $city = City::searchByName($this->src->getCity());             if ($city instanceof City) {                 $this->dest->setCity($city);             } else {                 $this->dest->setCity(City::createByName($this->src->getCity()));             }         }         // ...     }      or a little bit more fancy:               namespace Translate      {              class Abstract          {             protected $src  = NULL;             protected $dest = NULL;                  public function __construct($src, $dest) { ... }             abstract pubilc function import();         }                   class Name extends Abstract          {             public function import()              {                 if(!$this->dest->nameFixed()) {                     $this->dest->setName($this->src->getFirstName() . $this->src->getLastName());                 }             }             // ...         }          }      I'm not really happy with the examples above. The main problem is how to call the methods (1st solution) or create the Objects (2nd solution). One option is to get all methods or classes dynamicly by get_class_methods() and parse the method names for /import\w+/. But I'm not sure how performant this is. The other option is to call the methods staticly but there is also a danger to forgot a method to call...


How to implement only a part of an interface

When developing in OOP, sometimes an interface / contract is given by a library that you cannot alter. Let's call this interface J. Now you have an object of class A that consumes objects that implements this interface. Inside A only a small part of the interface's definitions are needed. Some of the object classes are created by me during the project (let's call one of them type D), so there's an overhead in the implementation of everything inside interface J. I want to implement a subset of the functionality in interface J, but my solutions so far do not satisfy me:   * implementing every aspect of J and then throwing "notImplementedExceptions" misinforms the user of my objects: it would seem my objects of type D do conform to interface J, but they don't - and other consumers of my objects (that accept objects implementing interface J) can't rely on the integrity of my objects.    * Implementing a newly defined interface prohibits me from using objects that implement only interface J, although interface J is fully compatible with my own interface.   * Letting my custom objects implement interface J would create significant overhead, because they don't need all this functionality. When I was able to alter interface J, I would create a "super-interface" K that had this subset of the functionality of interface J, and make interface J inherit from interface K. But I cannot alter interface J. What is an object-oriented solution to this problem? Is the best solution still implementing "just" interface J? Or are there OOP-ways to "superclass" an interface without altering it?


How do we learn BPM products?

What are the topics I should learn for a BPM (Business Process Management) product? I mean, do I need to learn BPMN (Business Process Modelling Notation), BPEL (Business Process Excecution Language)? Are there any open source lightweight BPM products by Apache or somebody?


Should I continue to perform freelance work for customers who keep on demanding more without paying?

So a client comes to me and says it needs some work done. Basically 4 tasks, which I agreed to perform for a certain price. The customer creates the job offer (a fixed time and price job) on ODesk, I accept it, but it took some days and constant reminding for the customer to initiate a contract based on that job. The problem is that the original task has been completed, the contract is still active, I have not been paid yet, the customer says he will pay when the project is completed, and until then, new tasks occur constantly, or changes to older tasks that require full re-doing of elements. For all of this the client promises payment. No updates from this client on ODesk, no new tasks there. I keep reminding the client about sorting out the administrative issues, but with no results. At the same time, the client pushes on continuing work, since the project is soon to be launched. I don't know what to do.   * If I refuse to perform any work without the bureaucracy, the project will be late. But it's not my fault, is it? I am scared that I might receive a negative feedback in this case, or something even worse.   * If I drop out of this project I'm afraid I won't be getting even what I've earned.   * If I continue like this, I'll be wasting a lot of time doing stuff similar to the stuff described here, but as a programmer (yes, it has already come to similar requests, for lots of hardcoded content). How do I communicate with such clients in such situations? How do I avoid a conflict? P.S. The client is a small company. Different people handle different aspects of this project, and everybody introduces their own changes to the original specs. **After 2 years** : Wow! Very question! Much popular!   I decided to let everyone in on the ending of this story. I've confronted the customer, explained that I will not work until I get paid for what I did, and until a hourly contract is open. They paid me the next day and opened a contract. A fruitful, but short collaboration started. Everyone was happy. Except I didn't get any feedback.


Why was strict parsing not chosen for HTML?

I am pretty much unaware about the detailed computing history that surrounds internet but it has always made me think why strict parsing was not chosen when creating HTML. Browsers accept any rubbish you write and try their best to parse it. The process, if I am not wrong, hinders performance, allows people to write insane markup, and also allows the obsolete features browsers support because of legacy reasons. Is there a specific reason for why HTML is not strictly parsed?


What is the most reliable session storage in PHP: Memcache, database or files?

What is the best and most safest way to handle PHP sessions. Is the best way to store sessions in:   1. Database (more reliable, but high bottleneck, slow speed, not good for high database usage websites)?   2. Memcache (super fast, but distributed more security problems, chances of loosing data when the server restarted and chances of loosing data when the cache is full)?   3. Files (default option, I guess slow since it reads and writes from file I/O, less security, etc). Which method is the best? What are the problems and good things of each of those approaches?


Best Way To Bring C++ Into Objective-C Project

For an upcoming XCode iOS project I'm planning on writing my views and view controllers in Objective-C. My model will be provided to me in C++. I am aware of 2 ways of using C++ in an objective-c project. They are described below. What are the pros and cons of each method. Is there any other recommended way, and what are its pros and cons? -In C++ header files, use extern "C" declaration as described in Wikipedia. -Wrapping C++ with an Objective-C++ as described by Rob Napier.


Why do browsers leak memory?

A colleague and I were speaking about browsers (using a browser control object in a project), and it appears as plain as day that all browsers (Firefox, Chrome, IE, Opera) display the same characteristic or side-effect from their usage and that being 'Leaking Memory'. Can someone explain why that is the case? Surely as with any form of code, there should be proper garbage collection? PS. I've read about some defensive patterns on why this can happen from a developer's perspective. I am aware of an article Crockford wrote on IE; but why is the problem symptomatic of every browser? Thanks


How to outsource a pet project?

I have a fairly ambitious software development project that I have no time to give. This project is for my personal life and if completed will save me much time and money. I am a software developer by trade but don't have much time to work on this project. So, I am considering outsourcing or contracting out some of the work so I can get it done faster. It's one of those projects where the longer I take to finish it, the more it costs me. I have not outsourced anything and would like to try, what is a good way to get started? What are some risks that I might face?


what kind of certificate needed for my application ?

I am releasing free C# softwares I've created using Visual Studio. In the future, some of these softwares might become Paid. I was wondering if I need to purchase any kind of license for them ? I understand that it's good to have a certificate for your website (SSL?), if your trying to sell your software but what about your applications ? I just don't want anti-virus/browsers flagging my application as not trusted. Any suggestion is appreciated.


How common are "bandage" fixes?

Imagine the following scenario: You've detected that your (or someone else's) program has a bug - a function produces the wrong result when given a particular input. You examine the code and can't find anything wrong: it just seem to bog out when given this input. You can now do one of two things: you either examine the code further until you've found the actual cause; or you slap on a bandage by adding an `if` statement checking if the input is this particular input - if it is, return the expected value. To me, applying the bandage would be completely unacceptable. If the code is behaving unexpectingly on this input, what _other_ input that you've missed will it react strangely to? It just doesn't seem like a fix at all - you're just shoveling the problem under the rug. As I wouldn't even consider doing this, I'm surprised at how often the professors and books keep reminding us about how applying "bandage" fixes is not a good idea. So this makes me wonder: just how common are these kinds of "fixes"?


Code execution time out occasionally

I am working on an e-commerce website. There is a case where I need to fetch the whole data in database through a third-party API and send it to an indexing engine. This third-party API has many functions like getproducts, getproductprice, etc., and each of those functions will return the data in XML format. From there I will take charge, I will use various API calls and will handle the XML data with XSLT. And will write to a CSV file. This file will be uploaded to an Indexing engine. Right now I have details of 8000 products to feed the engine, and almost all time the this process takes about 15 min to complete, and sometimes fails. I can't find a better solution for this. I am thinking about handling the XML data in C# itself and get rid of XSLT. As I think, XSLT is far slower than C#. Is it a good Idea? Or what else I can do to solve this issue?


What should you do when presented with a horrible design?

Our firm makes websites. We also design websites. But sometimes our client brings his/her own design. This is often made by an in-house designer, or it is the same design they used for something else. However, sometimes these designs look awful. And I am talking really unprofessional, unbalanced, uncool. But the client really wants this design. I really do not like working with a design that is so awful. It takes away all pleasure in coding. You code. You check the demo. Works great. Looks awful. It's just not fun. And ultimately the client might be happy, but 1) I do not feel proud of the final product and 2) the community sees you 'develop' ugly websites, which is bad for your image. Anybody experiencing this kind of stuff? What do you recommend? I've been thinking:   * Blocking these clients. If somebody has an 'own' design, ask to see it first. Then somehow politely decline. Drawback: you lose a client.   * Create a new design. Have our in-house designers work one something really cool. Drawbacks: client would need to pay for this (without asking for it), or it will be declined and the company loses time = money. And it might come as an insult if you propose a new design out of the blue. THEIR designer won't like it for sure.   * Put a clear disclaimer at the bottom of the site: Website design by XXXXX, Website development by US. Helps for the community-impact (if people pay attention), but not for the uneasy feeling.


What techniques do you use when dealing with a difficult project manager?

I'm currently working on one part of a technical data heavy project. The project manager in charge of this project is what one might term "An Old- School Project Manager" in that he has absolutely no knowledge of the application domain or anything remotely technical whatsoever - in his own words "What he does is Delivers." As well as designing the technical specifications and developing the code to those specifications, my role is also quite client facing, so I need to interact with the people who will be consuming the data to help to get it in shape for when it is all finally deployed; most of the tasks that these clients are being asked to do is way beyond their job description and I think it is important to be respectful of that and realise any help that they give us is based on goodwill. The PM is an absolute control freak who rubs everyone he ever deals with completely up the wrong way. All emails must go through him (maybe he will forward them on, maybe he will let you know if there has been a reply), and all emails must be written in a language that he understands (he doesn't know what a database is, or the difference between a schema and data so...). He almost never reads anything he's sent, what he does read he sends back asking for it to be "more high level", and he never knows what he is asking for, he just starts rambling about "this must be simple right, this is how it is, no?" - not that he admits this, he just says that he needs me to make what I've said "more high level". I'm struggling to work out what he actually does all day except of course for Delivering and acting as postmaster. How do you work with a manager who has this kind of personality?


Should I sign an NDA and IP contract without an expiry date?

I work in a small software development company. I just received a NDA and IP contract to sign, but it doesn't have an expiry date.   1. Does this mean that it's a lifetime agreement with the corporation?   2. Lacking an explicit expiry date, is there an implicit date at which the contract expires?   3. If/when I leave the company, does the agreement still stand? If so, how long?


What is the best IDE for Scala?

I tried programming Scala in Netbeans and Eclipse, but it is not what I'm looking for. In Netbeans suggestions for method names etc. are not working. In Eclipse I can't go to some classes sources by pressing F3. (e.g. scala List). Is support in IntelliJ IDEA any better? Are there other IDE's supporting Scala?


What would be a few ideas/concepts from programming that I can have on paper and hang on a wall as art?

And by that I mean any piece of code, or an idea/algorithm presented in pseudo code, something which is very important and is almost art now. I intend to put up a few paintings and work on paper around my office which depict engineering, rather celebrate engineering. I want them to be not so commonplace like e=mc2 or anything too geeky, like 42. They be special, they be important and have earned the position of being almost sacred owing to their contribution to their field. So I want a representation of computer programing as well. Thanks for your time. EDIT:After seeing a few initial responses I would like to mention that I am not looking for things which go on a t-shirt or mug, but huge framing on a wall. So anything funny/wicked/clever is not only not suitable, but I want it to be inspiring/celebrating. Not to say that I don't love the funny, but this time I want to focus on things serious.


Method naming advice required

My question will be about how do you think it would be fit to name some methods in a fluent interface. Let me try to demonstrate the problem. Consider this relation tree: ![associations](http://i.stack.imgur.com/SgfFs.png) A person can have dogs and cats, and a dog can have bones. Pretty simple. What i'm trying to do is create a domain specific fluent interface for determining, which ones of these relations does the user need. It is able to handle any depth of relationships. **I designed the operation something like this** (It is building the assoicaiton tree, from which i can determine, what the user wants): ![association tree building](http://i.stack.imgur.com/R1UCs.png) As code (it may be more readable):               personAssoc = person.associate().withCats().and().withDogs().withBones().up().done();       But i'm trying to make this part as intuitive as possible, so i wan't the **method names** to **make sense after each other** , and **be as close to spoken language as possible**. My biggest concerns are the following 3 method names:   1. **`and()`** in my language of choice `and` is a reserved keyword, so i can't use it. I looked up synonyms (`together()`, `including()`, `also()`) but they don't sound/look right (`and` means, that we will add more children to the parent association).   2. **`up()`** it is obviously breaking any kind of flow. With this method name, the whole thing became a lot further away from spoken language, than i wanted to (`up` means, we are not necessary wan't to add more relations to the parent, but we are done with the current one. In code it is the same as `and`).   3. **`done()`** is only called once, at the end of the method calls, but still doesn't fit the picture (`done` means, that we are literally done, we won't add more associations). **What i'm looking for** is other, better names for the above 3, which:   1. Which make the usage of the fluent interface closer to spoken language.   2. For `and` a name, which is as far as possible from any language keywords. If you read this whole thing, feel free to drop by any ideas, it might help me out a great deal! **Thank you for any suggestion.**


Scheme Stream Implementation

After working my way through SICP I decided to work though some Project Euler problems using scheme. In this particular problem I am trying to generate an infinite stream of integers however I am recieving an error from the MIT Scheme interpreter.               ;Aborting!: maximum recursion depth exceeded      This leads me to believe my stream implementation is incorrect however after comparing my code against that in the book I can not find any errors.               (define (delay x)       (lambda ()         (x)))          (define (force x)       (x))          (define (cons-stream a b)       (cons a (delay b)))          (define (car-stream s)       (car s))          (define (cdr-stream s)       (force (cdr s)))          (define (integers-starting-from n)       (cons-stream n (integers-starting-from (+ n 1))))      The error occurs when I run the following code:               (define n (integers-starting-from 1))      Where have I gone wrong? **EDIT:** Thanks to Chris Jester-Young below I have it working now. The correct implementation of delay and stream are as follows.               (define-syntax delay       (syntax-rules ()         ((delay expr)          (lambda ()            (expr))))          (define-syntax stream       (syntax-rules ()         ((stream a b)          (cons a (delay b)))))


JUnitEE vs JUnit

I know what unit testing is in general and what _JUnit_ is in particular. But here I see that there is a project called _JUnitEE_ which seems to me to be a wrapper over JUnit. So I would like to better understand the pain point of using vanilla _JUnit_ and how _JUnitEE_ is able to solve those problems.


Who can be called a good team player?

Many times you encounter something like "team-worker" or "enthusiast to work in a team" or stuff like that in employment ads which state that they want you to be or become a good member of a development team. Who can be regarded as a good team member? Which qualities of a developer can be regarded as good points regarding to work in a team? Also how can a developer improve his/her teamwork skills (or attributes, if you will)?


Python code style - blank lines in long list

I'm curious, is there a standard approach to dealing with long lists in the Python community, and in particular, is there any antipathy toward doing blank lines followed by comments to break up a particularly long list, e.g. of tuples, or in a dict, etc.? For example, I'm developing a GUI application in wxPython, and am defining the keyboard shortcut mappings to . Is this fairly Pythonic?               accelerator_table = wx.AcceleratorTable([         # Case accelerators         (CTRL, ord('S'), EventIds.SAVE_CASE),         (CTRL_SHIFT, ord('S'), EventIds.RENAME_CASE),         (CTRL, wx.WXK_DELETE, EventIds.REMOVE_CASE),         (CTRL_SHIFT, wx.WXK_DELETE, EventIds.DELETE_CASE),              # Project accelerators         (CTRL_ALT_SHIFT, ord('S'), EventIds.RENAME_PROJECT),         (ALT, wx.WXK_DELETE, EventIds.REMOVE_PROJECT),         (ALT_SHIFT, wx.WXK_DELETE, EventIds.DELETE_PROJECT),              # Help accelerators         (NORMAL, wx.WXK_F1, EventIds.HELP),         (NORMAL, wx.WXK_F2, EventIds.LAUNCH_MANUAL),         (NORMAL, wx.WXK_F12, EventIds.ABOUT),         ...     ])      The details aren't particularly important, but I'd like to write in a style that will not annoy other programmers along the way, and therefore to decide right now whether this pattern is worth keeping around. **Edit:** Just to clarify: I'm not intending to put anything beyond that single blank line between sections in the list. That seems like it should minimize any confusion on the part of someone reading through the code.


Formal study about trends and prevalence of agile vs traditional methodology in the industry

Has there been a formal study about the prevalence of agile vs traditional (e.g. waterfall) software development methodology in the IT industry? And how fast the agile share is growing (assuming it is)?


Weighing pros and cons for using jQuery for just one widget

I have been using html select boxes or textboxes for date input. On submit, the date is validated and if invalid an error is returned. I have avoided javascript calendars thus far, but jQuery datepicker seems to be a popular choice amongst people on SO. I was updating my app and wondered whether to use a Javascript Calendar(jQuery datepicker in particular). It would be a good "feature" for existing users and will fit the "2011" upgraded look of the app. I am not using jQuery or anyother JS library. The scripts in use are "plain" javascript. With jQuery, I will have to include jQuery's library in the universal .js files list or link to Google's copy. Either way it will increase page load time. And I understand that with or without datepicker in place, the validation(and the error handling) stays and that the datepicker widget is for visual purposes only. But UI is an important factor. A positive that I can see is, I might use more of jquery in the future and I will not have to think about page load time and bandwidth issues then. So my question is, is lugging along jQuery the right decision, when I only see one use in the near future? Or should I use a "plain" JS only calendar widget or should I simply stick to the select or text boxes. Wanted to post this on SO, but since the topic is more about programming practices and decision making, I am posting the question here.


unique_ptr and references - coding style question

I'm pretty sure this is a question purely about aesthetics but I wanted to get all your opinions on it before I start proliferating this type of code in my codebase. Consider the following code:               //Foo.h     class Bar;     class Foo     {         public:            Bar& GetBar(){return *bar.get();}         private:            std::unique_ptr<Bar> bar;     };          //Bar.h     class Bar     {          public:              DoSomething(){//did something...}     };      This allows us to forward declare Bar in Foo.h and avoid having to #include Bar.h. This leads to using Foo's Bar in the following way:               Foo foo;     foo.GetBar().DoSomething();      Personally, I think this would look a lot nicer:               Foo foo;     foo.bar.DoSomething();      To achieve that, I've written:               //Foo.h     class Bar;     class Foo     {         public:             Foo();             Bar& bar;         private:             std::unique_ptr<Bar> bar_ptr;     };          //Foo.cpp     #include "Bar.h"     Foo::Foo() : bar_ptr(new Bar()), bar(*bar_ptr) {}      This allows me to forward declare Bar and use the 'bar.' syntax. Ugly? Not Ugly? The downside is that I have 2 member vars for only 1 object.


Which practice is the best for database connection? (PHP, etc)

Leave a open database connection throughout the execution of the aplication, or for each time a operation will be executed a new connection will be created? Open throughout the execution: Open aplication -> Open connection; Operations -> use the opened connection -> commit; Close aplication -> close connection; For each time a operation will be executed: Open aplication -> ...; Operations -> create connection, execute operation, commit, close connection; Close aplication -> ...;


any good book on Investment banking for IT professionals

I have been working as a Java developer for corporate Banking client. Now I want to step into an investment banking domain job. What sorts of resources (books, sites, etc.) can I use to understand investment banking so that as an IT Professional, I can become effective developing software applications for this domain?


How to make a random-access archive of text files?

I wrote an application that tests the performance of evolutionary algorithms. This application performs a **run** of the algorithm which consists of **several generations**. The data which is produced by my application looks like this:               run1.run             // text file containing metadata     run1_data            // folder containing experimental data        -statistics1      // text file containing some specific statistics        -statistics2             -generation0             -generation10     // snapshot of the algorithm at generation10        -generation20        ...      Once this data is written, **it is never changed**. When I want to **examine** the data, my application reads the **metadata** file (.run), opens the **_data** directory and reads the rest of the data. This was all fine until recently. I now have **hundreds of thousands** of these files and I ran out of inodes on my system and also the loading of the data and copying is extremely slow, even though there are only a few gigabytes. My data seems to be too fragmented, since the files are quite small. My application is written in **C++** and uses the **Qt** library for filesystem operations. I was thiking of using the `<system>` header to issue a `tar` command to archive data after writing and un-archive before reading, but I found out that `tar` must read the entire archive to find the contents. This is a problem for me, since to save operating memory and time I sometimes load only `Statistics1`, sometimes only `generation10`... I was considering to change the format of my data so that there would be **only one file** , which would have something like a **table of contents** at the beginning, followed by **all data files concatenated**. The table of contents would indicate the **beginning and end** of each concatenated file. However I am not sure if this is a good solutions since the `std::ifstream` class that I use to read the files **cannot make random jumps**. I am a beginner programmer and I do not want to waste a lot of time on developing something that would not work so I ask for any advice on how to solve my problem.


Responding to app feature requests I'm not going to implement

I'm a new app developer and after like 20 downloads of my app (free and ad- free) I already got two feature requests, and I'm not going to implement either. Should I respond to these feature requests and if so, how? I'd prefer not responding at all because I'd rather spend the time to work on my app, but being a new developer, a couple of poor ratings in the app store could hurt my app.


Supporting multitenancy

What are the typical challenges that arise when converting a single-tenant app into a multitenant app? Security and data isolation strike me as the most significant. What are some others? I'm one of the architects for a fairly significant automation effort, and historically it's just been our company using it. We want to make it possible for others to use it as well. Every time we talk about "making it multitenant", the conversation revolves around keeping users with one tenant away from the data that another tenant owns, and making sure that users with one tenant can't (either intentionally or inadvertently) create impacts in another tenant's environments. What I'm wondering is whether security/data isolation are really the only major concerns here, or whether there are some other major concerns that we're just not thinking about.


How to detect the encoding of a file?

On my filesystem (Windows 7) I have some text files (These are SQL script files, if that matters). When opened with Notepad++, in the "Encoding" menu some of them are reported to have an encoding of "UCS-2 Little Endian" and some of "UTF-8 without BOM". What is the difference here? They all seem to be perfectly valid scripts. How could I tell what encodings the file have without Notepad++?


How to search the web for programming related solutions?

I have the impression that Google has become unusable when searching for programming related questions. Example: I'm Googling for               XML-RPC Redstone Cookie      I'm expecting results where all three terms are contained. I don't care for results where one term misses. I guess until some months ago Google just worked this way, i.e. all terms were included. Somehow this feature is gone now (Google apparently thinks it is more intelligent than the user and knows what the user is searching for). So I helped myself putting a + in front of every word. This is, however, a bit cumbersome. And for the last weeks, it even doesn't work anymore in all cases, Google ignores the +. So how do you search for progamming related problems? Do you still use Google? If yes, which techniques do you use to get the right results? Or do you use another search engine? Which one?


Massive vehicular network simulator

I am interested in making a vehicular network simulator (vehicular network as in vehicles can be equipped with radios and when they come in range they can talk with each other). I want to be able to scale to 1000s of nodes if not more. I am quite frankly torn on how to do, or even which language to use or whether I should instead be using some other piece of software/code. I know that this should depend on a lot of design decisions that I may have, but it would be great if somebody can point me towards the right direction. I was planning to use a multi-threaded architecture, but not sure whether it will add to the complication or make it easier. Also if I go for a multi- threaded architecture, do you think that the Go language will be a good choice? I have a few years of experience in Java, but haven't done any big project, and essentially no experience in Go.


Ruby using the Gosu framework: why it runs slow first time?

I'm creating a Ruby game using the Gosu framework. All good. Sometimes, when I run the game, it has some kind of slow startup, and probably it will be rather slow during the whole game. So I close it and... open it again. It is very likely that it will startup quickly and the whole game will run smoothly and fast. Why is that? What is this phenomenon? Is it faster because of some cache stored or whatever since the first run? (But why would cache be stored? If the app dies, I would expect no references at all etc...) Ruby, Windows 7.


What is the way to go to extract data from websites?

I've been thinking about a side project that envolves web data scraping. Ok, I read the Getting data from a webpage in a stable and efficient way question and the discussion gave me some insights. In the discussion Joachim Sauer stated that you can contact the owners of the sites and architect some way to provide the data that I want. The problem I see is that the websites are generally badly created and apparently seldom have changes in HTML (I don't think they will help me), but the data is relevant. I have suffered a lot using those sites so I would like to aggregate and show them in a better way. So, going with scraping, specifically Scrapy (for python), is a problematic approach? I read that parse.ly uses scraping (Python and Scrapy), but in another context. Given my context, there's a better approach than going with scraping? If going with scraping, how to deal with website structure's changes?


Can CC0 code use a GPL library?

Suppose my code uses (simply links to) a library licensed under the GPL. Can I release _my code_ under CC0 (public domain dedication)? Is my code affected by the copyleft nature of the GPL?


use of script tag in different position of page

I found that sometimes the script don't run properly when I add script tag in the head section. But when I add script right before the ending tag of body it works fine. What is the difference between adding script in head tag   **OR**   on just before ending body tag   **OR**   right after the control? I found this issue very often when I use JQuery..


REST: How to store and reuse  REST call queries

I'm learning C# by programming a real monstrosity of an application for personal use. Part of my application uses several SPARQL queries like so:               const string ArtistByRdfsLabel = @"     PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>     PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>     SELECT DISTINCT ?artist     WHERE     {{         {{             ?artist rdf:type <http://dbpedia.org/ontology/MusicalArtist> .             ?artist rdfs:label ?rdfsLabel .         }}         UNION         {{             ?artist rdf:type <http://dbpedia.org/ontology/Band> .             ?artist rdfs:label ?rdfsLabel .         }}         FILTER          (             str(?rdfsLabel) = '{0}'         )      }}";          string Query = String.Format(ArtistByRdfsLabel, Artist);      I don't like the idea of keeping all these queries in the same class that I'm using them in so I thought I would just move them into their own dedicated class to remove clutter in my RestClient class. I'm used to working with SQL Server and just wrapping every query in a stored procedure but since this is not SQL Server I'm scratching my head on what would be the best for these SPARQL queries. Are there any better approaches to storing these queries using any special C# language features (or general, non C# specific, approaches) that I may not already know about? **EDIT:** Really, these SPARQL queries aren't anything special. Just blobs of text that I later want to grab, insert some parameters into via String.Format and send in a REST call. I suppose you could think of them the same as any SQL query that is kept in the application layer, I just never practiced keeping SQL queries in the application layer so I'm wondering if there are any "standard" practices with this type of thing.


Methods for efficient knowledge retention and fast study material lookup

When I read a book or article about something new, I have two main concerns:   1. Retaining the new knowledge I just acquired   2. Being able to access the new knowledge efficiently later on What are some methods you folks use to annotate what you learn? I recently read _Pragmatic Thinking and Learning_ and one of the things I'm trying out is making notes from books in mind-map format. Another method I'm trying out is tagging important passages in books with labels such as: definition, feature, remember, usage, caveat... It's too early to tell how these will work for me, but I'd like to know what works for you and how you use it. There are other questions asking what tools people use, but I think process is more important than the tool, so that's what I'd like to learn about.


How does throwing an ArgumentNullException help?

Let's say I have a method:               public void DoSomething(ISomeInterface someObject)     {         if(someObject == null) throw new ArgumentNullException("someObject");         someObject.DoThisOrThat();     }      I've been trained to believe that throwing the `ArgumentNullException` is "correct" but an "Object reference not set to an instance of an object" error means I have a bug. Why? I know that if I was caching the reference to `someObject` and using it later, then it's better to check for nullity when passed in, and fail early. However, if I'm dereferencing it on the next line, why are we supposed to do the check? It's going to throw an exception one way or the other. **Edit** : It just occurred to me... does the fear of the dereferenced null come from a language like C++ that doesn't check for you (i.e. it just tries to execute some method at memory location zero + method offset)?


Modern programming language with intuitive concurrent programming abstractions

I am interested in learning concurrent programming, focusing on the application/user level (not system programming). I am looking for a modern high level programming language that provides intuitive abstractions for writing concurrent applications. I want to focus on languages that increase productivity and hide the complexity of concurrent programming. To give some examples, I don't consider a good option writing multithreaded code in C, C++, or Java because IMHO my productivity is reduced and their programming model is not intuitive. On the other hand, languages that increase productivity and offer more intuitive abstractions such as Python and the multiprocessing module, Erlang, Clojure, Scala, etc. would be good options. What would you recommend based on your experience and why? EDIT: Thanks everybody for your interesting answers. It's hard to make a conclusion without actually trying since there are many good candidates: Erlang, Clojure, Scala, Groovy, and perhaps Haskell. I voted the answer with the most convincing arguments, but I'll try all the good candidates before deciding which one to pick :)


Visual programming for serious software

Are visual program control flow diagrams and languages which support that used for larger serious programs? Why not? They seem like a nice overview of the code. In the thread What software programming languages were used by the Soviet Union's space program? a visual language is mentioned (Drakon) and I wondered why such approaches aren't used more often? Is there nothing a visual control flow representation (I don't mean class diagrams etc.) which are 1-to-1 with code can help compared to typing in letters in an editor?


Experiments correlating code metrics to bug density

I'm wondering if someone has done some experiments correlating code metrics (SLOC, Cyclomatic Complexity, etc) with bug density in Object Oriented applications. I'm not looking for experiments that only prove or disprove a correlation, but on both. I'm not trying to find a silver bullet as I believe that the bug density of a project _might_ correlate to one or more metrics for a given project or team and the correlation can change during the lifetime of the project / team. My goal is to   1. Measure all interesting metrics for 2-3 months (we already have quite a few from sonar).   2. Find one metric that correlates with the number of new bugs.   3. Do a root-cause analysis to check why this happens (e.g. Do we lack a certain design skill?).   4. Improve the skill and measure change for a couple of itereations.   5. Rinse and repeat from 2. If you don't have any experience on this, but remember seeing a paper / blog on this subject, I would appreciate if you can share it. * * * So far I've found the following links with some information about this subject   * Do Bugs Reside in Complex Code? - just the slides from a presentation.   * Changes and Bugs: Mining and Predicting Development Activities - Just slides frmm a presentation. Bottom line the more dependencies, the higher the chances of bugs (I think this is quite a general rule).   * Failure is a four-letter word - A parady about the correlation between bugs and metrics.


User Generated Content and Hotlink Protection

I have a website that allows for users to paste content (like snippets of code, etc) for sharing. Like Pastebin and Github, I also have a "raw" link that will display the raw contents of those posts. However, some users are posting up code and then using our service as a host for distributing content that violates our TOS (for example, javascript code and then linking to that code from external sites). Running on NGINX and PHP, what is the best way to manage this? I have a feature that when reported, I can disable the raw version of a particular post. However, it is not feasible to monitor each and every post (and then be sure that I understand what is good / what is bad). Is my only solution to disable raw functionality across the board? Should I block the raw versions from sites like facebook (using referrer maybe)? I played around with hotlink protection, but in all truth, it doesn't really appear to work all that well (or it could be just my configuration of it).


Modelling network and persistent entity representations

I have an app where I need to synchronize some entities (simply download latest versions of entities from server to client). Entity has bunch of text properties and bunch of resource links (referenced by ids, URLs, whatever). For example let `Entity` has three properties:               id: integer,     name: string,     photos: array of photo ids      For now `Entity` is represented by two classes: one for persistent store (I'm using CoreData storage in iOS, you may consider it as ORM if you aren't familiar with iOS SDK) and one for JSON parsing and serialization called `Entity` and `JSONEntity` respectively. `Entity`               id: integer,     name: string,     photos: array of paths for files at local file system     pendingDownloads: object to track pending file downloads for `Entity`      `JSONEntity`               id: integer,     name: string,     photos: array of photo ids      I'm going to use the following algorithm:   1. call server API and obtain array of instances of `JSONEntity`   2. for each retrieved `JSONEntity`     1. find or create corresponding instance of `Entity` that should be updated     2. immediately update `name` property of `Entity` instance     3. associate `pendingDownloads` instance with current `Entity` instance `Entity` instance that have associated `pendingDownloads` object is considered as downloading and can't be used. When application starts:   1. find `Entity` instances that have non-null `pendingDownloads`   2. for each `id` in `pendingDownloads`     1. download photo     2. add local file reference to photo into `photos`     3. remove current item from `pendingDownloads`   3. null-out `pendingDownloads` property   4. notify model that `Entity` finished syncronization As for me the biggest flaw of current approach is that I have to keep two parallel hierarchies of classes - one for persistent store and one for JSON parsing/serialization. I tried to use inheritance: I declared newtork-level (like photo ids) properties in superclass and local-level (like file references) in subclass. But I don't like this approach either - object become overloaded with responsibilities - it have to track both network-level and local-level information. Are there any patterns or approaches to handle this kind of situations? Would be grateful for any thoughts. Thanks.


Full production build in source control for easy rollbacks?

I want a quick way to roll back our production build in the event of any mishaps - a one-click solution, if you will. My gut is telling me that this is important - and I believe that my gut is correct, but I want implementation advice. My current thought is to start a local repository on our production server, and simply commit the entire production build to the repo - binaries, web assets, everything. When we make an update to the production site, we can commit the changes to the repo. This way, if anything breaks for any reason and we need a quick rollback - it's simply a case of checking out the previous commit. What better methods are available for this type of rollback? I know that there are multiple backup solutions, but a VCS is familiar to work with and provides similar benefits. Am I stepping into a trap?


gnu lesser general public license question

I have a question about Thingiviews license. I have a site that has to do with 3D Printing, it is not done yet but I was wondering if I would be able to use it on my site, The big reason I am asking is because it will be used to show 3D models that will eventually be made and sold, like shapeways kinda, so I am not selling Thingiview but it would be used to show something that will eventually make money. Thingiview is currently licensed under: > GNU LESSER GENERAL PUBLIC LICENSE and from what I can gather, it seems that what I want to do should be okay, do I just need to give the creator of it credit? I will either way but it seems that is all that is required. Is what I want to do okay (by ok I mean legal)? Also if I want to change it I can do that too right, I have some ideas to add to it. Is there anything I would need to do if I change it a little bit?


Are there any scientific studies done on TDD that use total cost of ownership for a product as the measurement?

When I was reading the summary of previous work in _Dogsa T, Batic D. The effectiveness of test-driven development: an industrial case study. Software Quality Journal. 2011;19(4):643-661._ it struck me that the measurements used in a lot of studies around TDD are based on things like lines of code, defects and time spent on development. Are there any studies out there that focus on the total cost of ownership for products that have been developed using TDD vs ex traditional development or test-last? I am especially interested in the total cost of acquisition and operating costs.


Learning to investigate bugs

I'm not even sure how to define this difficulty. It reminds me of the test a couple of prospective employees did on me before I got a job. They would pick an object in the room and then I'd be allowed to ask questions to help myself determine what that object is (much like 20 questions). I was ridiculously good at this (no, I never got high points for humility), so I'd assumed that I'd be really good at troubleshooting bugs... But here's the thing I figured out recently. I'm really good in that situation because it's really easy to see everything that's in the room, thus I can approach my problem with some concept of it's component parts. In essence I "know what I don't know". But with programming I run into a lot of situations where the problem is a complete unknown to me. I know it's broken, but I have no concept of how it might be broken. I've followed all the instructions, I know the technology fairly well... If I'm honest, I feel like I'm just having a hard time imagining things that could be wrong so I can test them and, hopefully, find a solution. How do I go about developing that skill? What do I need to do to help my, apparently, limited imagination come up with ways that my project could possibly be broken? Are there exercises (puzzles perhaps?) that can make me better at this? I'm aware that probably the biggest cure is just experience...but I'm hoping to help accelerate the process if I can. Staring at my computer screen blankly for a few hours at a time is not even kind of fun...


Shall I separate the admin part from the rest of the war

I built a web-applicationg using struts2. Then I built a small admin interface in the same war. With time the webapp grew and so the admin-interface. Now, I'm thinking to separate the admin interface from the rest of the app in a separate war Is it a good idea ? Is there any performance benefit that I can get due to separation of the admin war and the rest of the webapp. The admin part is mostly about making changes/updations/settings in the database, so it's not affecting the UI of the rest of the app directly. Separating it also ensures that I can make updations to both parts without affecting the other. [UPDATE] I cannot put admin part on local machine. It's a web-app. `Do they use the same classes?` Nope, the entire package is different for admin actions and view is also separate. `How do you update them?` upload war `Do you use application session?` yes of course, although different sessions are used for admin & normal-user.


Mocking concrete class - Not recommended

I've just read an excerpt of "Growing Object-Oriented Software" book which explains some reasons why mocking concrete class is not recommended. Here some sample code of a unit-test for the MusicCentre class:               public class MusicCentreTest {       @Test public void startsCdPlayerAtTimeRequested() {         final MutableTime scheduledTime = new MutableTime();         CdPlayer player = new CdPlayer() {            @Override            public void scheduleToStartAt(Time startTime) {             scheduledTime.set(startTime);           }         }              MusicCentre centre = new MusicCentre(player);         centre.startMediaAt(LATER);              assertEquals(LATER, scheduledTime.get());       }     }      And his first explanation: > The problem with this approach is that it leaves the relationship between > the objects implicit. I hope we've made clear by now that the intention of > Test-Driven Development with Mock Objects is to discover relationships > between objects. If I subclass, there's nothing in the domain code to make > such a relationship visible, just methods on an object. This makes it harder > to see if the service that supports this relationship might be relevant > elsewhere and I'll have to do the analysis again next time I work with the > class. I can't figure out exactly what he means when he says: > This makes it harder to see if the service that supports this relationship > might be relevant elsewhere and I'll have to do the analysis again next time > I work with the class. I understand that the service corresponds to `MusicCentre`'s method called `startMediaAt`. What does he mean by "elsewhere"? The complete excerpt is here: http://www.mockobjects.com/2007/04/test-smell- mocking-concrete-classes.html


How to do dependency Injection and conditional object creation based on type?

I have a service endpoint initialized using DI. It is of the following style. This end point is used across the app.                public class CustomerService : ICustomerService     {         private IValidationService ValidationService { get; set; }         private ICustomerRepository Repository { get; set; }              public CustomerService(IValidationService validationService,ICustomerRepository repository)         {             ValidationService = validationService;             Repository = repository;         }                   public void Save(CustomerDTO customer)         {             if (ValidationService.Valid(customer))                 Repository.Save(customer);         }      Now, With the changing requirements, there are going to be different types of customers (Legacy/Regular). The requirement is based on the type of the customer I have to validate and persist the customer in a different way (e.g. if Legacy customer persist to LegacyRepository). The **wrong** way to do this will be to break DI and do somthing like                 public void Save(CustomerDTO customer)         {             if(customer.Type == CustomerTypes.Legacy)             {                 if (LegacyValidationService.Valid(customer))                     LegacyRepository.Save(customer);             }             else             {                 if (ValidationService.Valid(customer))                     Repository.Save(customer);             }         }      My options to me seems like   1. DI all possible `IValidationService` and `ICustomerRepository` and switch based on type, which seems wrong.   2. The other is to change the service signature to `Save(IValidationService validation, ICustomerRepository repository, CustomerDTO customer)` which is an invasive change.   3. Break DI. Use the Strategy pattern approach for each type and do something like:              validation= CustomerValidationServiceFactory.GetStratedgy(customer.Type);     validation.Valid(customer)      but now I have a static method which needs to know how to initialize different services. I am sure this is a very common problem, What is the right way to solve this without changing service signatures or breaking DI?


how to fully unit test functions and their internal validation

I am just now getting into formal unit testing and have come across an issue in testing separate internal parts of functions. I have created a base class of data manipulation (i.e.- moving files, chmodding file, etc) and in `moveFile()` I have multiple levels of validation to pinpoint when a `moveFile()` fails (i.e.- source file not readable, destination not writeable). I can't seem to figure out how to force a couple particular validations to fail while not tripping the previous validations. Example: > I want the copying of a file to fail, but by the time I've gotten to the > actual copying, I've checked for everything that can go wrong before > copying. Code Snippit: (Bad code on the fifth line...)               // if the change permissions is set, change the file permissions     if($chmod !== null)     {         $mod_result = chmod($destination_directory.DIRECTORY_SEPARATOR.$new_filename, $chmod);         if($mod_result === false || $source_directory.DIRECTORY_SEPARATOR.$source_filename == '/home/k...../file_chmod_failed.qif')         {             DataMan::logRawMessage('File permissions update failed on moveFile [ERR0009] - ['.$destination_directory.DIRECTORY_SEPARATOR.$new_filename.' - '.$chmod.']', sfLogger::ALERT);             return array('success' => false, 'type' => 'Internal Server Error [ERR0009]');         }     }      So how do I simulate the copy failing. My stop-gap measure was to perform a validation on the filename being copied and if it's absolute path matched my testing file, force the failure. I know this is very bad to put testing code into the actual code that will be used to run on the production server but I'm not sure how else to do it. Note: I am on PHP 5.2, symfony, using `lime_test()`. **EDIT** I am testing the chmodding and ensuring that the array('success' => false, 'type' => ..) is returned


System response times --- A good Service Level Agreement?

In order to view system performance, I have been asked by management to give page response times for a few key pages. I want to make sure I am giving a good picture of the overall health of the system, and not just narrowing in on a single measurement. So my question is: **When developing software, what metrics would you provide to your stakeholders to indicate a system that is healthy and running well?** (if it is not running well, that should also be evident! Not trying to hide/obscure any problems.)


Crappy school, what to do?

I started programming fairly late. I am 24 years old and about to graduate from a local public university with a really poorly designed curriculum and teachers. Most of the work felt like busy work, and no matter how much I try, it all feels like a waste. I know what a good curriculum looks like. I know what books I should read, but alas it's not so in my university. There is no way at this point that I can catch up to those graduating from places like MIT. My question and this is a serious one: what do I do? Do I just postpone learning the theory I would have learned until later and focus on software engineering skills? How important is the theory in terms of landing a job in New York? Any particular things I should focus on to land a software engineer job? I am very motivated and I just wish someone would give me the time and a chance.


What do you call "X <= $foo <= Y" comparison?

While writing a Perl statement like `if ( $foo >= X && $foo <= Y )` yet again, I wondered why many programming languages do not support the more comfortable form `if ( X <= $foo <= Y )` and what this is called. I came up with "3-legged comparison" but no results when searching for it. By the way there is also the "element-of-set" form `if ( $foo in X..Y )` which I only consider more readable when provided via a short keyword. Is there a term for `X <= $foo <= Y` comparison? Which languages support it?


Pair programming remotely with Visual Studio?

What tools exist to facilitate pair programming with Visual Studio when the programmers are not in the same physical location? At the moment we are thinking voice (Skype?) plus remote desktop (VNC? TeamViewer?), but it would be good to know of other suggestions and experiences. Also, is there anything more integrated with Visual Studio? A bit more background: we are two experienced developers with who have collaborated well for a long time on a large mature project (ASP.NET, Windows Forms and SQL Server). However we are not usually working on the same part of the code base at the same time. We intend to spend some weeks doing substantial refactoring and it would be ideal if we were able to do this work with a pair-programming approach.


How do you make CS students and future programmers aware of the various software licenses and their nuances?

To be specific: How would you include it as part of curriculum? Would it be too boring to just introduce them as a pure law subject? Are there any course structure available or can we derive one? What are the books that could be used? I would like to see that - after going through the course - candidate is well aware of "what software licenses are and what they are good for". Various implications of not knowing it in it's proper sense. What licenses they should use for their own code. What to consider when they are trying to use certain libraries or tools in their project and gauge risks/rewards associated with it. The idea is to let them make informed choices when they are professionals/practitioners in field of programming and not make them substitute for a lawyer or even a paralegal who is going to fight the case or draft things.


What are the main differences between FUML and the Executable UML profile?

I'd like to know what are the main difference between the Foundational Subset for Executable UML models and the Executable UML profile (which followed the Schlaer-Mellor methodology). Thank you


Mixing languages in .Net

I know that .Net provides the feature to mix several languages within the same application (there are some constraints of course, but this is not essential). Theoretically, this might be done because the languages supported by .Net do not fully expose all the features it can provide. IL does of course. So when you need a feature that the current language doesn't provide, you could write it in another .Net language. The whole code would be translated into IL, and so you would gain more features. From my personal experience, I was writing a project in C# and needed to integrate a small project written in C++ under .Net. When I consulted with some more experienced programmers, they said that it would be much easier to "translate" the C++ code into C# than integrate it. Since I had little time, it was what I did, and it was quite easy (the project was quite small). So my question is, has anyone experienced a real-life situation when mixing languages is an absolute necessity?


Is Non-Deterministic Resource-Management a Leaky Abstraction?

From what I can see, there are two pervasive forms of resource-management: deterministic destruction and explicit. Examples of the former would be C++ destructors and smart pointers or Perl's DESTROY sub, whilst an example of the latter would be Ruby's blocks-to-manage-resources paradigm or .NET's IDispose interface. Newer languages seem to opt for the latter, perhaps as a side-effect of using garbage collection systems of the non-reference-counting variety. My question is this: given that destructors for smart pointers or reference- counting garbage collection systems -- almost being the same thing -- allow implicit and transparent resource destruction, is it a less leaky abstraction than the non-deterministic types which rely on explicit notation? I'll give a concrete example. If you have three C++ subclasses of a single superclass, one may have an implementation that doesn't need any specific destruction. Perhaps its does its magic in another way. The fact that it doesn't need any special destruction is irrelevant -- all of the subclasses are still used in the same way. Another example uses Ruby blocks. Two subclasses need to free resources, so the superclass opts for an interface that uses a block in the constructor, even though other specific subclasses might not need it since they require no special destruction. Is it the case that the latter leaks implementation details of the resource destruction, whilst the former does not? EDIT: Comparing, let's say, Ruby to Perl might be more fair since one has deterministic destruction and the other hasn't, yet they're both garbage- collected.


Is there a manageable way of keeping track of loose code?

I program simple tasks everyday, but I have a hard time finding the scripts, and code snippets I write. Is there an manageable way to keep track of this sort of thing?