title: Composition of a dev team

text: I'm in a team of fifteen people and the team is in transition after a few changes of management. The current line of management is pushing for an agile approach to developing software but without providing any lead. The team suffers from a big communication problem both inside and with other departments in the company who are our customers. Management has recently created a sub-team composed by the technical specialists. They have great knowledge of the code base but have been in the company for up to ten years and are not so open to change. There goal is to provide technical direction. I've joined the team in the last six months. I have a good six years experience developing different software but don't have the same knowledge of the code base as others. I have good communication and organisation skills and can relate to the customers easily. The company's focus is to deliver innovative new products, but based on my observations we break down in project organisation (we seem to lose focus of the customer, get buried in the code base and misinterpret requirements). I think I can provide direction in delivering projects with a good focus on the customer, however I don't hold the same technical expertise as the technical specialist team. I also think I'm the only one with previous agile experience in the team. I've got two questions:   1. Is there room in a dev team for technical specialists and those that are good at delivering and making the customer happy, i.e the two working in tandem with each other?   2. Do you need to be a technical specialist to lead a dev project team?


title: How to apply good Object Oriented Design principles in Embedded Systems

text: I am a firmware engineer moved from Electrical background to Embedded Systems. I was till now programming in C and never bothered to apply OO principles in my design. Recently I was forced to implement design in C++. I started liking the OO principles like SOLID, design patterns, etc. I wanted to know more about applying OO design in my firmware design. All the resources on OO, that I found were too much into application programming rather than firmware. I found this book relevant (ordered it). I was curious if there are any other resource that can help me learn OO principles with a focus on embedded systems. I am still new to OO world, so please suggest me if I should learn OO principles first and then learn about applying them for embedded systems or start learning only stuff relevant to embedded system.


title: Is there a canonical book for learning C# from scratch?

text: I was looking for a good C# book for beginners to learn the language fundamentals and OOP fundamentals, however, every book I have looked at seems to start quickly and does not touch the fundamentals in a professional learning way or maybe the authors are good at programming but not so good at how to teach the subject to others. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information about C#? What about that book makes it special?


title: Thread safe graph libraries

text: I am looking for a good Java Graph Library which is thread safe for concurrent access. JGraphT, JUNG, JTS are very good but again for concurrent access I will have to synchronize it externally which is becoming a pain. It is a pain because say If thread A have to access 50 vertices, Thread B for another 50 with the intersection of vertices being 20 vertices. Now while writing code I need to know this 20 before so that I can synchronize it accordingly. Pl suggest if there exists some framework for graphs which has inbuilt support for concurrency


title: Why doesn't Swing look native out of the box?

text: Java Swing GUI's don't look native by default (Except on Mac OS X for some reason). Swing uses it's own look and feel. You can get Swing to use the system look and feel by putting:               javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());      in the beginning of your `main` method, but: Why isn't this done by default?


title: Most common website scalability pitfalls

text: We are designing a website/web application where we hope to to achieve high user counts and, in general, lots of use. More specifically, we intend to be using PHP as the programming/scripting language and MySQL for the relational DB needs as a start. We have not yet figured out whether to use a NoSQL database or not. Related to that, we want to design with scalability in mind. What are the most common scalability pitfalls for websites? What are the key areas that we need to take into consideration, so that the system can be easily scalable?


title: What are good strategies in C for dealing with pointer errors of this type?

text: In C, I often come across errors with code like this               prio_queue->head[index] = newEntry;        Yields a " "Cannot assign Entry** to Entry* " How do you prevent/debug errors of this type, in general?


title: Tool to identify potential reviewers for a proposed change

text: Is there a tool that takes as input a proposed patch and a git repository, and identifies the developers are the best candidates for reviewing the patch? It would use the git history to identify the authors that have the most experience with the files / sections of code that are being changed. _Edit:_ The use case is a large open source project (OpenStack Compute), where merge proposals come in, and I see a merge proposal on a chunk of code I'm not familiar with, and I want to add somebody else's name to the list of suggested reviewers so that person gets a notification to look at the merge proposal.


title: Finding and/or becoming an open source product owner

text: Are there any open source projects that have roles that would be equivalent to a Scrum product owner role? If so, how did you go about finding these examples, and how do you believe those product owner roles came to be? (Just to be clear, it's not a requirement the project is Scrum based, just that it's open source and roles stated are equivalent to a Scrum product owner role. Also, I'm talking about a volunteer role, not a paid position at a non- profit.)


What is the proper way to suggest features to be added to the C# language? For example, I would like to have an operator similar to `??` but for selecting the min or max values. I'd like `a <? b` to expand to `a < b ? a : b` likewise for `>?`


title: Why does IEEE 754 Single Float have 8 bits for exponent but only allow 38 base ten Max Value

text: Why is it that the IEEE 754 standard provide 8 bits for the exponent but puts a range maximum of 38 on the largest acceptable exponent? Seems kind of ridiculous to have the data storage there but not allow it to actually be used. I wanted to pack data into this exponent for some encoding I'm doing, but I can't use all the bits because I can't pack an exponent larger than 38! I was hoping to pack values up to 256 using all bits (2 ^ 8).


title: What is a good example of a software development idea or technique that was a failure?

text: Specifically what are some examples of where ideas of the masses where just wrong. Why did people latch onto the ideas in the first place? And why were the ideas dismissed? Or perhaps the ideas are still alive and well and if so why? For example I might describe CORBA (and other similar technologies) as something that attempted solve the problem of communication between components of software. Many felt it was necessary to define contracts between various components. Ultimately, HTTP + JSON solved the problem for the masses and other various RPC mechanisms such as Thrift and Proto-bufs have popped up.


title: Visual Studio 2010 - Local File History

text: I have been using netbeans for many years now and recently I have moved from PHP/Git/Netbeans to C#/TFS/VS10. It has been very good so far, yet I miss this one little feature I enjoyed so much in Netbeans is... **local file history**. Whenever I was working on something I could test different ideas and then simply reverting or even comparing changes at different time of the day or even different days. I was wondering if there is any VS10 extension or some sort of plugin that would let me achieve similar functionality (internal version control sort of thing). _I would use TFS but we are only allow to check in our changes when they are actually read for production. Also I can't find revert changes button in TFS. I wouldn't want to create a branch either._ I'm so desperate I was going to put hg or git over my TFS folder just so I can achieve this I'm just hoping there is some better solution for this.


title: Implementing separation of concerns via MVC

text: I'm creating a question to see if my understanding of MVC separation is correct, I haven't been able to find a clear answer anywhere online. So is this the right way to implement it (in Java): I would have 3 .java files, one each for Model, Controller, View. I would put all the classes related to Model in the Model.java like so:               //Model.java {         public class Model              //class fields              public Model();              public ModelClassA();              public ModelClassB();              public ModelClassC();         }      With the ModelClasses being any class that I consider belonging to the Model. Is it correct to have the classes within the Model Class, as I have read that nested classes should be avoided where possible.


title: Are There Any Programming Focused Notebooks?

text: I know that engineering paper exists, but are there any companies that make programmer-specific notebooks for notes/pseudo-code/designs? Paper is my preferred way of outlining things, so the addition of a specialized pad to my list of tools would be greatly beneficial.


title: Effective Ways to Introduce Agile into the Workplace?

text: In your experience (anecdotal or otherwise), what are some effective ways to introduce Agile into a non-Agile organization or company? UPDATED: Can anyone speak to cases where you tried to introduce Agile but you were "shot down"? Also, do you now have a retrospective understanding why you were "shot down"?


title: How the hidden features being find?

text: Today I read about this news: http://www.karthikk.net/2013/04/google-glass-has-an-easter-egg-has-pictures- of-the-glass-team/ People found a hidden easter egg in the Google Glass... But how can they find that? If there are not Google employee or know this hidden feature or have the source code, how they can `active` this feature?


What are the pros and cons of outsourcing development and testing to two different companies? **EDIT:** Why do you prefer outsourcing development and testing to different companies or to the same company?


title: How to parse multipart field/file data separately?

text: I want to parse a multipart form twice: Once to grab the incoming fields, and later to process the file upload. I am trying to maintain a proper separation of concerns within my Node app:   * Controller is responsible for handling the incoming fields   * Model is responsible for the upload file logic. I need to pass the fields data into the model to create a new instance, so the fields data needs to be available _before_ the file upload starts. Currently every form.parse() or equivalent function parses both fields and files _together_. Example: req.pipe(busboy) handles both file and fields together. I have checked modules like node-multiparty, formidable, busboy, multer. Nobody seems to have a solution for this. An example of what I would like to achieve is here: http://stackoverflow.com/questions/22336177/node-js-busboy-parse-fields-and- files-seperatly Is this even possible?


title: How to run thread if multiple data is insert in the multiple table

text: I'm facing problem in gsoap , if two user go to register at a same time then database is   locked, i think its threading problem , how to handle it, please insist me. I am running multiple threads in background. every 5 seconds sending data to server.


title: How often should you change pairs?

text: In the company I'm currently working on, we've been doing pair programming for a while now. In the current project, for the last couple of days, we've been trying to make our pair programming a little better, so we even have a timer now to ensure that the swap between driver and navigator happens often enough. For changing pairs, we tried to do it in several ways. We tried changing at the _end of the week_ , but found it too long. We tried in the _middle of the week_ but we tended to forget, so we decided to do it _daily_. Problem is that there are some stories that take a couple of days, so it's a little cumbersome to do it this way. Then we changed to a " _per story_ " pair changing. But this is just a little uneven because the stories themselves most of the time are uneven as well. So, simple question: How often should you change pairs?


title: Web Programming Cross Browser Frustrations Normal?

text: So I'm a relatively junior programmer, been doing it for a couple years now and have been recently working on a redo of the company's website, and have ran into some frustrations and was just wondering if that's the way it goes or if I'm missing something. I am by no means a designer, I focus on the code and don't pay much attention to how pretty it looks, that's someone else's job as far as I'm concerned. That being said, I have been working on getting some things to work and the cross Browser problems have made me hate Web Development. I try to get html5 videos and no go, put in a flash backup and only works on half. Throw a Google api in and it looks like crap in ie and opera. The actual code behind doesn't work in ie7. It just seems like one thing after another. As I said I'm new to Web Development. Is this just the way it is? Throw some basic code in, then take all day/week to make it work everywhere? I've cooled off since my initial frustration but I'm just wondering if this is normal practice or how typical web programming goes, because it seems pretty lousy to be right about now. Thanks!


title: Can Java be considered a managed programming language?

text: I am curious; can Java be referred to as a managed language? I am mainly thinking about the Microsoft model when it comes to unmanaged versus managed code (say native vc++ to C#). With the similarities between C# and Java as high-level languages, is it correct to call Java a managed language as well?


title: Should I mix python and .NET?

text: So I have a good handle on how to rapidly develop a GUI controlled application in .NET (not so much in Python, I've only used Tkinter). I want my code to be easily deployed with very few dependencies. It does however have to interface with a particular 3rd party software package that exposes a very difficult COM API or a much simpler Python API. I'm thinking about writing a few python scripts to do the processing I need. These scripts will be called as a subprocess from the .NET application. I would complete the project much faster this way instead of spending days working through the COM API. I feel that the resulting code would also be much simpler and shorter avoiding the COM API, but I will be mixing two languages if I code the application this way. Also I'm not shipping my own python interpreter with it, it will use the one provided with the vendor software. Is this a terrible idea? I looked up IronPython, but this 3rd party software apparently requires cpython to leverage it's API, so I'm not sure that will work unless I go the COM route.


title: Why aren't browser extensions monetized?

text: With the monetization of mobile apps being so popular, I'm surprised that extension developers are still mostly relying on donations as their primary form of compensation for their software. While this is, of course, not a problem, I find myself wondering why browser extensions and plugins are generally exempt from monetization unlike plugins designed for software like Visual Studio and Photoshop are very often available only with purchase. What makes broswer extensions different, and has anyone had any success charging for a browser extension? Relevant: http://www.quora.com/Monetization/How-do-browser-extensions-monetize


title: Any enlightenment for understanding Object Oriented Programming?

text: I studied computer science near the end of 1980s, and wasn't taught OOP that formally. With Pascal or C, when I understand the top-down design of functions, and the idea of black box, then everything just seem to make sense, as if there is a "oh I get it!" -- some kind of totally getting it and enlightenment feeling. But with OOP, all I know was the mechanics: the class, instance, method, inheritance, polymorphism, encapsulation. It was like, I knew all the "this is how it is", but never had the feeling of "I totally get it", the enlightened feeling. Would somebody be able to describe it, or point to a chapter in some book or paper which talks about OOP so that the reader can feel: "I totally get it!" on OOP?


title: How can I get job in company when I unfamiliar with technology

text: _Sorry if I have chosen wrong stackexchange site for this question. Point me in correct place if any..._ How can I get job in company that have some unfamiliar technology for me in they Job Requirements list? In other words. How can I get job on **Lucene** if I have not any experience on **Lucene** , but for getting experience in **Lucene** I need to be involved in company that needs developers with **Lucene** technology experience? It is closed disk!


title: Are there any flaws in this Programming Language / Virtual Machine design?

text: I am building a Virtual Machine and I think I have a perfect program design but I am worried as I don't have too much experience on this field there might be flaws. Before I'll tell you how it'll work, I'm first going to list some stuff this programming language and virtual machine is all about.   * Being Loaded as an extension (Like JNI)   * Dynamically Loading Extensions / Plugins   * Better Performance than common scripts like Javascript / PHP   * Object Oriented   * Easy to setup all requirements   * Machine Security (You cannot use any native machine functions, security manager for extended permissions like managing files, connecting to network)   * Code Security (People'll have a hard time to recover the code) The total package will consist out of different parts:   * Compiler to Bytecode   * Virtual Machine (Read & Execute Bytecode)    * Program using the scripts (Contains VM to run them)   * Bytecode Program (Compiled program to be ran by the VM) A program will be stored inside a basic .zip archive. The .zip archive will contain all bytecode files as well the file containing an interface. When source code is compiled, all variable and function names will be gone. They will be replaced / obfuscated with regular integers. While compiling, an interface, as mentioned before, will be added to the .zip archive. The interface will basically be a library of function that can be called from outside the program, by the VM. This interface could for example include the main method. When the VM is being used as a plugin loader, it could for example also contain a `getName()` or a `getIcon` function. When loading in the VM it'll ask for an interface to use. When later on loading in a .zip to this VM it'll check if the interfaces match. If they don't the VM will refuse to load the program. When it's loaded in the main program will be able to ask the VM to run a certain function defined in the interface. Also the program being executed will be able to run functions of the VM. Also these functions will be a part of the interface. A program being executed can request to load in new programs. They will also be loaded with an interface and the program will be able to use it's method. (A plugin loading plugins basically) The idea seems flawless to me but just to be sure I wanted to ask everyone here if any problems or blockers might occur while developing it. Just to be clear, I'm not aiming to compete with Java/CLR or anything.


title: Custom Role Provider in ASP.NET MVC and specifically a User having multiple Roles

text: I have searched around and I can't find any particular answer that addresses what I am asking but no doubt it will have been mentioned already somewhere. I know that when you inherit from an abstract `System.Web.Security.RoleProvider` you override this method `public abstract string[] GetRolesForUser(string username);` and as the name of the method ( **GetRoles** ) and it's return value ( **string[]** ) implies, more than 1 role can be returned for a single user, but it could also be restricted to a single item array through a custom role provider. In my situation I am implementing this in a .NET MVC web app and using a custom .NET role provider, and I have a decision to make as to whether I should allow a user to be in more than 1 role at a time. I am looking for any general reasons for/against doing this (most specifically implementation reasons). Most of the points I can think are app domain specific, here are a couple...   * Deciding which role permissions take priority i.e. what to do when 1 role authorizes a particular action and another is supposed to deny it but both roles are assigned to the same user.   * Whether to allow users to switch in and out of their roles or to only ever assign 1 role to them and have an administrator change this. but is there any particularly bad reason why you should avoid giving a user multiple roles at a time? Is it better to give a user only 1 role?


title: Using third-party libraries - always use a wrapper?

text: Most projects I am involved with use several open-source components. As a general principle, is it a good idea always to avoid binding all components of the code to the third-party libraries and instead go via an encapsulating wrapper to avoid the pain of change? As an example, most of our PHP projects directly use log4php as a logging framework, i.e. they instantiate via \Logger::getLogger(), they use ->info() or ->warn() methods, etc. In the future, however, a hypothetical logging framework may appear which is better in some way. As it stands, all the projects which closely couple to the log4php method signatures would have to change, in dozens of places, in order to fit the new signatures. This would obviously have a wide impact on the codebase and any change is a potential problem. To future-proof new codebases from this kind of scenario, I often consider (and sometimes implement) a wrapper class to encapsulate the logging functionality and make it easier, though not foolproof, to alter the way in which logging works in future with minimal change; the code calls the wrapper, the wrapper passes the call to the logging framework _du jour_. Bearing in mind that there are more complicated examples with other libraries, am I over-engineering or is this a wise precaution in most cases? EDIT: More considerations - using dependency injection and test doubles practically requires that we abstract out most APIs anyway ("I want to check my code executes and updates its state, but not write a log comment/access a real database"). Isn't this a decider?


title: Dictionary of language concept terms?

text: Is there somewhere some kind of dictionary or book which explains all those modern terms of language concepts like (but not limited to)   * currying    * closure    * lambda function   * type deduction    * dynamic meta-programming    * multiple dispatch    * etc. ? I know that books on programming languages like groovy explain some of these concepts, but I am looking for something more comprehensive and language independent... Update: Yes, I know, I will find explanations for each of those single concepts through google and wikipedia, but I am looking for an overview of all those terms... a dictionary :-) Background: As long as I don't know the term to search for, I can't find it on wikipedia or google... **Bounty:** Since I am still looking for a good overview or list of programming concepts together with an explanation, I now offer a bounty for the best answer. If you don't have a link to an overview, but you know some programming concepts which are not mentioned yet - please feel free to create an answer and name them together with a link to wikipedia or another explaining text. I will collect all these answer and the best one will receive the bounty. **Update:** thanx for all answers. It was hard to decide on the right answer and bounty. Since it seems that there is no such dictionary I was looking for, I decided to collect references by myself in a blog: http://plconcepts.blogspot.com/


title: When is a code considered tight and how does it increase efficiency of the code?

text: I have read many times that insertion sort has tight code and hence the hidden constant factor in its asymptotic complexity is smaller. I just read yesterday that quick sort has tight code just like insertion sort so it also has smaller hidden constant factor. It is one of the reasons it is considered best among the `O(n lg n)` sorting algorithms. I don't understand what does it mean when someone says that this algorithm's code is tight. What does that mean exactly and how does it lead to improvement in the efficiency of the algorithm (the smaller hidden constant factor in asymptotic complexity)? PS: I am not sure which tags can be added to this question. So please add tags, if necessary.


title: Web Developers not learning "traditional" techniques?

text: I ran across this question on SO: http://stackoverflow.com/questions/7373066/webpage-source-code-incomplete- hidden-code Without trying to infer too much or start a side-discussion of the sort that SO discourages, I think it's fair to conclude that the OP is someone who is familiar with HTML, Javascript, CSS and the basic architecture of the Web. Yet this question suggests that they have never worked with code that used a traditional `form` post. Is it really the case that people starting to work in the Web nowadays don't learn about that crufty old stuff any more? I don't even mean this question to be as crotchety as it probably sounds. I'm not suggesting people learn about `<marquee>`, implement all UI layout in tables, dynamic content with `document.write` etc. But form posts seem like one of those critical pieces a person should understand, specifically before getting into Ajax. Did I stumble on an anomaly or a trend here? Am I wrong?


title: How to import an image using openGL

text: I am new to openGL C++ and what I wanted to know is if there was a pre- existing function in the OpenGL library that would allow me to import a 3d or 2d model? For example, if I make a 3d image using photoshop, or a 3d model using 3ds max could I use a library in openGL example (not real function): glUse3dimage(3dmodel); ? Or would importing images be more difficult and I would have to make my own function? I am not really a good programmer so I wanted to see how difficult this would be. Another question I had was if this was difficult would this be easier using openGL with another language? For example openTK with C#?


title: Static is bad, but what about the Factory pattern?

text: I'm on a TDD project, so I try to stick as much as possible to the good pratices involved with that kind of development. One of them is avoiding as much as possible static and global. I'm facing this problem: I've an object "article" that can have "options" (additionnal "micro-articles") linked to it. I can't figure out how to have a good approach that will not be counter productive or generate too much queries because I would be in a situation where everything is so decoupled that I'll basically need to make 1 query per object. From my actual perspective, I see 3 options: 1) Build inside article:               class Article     {         //[...]         public function getArrOption(){             //Build an array of Options instance.             //return an array of Options.         }     }      **Pro:** Straight forward **Const:** Maintenability: The article object now contain the building logic for the Option object. This will probably lead to code duplication. 2) Using an optionFactory               class Article     {         //[...]         public function getArrOption(){             return OptionFactory::buildFromArticleId($this->getId());         }     }      **Pro:** Building logic is not out of the Article class **Const:** I'm breaking the "static is hard to mock" rule, making my Article class hard to test. 3) Separate all logics.               //Build the array of Option instance in a controller somewhere, using a Factory:     $arrOption = OptionFactory::buildFromArticleId($article->getId());      **Pro:** Article only handle his own responsability, and doesn't care about his "father" link to the options. Things are really decoupled **Const:** Will require more code inside the Controller everytime I'll need to access the Options. That mean that I should _never_ use a Factory inside an object, and that sound kind of utopic to me... What's the best way to go ? ( Did I've miss something ? ) thanks. Edit: Not to mention that if I can't call factory inside class, I can basicaly never use the lazy initialization pattern too...


title: How were some language communities (eg, Ruby and Python) able to prevent fragmentation while others (eg, Lisp or ML) were not?

text: The term "Lisp" (or "Lisp-like") is an umbrella for lots of different languages, such as Common Lisp, Scheme, and Arc. There is similar fragmentation in other language communities, like in ML. However, Ruby and Python have both managed to avoid this fate, where innovation occurred more on the implementation (like PyPy or YARV) instead of making changes to the language itself. Did the Ruby and Python communities do something special to prevent language fragmentation?


title: Implementing chat in 2013

text: I played a bit with WebSockets and started to implement a tiny chat. Last time I did something like this was when there was no such thing as threads and computers had single core. I started to think how to implement it with todays programming patterns but I didn't come to any final conclusion. How you implement chat's main functionality in today's technics in higher level? I now have context Server, Socket and User. User has states Undefined, Connected, InChat, ToBeDisconnected, Disconnected, My main problem is the user maintenance:   * If user hasn't said "hello" in 5 seconds after connection was opened -> disconnect   * User is not replied to "ping" with "pong" at all or at least 2 minutes -> disconnect   * User has been connected over 12 hours -> disconnect   * User haven't been assigned profile (nickname and/or other details) after 5 minutes of connect -> disconnect   * Some other program specific flag that kicks out user is triggered -> disconnect  My current implementation is like how it was done in olden days. ie. I have               while(serverRunning)      {        foreach(socket in allSockets)       {         user = allUsers.findUserBySocket(socket);          doMaintenance(user);       }     }      Now this runs far too many times and locks and blocks allUsers and allSockets way too much. How this is implemented today? Like this for example?   * Socket connects    * Add to allSockets    * Add to allUsers    * Start per-user thread that runs every x seconds and runs **user.doMaintenance()**?   * Or there's per-user queue that gets injected with actions like **doPongCheckAction** , **doProfileTimeoutCheckAction** , etc every x seconds (also needs per-user thread which constantly empties user's queue)?   * Or there's Maintenance thread that runs every x second after last run and iterates through allUsers (a bit like current implementation)?   * Or there's thread that injects actions to all users queues when there's been too long when same kind of action were ran and other thread that iterates through all users and empties user's queue?   * Or something else or which is not even based on queues? :)


title: How to improve your ability to debug existing code

text: A common task in the working world is dealing with existing, but buggy code. What are some tips to improve your skills as a debugger?


title: Is it possible to use C++ code in an objective-c iPhone app

text: I'm thinking about writing an application that will have a web-version and an iPhone version (and perhaps later also an android version). Since there is some algorithms that are the same on the iPhone and the web versions, I was wondering if it is possible to write that part in c++, while keeping the rest of the application in objective-c?


title: Does doxygen support templates for the HTML output?

text: I've documented my code for `doxygen`, but I don't want the default HTML it gives. I know I can customize it by providing custom CSS, headers, footers, etc. (like GNOME does), and how I can add common PHP code to the files and tell it to save as `.php`, but that isn't really what I want. What I want is output like MSDN. I can't describe it really. My question is, Is this possible using doxygen with something like templates, or do I have to output XML and parse it with another program (that I wouldn't mind writing)?


title: How cache works in ServiceStack web services

text: I am new to caching and trying to understand how it works in general. Below is code snippet from ServiceStack website.               public object Get(CachedCustomers request)     {         //Manually create the Unified Resource Name "urn:customers".         return base.RequestContext.ToOptimizedResultUsingCache(base.Cache, "urn:customers", () =>         {              //Resolve the service in order to get the customers.              using (var service = this.ResolveService<CustomersService>())                     return service.Get(new Customers());          });     }          public object Get(CachedCustomerDetails request)     {         //Create the Unified Resource Name "urn:customerdetails:{id}".         var cacheKey = UrnId.Create<CustomerDetails>(request.Id);         return base.RequestContext.ToOptimizedResultUsingCache(base.Cache, cacheKey, () =>         {             using (var service = this.ResolveService<CustomerDetailsService>())             {                  return service.Get(new CustomerDetails { Id = request.Id });             }         });     }      My doubts:   1. I've read that cached data is stored on same/distributed server RAM. So, how much data can it handle, suppose in first method if customers count is more than 1 million, doesn't it occupy too much memory.   2. Ingeneral, do we apply caching only for GET operations and invalidate if it gets UPDATE'd.   3. Please suggest any tool to check memory consumption of caching.


I was wondering how the cover flow effect is coded. I used this link which gave me the code on how it all worked out : http://luwes.co/labs/js-cover- flow/. I am completely new to complex programs so I had a hard time in understanding how it all works out. Why do we program each file separately and place them in separate folders and how do all these file come together? Why is there build files, what do they do?


title: Using Microsoft Contoso company for own examples in microsoft based products?

text: We are currently planning to create a 'preview' version for one of our asp.net mvc apps. Is it allowed to use a company like Microsoft's contoso for such a case (Branding etc.)?


title: Problems in coordination between software and database teams

text: This is pretty much a "software process" question: When your organization is split into two teams: software team and database engineering team (the organization is in ETL/BI/Data mining delivering terabyte sized reports and database dumps for research organization), What are the most common issues in coordination between such two teams? and how do you work around them? Precisely how much authority does a DBA have in dictating design versus a Software Engineer?


title: balancing old cases with agile practices

text: My team is just getting started integrating agile practices (we've chosen kanban) into our dev, test and design teams, but we have a lot of bug cases and feature cases not written in user stories left over from the old system and we're trying to find a good way to take care of the bugs but still keep the devs that need to stay heads down focused. for now we have a newer dev assigned to bug fixes so the rest can work on new features but we are looking for the right way to structure the team. We have 7 devs, 2 testers and 2 designers. Thanks in advance for the help :)


title: How do I split out a service layer

text: I currently have four projects in my website's solution: **Project.Data**   This holds the EntityFramework DbContext object and also the Repositories that interact with it. It references _Project.Models_. **Project.Models**   This holds the business objects and doesn't reference any other project **Project.Web**   This holds all ViewModels, Views, Controllers and static website content. It references _Project.Data_ (for the Repositories), _Project.Models_ and _Project.Service_ And now I get to the problem project... **Project.Service**   I want this to be the project that _Project.Web_ uses to make its controllers thin, as I understand this is desirable. Each of the classes in this project will probably have a repository injected into it so they can access any data they need to. One of their responsibilities will be to create a ViewModel for the controllers in _Project.Web_ to use. This means that it will reference _Project.Data_ for a reference to those repositories, _Project.Models_ for the models and _Project.Web_ for access to the ViewModels. * * * So just as I'm getting the feeling I'm doing something really wrong by all this, I go to add my last reference to _Project.Web_ from _Project.Service_ and it errors out telling me that I now have a circular dependency... What exactly am I doing wrong here? Are there patterns I can use that will clean up some dependencies on other projects or am I trying to do something that isn't useful anyway?


title: Is outsourcing code more expensive in the long term? Does it harm code quality?

text: I am aware of a company that owns the intellectual property of a decent software product and makes an excellent income from licensing per annum. However, the director (non technical) complains about the cost of maintaining the development team, as it eats significantly into the profit margins, and is considering outsourcing development of specific modules to other countries that charge at a lower rate. Personally, I don't think this will be a more cost effective solution in the long term. This can lead to communication breakdowns when there are problems, additionally the specifications will need to be water tight which can end up taking taking more time anyway. In my opinion, when working in teams communication is key - or is there an effective way of making this work? What are other peoples thoughts AND experiences on this matter?


title: Where should I parse data obtain with a DAO

text: I have a DAO that brings data from a web service, that data comes in a string, in the likes of:               *NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...)      I have a DTO that I wanna fill up with the parsed data (the DTO has fields in the like of name, birthdate, id...) So, my question is, what is the best practice:   * Parsing the string in the DAO to fill up the DTO   * Passing the data string to the DTO and the DTO itself parse the string and fill itself up   * Do the parsing in an utility class that would receive the string and return the fill up DTO > DAO: Data Access Object > > DTO: Data Transfer Object Note: I kept this language agnostic so it could be useful to anyone using object oriented languages, but, in my particular case, I'm using Java.


title: Coding style - define fields separate or not

text: Some use this convention:               private String event;     public getEvent() { return this.event; }      public setEvent(String value) { this.event = value; }          private int id;      ... same as above ...      In some projects they define all the fields first, all static fields after (or before), all public/private variables, then the setters, getters, other methods. Which do you use and why?


title: Refactored to a fancy global variable?

text: I am currently refactoring an application that i built in JavaScript.   The application uses a **starting hour** and a **total working hour count** in order to construct a timetable for daily, weekly and monthly views. The starting hour and total working hour count are the same for all timetables I considered using a pattern to initialise the Timetable and started reading up on how to proceed in doing so in Javascript as I am not too familiar with the language. My orginal initialisation function for the Timetable had the following signature:               FillTimeTable( startingTimeWeekDay, workinghourCountWeekDay );        Problem with this method is that for a different view of the timetable I have to call the other views with the same signature again.               FillWeeklyTimeTable( startingTimeWeekDay, workinghourCountWeekDay );     FillMonthlyTimeTable( startingTimeWeekDay, workinghourCountWeekDay );      If the working hours change I or the poor bugger maintaining my code would have to alter them at different locations within the code and due to the way I organised my code they are not placed as neatly as here. So during refactoring I considered alternatives like a global variable, Singleton or an Object. I read about objects, private members and constructors and decided that this might be the solution after reading up on Singleton Implementations and binning the global variables. So currently I have the following code:               function Timetable( startingTimeWeekDay, workinghourCountWeekday) {           this.startWeekday = startingTimeWeekDay;           this.hoursWeekday = workinghourCountWeekday;     }          Timetable.prototype.startWeekday = function() {           return this.startWeekday;     }          Timetable.prototype.hoursWeekday = function() {         return this.hoursWeekday;     }          var myTimetable = new Timetable( 6, 8 );         Everything is working fine so far, but myTimetable just seems like a really fancy way of declaring a global variable to me. Is this the case? Did I just decide on the wrong strategy or is this the way to go or have I missed something essential to working with JavaScript?


title: MVC Architecture -- How many Controllers do I need?

text: I have been coding for a while, but mostly scripts and simple applications. I've moved into a new role where it is all about developing Web Apps and using a proper MVC architecture, so I am desperately trying to learn about all that very quickly. I hope this question is not too similar to "Best Practices for MVC Architecture" but as I am going through a few different tutorials, I noticed that some have multiple controllers for different things. **How many controllers does a single web app need?** I realize this would be difficult to answer without an example so I'll provide one: Application:   1. User logs in.   2. User can do one of three things:   **a)** Upload a file (stored in a mongodb database with meta data).   **b)** Search for a file.   **c)** Log out. My question is a general one, but I gave the example to help out anyone trying to answer.


title: Preventing Web Site Users From Using Their Back Button To Get To Cached Screens After Logging Out?

text: I have a legacy Java webapp ( Spring 3.1 MVC, legacy servlest and JSPs ) I have modified to log the user out after s/he clicks an external link to leave the web site. The last screen(s) s/he was on are getting cached in the browser, enabling them to see some data by hitting their back button. I could put no-cache headers into those screens, and it works, but the site was poorly designed with multipage forms, some with one result screen doing post requests to get to another screen. If those screens aren't cached, a user hitting his/her back button will find themselves on a blank page going backwards and forwards leaving him/her nowhere with no other choice except to login again. A bigger mess. Short of redesigning a site is there anything else I can do to prevent the user from using his/her back button, after logging out to get to cached screens? I tried having the user go to a static redirect screen after logging out in the hope that s/he would just get bounced back to the external URL when using their back button, but at least two browsers don't appear to cache or navigate to such pages. Any ideas would be welcome. I am able to use javascript as well as server side code. Even if I can't solve this problem, I may learn something for the future Thanks Steve


title: Am I doing events right?

text: My problem is with JavaScript in the browser but I guess it could apply to any event-driven environment. I have coded up a widget in my app. The widget allows a user to select an item using 3 different sub-widgets (table, map & gallery). The sub-widgets display the same items and a selection can be made from whichever sub-widget the user prefers to use. Whenever a selection is made by the user or set in code a "selection-changed" event is fired by the sub-widget. The main widget listens for these "selection-changed" events. This worked fine until I started getting further on with the project and realized that I needed to adjust the selection in the other 2 widgets when the selection changes (If the user selects an item on the map, it should highlight that same item in the table and gallery). The problem is that when I set the selection in the other 2 sub-widgets they in-turn fire the "selection-changed" event and that ends up getting pretty recursive. This also happens when I need to clear the selection in all of the sub-widgets (I get 3 "selection-changed" events with the same empty data). This leads to several redundant calls being made for external resources and gives me the feeling it will lead to further problems in future. So my question is am I doing events right? The answer is obviously 'no' because I've got myself in to a pickle so early on but I wonder how other people use events without getting in to these problems - what kind of architecture would be better in this situation? Maybe I could have a way of setting and clearing selections in the sub-widgets that doesn't go on to fire the event but this feels like a hack and may end up conflicting with the framework I'm using to handle my views/models.


title: Good Practice : Storing variables and classes names in database for direct call

text: I would like to know if this is a good practice to store variables and classes names in database to use let users accessing them. For instance users may create entries in database's table in which they can insert a program's function name that would executed when the program will read it. I find it is a dangerous practice since users may execute or access any data of the program, but I've been told it's a quite common practice in languages with introspection like Python. Moreover, i was also suggested to have field in a table that would store another table field's name, to create somehow a dynamic foreign key. I personally find both practices very bad since in first case there is no more separation between user data and program data, and for the second case there is no separation between structure and data in the database. Can you please confirm me these practices are discouraged or tell me I'm wrong and suggest me a way to approach them in a safer way. Thank you.


title: Desktop GUI Design/Prototype/Mockup/Wireframe

text: I'm working on a project at the moment and I'm currently looking for some sources regarding creating GUI mockups. In my case, I'm creating basic diagrams with the intended layout of the design to ensure it will work correctly and consistently. What is this called? I've seen various names for it, including:   1. GUI Prototyping   2. GUI Mockups   3. GUI Wireframes Which applies to my situation and are there any good resources to reaffirm my decision to create these diagrams?


title: Resource to start with JavaScript quickly?

text: Previously, I wanted to learn Python quickly: Resource to start with Python quickly? and I was quite successful (enough to write a simplified LISP interpreter). Now I need to learn JavaScript for some web programming using Prototype and Scriptaculous with Ruby on Rails. Are there any resources to learn JavaScript quickly in reasonable depth? I am not a beginner programmer, but I have no experience with JavaScript. Are there any good quick tutorials?


title: Splitting documentation between docstrings and sphinx

text: I'm using a combination of docstrings and Sphinx to document my Python programs. With Sphinx's autodoc, I can write a lot of documentation into the source as docstrings. Is there any standard for how much documentation to put in each? For example, **case 1** is index.rst               .. automodule:: foo        :members:      and foo.py               """documentation"""          class Foo:     """documentation""""              def bar(self, baz):             """more documentation"""      **case 2** index.rst               .. automodule:: foo      and foo.py               """documentation          .. autoclass:: Foo          """          class Foo:     """documentation          .. automethod:: bar          """"              def bar(self, baz):             """more documentation"""      **case 3** index.rst               .. automodule:: foo        .. autoclass:: Foo           .. automethod:: bar      and foo.py               """documentation          Classes:         Foo          """          class Foo:     """documentation          Methods:         bar          """"              def bar(self, baz):             """more documentation"""      The **1** is easy to maintain, but the docstrings in the source lacks information. The **2** puts that information into the source docstrings, but it's a bit harder to maintain and is a bit harder to read. The **3** is easy to read and has complete documentation in the source code, but is very hard to maintain, and when you use sphinx to generate the documentation, some information is repeated. (It'll look something like:               foo:         documentation         classes:             Foo              Foo:             documentation             methods:                 baz             baz


title: Functions that only call other functions. Is this a good practice?

text: I'm currently working on a set of reports that have many different sections (all requiring different formatting), and I'm trying to figure out the best way to structure my code. Similar reports we've done in the past end up having very large (200+ line) functions that do all of the data manipulation and formatting for the report, such that the workflow looks something like this:               DataTable reportTable = new DataTable();     void RunReport()     {         reportTable = DataClass.getReportData();         largeReportProcessingFunction();         outputReportToUser();     }      I would like to be able to break these large functions up into smaller chunks, but I'm afraid that I'll just end up having dozens of non-reusable functions, and a similar "do everything here" function whose only job is to call all these smaller functions, like so:               void largeReportProcessingFunction()     {         processSection1HeaderData();         calculateSection1HeaderAverages();         formatSection1HeaderDisplay();         processSection1SummaryTableData();         calculateSection1SummaryTableTotalRow();         formatSection1SummaryTableDisplay();         processSection1FooterData();         getSection1FooterSummaryTotals();         formatSection1FooterDisplay();              processSection2HeaderData();         calculateSection1HeaderAverages();         formatSection1HeaderDisplay();         calculateSection1HeaderAverages();         ...     }      Or, if we go one step further:               void largeReportProcessingFunction()     {         callAllSection1Functions();              callAllSection2Functions();              callAllSection3Functions();         ...             }      Is this really a better solution? From an organizational point of view I suppose it is (i.e. everything is much more organized than it might otherwise be), but as far as code readability I'm not sure (potentially large chains of functions that only call other functions). Thoughts?


title: How can my multinational transition from one development platform to another?

text: I am working in IT department of a big, international company. We are developing different Intranet applications for the business (Complaints, Rebates, Service Desk etc). Now we decided to migrate from PHP platform to .NET (integration with MS CRM Dynamics, Exchange and MS Office be among many reasons). As there are about 20 different applications the business is using on current, PHP platform, we will have to come up with the best way to move them all to the new platform. I don't want to go into details how to convert the code etc, as while we do migrate we want to improve all of these applications. So we came up with 2 main ways of moving these apps:   1. Support just one platform. What would it mean? Create homepage and literally migrate all apps as they are to .NET (without improving them while we do that). After New intranet is running we would start rebuilding migrated applications and improving them. That would save us developing intranet in .NET while having to support PHP platform.   2. Support both platforms for some time. That would mean building just a homepage and 1 or 2 new applications (which do not exist on our PHP platform). Making these available to the users but not taking off the PHP platform (we would incorporate menus and links to make it easier for users to move between apps on PHP page and the new one). Then we would start rewriting the PHP applications while improving them. Now I am not sure what would be better, on one hand (option 1) we will potentially make everything easier for users by not forcing them to use two different platforms at the same time. Although they won't see any improvement of having the new platform, apart from everything looking nicer, the functionality of applications on the new platform will be the same for some time. Also I think we would add ourselves (IT dep) more work as esentially we would write every app twice.   On the other hand in option two (2) users would have worse experience as two platforms look different, but they would realise the benefits of the new platform as new applications are beeing moved. Has any of you came across something like that? What would you choose? Or maybe there is even different, better way to those I have presented? I would like to know what do you think and how would you approach that.


title: Is practicing meditation a good or bad thing for programmers?

text: I'm practicing mindfulness since a few weeks, a popular form of secular meditation which concept is to focus yourself on the **present moment**. It works so great I don't understand why not more people are rushing into that practice. It's useful for me because I've important responsibilities in several companies, and I have to manage a high level of pressure. Programming is still a large part of my daily occupation, but most of what I do and will do in the future is working with programmers, not programming itself. `That's what I'm questioning`. As a programmer we use the past and plan for the future all the time very actively. Being in peace will certainly help with interpersonal interactions and communication, but the so specific intellectual task programming is? Is meditation decrease our **ability** to do that, in profit of more peaceful and happy life? **Is meditation a good or bad thing for our programming abilities?** I will be very interested in the way to do meditation too. For example, I use breathing. **UPDATE APRIL 8 2011** : just finished the 8 weeks Jon Kabat Zinn training (MBSR). While it's too early to measure benefits on my programming abilities, I can tell you it reduced overall anxiety significantly. I strongly recommend the program.


title: How is MVC different from Layered

text: Based on this book , refering to pages 156 to 159 , it talks about the two different types of software architecture model : MVC & Layered . There are distributed system architecture patterns such as : Master-Slave , 2 tier client-server , multi-tier client server , P2P These are my questions : 1) In MVC , there is the Model , View , Controller which is in essence a three layer architecture with View on top , Controller in the middle , Model on the bottom and all three layers are only able to communicate with the layers above and beneath them only which is exactly the same as layered architecture . What is the actual difference between them ?? 2) Isnt MVC a form of client server architecture ?? 3) Master-Slave seems exactly like 2 tier client-server where the server is the Master and the client is the slave , I dont understand how Master-Slave differs from Client-Server


title: can an object in a sequence diagram send a message call to the user?

text: I need to make a sequence diagram and I'm not sure how to represent user input. Is it correct to have a message be sent from an object to the user asking for user input or should all objects be passive and only be operated by the user?


title: A good interpreted language for a small embedded project

text: I have an mbed microcontroller which has a small ARM Cortex M3 on it. Basically, my effective resources for the project are ~25 KB of RAM and ~400 KB of Flash. For I/O I'll have a PS/2 keyboard, a VGA framebuffer (with character output), and an SD card for saving/loading programs (up to a couple of MB maybe). I ask because I'm trying to figure out what programming language to implement on the thing. I'm looking for an interpreted language that's easy for me to implement and won't break the bank on my resources. I also intend for this to be at least possible to write on the device itself, though the editor can be interpreted (yay, bootstrapping). Anyway, I've looked at a few simple languages. Some nice candidates:   * Forth   * BASIC   * Scheme?  Has anyone done something like this or know of any languages that can fit this bill or have comments about my three candidates so far?


title: Understanding the Macro Aspects of Data Structures

text: I am studying data structures right now, but I still need to find a teacher/site/book with a clear explanation of the macro aspects of this topic. What I mean is: most lessons/text books mix everything together, with no logical structure. They start with linked lists, then talk about stacks, queues, heap priorities and so on. But as far as I can tell, a linked list and a stack are not really in the same category. After all you can use the linked list to implement different types of data strcutures (e.g., a stack, a queue, etc). So would it be right to say that the types of data structures are: the stack, the queue, the hash-table, the heap, and the tree; while arrays (static) and linked lists (dynamic) are tools you are going to use to implement those data structures? If the above statement is not completely correct, maybe a linked list is indeed a data structure in itself, and therefore we would be using one data structure (e.g., the linked list) to build other data structures on top of it (e.g., a stack)?


title: Fast programmatic compare of "timetable" data

text: Consider train timetable data, where each service (or "run") has a data structure as such:               public class TimeTable     {         public int Id {get;set;}         public List<Run> Runs {get;set;}     }          public class Run      {         public List<Stop> Stops {get;set;}         public int RunId {get;set;}     }          public class Stop      {         public int StationId {get;set;}         public TimeSpan? StopTime {get;set;}         public bool IsStop {get;set;}     }      We have a list of runs that operate against a particular line (the `TimeTable` class). Further, whilst we have a set collection of stations that are on a line, not all runs stop at all stations (that is, `IsStop` would be `false`, and `StopTime` would be `null`). Now, imagine that we have received the initial timetable, processed it, and loaded it into the above data structure. Once the initial load is complete, it is persisted into a database - the data structure is used only to load the timetable from its source and to persist it to the database. **We are now receiving an updated timetable.** The updated timetable may or may not have any changes to it - we don't know and are not told whether any changes are present. What I would like to do is perform a compare for each run in an efficient manner. I don't want to simply replace each run. Instead, I want to have a background task that runs periodically that downloads the updated timetable dataset, and then compares it to the current timetable. If differences are found, some action (not relevant to the question) will take place. I was initially thinking of some sort of checksum process, where I could, for example, load both runs (that is, the one from the new timetable received and the one that has been persisted to the database) into the data structure and then add up all the hour components of the `StopTime`, and all the minute components of the `StopTime` and compare the results (i.e. both the sum of Hours and sum of Minutes would be the same, and differences introduced if a stop time is changed, a stop deleted or a new stop added). Would that be a valid way to check for differences, or is there a better way to approach this problem? I can see a problem that, for example, one stop is changed to be 2 minutes earlier, and another changed to be 2 minutes later would have a net zero change. Or am I over thinking this, and would it just be simpler to brute check all stops to ensure that   1. The updated run stops at the same stations; and   2. Each stop is at the same time


title: Is there a standard for machine-readable descriptions of RESTful services?

text: I've interacted with a few RESTful APIs that provided excellent documentation for humans and descriptive URIs, but none of them seem to return machine- readable descriptions of themselves. It's not too tough to write methods of my own that assemble the right paths, and many language-specific API libraries are already just wrappers around RESTful requests. But the next level of abstraction seems really useful: a library that could read in an API's own machine readable documentation and generate the wrappers automatically, perhaps with a call to some standard URI like `base_url + '/documentation'` Are there any standards for machine-readable API documentation? Am I doing REST wrong? I am a relatively new programmer, but this seems like a good idea.


title: What should I do with this installer, using tools like Wise, InstallShield, and InstallAnywhere?

text: I need to find an installer tool that can do the following on Windows 7, Windows Server 2008, or Windows Vista (32-bit and 64-bit editions):   1. Install IIS 7 if not installed    2. Install .NET 4.0 if not installed   3. Register ASP.NET 4.0 if necessary   4. Install SQL Server 2008 Express Edition if not installed   5. Install my webapp to IIS c:\inetpub\wwwroot\ by unpacking a ZIP file   6. Create database, login and run scripts   7. Update the web application's _web.config_ file with database information    8. Run two other MSI installs in silent mode (this one should be easy) I have used InstallShield in the past with a Delphi application I have written, but this is a lot more complicated. I have never "deployed" a web application to client machines, and we need this install to be bulletproof since most clients who install will not have much IT knowledge. What is the experience using these tools? We will buy the tool we decide is the best - but once we do, there won't be any going back - so I really want to make an informed decision.


title: What should go in atom:author for autogenerated content in an Atom feed?

text: I've recently started digging into Atom syndication feeds and are planning to migrate some web services we're running into an more standardized model using Atom Syndication and the Atom Publishing Protocol. The content of most of the syndication feeds are not created by a concrete user though, but rather auto-generated using data from various databases. I'm probably just a little stuck my head right now, but I simply can't decide what should go in the mandatory `atom:author` fields. The spec states:               A Person construct is an element that describes a person,     corporation, or similar entity(...)      So should the author field contain the name of our company, the developer(s) who wrote/maintain the generator, or something completely else? What would be the most semantically correct?


title: Design choices when doing multithreading in C++

text: OK, so, **background** : I have a little "server" app/module that is written in C++. This is kindof a tunnel application that provides a standardized API via TCP/IP[a] and on the other hand talks to the "real" server via TCP/IP[a] via it's own interface. It doesn't even officially support multiple clients, but due to the inherently multithreaded nature of the processing that is done by the server and by the client (plus asynchronous callbacks) the tunneling app itself is multithreaded and runs pretty well during normal operations. The application uses a number of simple mutexes (Win32 CRITICAL_SECTIONS) to lock down the code paths that would create problems when executed concurrently and this does work pretty well in practice. A little picture:               [proprietary server]        [tunneling app]        [client]                          <--1-                  <--1-                                   (upcalls)    |<--2-                          <--3-                  <--3-                                                | -2-->                           --1->    (returns)     -1-->                           --3->                  -3-->                           -a-->    (callbacks)   -a1->                           -b--> |                -a2->      So pretty much everything goes with regards to call chains. * * * We have now identified a number of problems in fringe cases like calls during initialization or shutdown of the server and/or tunneling app and I'm struggling to properly fix these as they are mostly related to multithreaded object and thread lifetimes and just throwing more mutexes or more locks at the problem really doesn't cut it. * * * As for the **Question** : _What I am looking for_ is advice and guideline on _how to write multithreaded (C++) code that would work in all corner cases from the start_ and doesn't involve just locking everything down. Possibly with a specific focus on the context of heavy multithreading in a network communication scenario. Any insights welcome. * * * Notes: [a] : It's a CORBA communication interface. But The problems I see are really not related to the actual messaging mechanism used, as the messaging part on the wire works very well.


title: Wrapping my mind around prefix notation?

text: I'm reading about LISP. I understand how prefix notation works at a certain level, but I was wondering if there are any tricks to making it intuitive.


title: Good introduction to metaprogramming in Prolog?

text: I would like to make for example imperative programs as output of Prolog (shaders of graphic card) and also event-driven programs (game logic) ... also I would like to learn how to metaprogram in Prolog in general. I believe there might be some insights or advices how to do it; I don't want to jump into it not prepared and hack until I make working programs. I wonder what is good introduction to metaprogramming in Prolog? Thanks :)


title: Need an OOP pattern or strategy for "pluggable" property

text: I'm using OOP and MVVM in a WPF c# application. The goal is for the resulting object (data-bound to user interface) to accurately represent a product. One specific area of the product is highly configurable. For conceptual purposes, imagine a boat which can have various means of propulsion. A submerged prop motor or above water fan motor may be attached at the stern, and they would have very different properties. At the model level, I could have an interface typed property for this `PropulsionDevice`, with the interface defining all the required information I need for pricing and weighting the finished product. How to assign this property based on user input is where I am unsure what to do. Creating an enumeration with an item for each class implementing my interface, and presenting it in a `ComboBox` seems clunky and naive (the disconnect between the enum item and the class seems wrong). But, I'm not sure if meta- programming with Custom Attributes or using Reflection would be a better option. Maybe there is another option? Any suggestions on how to allow for flexibility in my c# classes, as well as how to present this in the UI?


title: Justify moving beyond IE7

text: I work within a closed environment that defines supported browsers organization-wide. Put another way: you can't use it unless it's an approved install. Given that (soon-to-be-formerly) Twitter Bootstrap and jQuery plan to drop‡ IE7 support, and IE itself has been on version 9 for a while, I'd like to put together a thoughtful case for nudging my organization past IE7. Our environment does have Chrome, but it's adoption hasn't yet caught fire, and in any case everything we need to build will have the IE expectation, for better and for worse, forever. What are some other resources (particularly security-related) that can help me make the case for moving beyond IE7? ‡-perhaps "deprecate IE7 support" would be a better term


title: Why should I use Bower?

text: I can fully appreciate the benefits of a package manager like Python PIP, Node npm, or Ruby Gems since they're doing much more than adding files to your applications path. Maybe I'm missing the point, or I'm being obtuse, but here are the **negatives** I can see:   * Separate step when building a project   * Separate dependency to install via another package manager (yo dawg)   * More clutter in the projects root with `bower.json` and / or `.bowerrc`   * Reliance on the registry being up to date, correct, and available   * Some imports / references to things like images won't work The **positives** I can see are these:   * I don't have to download the dependencies manually   * Optionally install packages as part of scaffolding based on user prompts or the like I'd really like to know of any benefits I'm unaware of, and I should say I'm not trying to be provocative I genuinely want to know.


title: Functional Requirements / Specification and relationship to DEV and QA

text: Functional Requirements state "WHAT" needs to be done from a user's perspective Functional Specification state "HOW" it needs to be done from technical standpoint. Do QA teams focus and Functional Requirements whereas development team focus primarily on functional specification though they need to have an understanding of functional requirements? I assume QA would sign off the product as long as the functional requirements are met irrespective of whether the functional specification is followed or not. Is my assumption correct?


title: Does an unexperienced programmer need an IDE?

text: Reading this other question makes me wonder if I (as an absolute beginner PHP programmer) should stick with WAMP and Notepad++ or to switch to some IDE like Eclipse. It's understandable that skilled developers will benefit from a big shiny IDE. But **why should an absolute beginner use an IDE?** Do the benefits outweigh the extra challenge of learning the IDE on top of learning to develop? **Update for clarification:** My goal is to get some basic programming experience. By choosing PHP and WAMP (and FogBugz and Kiln) I hope to avoid having to navigate the tricky / messy OS specifics and compiling etc. and just focus on basic functionality like an online user registration form. I've got lots of theoretical understanding from university a decade ago but no practical experience. I want to remedy that with a hobby project that would be similar to a real-world sellable web app. There are so many questions to ask. So many pitfalls I probably _have_ to blunder into. This question is just one piece (my first!) of that puzzle.


title: Object oriented vs vector based programming

text: I am torn between object oriented and vector based design. I love the abilities, structure and safety that objects give to the whole architecture. But at the same time, speed is very important to me, and having simple float variables in an array really helps in vector based languages/ libraries like Matlab or numpy in Python. Here is a piece of code I wrote to illustrate my point Problem: Adding Tow volatility numbers. If x and y are two volatility numbers, the sum of the volatility is (x^2 + y^2)^0.5 (assuming certain mathematical condition but that's not important here). I want to perform this operation very fast, and at the same time I need to ensure that people don't just add the volatility in the wrong way (x+y). Both of these are important. The OO based design would be something like this:               from datetime import datetime      from pandas import *          class Volatility:         def __init__(self,value):            self.value = value              def __str__(self):            return "Volatility: "+ str(self.value)              def __add__(self,other):             return Volatility(pow(self.value*self.value + other.value*other.value, 0.5))      (Aside: For those who are new to Python, **add** is just a function that overrides the '+' operator) Let's say I add tow lists of volatility values               n = 1000000     vs1 = Series(map(lambda x: Volatility(2*x-1.0), range(0,n)))     vs2 = Series(map(lambda x: Volatility(2*x+1.0), range(0,n)))       (Aside: Again, a Series in Python is sort of a list with an index) Now I want to add the two:               t1 = datetime.now()     vs3 = vs1 + vs2     t2 = datetime.now()     print t2-t1      Just the addition runs in 3.8 seconds on my machine, the results I have given doesn't include the object initializaion time at all, its only the addition code that has been timed. If I run the same thing using numpy arrays:               nv1 = Series(map(lambda x: 2.0*x-1.0, range(0,n)))     nv2 = Series(map(lambda x: 2.0*x+1.0, range(0,n)))          t3 = datetime.now()     nv3 = numpy.sqrt((nv1*nv1+nv2*nv2))     t4 = datetime.now()     print t4-t3      It runs in 0.03 seconds. That's more than 100 times faster! As you can see, the OOP way gives me a lot of security that people won't be adding Volatility the wrong way, but the vector method is just so crazy fast! Is there a design in which I can get both? I am sure a lot of you have run into similar design choices, how did you work it out? The choice of language here is immaterial. I know a lot of you would advise that use C++ or Java, and the code may run faster than vector based languages anyway. But that's not the point. I need to use Python, because I have a host of libraries not available in other languages. That's my constraint. I need to optimize within it. And I know, that a lot of people would suggest parallelization, gpgpu etc. But I want to maximize single core performance first, and then I can parallelize both the versions of code. Thanks in advance!


title: Have enterprises adopted pure FP to create desktop user interfaces? Examples?

text: ~~I see some evidence (F#) online that functional programming is penetrating enterprise.~~ Where I work we primarily develop VB.NET WinForms applications. The .NET infrastructure for developing WinForms apps is built on OO concepts (classes owning methods) -- think of how a combo box is defined. As a result, it does not appear that even when using F# one is able to embrace the functional paradigm. The examples I find have F# falling back to OO style. Is anyone aware of examples where an enterprise has adopted pure functional style for the development of GUIs? This speaker talks about immediate-mode GUIs which would seem a good fit for the functional paradigm. React.js and Elm language are good fits, but not adopted by "enterprise." I am not aware of an enterprise that is doing truly functional GUIs. I am wondering if pure FP is suited to the task and if someone could direct me to source code examples. I have a hunch that enterprise has long ago taken the OO road and so OO is what the GUI platforms were built on. If FP had been as widely used we'd have the FP GUI libs too.


title: Interface and Inheritance: Best of both worlds?

text: I 'discovered' interfaces and I started to love them. The beauty of an interface is that it is a contract, and any object that fulfills that contract can be used wherever that interface is required. The problem with an interface is that it can't have a default implementation, which is a pain for mundane properties and defeats DRY. This is also good, because it keeps the implementation and the the system decoupled. Inheritance, on the hand, maintains a tighter coupling, and has the potential of breaking encapsulation. **Case 1** ( Inheritance with private members, good encapsulation, tightly coupled)               class Employee     {     int money_earned;     string name;          public:      void do_work(){money_earned++;};      string get_name(return name;);     };               class Nurse : public Employee:      {        public:        void do_work(/*do work. Oops, can't update money_earned. Unaware I have to call superclass' do_work()*/);          };          void HireNurse(Nurse *n)     {        nurse->do_work();     )      **Case 2** (just an interface)               class IEmployee     {          virtual void do_work()=0;          virtual string get_name()=0;     };          //class Nurse implements IEmployee.     //But now, for each employee, must repeat the get_name() implementation,     //and add a name member string, which breaks DRY.      **Case 3:** (best of both worlds?) Similar to **Case 1**. However, **imagine that (hypothetically) C++** did not allow overriding methods **except** those methods that are **pure virtual**. So, in **Case 1** , overriding do_work() would cause a compile-time error. To fix this, we set do_work() as pure virtual, and add a separate method increment_money_earned(). As an example:               class Employee     {     int money_earned;     string name;          public:      virtual void do_work()=0;      void increment_money_earned(money_earned++;);      string get_name(return name;);     };               class Nurse : public Employee:      {        public:        void do_work(/*do work*/ increment_money_earned(); ); .     };      But even this has problems. What if 3 months from now, Joe Coder creates a Doctor Employee, but he forgets to call increment_money_earned() in do_work()? * * * **The question:**   * Is **Case 3** superior to **Case 1**? Is it because it of 'better encapsulation' or 'more loosely coupled', or some other reason?   * Is **Case 3** superior to **Case 2** because it conforms with DRY?


title: Mastering technology like LINQ, WCF really necessary or is OOPS enough?

text: I am a C# developer. My observation of the IT industry as a C# developer is that the technology keeps changing or being updated by Microsoft like LINQ, WCF, and WPF etc. OOP has been the fundamental for all kinds of developments that we see today in any language. My question is,   1. Is it good if I am a decent programmer in OOPS but not mastering any specific technology?   2. As a WinForms developer, is it necessary to know C++ with C# for better job perspective?


title: Rich console UI

text: There are bunch of console programs and especially games using full redraw (not sure ho this correctly named) of console window. For example, look at output of linux `top` program -> http://upload.wikimedia.org/wikipedia/commons/9/9f/Top_program.jpg it doesn't just write text line by line all the time making the whole output oh thousands lines, but every second clears the screen and prints updated information. Or another example of `Apache Geronimo`: during startup, it prints to console progressbar -> http://i.imgur.com/BYWf1Sq.jpg My question is, how to reach the same result using Java?


title: Which is the best method for storing data for a Language Dictionary?

text: I have been working on making a completely offline dictionary using the Wiktionary XML dumps. The dumps themselves are about 10 MB, but when converted into a index using a search engine indexer (I use Whoosh Search Engine in Python), the complete index comes to about 250 MB. Which I think would be difficult to distribute, it might be zipped, still it won't come anywhere near 10 MB. And indexing takes about 1 hour in my system, so indexing while installing the software in a PC is tedious. So I am looking for an alternate way of storing the words and meanings to make the dictionary. Which is a better searchable solution? May be some sort of Data Base that produces light weight DBs. Or the search engine indexes are better than DBs?


I heard different interpretations of _sound and complete_. I understand that _completeness_ means finding a solution if there is one. What does it mean to say an algorithm is _sound_. What does it mean to say an algorithm is Sound and Complete?


title: Java: How to manage UDP client-server state

text: I am trying to write a Java application that works similar to MapReduce. There is a server and several workers. Workers may come and go as they please and the membership to the group has a soft-state. To become a part of the group, the worker must send a UDP datagram to the server, but to continue to be part of the group, the worker must send the UDP datagram to the server every 5 minutes. In order to accommodate temporary errors, a worker is allowed to miss as many as two consecutive periodic UDP datagrams. So, the server must keep track of the current set of workers as well as the last time each worker had sent a UDP datagram. I've implemented a class called WorkerListener that implements Runnable and listens to UDP datagrams on a particular UDP port. Now, to keep track of active workers, this class may maintain a HashSet (or HashMap). When a datagram is received, the server may query the HashSet to check if it is a new member. If so, it can add the new worker to the group by adding an entry into the HashSet. If not, it must reset a "timer" for the worker, noting that it has just heard from the corresponding worker. I'm using the word timer in a generic sense. It doesn't have to be a clock of sorts. Perhaps this could also be implemented using int or long variables. Also, the server must run a thread that continuously monitors the timers for the workers to see that a client that times out on two consecutive datagram intervals, it is removed from the HashSet. I don't want to do this in the WorkerListener thread because it would be blocking on the UDP datagram receive() function. If I create a separate thread to monitor the worker HashSet, it would need to be a different class, perhaps WorkerRegistrar. I must share the HashSet with that thread. Mutual exclusion must also be implemented, then. My question is, what is the best way to do this? Pointers to some sample implementation would be great. I want to use the barebones JDK implementation, and not some fancy state maintenance API that takes care of everything, because I want this to be a useful demonstration for a class that I am teaching. Thanks


title: Code review approaches

text: Just going out on a limb here. Is doing a code review by sampling a few classes and units of code by a developer good enough to judge what he has done wrong to provide inputs? This is just in case you are pressed for time and can't review every single line written by them. I am working on the assumption that the developers might duplicate the same type of mistakes everywhere. Is this an effective approach? or partially effective, or not at all effective? What other approaches are better? Sitting with each developer who has written the lines of code and asking them why they did that a particular way? or doing it by yourself and then sending a synopsis of your findings via email? How do you approach reviewing code written by junior developers/peers when you have to review all the code base in a typical 15 day sprint?


title: Drawing out a document with strategies for coping with "disasters"

text: Does anyone happen to know of some guidelines for writing up a document for coping with possible disaster scenarios ? By disaster I mean anything that could lead to loss of work, time or eventually a client. I seem to remember reading an article along these lines but, unfortunately, I can't find it anymore. So I'd appreciate some feedback in this direction. I think such an approach would be useful in the company I'm in right now as we've had the occasional scare which might have been avoided with some preventative thinking.


title: Order of parameters in localization code

text: In localization code (like `T('English phrase with %s and %s parameters', param1, param2)` the order of parameters in different languages is different. How to handle this? Our localization engine seems not to support named or numbered parameters, so the parameters need to go in the same order as they are in code.


title: confusion on using nodejs within an actual web application or ide

text: I am new to using `nodejs` completely, and it seems to be pretty much the go to thing for **everything** right now. But I program in Visual Studio, and I'm a bit confused about how this works. I will cite an example; One task I want to do is to get a list of all the files in a directory and all of its sub-directories, and return them as a `string[]` for a javascript `.config` file. I started searching for that and found a lot of answers, but they all kept going back to `nodejs`, for instance, this one, and this one, and this one. I really wasn't looking for anything having to do with `nodejs`, it just seems to be part of every solution out there. I've installed it, and gotten it to where I can do some simple things like create a very basic server that listens to a port - thanks to simple tutorials written for a moron like me - but I'm having a hard time figuring out how to use these kinds of things in my real programs - specifically `ASP.NET MVC`. I've searched pretty hard on this topic too, and discovered things like `iisnode` and the like that do some partial integration. But even with all of this, this wealth of information, I am **extremely** confused. I understand that I can use it from a command line, like `PowerShell`, I can run commands from a terminal, and install packages into projects, but I'm having a hard time seeing and finding how this actually translates into literal, real usage in an existing application. I have scoured around for days and days for examples, I've read at least 3 books on nodejs, The Node Beginner Book, What is Node, and Professional Node.js and to be very honest I am still as lost as ever. Everything I read keeps assuming I am doing things from the command line or a terminal, but all of the applications I see for node assume you're writing a web application. I'm having a really hard time wrapping my head around **how** you use it **within** an application. Can anyone assist me with this? Perhaps a working example of an actual program that uses node? I'll take almost anything at this point, though `ASP.NET MVC` is my core system of choice. I was originally going to post this on `StackOverflow`, but someone suggested that this community was more appropriate for this question. # Update I want to make a more clear example of what is confusing me, I'm already learning because of the 1 proposed answer, but let me give more examples. I program in `Visual Studio`, it has no real concept of `node.js` \- in fact, if I try to do things that will run against node, it gives me problems. I often have to code anything related to node in `WebStorm` from `JetBrains`. I understand that I can _'compile'_ things with node, what I don't understand is how I can **invoke** it within my program, not inside of a command line. For example let's say there is a node module that takes an array and does something to it - for sake of example let's say that it sorts everything in the array alphabetically, and it is a _module_ called _supersort_. So if I were at the console, I would just type in ... > node supersort.js Okay, but now I'm **not** at the command line. I have published my web application. My user is at a page, let's say `/account/history` and they are seeing a list of every product they have bought. For the sake of argument, say I've got that list as a `object[]` or `string[]` \- I realize that is completely absurd and it would be far more complex, but just jive with me. I want to run _`supersort`_ on this page. But it's live! How do I do it? How do I run this _module_ on their live, active data without manually being there at the console? Is there a set of javascript files I'm supposed to download and call http requests a certain way? Do I wire up a special `IHttpHandler` in `IIS`? I think you can start to see where I am lost. # Update 2 Attempting to further emphasize my question, I'll try and cite a more specific example. I want to use the library `Q.js` in my `ASP.NET MVC` application. Now, there is a version 1 that I can seem to run out of the box, but I want to try out version 2 - you can find it linked **Q.js v2 (beta)** So I am using Visual Studio, and I'll download the `q.js` file and load it up, but immediately we already have trouble now - if you look at the file's source code right away I see this.               require("collections/shim");     var WeakMap = require("collections/weak-map");     var Iterator = require("collections/iterator");     var asap = require("asap");      Now I certainly don't have folders with those names in my application - and even though I have `node.js` installed, putting this file in a `<script>` tag does not work, as it says it cannot find the specific libraries. If I go to a console explicitly and type in `npm install -g q@~2`, it will create a folder called `node_modules/q` in my `AppData/Roaming/npm` folder, and this one **does** have folders for those other libraries. So what is the right way to do this? It's clear that just having node installed doesn't make node commands work when I try to run the page in ASP.NET MVC - but I also don't understand how to get to the final version of the library that I can include on my application like a normal javascript file and use across the program.


title: CAN Protocol Understanding

text: I have a task to convert CAN protocol Driver from Basic CAN to Full CAN. The project contains CANopen stack used in it. I have initiated the study of CANopen stack. **I want to know is it necessary to study CANopen Stack and to how much depth should I study CANopen stack?** Please note- Major task is to improve the drive code by converting it into Full CAN implementation


title: Choosing a file format to storage a simple text data

text: My .NET application makes its work and then creating a report (an Excel worksheet). The report holds thousands of short text strings [KEY - VALUE], so excel worksheets suites very well, one column holds keys and another holds values. It's easy to examine this reports. But because of performance issues now i'm trying to find another file format to create reports in .NET in a way that's easy to manually examine, like a table or plain text. So what kind of file can I choose? Sorry my bad english.


title: what is the reason for using xslt?

text: Why is XSLT used by many web applications?


title: When designing data models for JPA, what's the best way to make use of polymorphism?

text: I've been asked to support a Java EE application. The data model was poorly- designed and will not support several necessary use cases; so I'm developing a new data model using EclipseLink (the old one was built on iBATIS). Mind you, I'm no EclipseLink guru, and still have many questions about the best ways to utilize it. For example, the current application has different entities for different types of requests-- let's say, CakeRequest, PieRequest, DonutRequest, etc. My first thought was to create a base Request type, then extend that with PieRequest, which can have fields specific to it, such as crustType and hasCoolWhip. Certainly, EclipseLink can do that. However, I also need the ability to list all Requests, starting with the most recent. I'm not sure what the best way to handle this would be. In order to sort requests together, I need to be able to put all request types in a single collection, which defeats the purpose of polymorphism. It could be that there are EclipseLink features which would help me out here, features that I'm unaware of; or perhaps Java itself could provide the answer. Does anyone have any suggestions? Thanks very much!


title: Perforce workflow

text: So, we have just migrated from SVN to Perforce. I'm having a little trouble trying to figure out the best workflow. For Subversion, I did the following (via TortoiseSVN):   1. Check out repo   2. Do work   3. Update repo   4. Resolve conflicts, if any.   5. Commit my code.   6. Do work.. What is the best approach for P4? I know that you must open files for edit before actually editing them. With this in mind I am currently doing the following (via P4V):   1. Sync to head   2. Open entire project for editing   3. Do work   4. Revert unchanged files   5. Submit i.e. commit pending changes.   6. Open entire project for edit, again.   7. Do work.. Is this a practical approach? or is there one that is more in tune with Perforce best practices?


title: Embedded systems learning: next step

text: I am a newbie trying to learn embedded systems programming on ubuntu. I've tried the below link: http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Tutorial-A- simple-embedded-Linux-system/ But after doing this, I don't know, I felt as though I just created a USB boot disk. I don't know what other people knowledgeable in this field might think...nonetheless I'd like to take the next step. What should I look for next?


title: Where do you store your builds?

text: We currently use Team Foundation Server to do our builds. I know we can tell TFS to keep our builds for a certain amount of time or keep them indefinitely. What if we want to keep some or all of our builds indefinitely in case we need to go back to them for some reason? Do any of you use source control to store your builds or use some type of file server to keep your builds on a file server for future retrieval? Storing the builds within the Team Build directory would cause that directory to get very messy quickly. Of course we can always branch out an old changeset and create a build definition for that branch, but that's more time consuming than retrieving a build from source control or from a file server. Maybe what we're trying to do is just a bad idea.


title: Avoid DD anomalies

text: I have this problem called out by PMD (static code analyzer) more often that I would like, and would like to know how someone with more experience than me would write it. My code is functional but I find it inelegant, so I want to know how other programmers would write this piece. The case is, in a network/IO petition I may or may not get a result from, but my parent method is not null-proof so I always have to return something. I also don't like several returns on a method.               public String getBingLocation(Coordinate... data)     {         String response = "Not Retrieved";         final Coordinate location = data[0];         JSONObject locationData;         try {             locationData = NetworkManager.getJSONResult(ApiFormatter                     .generateBingMapsReverseGeocodingURL(location.Latitude, location.Longitude));             if (null != locationData) {                 final String address = this.getAddressFromJSONObject(locationData);                 response = address;             }         } catch (final ClientProtocolException e) {             LoggerFactory.consoleLogger().printStackTrace(e);             return response;         } catch (final JSONException e) {             LoggerFactory.consoleLogger().printStackTrace(e);             return response;         } catch (final IOException e) {             LoggerFactory.consoleLogger().printStackTrace(e);             return response;         } finally {             location.Street = response;         }         return response;     }      Other example:               public static Object loadObject(final String fileName, final Context context) {         Object object = null;         try {             ObjectInputStream objectInputStream = null;             try {                 final FileInputStream fileStream = context.openFileInput(fileName);                 objectInputStream = new ObjectInputStream(fileStream);                 object = objectInputStream.readObject();             } catch (final ClassNotFoundException catchException) {                 LoggerFactory.consoleLogger().printStackTrace(catchException);             } catch (final ClassCastException catchException) {                 LoggerFactory.consoleLogger().printStackTrace(catchException);             } catch (final Exception catchException) {                 LoggerFactory.consoleLogger().printStackTrace(catchException);             } finally {                 if (objectInputStream != null) {                     objectInputStream.close();                 }             }         } catch (final IOException catchException) {             LoggerFactory.consoleLogger().printStackTrace(catchException);         }         return object;     }


title: Implement SSO login with or without Membership

text: I need to implement SSO for four different domains, say               abc.com     pqr.com     sql.com     xyz.com      Now, I have already login system for two of my applications using Membership. But now requirement is changed, challenge is to make Single Sign On.               Me: Can we have subdomains?     client: no !!!          Me: Can we have single database and separate session management server?     client: NO !!!      After that I create a POC in which I am able to share a cookie across the multiple domains but issue is it need to ping and bounce back to all domains on user browser which led the larger login time. Can I have suggestion how to get it done?