Using which technique does facebook and pininterest show images?

If anybody has ever noticed that when you open a image in Facebook something like this happens:- suppose you are at your homepage on Facebook:- the URL is https://www.facebook.com/ now if you open a image it gets opened in new modal like window and URL changes to:- https://www.facebook.com/photo.php?fbid=10151125374887397&set=a.338008237396.161268.36922302396&type=1&theater As far as I know in any common case a modal overlay would have kept the url in the address bar the same , My question is how does facebook / pintrest achieve this behaviour of not re-loading the whole page but still achieving the change in the address bar. Is there any jquery or javascript plugin for this?


Is there such a thing as a specification-code framework?

I've been googling for a while and can't fathom why this doesn't exist yet. By a specification-code workflow I mean a system which links code to it's specification. For example I could be looking at a repository and highlight a specific revision and it would give me the related spec. I could also reverse this process and select a spec and it would show me all the related code changes and issues. I'm looking for this so I can mine a current system for ideas for my uni FYP of a software development suite harnessing existing systems.


TDD - Making assertions about C# Expression trees

How would you unit test the PerformUpdate method in the sample below? This is a (very) simplified version of some code that performs updates against a database where the schema is dynamic and represented by the fields collection. EDIT: If it is not clear what I am asking, I would like to know how different developers would approach testing\mocking this code from a TDD perspective. For example, what tests would you write, what would you mock, how would you verify method calls are made with the right arguments?               public interface IUnitOfWork     {         IEfRepository<Field> Fields { get; }     }          public class UpdateService     {         private IUnitOfWork unitOfWork;              private IDataUpdater dataService;              public Activity PerformUpdate(App app, IDictionary<string, object> data)         {             var fields = this.unitOfWork.Fields.FindWhere(o => o.App.Identifier == app.Identifier);             var activity = this.dataService.PerformUpdate(fields, data);                  return activity;         }     }


How to determine the better design?

What do I need to consider to determine which design I choose when I have the following scenario? There are two cases to considerer;   * Given T a generic class, I have to do something with multiple T's (Iterating each one of them).   * In other cases, with the same T, I have to process just once. In both cases, independent of what is T and how I'll need to process it, the class that comprises T will behave exactly the same way, therefore, I don't need to worry about implementation details. There are 2 possible solutions, and I don't know what directions should I follow to decide between them.   * Always consider as a List, this is for sake of simplicity, since there are no difference between a List of T and only T.      * Use inheritance; the first child class will receive a List of T and work with it, the second, a single T and work with it. Are there some good pratices or some article to help to decide such cases? I'm looking for something like this article, or your experience as well. * * * **UPDATE:** The class I'm design is not T, but its composer.


Better sticking with MDI or learning WPF?

I have a personal project I'm going to start working on soon. It will be database driven and have various screens that the operator may want to use. First thing I thought of was an MDI interface would be perfect for what I want. I work with Then I started investigating WPF - partly because one of the controls I want to use is a WPF control. I haven't worked with WPF much at all, and I'm wondering whether or not it's worth the effort to try and learn it instead of going with WinForms and MDI? In my current situation I use WinForms and MDI for my day job. There's a possibility I may work with WPF in the future, but if that happens I'd have time to learn on the job. Am I better off just sticking with what I know to get my project off the ground, or is WPF a much better improvement that it's worth going that route? If so, what exactly are the advantages I may find from WPF?


Why don't mobile platforms support generational garbage collection?

Both Windows Phone/Xbox and Android lack support for generational garbage collection. This is frustrating for a lot of programmers. There seems to be a legitimate engineering reason to it, but I can't figure it out. Current phones have more memory and probably better CPUs than the desktops/laptops running .NET 1.1 with generational GC back in 2001, and I can't think of any reasons that ARM processors would be worse at generational GC than x86 would. There's also less need for multitasking on phones and consoles, so there's relatively more free heap space. So what gives? **Edit:** A few points to clarify:   * These platforms use garbage collection for apps exclusively, so my question isn't about why GC isn't supported; my question is about why _generational_ garbage collection isn't.   * The reason that people are frustrated about the lack of generational GC is that non-genrational GC is extremely inefficient. (That means that battery life isn't the reason.)   * I do believe that there's an honest technical reason for the lack of generational GC support. This isn't a rhetorical question.


Alternative to SIP, voice communication in Android

Is it exists any alternative to SIP protocol? I want implement voice & video chat option in my application. I don't want use SIP, because I need only simple communication without call for landlines etc. It seems to me, it maybe doing with sockets, and audio records, but I'm not sure. I care about the fact that many people (for example 1000) could simultaneously carry on a conversation. Is it possible on regular server? Is it at all possible without a server? Best regards.


Should I convert the whole project to UTF-8?

I am working on a highly customized shop software, based on a open-source one, written in PHP and usual web techniques (CSS, HTML, JS). I did a lot of customization in the past months/years and developed specific, individual features which are necessary to be successful at our branch. The shop and the project files are encoded in ISO-8859-1 (company is located in Germany). Now we want to spread out and use the shop system in different countries (e.g. Sweden, Poland, Great Britain) and customize it to the domestic needs. But I am afraid that I could encounter some encoding problems afterwards, so my question is: Is it wise to change the encoding of the whole project and the environment to UTF-8 before I prepare the shop for "multi-shop" usage or should I leave the source at it is and handle (possible) encoding problems for each country as they approach afterwards?


How to get local device time corresponding to NTP server timestamp?

So, I'm trying to use an NTP server to help me synchronize an app across two Android devices (to have them perform some action at the exact same time, give or take < 20 ms). I'm using the SNTP client code here as provided from the StackOverflow post here and it works just fine. The problem is that at the exact instant that the NTP server gets its timestamp, I need to know what time it is locally on my device (so not the time that the device received the returned timestamp, but the actual device time that corresponds to the timestamp from the NTP server). This would mean I'd have a sort of "snapshot" with two different timestamps (one device, one NTP server) that took place at the "exact" same time. I am having a very hard time figuring this out and am starting to think it's not possible at all (which sort of makes sense). My best effort has been to try and assume that the local device time that corresponds to the time returned by the NTP server would be halfway through the roundtrip request- response time, but even the obvious error there is made even worse the longer the NTP request takes, so that's solution's simply not good enough. How can I move forward with this on Android?


Object-oriented design question

I am using a class through a dll to which I do not have direct control. So in effect, I am only a client of this class. The class represents a form that can be printed, sent to clients and tracked in the system. I need to calculate two types of dates after which, if the form is received it is considered late. Rather than simply calculate the late dates in the method where I am already handling the form, I want to extract the algorithm for calculating the late dates in a separate class as it is complicated and can be subject to change for administrative reasons. Since I cannot modify the original class. I came up with these possible solutions: (For reference the code is in C# 4/.Net 4.) A- Create a FormLateDateCalculator class that has methods to return a late date for a given form. B- Create a FormLateDate class that takes a form in it's constructor and has a property for each type of late date. C- Create two extension methods on the Form class that calculate the late dates. While all three of these methods work (and I am sure there are others), I would like to know which is the best in regards to object-oriented design and why?


Approaches against code base becoming uniformly slow

We are working on a moderately-sized C++ code base (10Mloc) which through our optimization efforts is becoming uniformly slow. This code base is a set of libraries which we combine to put them to work. When the general framework of how these libraries communicate was developed there was some emphasis on performance and later on, when more parts where added, the general framework wasn't changed much. Optimization was done when needed and as our hardware evolved. This made expensive early decision apparent only much later. We are now at a point where further optimizations are much more expensive since they would require rewriting large parts of the code base. We find ourselves approaching an undesirable local minimum since we know that in principle the code should be able to run much faster. Are there any successful methodologies which help to decide what turns to take over the evolution of a code base towards a globally optimally performing solution which aren't easily confused by easy optimization opportunities? ### EDIT To answer the question how we currently profile: We really only have 2 different scenarios how this code can be used, both embarrassingly parallel. Profiling is done both with wall clock time averaged over a large sample of inputs and more detailed runs (instruction costs, branch mispredictions and caching issues). This works well since we run exclusively on our extremely homogeneous machines (a cluster of a couple thousand identical machines). Since we usually keep all our machines busy most of the time running faster means we can look at additional new stuff. The issue is of course that when new input variations show up, they might get a late-comer penalty since we removed most obvious micro-inefficiencies for the other use cases, thus possibly narrowing down the number of "optimally running" scenarios. The current answers rightly suggest to separate data and algorithms so this becomes easier to adjust.


Subclassing to change default settings?

I have a class called `Timeline`. I want to allow several defaults in my code, such as a `Timeline` with a `Start` event (The details are not needed. All that matters is that I have a class, and I want to be able to have a few different default setting). Here are the options I thought of: 1) Following a GUI/Swing inspired idea, I might want to subclass the `Timeline` class and, in its constructor, use the public functions to set the default. Then, I could later just instantiate those objects instead of the superclass 2) A factory class could have functions like "getTimeLineWithExplosion" and set everything up. Which of those two is the better idea? Is there a design pattern better than both of them? PS: This is implemented in Java, but could easily be in another language.


Large invoice database structure and rendering

Our client has a MS SQL database that has 1 million customer invoice records in it. Using the database, our client wants its customers to be able to log into a frontend web site and then be able to view, modify and download their company’s invoices. Given the size of the database and the large number of customers who may log into the web site at any time, we are concerned about data base engine performance and web page invoice rendering performance. The 1 million invoice database is for just 90 days sales, so we will remove invoices over 90 days old from the database. Most of the invoices have multiple line items. We can easily convert our invoices into various data formats so for example it is easy for us to convert to and from SQL to XML with related schema and XSLT. Any data conversion would be done on another server so as not to burden the web interface server. We have tentatively decided to run the web site on a .NET Framework IIS web server using MS SQL on MS Azure.   1. How would you suggest we structure our database for best performance? For example, should we put all the invoices of all customers located within the same 5 digit or 6 digit zip codes into the same table? Or could we set up a separate home directory for each customer on IIS and place each customer’s invoices in each customer’s home directory in XML format?   2. And secondly what would you suggest would be the best method to render customer invoices on a web page and allow customers to modify for best performance? The ADO.net XML Data Set looks intriguing to us as a method, but we have never used it.


Is it normal needing time to understand code I wrote recently

By recently I mean some weeks ago. I am trying to continue a project I left 2 weeks ago and I need time to understand some functions I wrote (not copied from somewhere) and it takes me time. Normally I don't need to because my functions, methods etc. are black boxes but when I need to change something it's really hard. Does this mean I write bad code? I am still in school and I am the only who writes/uses the code so I don't have feedback, but I am afraid that if it is difficult for me to understand it, it would be 10 times more difficult for someone else. What should I do? I write a lot of comments but most of the time are useless when reviewing. Do you have any suggestions?


detect if a combination of string objects from an array matches against any commands

Please be patient and read my current scenario. My question is below. My application takes in speech input and is successfully able to group words that match together to form either one word or a group of words - called phrases; be it a `name`, an `action`, a `pet`, or a `time` frame. I have a master list of the phrases that are allowed and are stored in their respective arrays. So I have the following arrays `validNamesArray`, `validActionsArray`, `validPetsArray`, and a `validTimeFramesArray`. A new array of phrases is returned each and every time the user stops speaking.               NSArray *phrasesBeingFedIn = @[@"CHARLIE", @"EAT", @"AT TEN O CLOCK",                                      @"CAT",                                      @"DOG", "URINATE",                                      @"CHILDREN", @"ITS TIME TO", @"PLAY"];      Knowing that its ok to have the following combination to create a command:               COMMAND 1: NAME + ACTION + TIME FRAME     COMMAND 2: PET + ACTION      COMMAND n: n + n, .. + n          //In the example above, only the groups of phrases 'Charlie eat at ten o clock' and 'dog urinate'     //would be valid commands, the phrase 'cat' would not qualify any of the commands     //and will therefor be ignored      **Question** What is the best way for me to parse through the phrases being fed in and determine which combination phrases will satisfy my list of commands? **POSSIBLE solution I've come up with** One way is to step through the array and have if and else statements that check the phrases ahead and see if they satisfy any valid command patterns from the list, however my solution is not dynamic, I would have to add a new set of if and else statements for every single new command permutation I create. My solution is not efficient. Any ideas on how I could go about creating something like this that will work and is dynamic no matter if I add a new command sequence of phrase combination?


eXtreme Programming (XP) Methodology Testing

I am about to undertake a project for university, and given the project scope I have decided to use XP/agile methodology. I have began with developing a use case diagram; gathering user stories for the first couple features. I am in the process of helping the customer develop the acceptance test and my question is: _can the user stories for each feature be used as a user acceptance test?_


Algorithms to Determine How Much A Factor Contributes to A Total Value

Lets say that I have hundreds/thousands of objects(entries) in a database and each object contains 10 attributes. I have a way to quantitatively measure each attribute where a higher number implies that the object is better in that area. I also have a final price associated with that object. Is there any way to programatically (through maybe an algorithm) determine an approximation of how much each attribute contributes to the total cost? In essence, I want to be able to estimate the average total cost = a*attribute1+b*attribute2+.....+j*attribute10 by solving for a,b,...,j I realize that this might be more of a statistics question than a programming question, but I am more interested in the implementation of this through programming than a fully statistics explanation. Is this something more suited for scipy? numpy? some statistics framework?


Is Resque appropriate for an evented application?

As the title says, is Resque appropriate for an evented application that requires a decent amount of speed? I'm working on a server application that emulates the default Minecraft server, and I was wondering whether Resque would be more of a hinderance or a help for managing events (such as firing an event when a certain network packet is received), or whether it would be better to use a synchronous approach (i.e, Wisper). Example - let's say the `:player_move` packet is received. In this packet we have an x, a y, z. We should then notify the `WorldController` that `player` has moved to x y and z. The `WorldController` then does it's own thing - such as notifying appropriate players in an area around the actor. However I don't want to manually hard code that the `:player_move` packet maps to `WorldController#move_player`, so I am currently using Wisper to publish a `:player_moved` event. This is great, however the events are handled synchronously, and there is no guarantee of order - This is something I'd like to have, so I could implement cancellation of events. Obviously the pros and cons of Resque over Wisper is that: **Pros**   1. Tried and tested (no need to roll your own with Wisper)   2. Asynchronous processing   3. No need to write large amounts of boilerplate to tie each subscriber to each publisher.   4. Guaranteed ordering of jobs (and the ability to cancel jobs) **Cons**   1. Slower (likely, due to having to interface with a database)   2. Reliance on Redis as a cache (not that that's really a con)   3. No guarantees of if or when something will occur (nature of threading)   4. Memory usage (process splitting) Thoughts?


Adapter Pattern: Design Patterns

So far as I know, there are two forms of the Adapter Pattern: the class adapter and the object adapter. Could someone please explain to me the following limitation of the class adapter and why it is not a limitation of the object adapter:   * a class adapter is not suitable when we want to adapt a class and all of its subclasses. I guess the following is considered a limitation of the object adapter:   * with an object adapter it is harder to override Adaptee behaviour than with a class adapter. Why is that?


Buyer vs Seller on UML Model

I'm modeling an Online Classified System where, naturally, who sells also can buy and vice-versa. The question is: should I have two different Actors, Buyer and Seller or I could have, say, an actor Client capable either buy and sell? How do you approach this Model? Cheers,


Polling vs events pros and cons in JavaScript

I'm bit of a novice to JavaScript so I've been wondering on positive and negative sides of using polling compared to using events in JavaScript? When does one use one or the other? By polling I consider any effect that is triggered on something that repeats itself usually using `setTimeout`. But also for example:               function render() {        Bloop.renderComponent(box, document.body);        requestAnimationFrame(render);     }      Is also polling since `requestAnimationFrame(render)` which is called before each frame is called. Basically anything that fits this definition


db data to template: where to escape strings

I have an applications that queries a database, then renders a asciidoc template with data from the db, and converts the asciidoc to pdf. Now in the data there are certain characters that need to be escaped in order to not the mess up the formatting of the pdf. I have two options on where to do this:   * **Option A** : in or near the code that does the db query. Plus: escaping done only once. Minus: db code needs to know about the output syntax.   * **Option B** : in the template. Plus: escaping done where the formatting syntax belongs. Minus: Escaping possibly done more then once. I am leaning towards Option B, but I would be interested in what others think would be the best thing to do.


I am making 4-5x more story points than average, but producing bugs at half the rate. Graphs say it's 2x more bugs, how to deal with that?

So it is generally accepted that top tier programmers can produce an order of magnitude more/better code than their more average peers. It's also generally accepted that the rate of errors made in code is **relatively constant** for programmers. Instead, it tends to be impacted by the processes used when writing the code and after the code is written. (As I understand it) Humans tend to make mistakes at a fairly constant rate - better programmers just notice more of them and are quicker to fix them.   * Note that both of above assertions come from Code Complete by Steve McConnell - so it's not a matter of differing perspectives. So I've started to see this recently in my code. I can hammer out about 4-5x the amount of code as many of my peers (measured by story points estimated by the team), with higher quality (based on performance metrics and number of changes made after check-in). But I still make mistakes. Between better unit tests, a better understanding of what the code is doing, and a better eye for issues when doing code reviews I'm not producing 4-5x the number of bugs. But I'm still producing about _twice_ as many bugs found by QA as other developers on my team. As you might imagine, this causes some problems with non-technical folks doing metric measurements (read: my boss). I've tried to point out that I'm producing bugs at half the rate of my peers (and fix twice as many), but it's a hard sell when there's graphs saying I produce twice as many bugs. So, how to deal with the fact that increased productivity will lead to an increased number of bugs?


DDD Model Design and Repository Persistence Performance Considerations

So I have been reading about DDD for some time and trying to figure out the best approach on several issues. I tend to agree that I should design my model in a persistent agnostic manner. And that repositories should load and persist my models in valid states. But are these approaches realistic practically? I mean its normal for a model to hold a reference to a collection of another type. Persisting that model should mean persist the entire collection. Fine. But do I really need to load the entire collection every time I load the model? Probably not. So I can have specialized repositories. Some that load maybe a subset of the object graph via DTOs and others that load the entire object graph. But when do I use which? If I have DTOs, what's stopping client code from directly calling them and completely bypassing the model? I can have mappers and factories to create my models from DTOs maybe? But depending on the design of my models that might not always work. Or it might not allow my models to be created in a valid state. **EDIT 1:** Aside from lazy/eager loading and using a DI framework to inject repositories in my models, what is another approach? What's the correct approach here?


ASP.NET MVC Portable Areas - Can they communicate and be used as a plugin-like architecture?

I'll get straight to the point: I was wondering if there is a common pattern to use portable areas as a components of a plugin-like architecture. Example: We've got 3 plugins (portable areas) packaged and distributed via NuGet feed. Each of them is following the standard MVC structure (has it own Models, Views and Controllers). Lets say login form, header and footer. What I was wondering if there is a way to make them communicate. For example: when user logs on, login plugin executes it own logic, logs the user and then it updates the state of the header plugin with changes it state accordingly. **Edit** : _Dealing with client side calls_ Another thing that I did not mention in the original post is that I wanted to expose the plugin features via controllers to be consumed via JavaScript as well. Lets say I have all architecture in place and all plugins registered themselves with the system properly (routes, dependencies ...etc) For example if I click the "Change color" feature of one "Colors picker" plugin it calls action method of another plugin (Image plugin lets say) and loads image of requested color. Of course everything should be done via Ajax without resubmitting the entire page that hosts the components. You think it is a doable scenario in the solutions you've proposed here? Thanks in advance for all the answers.


How to find a job that is using the tools I like (and keeping the payroll at a high level)

I have been a software developer for years now. I have been working in big companies using their own standard and tools. I have always been able to use some of my favourite tools, like Intellij as my main java IDE, but it can not be always the case. I have also been forced to use some crappy tools (bloatwares source versionning, broken quality insurance application, ...) and frameworks I would happily have replaced by another. What can I do to find a 'perfect' mission, where using my tools will be the norm, or at least not forbidden? Or even better, how can I find a job using a non mainstream framework? I don't want to sacrifice the payroll for my tools of choice, so joining a cheap start-up won't be a solution. I'm not looking for a job offer, but more on tips used by the lucky developers that have found a perfect matching job.


Ruby: how to step through ruby code

I'm trying to learn how to step through Ruby code (written by more experienced programmers) in order to improve my knowledge of Ruby. Problem is that I don't really know how to do it well. Googling the topic brought me to an about.com page on Ruby; I thought a higher quality more comprehensive answer should belong on StackOverflow, so if anyone can write an answer (with an example) for it, showing how a beginner can step through code to learn as much as possible about it, it'd be much appreciated.


PE License vs IEEE CSPD Certification

I am a working software engineer in the state of Pennsylvania with ~5 years experience. I have a BS in Computer Engineering, however I feel that I need to obtain either a PE License or IEEE CSDP Certification to solidify my status as a professional. Does anyone have an opinion on this matter? PE License (Computer Engineering) IEEE CSDP Certification


Low latency technologies for c++, c# and java?

I've been reading job descriptions and many mention 'low latency'. However, I wondered if someone could clarify what type of technologies this would refer to? One of the adverts mentioned 'ACE' which I googled to find out was some CISCO telephony technology. If you were hiring someone for a low latency role, what would you use as a checklist for ensuring they knew about low latency programming? I'm using this to learn more about low latency programming myself.


Should senior programmers be required to take on and mentor a junior developer?

In a shop that is intended to be tight-knit and supportive, should it be part of the culture that senior developers are paired with junior developers as mentors? Or should this mentoring be something that is more organic and spontaneous, i.e. not required, but allowed to develop without artificial encouragement?


Maintaining referential integrity between a mobile client and a server

So I have a relatively simple system. A **mobile client creates records in a sqlite database that I would like to have synced to a remote SQL server (that is shared with other mobile clients)**. So when I create a new record in the phone's sqlite table, I then push that change to my remote service through a RESTful API. The problem I'm having, is **how do I order the primary keys so that there isn't collisions in the data** (i.e. a record in the phone has the same primary key as a completely different record on the server). **What is the usual "best practice for referencing the record on the client, and for referencing the same record on the server?**


Source Control: Roles and Responsibilities - Best Practices

I'm looking for "Best Practices" concerning roles and responsibilities, specifically who is responsible for merges from development branches to trunk (or main). Basically I'm looking for ammunition to help my cause. Let me describe what I'm facing. I am the lead developer (owner) of a particular application. Our company recently moved from VSS (where I was the administrator of the VSS database in which my application was stored) to TFS (where I only have permissions on development branches created by our "operations" team). In previous jobs, I was a TFS Admin, so I know my way around TFS and MSBuild. I don't have an issue with the branching and merging strategy being used (main branch, with bug/project development branches created as needed, merged back to main then promoted to a release branch). The issues I have are:   1. I cannot create my own branches. I must create a TFS task to have an "operations" team member create the branch for me.   2. I cannot merge from Main to my development branch. I must create a TFS task to have an "operations" team member perform the merge, and then hope he doesn't "step on" any of my teams changes since the "ops guy" may or may not be a developer and certainly has little to no knowledge of the code he is merging.   3. I cannot merge from development to Main. Again I must create a TFS task to have the "ops guy" perform the merge, hoping that he does it correctly. Then I have to create another TFS task to merge back to my branch so that I can resolve any issues which have occured by having a non-developer merge to Main.   4. I cannot create or edit MSBuild scripts. Again I have to work with the "ops" team which is new to MSBuild so only the most basic build tasks can be performed. (Forget about anything complex, or heaven-forbid a custom task).   5. I cannot execute an MSBuild script. Again only the "ops" team can do this.   6. To top all of this off, typically it is an "off-shore" resource which performs the requested tasks, so even if I create the task to (branch/merge/build) in the early morning, it probably won't be completed until that evening. Now I have no issue with the "operations" team maintaining the release branches. As all they are doing is (basically) taking the latest version from Main and promoting it to the release branch; so as long as "Main" is stable and ready, the release branch will be good. My opinion is that technical leads (such as I) should be responsible for maintaining the trunk ("Main") and any merging to/from the development branches. The team lead should also have the ability to generate MS Build scripts to build and deploy to the Integration test environment. Can anyone direct me to a Best Practices document that'll help me prove my case? All my searching has turned up only Best Practices concerning the techniques of branching and merging, and no mention of WHO should be performing said branching/merging.


Requirement specifications with annotations?

I'm curoious if there are any templates using annotations such as ambigous, needs update and so on. Industrial or Academic does not matter. If there are, are there any way tools available that use these annotations to show that "22% of the requirements are tagged ambigous" and so on? Bonus points for Academic papers on this topic (or a nearly related topic)


CSS remote contract

I am signing a contract with someone remote in another country in regards with creating a new style sheet for their website. In our agreement the client pays 1/3 of the money first as deposit and the rest will be paid when I show the completed project online to him. Now my question is, since I know CSS is viewable online and there is no way to encode it, apart from the fact that I need to trust him, is there any way that I can protect my work from being stolen before the final payment? How do theme developers usually work remotely? I would appreciate if you please share your experiences with me


What are the most important languages to localize for on the App Store?

It's obvious that to gain more customers on any given platform, one of the most important steps to take would be to localize your software into many languages: as many as possible, ideally. However, with independently developed apps, it tends to be difficult to localize into many different languages, due to not having the budget and / or time to do so. My question is **if I were to localize my apps into languages other than English on the iOS App Store, which languages should I prioritize?** (Maybe the top three or four most important.) (Also, let's pretend this is a generic app that won't cater more to one language demographic than another.)


How to improve enterprise level application that consists of only static methods

I am new in a enterprise level application project and discovered that 99% of everything I've seen in code is static methods, static properties. The application at hand is a distributed app consisting of about a handful of WCF services that communicate through a business layer with a data access layer. The data access component is a singleton. There are transactions and MSMQ queues and multiple parties calling the WCF Services to notify the DB of changes, updates made in a seperate system and so forth. First time running a little test project I got a thread related exception using EntLib5 Logging, telling me that some code was called from an unsynchronized code block. I am curious to know how one should go about and improve an almost-all-static design. >   * Are there advantages to the current approach? >   * What are the disadvantages? >   * Where would you start (besides starting over) and improve all this mess? > Thanks for your opinions!


Is this statement from Knuth's fundamental algorithms still applicable today?

> In a sense, 10! (ten factorial) represents an approximate dividing line > between things which are practical to compute and things which are not. This is from Knuth's TAOCP Fundamental Algorithms book (1973). Is this still a valid statement or has computing power rendered it obsolete ?


How can I integrate and store sessions in my database, as opposed to storing them in a cookie and file system?

I've never worked with sessions in a database before, and I'm a little unclear on how they work. I have a user class already designed which stores user information: username, password, email etc. I also have a session class which uses the user ID to store a session cookie in the user's browser so that when they return to the application, a method is invoked to check if:               isset($_SESSION['id']){ $this->userId=$_SESSION['id']}      then take the user to the admin page. I've been reading that using the database is a more secure method of handling sessions, but I'm having a hard time wrapping my head around this concept. So say I wanted to store the session info in the database, and have access to that info so that if the user clicked on a link to their profile page, for example, I could use the session info to get their user info. How could I achieve this? Does it even make sense to use this approach?


How to store an object state/data for later processing?

What do you think would be the most effective solution to maintain an object status through a life cycle? The goal to be able to be continue from any state any time. During the life cycle likely to have human interactions over a variety of interface. For example, an order which needs to be approved by a few people. Or a data supply process that can requires many people to approve or edit? In my mind some solutions:   * When called a function serializes the object and saves it in a database.   * All steps of the process would be saved to somewhere (database, csv, xml, etc.), so it can always be recreated based on this.   * Possibly a mixture of the two methods? Any good methods for the problem?


NLP - Queries using semantic wildcards in full text searching, maybe with Lucene?

Let's say I have a big corpus (for example in english or an arbitrary language), and I want to perform some semantic search on it. For example I have the query: "Be careful: [art] armada of [sg] is coming to [do sg]!" And the corpus contains the following sentence: "Be careful: an armada of alien ships is coming to destroy our planet!" It can be seen that my query string could contain "semantic placeholders", such as: [art] - some placeholder for articles (for example a / an in English) [sg], [do sg] - some placeholders for NPs and VPs (subjects and predicates) I would like to develop a library which would be capable to handle these queries efficiently. I suspect that some kind of POS-tagging would be necessary for parsing the text, but because I don't want to fully reimplement an already existing full-text search engine to make it work, I'm considering that how could I integrate this behaviour into a search engine like Lucene? I know there are SpanQueries which could behave similarly in some cases, but as I can see, Lucene doesn't do any semantic stuff with stored texts. It is possible to implement a behavior like this? Or do I have to write an own search engine?


What are the best practices and strategies for transferring an outsourced software development project in-house?

What are the best methods of knowledge transfer? What kinds of documentation should be expected? What activities should take place before and after handover, both by the external party and ourselves?


Is it better to target iOS 5 and ARC or an earlier version with MRC?

I personally don't know much about iOS 5, but it seems like with automatic reference counting (ARC), you get rid of much of the memory management issues of the previous operating systems. So is it better to target iOS5 (and create apps that can only run on the newest iOS devices), or is it better for her to target iOS 4 or even iOS 3, so she understands the fundamentals of memory management in Objective-C? Are there any important aspects of iOS development that she might miss out on by jumping into iOS 5?


What are some books that explain low level stuff like com interfaces, dll injection etc? Basically low level windows programming. Searching on amazon gives me hacking books/10+ year old books which is not what i want. Thanks.


What is the difference between a software process model and software engineering methods (methodology)?

I'm an academic guy, who is now venturing into the software engineering world, puzzled by the fact that many terms seem to overlap each other. I'm reading some books and cannot quite distinguish/correlate a software process model from software engineering methods. For instance, in _Software Engineering_ Ian Sommerville defines a software process model as: > A simplified representation of a software process, presented from a specific > perspective. And software methodology ( _software engineering methods_ ) as: > Structured approaches to software development which include system models, > notations, rules, design advice and process guidance. However, Wikipedia defines _software development methodology_ like this: > A software development methodology or system development methodology in > software engineering is a framework that is used to structure, plan, and > control the process of developing an information system. In my opinion, Sommerville's definition of a software process model can enter on the scope of the Wikipedia definition. Can anyone enlighten me on this issue? An example would rock, e.g, `A` is a software process model and `B` is a software engineering methods (methodology).


What Are the Cons of Publishing Beta Software in Android Market?

I've spent some time developing a little Android app to scratch my own itch. I'm considering publishing the current version as a beta in Android Market. Pros for publishing it now would be the potential to get feedback. It would also be a way to gauge interest in the app which could effect whether to develop it further at all. What would be the cons of publishing beta in Android Market?


Is the MIT license suitable for an open source library that is only used in unit testing scenarios?

Some time ago I developed a small project for use in unit testing scenario's and published it on Codeplex. Back then I choose the GPL license but I didn't really understand it. Today I changed it to MIT, because it's a much simpler license that I can understand. I like to be recognized as the copyright holder, but I want everybody to be able to use the library without worrying about license issues. I think MIT covers both, but not 100% sure. ' _Virality_ ' is not an issue for this project. Would this license (MIT) in any way prevent a person to use my library for the unit testing of a closed-source commercial or private project? In this regard, is my recent change to MIT a change for the better?


How to really understand programming?

I have started to learn to program. I am interested in it and dont mind how long it takes to learn. But I am using books to start out and I find that there are some things I get and some things I have no idea. I can understand the code when I see an example but I feel completely lost if I were to go out and do something on my own. I have barely any experience: maybe 20 or so hours, which I understand is absolutely nothing.   * When does everything come together?   * What are some best ways to learn that anyone else has found?   * Are there any good projects people have done that have been a great learning experience?


What do you need to master a language and its technology?

> **Possible Duplicate:**   >  how to really master a programming language Let say about Java(just a sample, you can talk about C#, PHP, C++ ... it's just similar) and 10 (ten) levels, 1 is newbie and 10 is master. How can you identify someone at which level based on his knowledge? I do not tend to compare languages, I do tend to know what indicate a master or a newbie in a language _and its (language's) based technology_. Yeah, I know there aren't on earth a language stand alone, it always come with a technology with it. Let say in Java, you can memorize all of its keyword and syntax in just few days, but to _know_ it (I mean do something with it effectively), you must read the Oracle (Sun) javadoc many many times (I'm not mention the 3rd party product yet).


How can I  really master a programming language?

I know that learning a language, you can simply buy a book, follow the examples, and whenever possible try the exercises. But what I'm really looking is how to master the language once you've learned it. Now I know that experience is one major factor, but what about learning the internals of the language, what is the underlying structure, etc. There are articles out there saying read this book, read that book, make this game and that game. But to me this doesn't mean to master a language. I want to be able to read other people's code and understand it, no matter how hard that is. To understand when to use a function and when another, etc etc. The list could go on and on but I believe I've made the point. :) And finally, take whatever language as an example if needed, though best would be if C was taken as an example.


How can I develop a Package Manager for Embedded Systems?

I need to develop/use a package manager for an embedded Linux system with the following properties:   * A master fully controls which packages need to be installed (the slave has no possibility to ask the master anything)   * Download speed on the device is slow that not just everything from the master distribution can be download to the target   * Upgrading/Downgrading of packages must be possible   * It should be possible to replace the package manager on the system itself   * Possibility to replace the operating system itself   * It's easily to recover from failures (power loss, ...), especially relevant when considering the two points above   * Locks on the slave which have to be deleted manually are by no means allowed   * If a new (meta?) package replaces an old (meta) package and there are some unneeded packages left, they're removed, to save space on the device   * Define some form of order or dependency to install packages   * Perhaps some form of a recovery system is need (how to detect that it is needed, how to boot it, ...) Some points are just repeating other points, and some points are not necessarily something the package manager itself has to do. I started to copy ideas from dpkg (especially how it install files and renames them later to reduce the time frame where something bad can happen) and use the deb format for packages itself (not using all of the fields). I'm not sure myself, if this questions belongs to Programmers, but instead asking for a solution or anything like that, I'm more interested if other programmers faced the same problem and if there are any notable resources how this kind of problem is solved. Personally it happened to me too many times that embedded devices could be almost destroyed by a software update without any possibility (without special hardware) for recovery. Some links that may be relevant for others are the following ones:   * http://en.wikipedia.org/wiki/List_of_software_package_management_systems   * http://en.wikipedia.org/wiki/Ipkg I could as well provide a pseudo code alike description for what I intend to do.


In python, do we have class encapsulation at the level of the object?

I was bitten by using the `is` operator when i should have been using `==`. Am aware that the former tests for equality of the objects' identities and that the latter tests for equality of the objects' contents. Using `is`, i thought, also implicitly tests for the equality of the contents. For example `if a is b` is true, then the contents must be the same. This was the working assumption and i believe that it's still true. But what was discovered, and should have been known, is that if `if a is b` is false, then the contents of a and b may or may not be the same. Example (Python 3.3.3):               class Food:         def favourite_restaurant(self):             return "the foo diner"               if __name__ == '__main__':              fr = "the juice bar"         print('%r  is  %r: %r' % (fr, 'the juice bar', (fr is 'the juice bar')))         print('%r  ==  %r: %r' % (fr, 'the juice bar', (fr == 'the juice bar')))              f = Food()         result = f.favourite_restaurant()         print('%r  is  %r: %r' % (result, 'the foo diner', (result is 'the foo diner')))         print('%r  ==  %r: %r' % (result, 'the foo diner', (result == 'the foo diner')))      The first print block says:               'the juice bar'  is  'the juice bar': True     'the juice bar'  ==  'the juice bar': True      The second print block says:               result: 'the foo diner'     'the foo diner'  is  'the foo diner': False     'the foo diner'  ==  'the foo diner': True      It seems that objects instantiated within the instance of a class have their own group of ids, separate from objects outside the class. My understanding that encapsulation in python is really a matter for 'consenting adults'. Do we actually have encapsulation at some lower level?


Is there an imperative language with a Haskell-like type system?

I've tried to learn Haskell a few times over the last few years, and, maybe because I know mainly scripting languages, the functional-ness of it has always bothered me (monads seem like a huge mess for doing lots of I/O). However, I think it's type system is _perfect_. Reading through a guide to Haskell's types and typeclasses (like this), I don't really see a reason why they would require a functional language, and furthermore, they seem like they would be perfect for an industry-grade object-oriented language (like Java). This all begs the question: **has anyone ever taken Haskell's typing system and made a imperative, OOP language with it?** If so, I want to use it.


Javascript Rookie Question: Define Variables Inline

I'm proficient with HTML and CSS but I'm still pretty shaky when it comes to Javascript. That said, I've been able to build a site using the Internet Archive Book Reader, which relies on reader.js Here's a copy of one of my versions of reader.js https://gist.github.com/dylan-k/ed4efed2384e221d46cc It's a good site, but I find I have to repeat things a lot. Basically, I have one copy of reader.js for every page/book featured on the site. It seems there must be a better way. I re-use the script, making copies, just so that I can change lines `28`, `80`, `83`, `84`. Is there a way I could include just one copy of reader.js and then use a `<script>` tag to define these 4 lines for the individual pages?


How does session middleware generally verify browser sessions?

I've been using session middleware to build web apps for years: from PHP's built-in session handling layer to node's connect session middleware. However, I've never tried (or needed) to roll my own session handling layer. How would one go about it? What sort of checks are necessary to provide at least some modicum of security against HTTP session highjacking? I figure setting a cookie with a token to keep track of the session, and then perhaps some check to see that the originating IP address of the session doesn't change and that the client browser software remains consistent. Hoping to hear about current best-practices...


Estimating time remaining in a queue with multiple workers

I've been trying to figure out a way of calculating the estimated time remaining for an item in a queue when there are multiple workers processing items from the single queue. A client submits a job to the queue, but since processing can take some time I wanted to give an estimate of feedback. I know   * Number of items in the queue   * Position in queue   * Length of time an item takes to process*   * How many workers are running   * When each worker last completed a job I don't know   * How far along processing the worker is, only when it starts and ends** *Processing time is the 90th percentile processing time of past jobs within a reasonable time range. Not completely accurate but tends to overestimate slightly and is accurate enough for my needs.   **Workers are calling an external service so the best estimate of progress is time taken With a single worker I can use a function such as               estimated_seconds_remaining = (         (position_in_queue + 1) * average_processing_time_seconds     ) - (         average_processing_time_seconds - time_since_worker_last_finished_seconds     )      `(position_in_queue + 1) * average_processing_time_seconds` gives me the time it will take to process all the items in the queue plus the one that is currently being processed, then taking away `average_processing_time_seconds - time_since_worker_last_finished_seconds` gives me the estimated time remaining to process the current queue item. This works fairly well, and is accurate enough for reporting back since the variation in processing times is quite small. But, in production I'll be running multiple workers, so multiple workers will be processing items from the same queue. There will most likely be 3 or 4 workers running, but could be upwards of 10 at times. The simplest option is just modifying my formula so               estimated_seconds_remaining = (         (position_in_queue + 1)/number_of_workers * average_processing_time_seconds     ) - (         average_processing_time_seconds/number_of_workers - time_since_worker_last_finished_seconds     )      But this gives inaccurate and erratic predictions, since the estimates are being re-calculated every second to update the display the times jump up and down depending on when the workers all finish their jobs. Is there a simple way, with the information I have, to calculate a reasonably accurate prediction of the time remaining before an item from the queue is processed?


What is the absolute minimum set of instructions required to build a Turing complete processor

I have a general idea of how the processor handles instructions but spend my time working in mostly high level languages. Maybe somebody who works closer to the iron can provide some valuable insight. Assuming that programming languages are basically very high level abstractions of a processor's instruction set, what is the most basic set of instructions necessary to create a turing complete machine? _Note: I don't know anything about the diversity of hardware architectures but -- for the sake of simplicity -- lets assume it's a typical processor with an ALU (if necessary) and instruction stack._ *


Node.js API Architecture

I am currently working on a web app and want to design the interface between nodejs / mongoose and the backbone app. A short description of the app: A user signs up to the application and gets a user account where he can create an organization (e.g. footballclub). Within these organizations you can set up projects. Within these projects you can define tasks you could assign to somebody) I want to have a RESTful api for the app. My problem is: A user could have more than one organization, if i have an api for projects like GET /projects/   POST /projects/   GET /projects/:id   PUT /projects/:id   DELETE /projects/:id How do i determine to which organization the project belongs? Do i add a parameter to the api or do i send an extra field containing the id of the organization? Any help is appreciated!


Is it common for business analysts (or other non-development team members) to have stories tracked alongside developers?

We're using JIRA with Greenhopper, and currently our business analyst has tasks for their analysis which will eventually lead to new stories placed in the backlog, running alongside the stories for the current sprint, and it feels kind of messy - especially because they don't overlap the workflow for the development stories. Is it common for this to be the case? Should it be? It feels like the analysis ought to be an external process that feeds in to the product backlog, not something that tags along the sprint backlog, but I am new to scrum. I consulted the scrum guide and didn't see anything explicit, and while we don't really have a Product Owner (although at times I would say our manager fills that role, other times so does the business analyst), I guess I could also phrase the question as: Should Product Owners track their tasks next to the stories that the development team works on?


What does "polyadic" mean in the context of functional programming and type systems?

And how does it (or does not) correspond to "polymorphic"? Occasionally I see this notion like in: Implement and represent polyadic operations. I checked Wiktionary but it only gives a general meaning, not specific to functional programming.


C++ IDE and tools with Clang integration

Recently I've read this blog about Google integrating Clang parser into their code analysis tools This is something in which C++ is at least a decade behind other languages like Java, but now that llvm-clang is almost C++ iso-ready, I think its possible for C++ code analysis tools to begin using the C++ parser effectively, since it has been designed from the ground up precisely for this I'm wondering if there are existing open source or known commercial projects taking this path, integrating with Clang to provide higher-level analysis tools?


Best practice to return a long string in a stub

I have some methods im trying to test which use a StreamReader dependency that i mock using Rhino mocks. But it is a large xmlFile. In the spirit of unit testing im trying to keep away from using a test file in my test project. On the other hand copy-pasting 100 lines of xml into my test class seems sort of ugly. What is the best practice when returning large strings using a stub.


Is "Computer Science != Software Engineering" an excuse to teach programming poorly?

We've all heard it; whenever there's a discussion about CS grads having poor development skills someone eventually says, > Computer science isn't software engineering. The problem that I see is that programming and software development _are_ taught in CS courses. They're just commonly taught poorly. If it's being taught, then why not teach it right the first time? * So I would like to see what the opinions are on 2 questions:   1. Is the CS != SE argument a copout or excuse for not properly teaching programming skills.   2. Regardless of your answer to question 1; if you were in the almighty position of making such a decision: would you force an emphasis on proper teaching of programming in CS courses? *. I have a suspicion, based on anecdotal evidence I obtained throughout my education, that most academics in the field haven't had to write code to be maintained and haven't maintained code, and as a result don't have the knowledge/skills to teach it effectively.


A colourblind member of our team

My team relies a lot on colour within our code to outline features that need to be worked on (we colour lines of code that need attention). We have a close friend who is colourblind and wants to join our team. What can we do to highlight what needs work without using colour? We have about 25 people on the team that are all accustomed to the line colouring system and we have found it to be most efficient.


Is a coding standard even needed any more?

I know that it's been proven that a coding standard helps enormously. However, there are many different tools and IDEs that will format to whatever standard the programmer prefers. So long as the code's neat/commented (and not a spaghetti mess), I don't see the need for a coding standard. Are there any arguments for the development of a coding standard (we don't have one, but I was looking into creating one)?


What is this called?

I'm hoping there's a book or something out there for me to get... If I have a class that has Collection as an instance variable, what is that method of coding called? A design pattern? If so, where can I find more information on it? As I've been working with this mentor, he's really helped me understand my programming weakness and that weakness is thinking in terms of collections or relationships between objects. It just seems so difficult for me right now and I need to read to become smarter. My mentor is a great guy, but I'm starting to feel like I need to learn more on my own.               public class Evaluation     {         private List<Criterion> criterion = null;              public Evaluation()         {             criterion = new List<Criterion>();         }     }


Am I Unit Testing or Integration Testing my Stored Procedures?

I have had many occasions recently where I have needed to maintain complex stored procedures and functions. These were broken already, usually in fairly subtle ways - there were very few occasions where you would call the SP with valid parameters and it just plain didn't work. My solution was to evolve a framwork that executes the stored procedures inside a transaction, after initializing the database to the initial conditions I needed, then testing for the expected result, also within the same transaction. The transaction was rolled back at the end of the test. This has worked very well. But some would call this "integration testing" since it involves integrating with the database. I call it unit testing, since I tested individual components and individual test cases for those components, and since I completely controlled the initial state of the database. But where should the line be drawn? Is this integration testing or unit testing? Is there a practical reason why this sort of test is a bad idea? If this is "only" integration testing, does anyone have suggestions on how to do actual "unit tests" on these stored procedures?


Would it be possible to publish my code on an official site with a third-party library?

I'm building a rather large and extensive wrapper in Delphi for an email system called Mandrill. There are wrappers for this API in many other languages, but not for Delphi. So, I'm hoping to produce the first full wrapper. The problem is, I'm utilizing a third-party JSON parser called superobject. I'm afraid that if I complete this wrapper, I won't be able to provide my code for Mandrill to share, because of this third-party library. If I do complete this wrapper, is there any chance that Mandrill will be able to legally publish it on their site, based on the fact that I'm using superobject? Or would I need to parse my own JSON to be applicable? PS - I mean this question in a general concept, not necessarily for my precise scenario, but in general, if I use a third-party library, can I legally post it with my code on another third-party's site?


Entities optional relations: separate classes or single class?

Lets focus on a domain object that is related to **more** other (different!) entities. Sometimes we need one relation and sometimes the other. Let's be agile and say: we don't know in a front how many other relations there will be. In other words: we have object **A** that is related one-to-one to **B** and one-to-many to **C** and again one-to-one to **D** and so on. Now, when developing the presentation tier, it often needs a lot of data to display; like table of **A** with **B** , or on other place one **A** with many **C** and so on. How we gonna model these relationships? Here is an example: `Competition`. Sometimes it comes and needs to be used with e.g. `Venue`. Sometimes with e.g. `List<Event>`. Since you care about performances, let's also say that the related objects (`Venue` and list of `Event`s) come from the single input/repository method/finder method/one SQL join (however you call it) - and that they can be _injected_ into `Competition` using some mapping tool. This way we express the actual relationship between the entities. Question: should we keep both relations/references in the `Competition` class and ignore the other when one is used, or we should make many separate classes - one for each relation? (It doesn't matter if it is 1-1 relation or 1-many, the question is the same.) In other words, should we have: **[A]** Everything in the single class. Getter methods do represents relationships. It's on us to fill the object if relation is needed.               class Competition {         ... competition data...              private Venue venue;         public Venue getVenue() {             return venue;         }              private List<Event> events;         public List<Event> getEvents() {             return events;         }     }      But then, when your application method return a `Competition` you don't know what relations are populated and you have to figure that out by looking the application methods code or by method name (e.g. `findCompetitionWithEvents...()`). **[B]** For each relationship we have a type or interface. One way to do so, without interfaces for the simplicity of this example, is:               class CompetitionVenue extends Competition {         private Venue venue;         public Venue getVenue() {             return venue;         }     }      and               class CompetitionEvents extends Competition {         private List<Event> events;         public List<Event> getEvents() {             return events;         }     }      Now the type speaks by itself what relationship is returned and therefore application method that returns it guarantees that relation exists. But then each relationship would have its own class or interface; EDIT: **[C]** Each relationship is represented using a generic class like `Tuple<Competition, List<Event>>` and `Competition` does not have the getter for list of events?


Can you/should you develop components for ASP.NET MVC?

Following from the previous question I've started to wonder - is it possible to implement "Components" in ASP.NET MVC (latest version)? And should you? Let's clarify what I mean with a "component". With that I mean a "control" (aka "widget"), similar to those that ASP.NET webforms is built upon. A gridview might be a good example. In webforms I can place on my form a datasource component (one line of code), a gridview component (another line of code) and bind them together (specify an attribute on the gridview). In the codebehind file I fill the datasource with data (a few lines of DB-querying code), and I'm all set. At this point the gridview is a fully functional standalone component. I can open the form, and I'll see all the data. I can sort it by clicking on the column headers; it is split into several pages; I can drag the column headers around and rearrange columns; I can turn on "grouping" mode; etc. And I don't need to write another line of code for any of it. The gridview, as a component, already has all the code tucked away in its classes and assemblies. I just place it on the form, initialize it, and it Just Works. At some times (like sorting or navigation to a different page) it will also perform ajax callbacks to the server, but those too will be handled internally, with my code having no knowledge at all about it. And then there are also events that I can attach if I want to get notified when something happens. In MVC I cannot see a way of doing this cleanly. Sure, there are the partial views, but those only handle half of the problem - they render the initial HTML. Some more can be achieved with client-side Javascript (like column re- arranging), but when the grid needs to do an ajax callback (say, to fetch the next page of data), my code will have to get involved and process that request. At best I guess I can provide some helper methods to process it, but I'll have to write the code that calls them, and also provide a controller method with signature matching the arguments of that callback. I guess that I could make some hacks with global events or special routes or something, but that just seems... hackish. Unelegant. Perhaps this is not the MVC way? Although I've completed one project in it, I'm still far from being an MVC expert. But then what is? In the intranet application that we're building there are dozens upon dozens of such grids. Naturally I want them all to have a unified look & behavior, and I don't want to repeat the same code all over the place. So what's the "MVC" approach to this problem?


A little confused with the notion of stateful/stateless architectures. Forgive me if I'm unclear. Questions: Can we consider a clients interaction with a web server to be stateful if the web server maintains state via session variables or cookies? What if we assume that any change to this information comes from the client side any way and doesn't depend on other users?   * What about amazon's web store? Although state may change and not be reflected automatically to the client... if the client attempts to operate on stale data, the system recognizes this and acts appropriately. Is this purely stateless still? Or somewhere in between?   * What if we added a layer of java script that constantly polled the server every second to keep the client side updated? At an abstract level wouldn't this be considered stateful because the client will continuously have an updated state? Definitions/Models I'm trying to work with: Stateless architecture of websites: HTTP is a stateless protocol. The client makes an HTTP web request. The server calculates/processes the request and returns back to the client the appropriate information which the current state of the website. While the client has that information, the website can change state and these changes won't be reflected back to the client side until the client makes another web request. Stateful architecture: The client can simply operate assuming that any data that is seen represents the actual state of the server.


When getting a list of files to process, should I store them to a list of string, or a list of Stream?

for a list of files, coming from a list like from a file dialog is it better to store the list as a list of strings or should I convert each file to opened Streams stored in a List? For example                       List<string> files = new List<string>();                  List<FileStream> fileStreams = new List<FileStream>();                  foreach (Stream f in fileStreams)             {                 //process stream             }                  **VS**                  foreach (string s in files)             {                 //open filestream                 FileStream fs = new FileStream(s, FileMode.Open);                      //process             }


Why aren't plain-text markup languages (like LaTeX or Markdown) more popular in the software development process?

I'm currently an intern at a government contractor and am getting the (obnoxiously unavoidable) feeling that Word is the de-facto standard in the software development process. Its binary format makes it very difficult to collaborate on documents in the way I am used to collaborating on a code base. The use of plain text markup (with such languages as LaTeX, Markdown, ReStructured Text, _etc._ ) allows for a diff-friendly document that works well with the normal workflow of a developer. As for comments where the language doesn't support them (eg Markdown), there are many existing solutions that allow collaborative comments on code bases (eg GitHub, Bitbucket) that could _easily_ be applied to other plain-text files containing markup. I understand the need to cooperate with technologically illiterate management necessitates some sort of graphical interface to everything, but such interfaces exist for most of these formats. (For example, LaTeX has a 'fork' of sorts called LyX that puts a graphical front-end to a plain-text, LaTeX- like syntax. This file, even though primarily graphical in its editing, is _still_ diff-friendly. (Inception comment: it also has Word-style comments.)) Many of these solutions could yet be used instead of Word, and the vast majority are free or open-source. However, we use Word even for our own internal documentation that nobody else sees. We work with text for a significant chunk of our career---why is documentation so special?


Multiple Data Types for Single Variable in C

I am trying to implement basic cons, car and cdr of SCHEME in C. I have made a simple program that allows me to cons two integers as shown in the main program. However, I want my program to be able to cons a 'consed object' with a digit as well as cons a 'consed object' with another 'consed object' as shows below:   * (cons 2 3)   * (cons 2 (cons 2 3))   * (cons (cons 2 3) (cons 2 3)) Since the limitation arises because the data in the struct is of type int, is it possible to have a variable accept multiple data types in C? If yes, how? If not, is there another way to deal with this issue? Here is my code:               #include <stdio.h>     #include <string.h>          typedef struct cons_object {     int data;     struct node* next;     } cons_object;          cons_object* cons(int x, int y )     {     cons_object* car = NULL;     cons_object* cdr = NULL;     car = malloc(sizeof(struct cons_object));     cdr = malloc(sizeof(struct cons_object));     car->data = x;     car->next = cdr;     cdr->data = y;     cdr->next = NULL;     return car; /*returns the pointer car*/     }          int car(cons_object* list) /*takes in a consed object*/     {     cons_object* car = list;     int y;     y = car->data;     return y;     }          int cdr(cons_object* list)     {     cons_object* cdr = list;     cdr = cdr->next;     int z;     z= cdr->data;     return z;          }          int main ()     {     int y = car (cons(33,42));     printf("%d\n",y);     int z = cdr (cons(3,4));     printf("%d\n",z);     return 0;          }


MVC: "User" model gets big and crowded. Should methods that do CRUD operations on one-to-many relationship data be in different models?

In most MVC web projects there is a User class. Many times a user has something else in a one-to-many relationship, i.e. orders. If we have a user class that has many orders, should methods that add, edit or delete orders for a user be placed in the user class, or in a separate Order class? i.e. 1.               user.add_order(order_name)   //Instance method      vs 2.               Order.add_order_for_user(user_id, order_name)   //Static method      or alternatively, 3.               order = new Order(user_id,order_name)     order.save()      (Also, in the case of option 3, should this be combined with option 1 and put in that method)? My main issue with option 1 is that the user model tends to get huge in terms of size. Does this violate SRP? For instance, in one of my projects a user has many "things" like friended users, feeds, uploaded files, warnings, punishments, and the list goes on. I'm basically adding CRUD methods for all those "things" that a particular user has many of, in the User class itself. Is this a bad thing, and should I spread out the CRUD methods to different classes? However, one of the advantages for option 1 is that I can control logic in those CRUD methods using the attributes of the current user object, without having to query the user. For instance, if I have a method "add_file" I can check to see if the user's total file space used (an attribute of User) is less than a max without having do do another query.


Categorize tasks/bugs by risk of changes

The project I'm currently working on has an issue: bugs and tasks are often assigned to people who are too new or too inexperienced and their work ends up producing more bugs down the road. The problem is that parts of our software are much more "dangerous" to work on than others due to code quality issues. I've been trying to combat this issue by estimating the risk associated with tasks and paying close attention to which developers get assigned which tasks. We use JIRA so I started labeling issues to keep track of this estimation. I've noticed that I've ended up using several metrics to categorize a bug/task:   * How clear/straightforward it is. E.g. whether it's something that will need a lot of design work or just a simple UI bug fix.   * How maintainable the affected area of the code is. Is it a well-designed area or a big ball of mud.   * How much of the program I think will be affected by the required change. My labels are kind of messy since I didn't have a clear idea when I started what the possible categories would be and I still don't. I'm thinking about requesting a new field be added (something like "Risk") so that we can require an estimate before assigning the work to someone. Has anyone dealt with this sort of thing before?


Commercial product using a GPL OS

we are planning to create a commercial product. The product consists of some MCUs and a small computer (we are developing on a Raspberry Pi at the moment). The computer needs an operating system as we would like keep things like WLAN and booting as simple as possible. We created some software that runs on this computer (node.js application). The most operating systems like Arch Linux are licensed under the GPL. The product we would sell contains the computer with pre-installed OS and software. This system operates as a central access point to MCU devices and is able to control them. We use other's software in our product. We do not modify their source code. The product (the computer part) consists of a computer, an OS and software we create.   1. How does the use of an OS affect our own code (licence)?   2. Is there a possibility of avoiding GPL for our own code? eg. shipping the software separated?   3. Are there any effects to other components of our product, eg. the MCU part?   4. The node.js application delivers a WebApp to the client where it is executed. Are there any effects (As we would like to sell parts of the code as an additional App on the App Stores)? I know we make use of the work of the community and i respect this. The problem is: The software alone is kind of useless without the MCU devices. I do not expect a legal advice.


How do statically typed languages handle test discovery?

I come from a Python background, so I'm used to pretty automatic test discovery. For example, the `py.test` library automatically locates any files which begin with `test`, finds classes whose names start with `Test` inside of the those files, and then calls all the functions whose names start with `test_` in those classes. This type of test discovery is enabled by Python's deep support for reflection and dynamism. These features are often absent in statically typed languages, because they're difficult to make integrate with the type system. Therefore, I'm interested in hearing about what approaches statically typed languages use to make test discovery simpler?


How can I improve my application's memory use?

I am writing a C# application, and can see the memory usage increasing as the running time of the application increases. Are there any tools or techniques I could monitor my application's memory use, identify memory leaks and generally improve my application's memory use?


Looking for terminology for the relation of a subject and a predicate

While writing some predicates for collection filtering I have stumbled over the choice of the right words for the relation of the subject and the predicate (English is a foreign language for me). What I ended up writing was "Subjects **matching** this predicate..." This seems to be incorrect, since predicates are functions and not regular expressions. But saying "Subjects for which this predicate returns true..." sounds awkward to me as well.. So what would be the correct term?


Random List of numbers in C

I have just started a C programming course and so far have only done the basics like `printf`, read a little on variables etc on the course book. The teacher has tasked us with writing a program that will take a value entered by the user, this will be the number of students in the class (25 at the moment but can be variable). It will then list the number of students randomly and place them in 3 columns. The purpose is to sort students into groups of 3 randomly, then display on the screen in columns. Now my question is not for the code that defeats the object of me attempting the exercise, but how to structure it. I can see that using an array can be used to display the list, but really after some pointers on how best to approach the problem in blocks, then I can attempt to program each block.


Repository Pattern: Doctrine2 vs Microsoft Entity Framework?

I have been using Symfony2 with Doctrine2 for some years. I have recently started using Microsoft's Entity Framework with MVC5. From my Symfony2 experience I understand that a repository's job is only to retrieve and return objects, no additional operations like Saving. Now every examples I have seen for EF has a method Save/Update as part of the repository. For symfony I have been creating manager classes as follows:               interface IManager     {         function getClassName() ;         IRepository getRepository() ;         function Save(object);         function Update();     }      So I pass around the manager, if I need to retrieve objects I call the repository directly. If I need to save I call the manager's save method. Is a repository supposed to support save/update? What do you think of my IManager class, should I also use it for EF?


Is it a good idea to return a default value if a field in a query cannot be found?

At the place I work we are using a SafeReader class that wraps an IDataReader. One of the 'features' is that if the field you are trying to access wasn't in the query then it just returns a default value. So I am working with some code that is already in place, but apparently never fully worked as it accesses fields that aren't returned from the stored proc it's calling but it didn't throw any exceptions since the SafeReader kindly returned default values. I personally don't like this because it means that when there are mistakes in the code (someone forgets to include a field in the query, or perhaps a misspelling) then it's harder to catch. My question is whether this violates any general 'best practices' of development or object oriented programming ideals? Or does this seem perfectly reasonable?


How managers choose programming languages

It's not a secret to anyone that managers can and often will impose the programming language that will be used for a project. Being a programmer myself, I have never been able to understand this. But now I think I do: I've just had a revelation when Joel Spolsky said on the podcast that they should use QuickBooks because "every accountant in the world knows it". This struck me as being very similar to "chose Java because every programmer in the world knows it". Now that I've seen the same issue from another perspective,I don't know much about accounting, but I do know something about programming, I'm wondering how a programmer can help make sure the right programming language is chosen for a project?


How should a programmer get what they need/want from a systems administrator?

In what ways would people recommend a programmer communicate the need for newer, more up to date libraries to system administrators. At our organization the programmers often do many system administration tasks such as system updates, installation of software, management of software, recovery of specific systems after failures, etc. Programmers are currently limited by the age of some of the systems available and would like newer OSes and subsequently libraries available to them. What is a good way to communicate these desires to the SAs who are, in the end, in charge of deciding what OSes to install. Edited to simplify the whole question. Thanks.


What have my fellow Delphi programmers done to make Eclipse/Java more like Delphi?

I am a veteran Delphi programmer working on my first real Android app. I am using Eclipse and Java as my development environment. The thing I miss the most of course is Delphi's VCL components and the associated IDE tools for design-time editing and code creation. Fortunately I am finding Eclipse to be one hell of an IDE with it's lush context sensitive help, deep auto-complete and code wizard facilities, and other niceties. This is a huge double treat since it is **free**. However, here is an example of something in the Eclipse/Java environment that will give a Delphi programmer pause. I will use the simple case of adding an "on-click" code stub for an OK button. **DELPHI**   * Drop button on a form   * Double-click button on form and fill in the code that will fire when the button is clicked **ECLIPSE**   * Drop button on layout in the graphical XML file editor   * Add the View.OnClickListener interface to the containing class's "implements" list if not there already. ( _Command+1 on Macs, Ctrl + 1 on PCs I believe_ ).   * Use Eclipse to automatically add the code stub for unimplemented methods needed to support the View.OnClickListener interface, thus creating the event handler function stub.   * Find the stub and fill it in. However, if you have more than one possible click event source then you will need to inspect the View parameter to see which View element triggered the OnClick() event, thus requiring a case statement to handle multiple click event sources. **NOTE: I am relatively new to Eclipse/Java so if there is a much easier way of doing this please let me know.** Now that work flow isn't all that terrible, but again, that's just the simplest of use cases. Ratchet up the amount of extra work and thinking for a more complex component (aka widget) and the large number of properties/events it might have. It won't be long before you miss dearly the Delphi intelligent property editor and other designers. Eclipse tries to cover this ground by having an extensive list of properties in the menu that pops up when you right-click over a component/widget in the XML graphical layout editor. That's a huge and welcome assist but it's just not even close to the convenience of the Delphi IDE. Let me be very clear. I absolutely am not ranting nor do I want to start a Delphi vs. Java ideology discussion. Android/Eclipse/Java is what it is and there is a lot that impresses me. What I want to know is what other Delphi programmers that made the switch to the Eclipse/Java IDE have done to make things more Delphi like, and not just to make component/widget event code creation easier but any programming task. For example:   * Clever tips/tricks   * Eclipse plugins you found   * other ideas? Any great blog posts or web resources on the topic are appreciated too. \-- roschler


Are macros values, data types, identifiers, variables, constants, or ...?

Macros exist in many programming languages, for example, C.   1. A data type is a set of values with operations on the values. Are macros values, or data types?   2. Are macros identifiers, variables, or constants?   3. Are macros something not belonging to a programming language, and something that will be translated to the programming language in the preprocessing step of compilation? Thanks,


If we can do functional programming with Python, do we need a specific functional programming language?

Using generators and lambda, we can do functional programming with Python. You can also achieve the same thing with Ruby. So the question is: why do we need specific functional programming languages such as Erlang, Haskell, and Scheme? Is there anything different that these specific functional programming languages provide? Why can't we just use Python for functional programming?


Calculate statistics for web application

I'm planning to add a couple of usage statistics to my web application. Some common things like: registered users, amount of comments/posts, etc. over time (last 24 hours / last week / last month / last year) which I want to display graphically to all admins.   I know that I can retrieve all information from database queries, but I have a bad feeling going over "old data" over and over again. Example: _Yesterday, I requested the amount of users who registered for an account the last year. Admin XYZ requests the same statistic today._ A simple select-all-users-reg-date-last-year query would be redundant and cause much database traffic, right? **What is the best approach of calculating statistical data like this?**


Why is Reflector such an essential utility?

Reading the brouhaha surrounding Reflector going paid got me thinking about the product and its uses. Many people seem to consider it an essential tool. I have to admit, I haven't used Reflector in years. I mean, there's documentation for both the .Net APIs and the third party components I use. In the past, whenever a colleague pulled Reflector out of his tool belt, I got the sense he was headed into the weeds. Reading all the passion around Reflector is leading me to question if I'm really missing something here. Why do you need something like Reflector so often that you consider it an essential tool? I can see it being needed on very rare occasions, but not enough to be considered an essential tool. Please enlighten me.


What is the easiest way of viewing an RGB byte array as an image?

I have a byte array stored in a file. I want the quickest, easiest way of viewing the image whether it is writing code or using a utility or web page.


Machine code JITs and the Execution Disable bit

How is runtime-generated machine-code (such as the output of a JIT), actually executed by the CPU if the CPU/OS has an Execution Disable bit? As far as I know, many modern processors and Operating Systems include support for an NX bit, (including Intel and ARM), which prevents machine code that is stored at any address _other_ than the code section of a compiled binary from being executed. Clearly, this is a nice security advantage, because it prevents shell-code injection attacks. But how do JIT engines, like LLVM, which dynamically generate machine-code, get around this?


Is handwriting out code an efficient way to learn a programming language?

In my C++ intro class last semester, all of our tests were paper/pencil and we had to write out code with a pen or pencil in order to answer questions. It seemed counterintuitive at the time, but also made sure students knew the answer down to the last semi-colon. Given that handwriting notes is an essential practice in learning other topics both in the class room and at home, how productive is handwriting code examples and documentation?


Semantic Versioning and splitting apart a library, providing a bundled build

I've got a nice, fairly popular JavaScript library that is following Semantic Versioning. The current library has a few dependency libraries, which are available either as separate downloads or as part of a single bundled download. I see a need to head down this path further. I want to extract additional, smaller libraries out of the one larger library. Each of these extracted libraries would be available as separate files, or inside of the one bundled build, again. If I go down this path of extracting the libraries, and providing a bundled version of the final code, does this require a full version change in semantic versioning? Would I have to bump from 1.x to 2.x? My first thought it no: I will not change any public API, so I don't have to change the major version number. But then I wonder... well, I am restructuring a lot of things, even though the final API for the bundled version would be the same. Is there a clear answer from semver on something like this? Do I need to bump first, second or third dot? Or something else?


Why should we NOT do frequent deployment in PROD or to test server?

I was instructed by my project manager that frequent deployment in PROD or to test server should be avoided. But I don't understand why? We roll our testing copy to PROD on every sprint end but suddenly client would ask a simple change to the existing application which would require a re-deployment. When every thing was well tested and QA approved. why should we avoid frequent deployment? How it was done universally?


What are the best practices for rapid prototyping using exclusively HTML/CSS/JS

I'm developing a **prototype** of a web application. I want to only use HTML, CSS and Javascript. I prefer to use my text editor and not having to learn (or pay, for that matter) a new tool like Axure. What would be, to your mind, the best practices? To me there are many qualities for a good prototype:   * Quickly developed   * Easy to improve   * Fair fidelity as regards UX (this disqualifies tools like Omnigraffle or PowerPoint that are more dedicated to wireframing) I trying to learn as quickly as possible, but I would like to know, based on your experience, on how you managed to be both quick and agile. Reference:   * http://www.boxesandarrows.com/view/prototyping-with


Navigating Code in Visual Studio

OK, so my class file is getting rather large, and that's a code smell. But until I can refactor it out, I need to get a handle on it. Primary options:   1. Code Regions.   2. Splitting into partial classes. I have never really liked code regions. They take time to write, and it seems I am always folding/unfolding the regions to find something. I like the partial class idea. Say for example, all public and private properties go into a partial class when they become too many. Does this make sense? The bottom line is that I just need to be able to find methods and properties rapidly, ie navigate code. So, really what I am asking is what is the best way to navigate code?


Computer Science: Arts or Science?

Various colleges and universities may offer a degree in Computer Science either as an Arts or a Science. What differences are there between the two? Would recruiters and those who conduct interviews favor one over the other? _(Bachelor of Arts vs Bachelor of Sciences etc...)_ **Update** \- Just wanted to add this link to Joel Spolsky's site to give a better frame of reference: BA or BS in Computer Science


Github-like "pull requests" without Github

I work as an analyst for a financial institution, which, due to data sensitivity, will not store any data in the cloud. However, I'm having some success getting my team to use Git for code management. I was wondering whether there was any way to implement Github-like pull requests in our own server. The specific feature I'm interested in is the ability to submit a changeset _for comments_ , without actually having it merged into a given branch. I like the workflow of (1) submit changes, (2) have changes reviewed and commented on, and (3) either accept the commit or reject it. Can this be implemented (even better, can this be _easily_ implemented) on our own servers?


Synchronizing local and remote cache in distributed caching

With a distributed cache, a subset of the cache is kept locally while the rest is held remotely.   * In a **get** operation, if the entry is not available locally, the remote cache will be used and and the entry is added to local cache.   * In a **put** operation, both the local cache and remote cache are updated. Other nodes in the cluster also need to be notified to invalidate their local cache as well. What's a simplest way to achieve this if you **implemented it yourself** , assuming that nodes are not aware of each other. **Edit** My current implementation goes like this:   * Each cache entry contains a time stamp.   * Put operation will update local cache and remote cache   * Get operation will try local cache then remote cache   * A background thread on each node will check remote cache periodically for each entry in local cache. If the timestamp on remote is newer overwrite the local. If entry is not found in remote, delete it from local.