title: Simulating/developing_a_testing_strategy for factors that might cause the same algorithm to produce different results in Distributed Systems

text: This is a **Purely Academic Question** **Context:** I am working with some algorithms which are meant to arrive at a consensus in distributed systems. I intended to tackle Byzantine faults with these algorithms. For this I have implemented several algorithms published in IEEE papers and need a platform to test these algorithms. I wanted to test the merit of existing algorithms. For this I implemented thousands of Linux Containers on my system and now i want to do message passing between them, or say _simulate_ my distributed system. But the question is the data that is flowing must have _faults_. This is the genesis of this question. Why I need something more _sophisticated_ than RNG's is that I will need to attach some real credibility to my work. I want it to tackle some real world application generating faults rather than just fix the faults I myself generated in an algorithm. So, I need to simulate the factors that result in Byzantine faults. OR, to quote FrustatedWithFormsDesigner: `I need to develop a testing strategy that will have a deliberate number of faults to test fault-handling` To Summarize: **Say I am running a program in a distributed environment, then what are the factors that might end up generating Byzantine faults and is it possible for me to inculcate these factors in my simulation and how?** So, what I need is: A program that will make a small no. of mistakes every now and then, and I should not know what mistakes it has made and when. _I do not need it to make multiple mistakes in one set(run of the algorithm), but rather I plan on making (say) 10,000 runs of the program, and I need it to make mistakes 2000 times .._ Very importantly, I must be sanguine that there are no more than (1/5)n mistakes, where n is the total no. of results generated using the program. The _results_ that I am talking about here can be anything that is quantifiable and verifiable, like eg. an array of values. Doing something like this:               1for(int i=0; i<10000; i++)     2   //one fifth of the times put garbage in the array using random function!!     3   for (int j=0; j<5; j++)     4      array[j]=j;      using a RNG in step `2` to _hide_ where the fault is present is too simplistic, trivial and not _real_ enough. I thought I could use some algorithm built around some mathematical function that is bound to fail 1/5th of the times, But I could not think of any. P.S. Please tell me if you need more data to understand the problem.


title: I've been told that Exceptions should only be used in exceptional cases. How do I know if my case is exceptional?

text: My specific case here is that the user can pass in a string into the application, the application parses it and assigns it to structured objects. Sometimes the user may type in something invalid. For example, their input may describe a person but they may say their age is "apple". Correct behavior in that case is roll back the transaction and to tell the user an error occurred and they'll have to try again. There may be a requirement to report on every error we can find in the input, not just the first. In this case, I argued we should throw an exception. He disagreed, saying, "Exceptions should be exceptional: It's expected that the user may input invalid data, so this isn't an exceptional case" I didn't really know how to argue that point, because by definition of the word, he seems to be right. But, it's my understanding that this is why Exceptions were invented in the first place. It used to be you _had_ to inspect the result to see if an error occurred. If you failed to check, bad things could happen without you noticing. Without exceptions every level of the stack needs to check the result of the methods they call and if a programmer forgets to check in one of these levels, the code could accidentally proceed and save invalid data (for example). Seems more error prone that way. Anyway, feel free to correct anything I've said here. My main question is if someone says Exceptions should be exceptional, how do I know if my case is exceptional?


title: Either Monad and Exceptional Circumstances

text: I have a function returning an Either such as GetUserFromDb(int id). If the database is offline, should I catch the error in the function and wrap it in a failure / Left case or should I let it bubble out as an exception as there is nothing I can do and it really is an exceptional situation?


title: Should I use an Exception in a case like this?

text: I have a Windows service with a fluent interface like this:               aRequest = Repository.getRequest()                          .createProcess()                          .validate();      Sometimes `getRequest()` could return a `null` value and this would cause an error in `createProcess()`. I could banally split `getRequest()` from `createProcess()`, but if I wouldn't do that what way should I follow, what way is better:   * Check if request (`this`) is null and in the case return null:              if(this is null)       return null      I could do this check in every method next to `getRequest()`. At the end `aRequest` will be `null`.   * Throw an exception if `createProcess()` method receive a `null` value:              if(this is null)        throw new NullRequestException();      PRO of the second way: Only second method need a check, independently of the number of method in the chain. CON of the first way: Every method in the chain needs a check Now the question: Is second way a bad use of exception concept, since could be normal the absence of request sometimes?


title: Which Programming Languages Support the Following Features?

text: My personal programming background is mainly in Java, with a little bit of Ruby, a tiny bit of Scheme, and most recently, due to some iOS development, Objective-C. In my move from Java to Objective-C I've really come to love some features that Objective-C has that Java doesn't. These include support for both static and dynamic typing, functional programming, and closures, which I'm trying to leverage in my code more often. Unfortunately there are trade-offs, including lack of support for generics and (on iOS at least) no garbage collection. These contrasts have lead me to start a search for some of the programming languages that support the following features:   * Object Oriented   * Functional Programming Support   * Closures   * Generics   * Support for both Static and Dynamic Typing   * Module Management to avoid classpath/dll hell   * Garbage Collection Available   * Decent IDE Support Admittedly some of these features(IDE support, Module Management) may not be specific to the language itself, but obviously influence the ease of development in the language. Which languages fit these criteria?


title: Is declaring fields on classes actually harmful in PHP?

text: Consider the following code, in which the setter is deliberately broken due to a mundane programming error that I have made for real a few times in the past:               <?php              class TestClass {                  private $testField;                  function setField($newVal) {                 $testField = $newVal;                 // deliberately broken; should be `$this->testField = $newVal`             }                  function getField() {                 return $this->testField;             }              }              $testInstance = new TestClass();         $testInstance->setField("Hello world!");              // Actually prints nothing; getField() returns null         echo $testInstance->getField();           ?>      The fact that I declared `$testField` at the top of the class helps conceal that programming error from me. If I hadn't declared the field, then I would get something similar to the following warning printed to my error log upon calling this script, which would potentially be valuable to helping my debugging - especially if I were to make an error like this in a large and complicated real-world application: > PHP Notice: Undefined property: TestClass::$testField in /var/www/test.php > on line 13 With the declaration, there is no warning. Perhaps I'm missing something, but I'm aware of only two reasons to declare class fields in PHP: firstly, that the declarations act as documentation, and secondly, that without declarations one can't use the `private` and `protected` access modifiers, which are arguably useful. Since the latter argument doesn't apply to public fields - assigning to an undeclared field of an object makes it public - it seems to me that I ought to at least comment out all my public field declarations. The comments will provide the exact same documentation value, but I will benefit from warnings if I try to read an uninitialized field. On further thought, though, it doesn't seem to make sense to stop there. Since in my experience trying to read an uninitialized field is a much more common cause of error than trying to inappropriately read or modify a private or protected field (I've done the former several times already in my short programming career, but never the latter), it looks to me like commenting out all field declarations - not just public ones - would be best practice. What makes me hesitate is that I've never seen anybody else do it in their code. Why not? Is there a benefit to declaring class fields that I'm not aware of? Or can I modify PHP's configuration in some way to change the behavior of field declarations so that I can use real field declarations and still benefit from "Undefined property" warnings? Or is there anything else at all that I've missed in my analysis?


title: Real time data synchronization techniques between two systems

text: I need to come up with a design for real-time data update from a COTS product (a Point of Sales system) to a custom-built .NET application (an Inventory Management system). Particularly, any sales transaction happening in POS system needs to update the inventory database (present in Inventory Management system) immediately (in real time). The only way any other system can communicate to the POS system is via its API exposed as web services. I have thought about introducing a Service Bus (or any such EAI tool) in between the two systems and taking advantage of the publish-subscribe model so that any sales depletion happening in POS system will trigger data update to the IM system via the service bus. My questions are:   1. Is it a good/feasible solution?   2. Do you have any other suggestions for such real-time data synchronization between different systems?


title: White Boards -- Who Uses Them?

text: So as both a full-time programmer and hobbyist as well (developing my own things for personal use and maybe to sell one day), I feel that me purchasing a big white board to hang in my room at home or something would be very useful. Does anyone here have one as well, to use for high level designs (UML, Architecture, etc.) and things like very early UI mockups, etc.? If you guys do have them, which ones have you bought? I can't seem to pin one that would be good for home use and I'm not sure of the pricing/other things. Thanks!


title: I'm always reimplementing observer/subject code in Java. Is there a better option?

text: I'm always writing observer/subject interfaces in a particular Java project, e.g.:               /**      * Registers the receiver to the dispatcher.       * When data arrives that the receiver can process,       * it will be passed to the receiver.      * ...      */     void addReceiver(IDataReceiver receiver);          /**      * @return      *      True, if the receiver has been registered, false otherwise.      * ...      */     boolean hasReceiver(IDataReceiver receiver);          ...      When a class implements these interfaces, I have to implement the code, test it, debug it, etc. It feels so futile to keep reimplementing such similar logic. Is there _any_ better option in Java?


title: How to hire a web-programmer : for non-programmer

text: I am a non-programmer that has used the services of : freelancer, odesk, etc I've tried asking for what i need but, I can't find anyone who can show me any type of example similar to what I request in the specs for the web- programming. They have front ends and back ends, but they don't fulfill true "live" website requirements. "live" as to be ready to support traffic, keys in hand, can be updated constantly by me, ... How do I figure how to evaluate a programmer ? How do I bid the appropriate price for the services ?


title: Why is the "kill" command called so?

text: Why was it decided to call the `kill` command "kill"? I mean, yes, this utility is often used to terminate processes, but it can actually be used to send any signal. Isn't it slightly confusing? Maybe there are some historical reasons. All I know from `man kill` that this command appeared in Version 3 AT&T UNIX.


title: Open Source Etiquette

text: I've started working on my first open source project on Codeplex and came across some terrible code. (I did learn that C# still has the "goto" statement) I started adding features that the "owner" wanted and after exploring the code base and seeing what a mess it was (e.g using "goto") I wanted to clean it up a bit. But I am a bit concerned and that is why I'm turning to you all: is it proper etiquette for me to "fix" the "bad code" or should I let it be and work on new features? Like I said before, I'm new to the whole OSS scene and working on a team in general so I would like to not mess it up.


title: When should I use AtomPub?

text: I have been conducting some research into RESTful web service design and I've reached what I think is a key decision point so I thought I'd offer it up to the community to get some advice. In keeping with the principles of a RESTful architecture I want to present a discoverable API, so I will be supporting the various HTTP verbs as fully as possible. My difficulty comes with the choice of representation of those resources. You see, it would be easy for me to come up with my own API that covers how search results are to be presented and how links to other resources are provided, but this would be unique to my application. I've read about the Atom Publishing Protocol (RFC 5023), and how OData promotes its use, but it seems to add an extra level of abstraction over what is (currently) a rather simple API. So my question is, when should a developer select AtomPub as their choice of representation - if at all? And if not, what is the current recommended approach?


title: Reasons to Use Version Control

text: > **Possible Duplicate:**   >  I'm a Subversion geek, why I should consider or not consider Mercurial or > Git or any other DVCS?   >  What is the value of using version control? I am a relative noob to programming, and am not going to be developing super- good software or even programming professionally anytime soon. With this predicament, is there really any reason to learn git or subversion or any other version control systems?


title: What is the value of using version control?

text: I'm new to version control (currently using SVN), but I don't understand how this helps developers. What does version control do that makes it useful in a development environment?


title: The use of Test-Driven Development in Non-Greenfield Projects?

text: So here is a question for you, having read some great answers to questions such as "Test-Driven Development - Convince Me". So my question is: **"Can Test-Driven Development be used effectively on non- Greenfield projects?"** To specify: _I would really like to know if people have had experience in using TDD in projects where there was already non-TDD elements present? And the problems that they then faced._


title: MASS equivalent for intel compilers and architectures

text: I was looking for an Intel alternative to MASS IBM libraries (Mathematical Acceleration Subsystem). I know Intel implements MKL libraries, but I d'nt know if there is a specific Math acceleration library in it.


title: How do you get consistency in source code / UI without stifling developer's creativity?

text: We have a small team (2-3) of programmers writing a program with a lot of forms and dialogs. We have a problem where we cannot keep good consistency in what we write, or how we write it. The latest issue I've noted is that we have lots of places where we have a date range, and we use all kinds of wording to indicate this range is it Start/End or From/To or "Between **_ and _** ". The other side of this is that one of the developers might come up with a better way of doing something (like maybe initializing the state of a check box from the settings file). And then we'll have all of the "old" stuff written in the old/poor way, and new stuff written in a better method. I try to be constantly vigilant about the first thing, but it seems like I'm always finding new failures. The second one creates a huge burden if we're going to go back and fix all the old stuff as soon as we come up with a slightly better way of doing something. Either that, or we ignore all old stuff until something is broken, and then we have no clue what the heck the software is doing because its written completely differently than what we write currently. One last thing, if we push the burden of "fix it everywhere now that you've found it" on the developer who comes up with the better solution, its self defeating, because its like great, that's a better way to check for that error, now fix it everywhere in the code. Bosses don't really ever seem to care about the quality of the code, just when we'll be able to release the next version (but that's a different discussion).


title: What is the best way for a top-down procedural programmer to learn OOP?

text: I'm an old school top-down procedure programmer. I started with Turbo Pascal on the DOS environment. Every time I try to learn OOP on my own I stumble. I try and make OOP somehow fit into my top-down mindset. It's very frustrating, I seem to have a mental block. What is the best way for someone like me to learn OOP?


title: How do developers find the time to stay on top of latest technologies?

text: I was a freelance web developer until circa 2004 when I started going down the management route but have decided to try to get back into development again (specifically JavaScript and HTML5 web/mobile web apps) and I really get the impression to be truly good at these and similar fast moving technologies a constant amount of time is required to be set aside to invest in getting better at existing skills in addition to learning new skills. I understand right now since I am getting back into things there is a pretty steep learning curve, but seeing how good many guys are out there - the only way I see of getting up there is putting in a serious amount of time. For those working as fulltime developers, what I am trying to understand is this - on most days, how much time in the office is spent actually grinding out code compared to learning/research. I could easily spend 2-4 hours daily getting on top of the best ways to go about doing things. Do most good developers who are employed full time invest significant hours outside of work sharpening their skills? Or maybe I'm looking at all of this completely wrong?


title: How to guarantee invariants / Inner logic in setter methods

text: According to DDD-principles I use factory-methods to create consistent objects and to ensure that the objects are in the right state. Now I'm in doubt about inner logic of setter methods. I'm tied up with an object, that's similar to the following code snippet, so let's take it as an example:               public class UserCredentials {              private String username;              private UserCredentials() {             super();         }              public static UserCredentials create (final String username) {             String username = username.toUpperCase();             UserCredentials newInstance = new UserCredentials(username);             return newInstance;         }              private UserCredentials(final String username) {             this.username = username;         }              public String getUsername() {             return this.username;         }              public void setUsername(final String username) {             this.username = username;         }              public void checkConsitency() {             ...             isUppercase();             ...         }     }      We do have an invariant: The username of the credentials must always be uppercase. Now I want to make sure, that changing the username doesn't violate the invariant. But how do I guarantee the rule?   1. I do rewrite the setter method and add the conversion logic to the setter. Drawback: Setter contains logic.   2. I rely on clients, that they always provide uppercase username and I will throw consistency exceptions in the case of violation. Drawback: Origin of the wrong usage is hard to discover, moreover its bad practice at all.   3. I remove the setter method and replace it with a domain method like `changeUsername(String username)` that contains the conversion logic. Drawback: external developers may miss the setter method. Because of the statement "username of credential must always be uppercase" I tend to prefer alternative 3. But is there a smarter solution?


title: Entity Framework eager loading/reference data

text: I'm struggling to get my head around how best to eager load entities, and how to assign relationships when creating new entities. I'm using EF5 POCO, by the way. I'm retreiving a large hierarchy of entities from a database, representing chemical analysis results. As a simple example I have an "AnalysisResult" entity with two generated properties that relate it to a "ChemicalElement" entity - `ChemicalElement` and `ChemicalElementId`. Standard stuff so far. I started out by retrieving my AnalysisResults from the database _and_ eager loading the related ChemicalElements using the `.Include` LINQ statement, meaning I could access a result's chemical element simply via `AnalysisResult.ChemicalElement`. This was fine for results loaded from the database, but what if I wanted to create a new AnalysisResult - how would I get the ChemicalElement entity that I wanted to assign to it? As chemical elements never change, I decided to treat them as "reference/lookup data", so I dropped the eager loading, and I now retrieve _all_ ChemicalElements into a separate collection that I can refer to whenever I need. The downside of dropping eager loading is that an AnalysisResult loaded from the database has a null .ChemicalElement property, so I have to use its .ChemicalElementId property to lookup the ChemicalElement entity in my "reference collection". Have I overcomplicated the solution? Should I keep the idea of the ChemicalElement "reference collection" _but also_ eager load them when retrieving existing AnalysisResults? It seems wasteful to (potentially) retrieve them twice - once when I retrieve them all, and again when eager loading during the AnalysisResults retrieval.


title: Best practices for backing out a feature from a QA trunk

text: I have a question regarding source control in a general sense and specific to TFS. Let's say you have a three-tier system (Development branches, QA main trunk and Production branch). At a certain point, the changes from the dev branches are merged to the QA branch and the QA branch is tested. After the initial test, "feature A" is broken and needs to be fixed or removed, how should a feature be updated or removed from the QA branch? Should it be edited directly? or should the developer checks in the changes to dev and let it propagate up to QA again? Any thoughts on this (in general)? Also if this is done in TFS is there any tools that can help out with this situation? thanks!!


title: What is the best way to bring a new programmer up to speed on a project?

text: When you add a programmer to a project with a large code base, what is the best way to get them involved right away? Do you give them formal training in the code base or let them figure it out themselves? What tasks are best to get them up to speed? What kind of tasks are "safe" until they are familiar enough with the project to contribute to it with a full understanding of what they're doing? How do you determine if they've reached a level of full understanding? **Edit** : The project isn't behind a deadline. I work alone and want to add employees soon. I'd like to know how best to familiarize them with the code base.


title: Are programmers good at learning "spoken" languages?

text: This might be slightly off topic, but I'll risk it, as the site is about _Programmers_ ! Programmers are good at constantly learning new programming languages, but how good are they at learning a new spoken language ? Have you taken up a foreign language (French/Spanish/etc) **as an adult** and mastered it? Was it easy? I ask because I have been trying to learn French for quite some time now, and I'm still at the annoying "Je parle un peu de Française" stage. I've attended two French courses, one where the majority of the class were programmers, and one where they weren't and the difference in ability was quite apparent. Does a mathematical / logical inclination hinder learning a spoken language where grammar is not in ones and zeros? Or am I just transferring blame instead of simply accepting that I am not good with languages. _[It is important that you have not been taught the language in school, as early exposure really gives you the upper hand. I've picked up and got quite good at languages I've been exposed to under the age of 10.]_


title: Does comparison operand order affect speed?

text: I notice that someone in my organization programs comparisons like:               if (100 == myVariable)      rather than:               if (myVariable == 100)      He claims the former is quicker in languages like C++. I can't find any evidence. We program in C#. Is this true for any programming language?


title: How can architects work with self-organizing Scrum teams?

text: An organization with a number of agile Scrum teams also has a small group of people appointed as "enterprise architects". The EA group acts as control and gatekeeper for quality and adherence to decisions. This leads to overlaps between the team decision and EA decisions. For instance, the team might want to use library X or want to use REST instead of SOAP, but the EA does not approve of that. Now, this can lead to frustration when team decisions are overruled. Taken far enough, it can potentially lead to a situation where the EA people "grabs" all power and the team ends up feeling demotivated and not very agile at all. The Scrum guides has this to say about it: > Self-organizing: No one (not even the Scrum Master) tells the Development > Team how to turn Product Backlog into Increments of potentially releasable > functionality. Is that reasonable? Should the EA team be disbanded? Should the teams refuse or simply comply?


title: Using work time effectively: How to create code quickly?

text: > **Possible Duplicates:**   >  How can I be more productive at work? (additional context inside)   >  How to code on a very tight schedule? Sometimes we create new code quickly. And sometimes we can't concentrate. Development process has different _thinking stages_. There is a _fast_ stage when we create code as a result of our ideas. And there is a _slow_ stage when we think. And it is important not to be disturbed when _slow_ stage or thinking time may be extended. Do you know another recomendations to use work time effectively? May be good guide?


title: How to code on a very tight schedule?

text: I'm working on a project that has very tight schedule. I don't have much time to code and test (even though I work more than 12 hours everyday, it's still delayed), and the result is very fragile. Its code is also very dilemma. This program is used by all offices in our customer's company, which is located in many countries. I regularly get phone calls at midnight about errors from our user/tester or about them not knowing how to use some features. After three years on this project, I feel very stressed and I can't sleep well because I'm very worried about errors and phone calls. I have a few questions:   1. For three years, all the code I've written is just the perfect usage scenario code (so it break easily). It's poorly designed and doesn't have any unit tests. I have lots of problems because of this fact. Therefore, I want to know whether is it's feasible to write code that works when the project has a very tight schedule?   2. How can I write better code in the same amount of time?   3. How can I clear my mind and don't get worried about work when I go to sleep? I also welcome any suggestions.


title: tracking web traffic with Python

text: I learned of Compete.com and I am interested in how they track web traffic from other websites. I am most interested in doing this with Python but when I Google I can't find snap. Probably my English. Could someone tell me of existing modules that I may look at, and in general how to track web traffic from other sites (what do they look at when tracking)?


title: Should I keep separate client codebases and databases for a software-as-a-service application?

text: My question is about the architecture of my application. I have a Rails application where companies can administrate all things related to their clients. Companies would buy a subscription and their users can access the application online. Hopefully I will get multiple companies subscribing to my application/service. What should I do with my code and database?   1. Seperate app code base and database per company   2. One app code base but seperate database per company   3. One app code base and one database The decision involves security (e.g. a user from company X should not see any data from company Y) performance (let's suppose it becomes successful, it should have a good performance) and scalability (again, if successful, it should have a good performance but also easy for me to handle all the companies, code changes, etc). For the sake of maintainability, I tend to opt for the one code base, but for the database I really don't know. What do you think is the best option?


title: Is it unnecessary to use Github (social coding) even if you are the only one working on a project?

text: I started using Github now that I'm working on a project with some guys. And I started to wonder if I should use it in my personal projects too. I'm not sure if this will help me in some way or if it is unnecesary?


title: Single click handler for all buttons in Javascript? Is it a pattern? Whats the benefit?

text: I have been told that when there are multiple buttons on the page for same purpose but targeting different item e.g. delete item on a grid of items, they say it is recommended to just register for click handler only on the top most element like 'body' and check what was clicked instead of hooking up click with every delete button. Whats the benefit of this? Creating more handlers causes problems? Is it an optimization of some sort? Is it a pattern? Does it have anything to do with performance? Where can I read more about it?


title: GPL: does one line of GPLed code make program a "derived work"

text: I've recently run into some argument with a person that claims to be a lawyer (I have my suspicions about this not being completely true, though). As far as I know, copying even one line of code from GPLed program into proprietary body of code requires you to release the whole thing under GPL, if you ever decide to publish the software and make it available to the public. The person in question claims that it is "absurd" (I know it is, but AFAIK that's how GPL works), it is "redefining the copyright", "GPL has no power to do that", and claiming that "one line of GPLed code makes you release the whole thing under GPL" is absurd. That contradicts the GPL FAQ. Can somebody clarify the situation? Am I right in assumption that copying even smallest subroutine from GPL program into your code automatically makes your program a "derived work" which means you are obliged to release it under GPL license if you publish it?


title: Should the developer be involved in setup of test data in QA and UAT environment?

text: When QA or UAT comes, should the developer still be involved in setting up data or finding test data for the QA tester or business user? Or will this introduce bias to the developer who coded the system changes that are being tested in the said environments?


title: What undergraduate course to choose for a mature programmer returning to study

text: I have been developing applications (mostly web-based) for almost 10 years now and have learnt pretty much everything I know through experience (and the internet!). I wouldn't call myself an advanced programmer, but I am quite proficient in several languages (C#, Javascript, Ruby, HTML/CSS etc) and spend a quite a bit of time working on personal projects and reading countless books & articles. I am looking to emigrate to Canada, hopefully Vancouver (im from the UK) and one way would be on a student visa, if I was going to be studying for a minimum of 2 years. Having never been to university or achieved anything higher than A-Levels I am quite tempted by this path. The thought of learning is more exciting to me now than it was 10 years ago! What would be people recommend as a good undergraduate course to take that would complement this career path? Would Math be beneficial, if so which area of Math? TL;DR What undergraduate course/area of study would complement 10 years of (mostly web-based) programming experience?


title: THREADS: Kernel threads vs. Kernel-supported threads vs. User-level threads?

text: Does anyone know what the difference between these are? It seems to me that kernel threads correspond to the code that runs the kernel (intuitively), but I'm not sure about the other two... Also, would the pthreads standard be considered user-level and kernel- supported, since you are accessing a library while the kernel does all the thread scheduling/switching?


title: What skills should I cultivate to become a development/technical lead?

text: I am currently a professional programmer. I want to expand my skillset, but I also want to make the career jump to being a dev lead as part of a team. I know there's got to be a lot to learn (and this won't be an instant thing) but I think I'm smart enough to do it and I'm up to the challenge. I'm sure that many of the members here have probably gone through this themselves, and are now successful dev leads. Unfortunately, even though I know some personal areas I'd like to improve (depth of knowledge, breadth of knowledge, skillsets, etc), I'm not really sure how I would start something like this. As a programmer now, what steps should I take to get me to this goal? What should I prioritize?


title: Developer to team leader

text: How much experience is considered enough for a developer to become a team leader? For IT managment what is the measure to check if the current team member is good enough to become a team leader (technical level, interpersonal level) * * * updated: removed second part of the question for being duplicate (see comments)


title: What kinds of copyright or privacy issues apply to tweets?

text: If I want to use the data on Twitter in my application, what are the restrictions? What user data should I avoid touching? For example, if I want to collect information from certain type of tweets about users and use this information on my site as profiles for these users in my site, does this require permission from the users first or can I directly go and get the information? Technically, from anyone with a public account on twitter, we can get data of his/her tweets and create profile information for him/her, but does twitter privacy policy allow this? If you published some tweet on Twitter, am I allowed to take that tweet content and put it in my site (stating that it is written by you) but without asking you for permission? I found this in the Twitter Terms of Service: > Tip We encourage and permit broad re-use of Content. The Twitter API exists > to enable this. But also found this on the Twitter API Terms: > You may not use Twitter Content or other data collected from end users of > your Client to create or maintain a separate status update or social network > database or service.


title: Are value converters more trouble than they're worth?

text: I'm working on a WPF application with views that require numerous value conversions. Initially, my philosophy (inspired in part by this lively debate on XAML Disciples) was that I should make the view model strictly about supporting the _data_ requirements of the view. This meant that any value conversions required to turn data into things like visibilities, brushes, sizes, etc. would be handled with value converters and multi-value converters. Conceptually, this seemed quite elegant. The view model and view would both have a distinct purpose and be nicely decoupled. A clear line would be drawn between "data" and "look". Well, after giving this strategy "the old college try", I'm having some doubts whether I want to continue developing this way. I'm actually strongly considering dumping the value converters and placing the responsibility for (almost) all value conversion squarely in the hands of the view model. The reality of using value converters just doesn't seem to be measuring up to the apparent value of cleanly separated concerns. My biggest issue with value converters is that they are tedious to use. You have to create a new class, implement `IValueConverter` or `IMultiValueConverter`, cast the value or values from `object` to the correct type, test for `DependencyProperty.Unset` (at least for multi-value converters), write the conversion logic, ~~register the converter in a resource dictionary~~ [see update below], and finally, hook up the converter using rather verbose XAML (which requires use of magic strings for both the binding(s) ~~and the name of the converter~~ [see update below]). The debugging process is no picnic either, as error messages are often cryptic, especially in Visual Studio's design mode/Expression Blend. This isn't to say that the alternative--making the view model responsible for all value conversion--is an improvement. This could very well be a matter of the grass being greener on the other side. Besides losing the elegant separation of concerns, you have to write a bunch of derived properties and make sure you conscientiously call `RaisePropertyChanged(() => DerivedProperty)` when setting base properties, which could prove to be an unpleasant maintenance issue. The following is an initial list I put together of the pros and cons of allowing view models to handle conversion logic and doing away with value converters:   * Pros:      * Fewer total bindings since multi-converters are eliminated     * Fewer magic strings (binding paths ~~\+ converter resource names~~ _)     * ~~No more registering each converter (plus maintaining this list)~~_     * Less work to write each converter (no implementing interfaces or casting required)     * Can easily inject dependencies to help with conversions (e.g., color tables)     * XAML markup is less verbose and easier to read     * Converter reuse still possible (although some planning is required)     * No mysterious issues with DependencyProperty.Unset (a problem I noticed with multi-value converters) *Strikethroughs indicate benefits that disappear if you use markup extensions (see update below)   * Cons:      * Stronger coupling between view model and view (e.g., properties must deal with concepts like visibility and brushes)     * More total properties to allow direct mapping for every binding in view      * ~~`RaisePropertyChanged` must be called for each derived property~~ (see Update 2 below)     * Must still rely on converters if the conversion is based on a property of a UI element So, as you can probably tell, I have some heartburn about this issue. I'm very hesitant to go down the road of refactoring only to realize that the coding process is just as inefficient and tedious whether I use value converters or expose numerous value conversion properties in my view model. Am I missing any pros/cons? For those who have tried both means of value conversion, which did you find worked better for you and why? Are there any other alternatives? (The disciples mentioned something about type descriptor providers, but I couldn't get a handle on what they were talking about. Any insight on this would be appreciated.) * * * **Update** I found out today that it's possible to use something called a "markup extension" to eliminate the need to register value converters. In fact, it not only eliminates the need to register them, but it actually provides intellisense for selecting a converter when you type `Converter=`. Here is the article that got me started: http://www.wpftutorial.net/ValueConverters.html. The ability to use a markup extension changes the balance somewhat in my pros and cons listing and discussion above (see strikethroughs). As a result of this revelation, I'm experimenting with a hybrid system where I use converters for `BoolToVisibility` and what I call `MatchToVisibility` and the view model for all other conversions. MatchToVisibility is basically a converter that lets me check if the bound value (usually an enum) matches one or more values specified in XAML. Example:               Visibility="{Binding Status, Converter={vc:MatchToVisibility                 IfTrue=Visible, IfFalse=Hidden, Value1=Finished, Value2=Canceled}}"      Basically what this does is check if the status is either Finished or Canceled. If it is, then the visibility gets sets to "Visible". Otherwise, it gets sets to "Hidden". This turned out to be a very common scenario, and having this converter saved me about 15 properties on my view model (plus associated RaisePropertyChanged statements). Note that when you type `Converter={vc:`, "MatchToVisibility" shows up in an intellisense menu. This noticeably reduces the chance of errors and makes using value converters less tedious (you don't have to remember or look up the name of the value converter you want). In case you're curious, I'll paste the code below. One important feature of this implementation of `MatchToVisibility` is that it checks to see if the bound value is an `enum`, and if it is, it checks to make sure `Value1`, `Value2`, etc. are also enums of the same type. This provides a design-time and run-time check of whether any of the enum values are mistyped. To improve this to a compile-time check, you can use the following instead (I typed this by hand so please forgive me if I made any mistakes):               Visibility="{Binding Status, Converter={vc:MatchToVisibility                 IfTrue={x:Type {win:Visibility.Visible}},                 IfFalse={x:Type {win:Visibility.Hidden}},                 Value1={x:Type {enum:Status.Finished}},                 Value2={x:Type {enum:Status.Canceled}}"      While this is safer, it's just too verbose to be worth it for me. I might as well just use a property on the view model if I'm going to do this. Anyway, I'm finding that the design-time check is perfectly adequate for the scenarios I've tried so far. **Here's the code for`MatchToVisibility`**               [ValueConversion(typeof(object), typeof(Visibility))]     public class MatchToVisibility : BaseValueConverter     {         [ConstructorArgument("ifTrue")]         public object IfTrue { get; set; }              [ConstructorArgument("ifFalse")]         public object IfFalse { get; set; }              [ConstructorArgument("value1")]         public object Value1 { get; set; }              [ConstructorArgument("value2")]         public object Value2 { get; set; }              [ConstructorArgument("value3")]         public object Value3 { get; set; }              [ConstructorArgument("value4")]         public object Value4 { get; set; }              [ConstructorArgument("value5")]         public object Value5 { get; set; }              public MatchToVisibility() { }              public MatchToVisibility(             object ifTrue, object ifFalse,             object value1, object value2 = null, object value3 = null,             object value4 = null, object value5 = null)         {             IfTrue = ifTrue;             IfFalse = ifFalse;             Value1 = value1;             Value2 = value2;             Value3 = value3;             Value4 = value4;             Value5 = value5;         }              public override object Convert(             object value, Type targetType, object parameter, CultureInfo culture)         {             var ifTrue = IfTrue.ToString().ToEnum<Visibility>();             var ifFalse = IfFalse.ToString().ToEnum<Visibility>();             var values = new[] { Value1, Value2, Value3, Value4, Value5 };             var valueStrings = values.Cast<string>();             bool isMatch;             if (Enum.IsDefined(value.GetType(), value))             {                 var valueEnums = valueStrings.Select(vs => vs == null ? null : Enum.Parse(value.GetType(), vs));                 isMatch = valueEnums.ToList().Contains(value);             }             else                 isMatch = valueStrings.Contains(value.ToString());             return isMatch ? ifTrue : ifFalse;         }     }      **Here's the code for`BaseValueConverter`**               // this is how the markup extension capability gets wired up     public abstract class BaseValueConverter : MarkupExtension, IValueConverter     {         public override object ProvideValue(IServiceProvider serviceProvider)         {             return this;         }              public abstract object Convert(             object value, Type targetType, object parameter, CultureInfo culture);              public virtual object ConvertBack(             object value, Type targetType, object parameter, CultureInfo culture)         {             throw new NotImplementedException();         }     }      **Here's the ToEnum extension method**               public static TEnum ToEnum<TEnum>(this string text)     {         return (TEnum)Enum.Parse(typeof(TEnum), text);     }      * * * **Update 2** Since I posted this question, I've come across an open-source project that uses "IL weaving" to inject NotifyPropertyChanged code for properties and dependent properties. This makes implementing Josh Smith's vision of the view model as a "value converter on steroids" an absolute breeze. You can just use "Auto-Implemented Properties", and the weaver will do the rest. **Example:** If I enter this code:               public string GivenName { get; set; }     public string FamilyName { get; set; }          public string FullName     {         get         {             return string.Format("{0} {1}", GivenName, FamilyName);         }     }      ...this is what gets compiled:               string givenNames;     public string GivenNames     {         get { return givenName; }         set         {             if (value != givenName)             {                 givenNames = value;                 OnPropertyChanged("GivenName");                 OnPropertyChanged("FullName");             }         }     }          string familyName;     public string FamilyName     {         get { return familyName; }         set          {             if (value != familyName)             {                 familyName = value;                 OnPropertyChanged("FamilyName");                 OnPropertyChanged("FullName");             }         }     }          public string FullName     {         get         {             return string.Format("{0} {1}", GivenName, FamilyName);         }     }      That's a huge savings in the amount of code you have to type, read, scroll past, etc. More importantly, though, it saves you from having to figure out what your dependencies are. You can add new "property gets" like `FullName` without having to painstakingly go up the chain of dependencies to add in `RaisePropertyChanged()` calls. What is this open-source project called? The original version is called "NotifyPropertyWeaver", but the owner (Simon Potter) has since created a platform called "Fody" for hosting a whole series of IL weavers. The equivalent of NotifyPropertyWeaver under this new platform is called PropertyChanged.Fody.   * **Fody setup instructions:** http://code.google.com/p/fody/wiki/SampleUsage (replace "Virtuosity" with "PropertyChanged")   * **PropertyChanged.Fody project site:** http://code.google.com/p/propertychanged/ If you'd prefer to go with NotifyPropertyWeaver (which a little simpler to install, but won't necessarily be updated in the future beyond bug fixes), here is the project site: http://code.google.com/p/notifypropertyweaver/ Either way, these IL weaver solutions completely change the calculus in the debate between view model on steroids vs. value converters.


title: Comparing Visual Foxpro with .NET

text: I used Foxpro 2.6 a decade ago. In my present company, few new projects are being developed in Visual Foxpro 9.0 and few projects are on .NET platform. From time-to-time I notice how Visual Foxpro is more powerful as compared to .NET when comparing dependency issues. Here are some of the advantages of VFP I noticed:   1. There is no hard and fast rule to use another full-fledged RDBMS. Even though the latest version of Visual Foxpro can be connected to SQL Server, but I have seen very large projects still, happily, using the old DBF. With .NET you have to connect to another RDBMS and it just adds to your Setup dependency.   2. Foxpro has built-in rich reporting capability since the time of DOS era, whereas .NET developers have to depend on Crystal Reports, SSRS or other third-party variants.   3. Visual Foxpro 9.0 has .NET capabilities as well. However, it is not dependent on .NET and therefore your final executable doesn't need .NET framework installed, which is again a dependency.   4. I have seen very large databases of Foxpro in few major government organizations, successfully running from a long time. These organizations don't feel a need to shift to SQL Server, not because of migration risks, but because they are happy with VFP. I want to step into VFP world but I read somewhere that Microsoft is stopping further developments of VFP and also stopping support to VFP 9.0 from 2015 onwards. What you guys suggest?


title: Scrum re-estimation of stories

text: Every day, after the stand-up, my team and I update our estimates for each story. I have a feeling that there is something wrong with the way we do it, so I need your help. This is how we do: Story A estimate: 24 hours (8 hours per day - we use "ideal days" as the measure)   * Day N: developer starts working on Story A in the morning (8 hours of work completed by the end of the day)    * Day N+1: Story A re-estimation = 16 hours (one workday taken out of Story A, from day N)   * Day N+2: Story A re-estimation = 8 hours (one workday taken out of Story A, from day N+1)   * Day N+3: Story A should be done by now. But it's not. The developer reckons it will take another 3 hours to finish. We update the story on the whiteboard and burndown accordingly.   * Day N+4: Story A took the whole day to be finished instead of only 3 hours! Now it's done. The difference, 5 hours, is completely unaccounted for in our planning. How should we be daily re-estimating our stories?


title: Javascript - is this a grey area for anyone else?

text: I have a firm understanding of HTML, CSS, PHP, MySQL (and to some extent apache/linux) and find that one of the things missing from my 'web development knowledge base' is javascript - creating richer user interfaces. I'd like to learn Javascript before I look at any frameworks (I've used light javascript/jquery before, but that's besides the point). Can anyone recommend a firm book or online documentation from 'absolute beginner' to 'expert' for javascript? I seem to be finding too many 'display the time' and 'hello world' tutorials...


title: Conceptually speaking, how would I pull facebook wall posts from 100k users?

text: Not looking for any code snippets here, so here goes: Let's say 100,000 users on my web app have authorized my application to connect to facebook (with or without `offline_access`). I want to build a sort of "pull" mechanism, whereby when a user posts to their facebook wall, I can grab it from the Graph API and store it locally on my server. I would assume that this would require a call to the Graph API every _n_ minutes to pull their latest wall posts. Ideally, this would be done for Twitter as well. I know LinkedIn does this, but I am not sure of the exact details. Question 1: I'd need to make an individual Graph API call for each user, right? Question 2: If I suddenly bombard the Graph API with 100k Graph API calls, wouldn't I run head-first into the rate limiter? Question 2b: If not, what if I had a million users? Surely...


title: How should I draw the (special) is predicate, which is used for arithmetic, in a Prolog search tree?

text: I normally construct my search tree by following the common convention:   * Place Queries or Goals in need of unification inside node boxes.   * Write down decision points on the edges, where Prolog has assigned an element to a variable.   * Leaf nodes which are fully satisifed will be an empty box, they represent a solution.   * Leaf nodes which can not be satisifed and represent failed attempts will have the unfulfilled goal in their box, to make them even more clear I also follow the convention of marking them by placeing a cross symbol below them. The above way has the nice side effect that it's easy to see the decision points. But what about creating a search tree for something like:               accLen([_|T],A,L)  :-    Anew  is  A+1,  accLen(T,Anew,L).     accLen([],A,A).       How should the assignment of Anew be represented in the search tree? It's not a decision point, the code has no other option then assigning it 1 plus the current value of A. Do you still place it on the edge, but underline it or something?


title: How can we calculate Big-O complexity in Functional & Reactive Programming

text: I started learning functional programming, I am trying to compare between different algorithms that are written in an imperative, functional , parallel programming and using Collections and Lambda expressions. In order to make my question clear and avoid sharing long algorithms that I am working on. I will take as an example the well-known modified Fibonacci algorithm (Euler Problem 2): Here is the problem : http://projecteuler.net/problem=2               //Iterative way:           int result=2;     int first=1;     int second=2;     int i=2;          while (i < 4000000)     {         i = first + second;              if (i % 2 == 0)         {            result += i;         }              first = second;         second = i;      }           Console.WriteLine(result);          // Recursive functional way:      FibonacciTerms(1, 2).TakeWhile(x => (x <= 4000000) )     private static int SumEvenFibonarciTerms()     {         return FibonacciTerms(1, 2)                 .TakeWhile(x => (x <= 4000000)).Where(x => x % 2 == 0)                 .Sum();     }          //Asynchrounous way      let rec fib x = if x <= 2 then 1 else fib(x-1) + fib(x-2)          let fibs =         Async.Parallel [ for i in 0..40 -> async { return fib(i) } ]         |> Async.RunSynchronously      How can I calculate the Big-O in algorithms that are written using Lamda expression (Complexity of functions like: filter, where, reduceleft, reducright, .. ) In the functional and Asynchrounous algo, the both are written in the same way ? Should we consider their complexity the same knowing that there is difference in the time of execution ?


title: How to get requirements from Non-technical client?

text: I’ve working as a software engineer for last 4 years. Throughout my small experience I worked for IT organizations, where we had separate role of project manager, analyst, quality engineer and software engineers and many more. Also we applied complex agile process working in large/small team. I personally participated on every step of software developer life cycle. Few months before I got good opportunity on a co-operate company and I’m serving right now. I’m assigned few internal projects which are company goals. The problem is, I’m spending most of the time in getting requirements and my boss is not willing to give me input. He is giving me full blame that I did not deliver the tasks. I’m unable to explain that without requirements I can’t work and even I can’t commit any deadline. He uses to say me often that please make my dreams come true. How can I get this divine requirement? It took around 1 month just to give me rights on my machine to install IDE and internet connection. In short, they did not give me any requirements or documents, the targets are still unclear and also team is not contributing. I’m not trying to leave this company, I’m consider it as a challenge to get things right. As a programmer, how can I handle this issue?


title: From Imperative to Functional Programming

text: As an Electronic Engineer, my programming experience started with Assembly and continue with PL/M, C, C++, Delphi, Java, C# among others (imperative programming is in my blood). I'm interested in add to my previous knowledge, skills about functional programming, but all I've seen until now seems very obfuscated and esoteric. Can you please answer me these questions? 1) What is the mainstream functional programming language today (I don't want to get lost myself studying a plethora of FP languages, just because language X has the feature Y)? 2) What was the first FP language (the Fortran of functional programming if you want)? 3) Finally, when talking about pure vs. non pure FP what are the mainstream languages of each category? Thank you in advance


title: schedule compliance and keeping technical supports and resolving issues

text: I am an entrepreneur of a small software developer company. The flagship product is developed by myself and my company grew up to 14 people. One of pride is that we've never have to be invested or loaned. The core development team is 5 people. 3 are seniors and 2 are juniors. After the first release, we've received many issues from our customers. Most of them are bug issues, customization needs, usage questions and upgrade requests. The issues from customers are incoming many times everyday, so it takes little time or much time of our developers. Because of our product is a software development kit(SDK) so most of questions can be answered only from our developers. And, for resolving bug issues, developers must be involved. Estimating time to resolve bug is hard. I fully understand it. However, our developers insist they cannot set the any due date of each project because they are busy doing technical supports and bug fixes by issues from customers everyday. Of course, they never do overwork. I suggested them an idea to divide the team into two parts: one for focusing on development by milestones, other for doing technical supports and bug fixes without setting due days. Then we could announce release plan officially. After the finish of release, two parts exchange the role for next milestone. However, they say they "NO, because it is impossible to share knowledge and design document fully." They still say they cannot set the release date and they request me to alter the due date flexibly. They does not fix the due date of each milestone. Fortunately, our company is not loaned and invested so we are not chocked. But I think it is bad idea to keep this situation. I know the story of ant and grasshopper. Our customers are tired of waiting forever of our release date. Companies consume limited time and money. If flexible due date without limit could be acceptable, could they accept flexible salary day? What is the root cause of our problem? All that I want is to fix and achieve precisely due date of each milestone without losing frequent technical supports. I think there must be solution for this situation. Please answer me. Thanks in advance. PS. Our tools and ways of project management are Trello, Mantis-like issue tracker, shared calendar software and scrum(collected cards into series of 'small and high completeness' projects).


title: Should I Use WCF For My Purpose?

text: I wrote two programs that server and client can connect to each other (one program for server and another for client) with their IP addresses (socket programming). Now I want to modify it so that if the client or server for example wrote something in `textbox` other user be notify of that. My programs are Windows Form Application. For this purpose, should I use WCF?


title: is Java free for mobile development?

text: Q1. I would like to know if it's free for a developer (I mean, if I have to pay no royalties to Sun/Oracle) to develop (Android) mobile apps in Java? After reading this snippet about use of Java field, I'm getting the impression that Java is **not** free for mobile development, is that right? > .."General Purpose Desktop Computers and Servers" means computers, including > desktop and laptop computers, or servers, used for general computing > functions under end user control (such as but not specifically limited to > email, general purpose Internet browsing, and office suite productivity > tools). The use of Software in systems and solutions that provide dedicated > functionality (other than as mentioned above) or designed for use in > embedded or function-specific software applications, for example but not > limited to: Software embedded in or bundled with industrial control systems, > **wireless mobile telephones, wireless handheld devices,** netbooks, kiosks, > TV/STB, Blu-ray Disc devices, telematics and network control switching > equipment, printers and storage management systems, and other related > systems are excluded from this definition and not licensed under this > Agreement... and from http://www.excelsiorjet.com/embedded/ > Notice : The Java SE Embedded technology license currently prohibits the use > of Java SE in cell phones. Q2. how come these plethora of Android Java developers aren't paying Sun/Oracle a dime?


title: Your experience with haxe and other languages that compile to PHP?

text: I would like to hear opinions from people who have used a language that compiles to php. One such language I know is Haxe. Other ones I've read about are Kira and Pharen. How well do these languages integrate with PHP? Is it relatively easy to write a plug-in for a PHP CMS in them? How mature are their implementations and tools? Would you recommend them to someone who has to use a php cms but hates php?


title: How to store currency ranges in a Postgres table?

text: I am using Postgres 9.3. I have to store range data like `<$250K, $250K-$4M,` etc which we will display in a dropdown. now I am making a table for all possible options that can be configured from an admin interface. Should I take separate column for min,max,currency_type(dollar,euro) and a column to store K,M etc or there is a better way to do that ?


title: Is saving SQL statements in a table for executing later a bad idea?

text: Is saving SQL statements in a MySQL table for executing later a bad idea? The SQL statements will be ready for execution, i.e. there will be no parameters to swap or anything, for example `DELETE FROM users WHERE id=1`. I guess I'm being lazy, but I thought of this idea because I'm working on a project that will require quite a few cron jobs that will execute SQL statements periodically.


title: How big sites scale up and optimize to massive traffic?

text: How do sites like Facebook and Twitter optimize their sites for massive traffic. Aside from spending big bucks on getting the best servers, what can be optimized in your code to accommodate massive traffic? I've read about caching your pages to static HTML, but that's impractical for social networking sites where the pages are constantly updated.


title: Why Was Python Written with the GIL?

text: The global interpreter lock (GIL) seems to be often cited as a major reason why threading and the like is a touch tricky in Python - which raises the question "Why was that done in the first place?" Being Not A Programmer, I've got no clue why that might be - what was the logic behind putting in the GIL?


title: Reflective discovery of an inner class in an API

text: Let me ask you, as this bothers me for quite a while but appears to be subjectively the best solution for my problem, **if reflective discovery of an inner class for API purposes is that bad idea**? First, let me explain what I mean by saying "reflective discovery" and all that stuff. I am sketching an API for a Java database system, that'll be centered around block-based entities (don't ask me what that means - that's a long story), and those _entities_ can be read and returned to the Java code as objects subclassed from the `Entity` class. I have an `Entity.Factory` class, that, by means of fluent interfaces, takes a `Class<? extends Entity>` argument and then, uses an instance of `Section.Builder`, `Property.Builder`, or whatever builder the entity has, to put it into the back-end storage. The idea about registering all entity types and their builders just doesn't appeal to me, so I thought that the closest solution to the problem that'd suffice my design needs would be to discover, using reflection, all inner classes of `Entity` classes and find one that's called `Builder`. Looking for some expert insight :) And if I missed some important design details (which could happen as I tried to make this question as concise as possible), just tell me and I'll add them.


title: Is it considered poor practice to include a bug number in a method name for a temporary workaround?

text: My coworker who is a senior guy is blocking me on a code review because he wants me to name a method 'PerformSqlClient216147Workaround' because it's a workaround for some defect ###. Now, my method name proposal is something like PerformRightExpressionCast which tends to describe what the method actually does. His arguments go along the line of: "Well this method is used only as a workaround for this case, and nowhere else." Would including the bug number inside of the method name for a temporary workaround be considered bad practice?


title: Social networking sites static caching

text: In sites like facebook or orkut or friendster what's displayed at the bottom instead of main web address like static.ak.fbcdn.net or profile.ak.fbcdn.net? Are these different servers or they are just used to misguide the hackers?


title: Allocating memory inside a function and returning it back

text: I want to pass a pointer to my function and allocate the memory to which this pointer points. I've read in other posts that I should pass a double pointer to this function and I did so, but I keep getting segmentation fault:               #include <iostream>     #include <stdlib.h>          using namespace std;          void allocate(unsigned char** t)     {         *t=(unsigned char*)malloc(3*sizeof(unsigned char));         if(*t == NULL)             cout<<"Allcoation failed"<<endl;         else             for(int m=0;m<3;m++)                 *(t[m])=0;     }          int main()     {         unsigned char* t;         allocate(&t);          cout<<t[0]<<" "<<t[1]<<endl;         return 0;     }      the result is always this: Segmentation fault (core dumped) I don't think that there's anything missing from this code. What could be wrong?


title: Who should participate in time estimation?

text: In an IT project:   1. Who should **participate** in time estimation? Developer, team leader, scrum master and etc?   2. Whose **vote** should be counted most?


title: Does Working (Java,DotNet etc) Technology determine long term growth?

text: I have learned Java, .NET, etc and now in iPhone development in my studies and work and I could make myself flexible in any domain I work with. But as I am a fresher as an iPhone developer, I can't predict my future about my long term growth in the software industry. Does one's working technology determine long term growth?


title: Responding or Maintaining Emails - best practice

text: I would like to hear how you manage your emails when you get lot of emails on a day basis. Here some of the things that I follow,   1. Read emails and respond for 2 hours once. I will not disturb my work for intermediate emails unless until I got the email with high priority status.   2. Even I responded the emails, I maintain the incomplete tasks in a separate folder with follow-up tag and set reminder. I could do the proper follow up.   3. Usually archiving emails every month and take a backup of them in DVD. Email size quota issue can be avoided. As well as it wont take much time to configure if you have less number of emails in your server if you have to move to the another machine/laptop.   4. Created a rule to categorize the emails based on the To address and give more attention to the emails if it is directly addressed to me only. Some of them above are not relevant or not needed for everyone. however, i feel that this is an important thing in management to have a smooth communication with higher/subordinate in any organization.


title: who should move the sprint status to complete in agile scrum model

text: we ask the developers themselves to close the sprint once they completed the sprint. Just want to confirm, if it has to be closed by TL after he reviewed the tasks completion.


title: POST and PUT requests – is it just the convention?

text: I've read quite a few articles on the difference between POST and PUT and in when the two should be used. But there are still few things confusing me ( hopefully questions will make some sense ): **1)** We should use PUT to _create resources_ when we want clients to specify the URI of the _newly created resources_ and we should use POST to create resources when we let service generate the URI of the _newly created resources_. **a)** Is it just by convention that _POST create request_ doesn't contain an URI of the _newly created resource_ or _POST create request_ actually can't contain the URI of the _newly created resource_? **b)** PUT has idempotent semantics and thus can be safely used for **absolute updates** ( ie we send _entire state of the resource_ to the server ), but not also for **relative updates** ( ie we send just _changes to the resource state_ ), since that would violate its semantics. But I assume it's still possible for PUT to send **relative updates** to the server, it's just that in that case the _PUT update_ won't be idempotent? **2)** I've read somewhere that we should " _use POST to append a resource to a collection identified by a service-generated URI_ ". **a)** What exactly does that mean? That if URIs for the resources were generated by a server ( thus the resources were created via POST ), then ALL _subsequent resources_ should also be created via POST? Thus, in such situation no resource should be created via PUT? **b)** If my assumption under **a)** is correct, could you elaborate why we shouldn't create some resources via POST and some via PUT ( assuming server already contains a collection of resources created via POST )? **REPLY:** **1)** Please correct me if I'm wrong, but from your post and from the link you've posted, it seems: **a)** The Request-URI in POST is interpreted by server as the _URI of the service_. Thus, it could just as easily be interpreted as _an URI of a newly created resource_ , if server code was written to recognize Request-URI as such **b)** Similarly, PUT is able to send **relative updates** , it's just that service code is usually written such that it will complain if _PUT updates are relative_. **2)** > Usually, create has fallen into the POST camp, because of the idea of > "appending to a collection." It's become the way to append a resource to a > list of resources. I don't quite understand the reasoning behind the idea of " _appending to a collection_ " and why this idea prefers POST for create. Namely, if we _create 10 resources via PUT_ , then server will contain a _collection of 10 resources_ and if we then create another resource, then server will append this resource to that collection ( which will now contain _11 resources_ )?! Uh, this is kinda confusing thank you


title: The usual metadata objects or: How to move a typical ExtJS App to jQuery, and: What's missing in the middle?

text: I have entered into an existing project that is all about maintaining nested data structures. You have companies which are assigend to accounts, and contacts and notes and... basically the usual bunch of 1:1, 1..n, n:m Database relations, stored in mysql or postgres, wrapped by Doctrine. Of course, every node comes with the usual set of metadata, that needs validation in terms of type (number, text, ...) and semantically (email, url, 'enums' like status, type, currency). More specifically what I stepped into I would describe (also from previous experience) as typical ExtJS hell. **Does this sound familiar to anyone?**   * a typical single URL-Application: No history, no meaningful specific bookmarks, oh and dare you pressing the back button...   * tabbed browsing is impossible (the not so rare use case of looking at Customer A, while entering something meaningful into Account or Customer B side-by-side)   * you have that typical navigation tree on the left, the stuff on the right is called in by Ajax. Data, but also a lot of executable java code.   * a strong "MS Office feel": CSS sprites are far, far way, simple pullDowns and multiple-Choice buttons need effort to be 'dressed down' to be usable.   * Not to mention all the clobbered div-s as opossed to few clean, semantically meaningful tags   * a hell of javascript (some of it quite akwardly created in PHP) to suit hard-to-debug controllers and stores and plenty of redundant code, to ensure the same thing over and over again for the various data fields.Sure, there is OOP class hierarchy for those Ext.[ux.]grids and windows, but of limited help. From previous experience I would LOVE to switch this to a straight REST-ful API, stuff is actually done between page request, the URl gives it to you just as it should look:               foo.com/accounts/16324/contact/create     foo.com/customer/search/state=California      And make the whole think jQuery-based, where I gain more control. That brings me to my general question: **Do I miss a middle layer?** Trouble: I wonder, how to fill certain gaps (that other 'Converts' are likely to encounter, too, hence I dare to ask such broad question):   1. _what plugins would be good for (editable) tables? Including resizable, sortable comments? I know about jQueryUI and jQueryTools but I don't think that alone fits the bill. I need a really good table/grid think, probably with backend routines that fit._   2. *Generally speaking, I feel, that I miss a middle layer between ORM and UI if I tinker with data structures, can I bring some automatism like "Here's my data structure, including types and validation rules, (oh, and the exisiting/default data) now build the form from it" Since this might vary from customer to customer, is another reason to not complete hardcode this to much. Also the Ext-JS-ish store functionaliy of only sending back fields that truly changed would be worthwhile. As is recognizing dirty-ness (aka the need to confirm 'save/cancel' on dialog closing).*   1. **Very** valuable would be generic mechanisms of "tentativene sub-Dialogs", e.g. Windows Screensaver do: So going into a Menu, from there to a submenu, saying ok on sub-dialog, then cancel on main ==> cancels the whole thing, nothing stored. In other words: Storing a few hierarchical data sets flexibly in the Session would be good. And pushing them into the DB (by repetive, generic means) when I got the actual "OK". Any good pointers for me the table-editing part in the frontend and/or the data-structure middle part? Thank you, Danke, Merci, Mille grazie, Xie xie! Fronker


title: certified scrum master

text: hello Im learning about Scrum, and noticed that there is a certified scrum master course is this worth it? or can I learn all of that from books and online, to implement in my work? thanks!!


title: Infinite loop with a singleton - does this type of issue have a name?

text: I ran into an unusual error while working on my project. To better learn from and remember it, I'd like to know if this type of error has a name or some definition. (The error itself `OutOfMemoryError` isn't unusual, I'm talking about what lead to this error). My (simplified) situation was this: I had a class `Singleton`:               class Singleton extends ClassA{         private static Singleton instance;              private Singleton(){ // implicitly calls super() }              public static Singleton getInstance(){             if (instance==null) instance = new Singleton();             return instance;         }     }      And it's superclass `ClassA`:               abstract class ClassA{         public ClassA(){             ClassB objectB = new ClassB();             // .. some logic ..         }     }      And a class `ClassB` that uses `Singleton` in it's constructor:               class ClassB{         public ClassB(){             Singleton singleton = Singleton.getInstance();             // .. some logic ..         }     }      What happens is the following: 1- `ClassB` is instantiated somewhere. It's constructor is invoked and calls `Singleton.getInstance()`. 2- `Singleton.getInstance()` sees that `instance == null` and executes `instance = new Singleton()`. 3- The constructor of `Singleton` is run. It's empty, but it implicitly calls the superclass' (`ClassA`) constructor. 4- The superclass of `Singleton` instantiates a `ClassB` object `new ClassB()`. 5- `ClassB`'s constructor is invoked and calls `Singleton.getInstance()`... Since the instantiation of `instance` in `Singleton` never reached it's finish, `instance == null` still returns `true`, and the cycle never ends. Resulting in an infinite loop, that finally resulted in an `OutOfMemoryError`. So my question is: **is this kind of infinite-loop-with-singletons error a common issue?** **Any ideas how I can avoid it in the future?**


title: I code rarely. Is this a bad sign?

text: I am a computer science student and learning Java now a days. I want to be a good developer/programmer. I like reading books. I search on the internet for the related topics and study them. I refer to StackOverflow and other good programming websites daily but I code rarely. Is this a bad sign? If yes then what should I do to overcome this problem?


title: Can't I just use all static methods?

text: What's the difference between the two UpdateSubject methods below? I felt using static methods is better if you just want to operate on the entities. In which situations should I go with non-static methods?               public class Subject     {         public int Id {get; set;}         public string Name { get; set; }              public static bool UpdateSubject(Subject subject)         {             //Do something and return result             return true;         }         public bool UpdateSubject()         {             //Do something on 'this' and return result             return true;         }     }      I know I will be getting many kicks from the community for this really annoying question but I could not stop myself asking it. Does this become impractical when dealing with inheritance? Update:   Its happening at our work place now. We are working on a 6 month asp.net web application with 5 developers. Our architect decided we use all static methods for all APIs. His reasoning being static methods are light weight and it benefits web applications by keeping server load down.


title: What are the advantages/disadvantages of using objects as parameters to other object methods?

text: I'm mostly thinking of PHP here, but if you want to refer to other languages that's fine. An object has a method that requires data contained in another class of object. Should I extract that data from the other object into a variable and then send just that data to the requesting object? Or should I pass the entire data-containing object into the data-requiring object, and then have the requesting object perform the data extraction operations? I'm asking because I'm working on a big project that I've written 100% of the code for, and some of my early code takes string or numeric arguments, but my later code seems to be leaning toward passing around objects. As I bump into some old code, I'm wondering if I should convert it to object parameters.


title: Languages with a clear distinction between subroutines that are purely functional, mutating, state-changing, etc?

text: Lately I've become more and more frustrated that in most modern programming languages I've worked with (C/C++, C#, F#, Ruby, Python, JS and more) there is very little, if any, language support for determining what a subroutine will actually do. Consider the following simple pseudo-code:               var x = DoSomethingWith(y);      How do I determine what the call to _DoSomethingWith(y)_ will actually do? Will it mutate _y_ , or will it return a copy of _y_? Does it depend on global or local state, or is it only dependent on _y_? Will it change the global or local state? How does closure affect the outcome of the call? In all languages I've encountered, almost none of these questions can be answered by merely looking at the signature of the subroutine, and there is almost never any compile-time or run-time support either. Usually, the only way is to put your trust in the author of the API, and hope that the documentation and/or naming conventions reveal what the subroutine will actually do. **My question is this:** Does there exist any languages today that make symbolic distinctions between these types of scenarios, and places compile- time constraints on what code you can actually write? (There is of course _some_ support for this in most modern languages, such as different levels of scope and closure, the separation between static and instance code, lambda functions, et cetera. But too often these seem to come into conflict with each other. For instance, a lambda function will usually either be purely functional, and simply return a value based on input parameters, or mutate the input parameters in some way. But it is usually possible to access static variables from a lambda function, which in turn can give you access to instance variables, and then it all breaks apart.)


title: What do you do to estimates for agile stories where developers are pair programming?

text: If it was a 2-point story for one person, would you double it if people are pairing? Pairing isn't always necessarily done 100% of a dev task, so it seems that doubling the story points seems wrong. And it might not be obvious how much of the task will require pairing until the end, so you wouldn't know what the points the story should be until you've finished - and it seems strange to change an estimate midway through a sprint. However, if velocity is going to be an accurate representation of how much work we can get through during a sprint, it seems right to change the estimates if more than one person is working on a task. But also, this seems like it adds a lot of admin overhead. Thoughts?


title: If someone offers you an unverified statement regarding software development practices, do you respond with "citation needed"?

text: Recently I attended a lecture given by Greg Wilson (Chief Scientist of Software Carpentry). From the abstract: > The idea that claims about software development practices should be based on > evidence is still foreign to software developers, but this is finally > starting to change: any academic who claims that a particular tool or > practice makes software development faster, cheaper, or more reliable is now > expected to back up that claim with some sort of empirical study. Overall, the lecture was very informative and left me thinking quite deeply about my approach to development. In particular, I now find myself looking for citations to back up a lot of statements. Previously, I had slipped into the habit of simply repeating offered truths, with perhaps a mental note to go check up on it later. Putting it bluntly, **I was being gullible**. Here's an example taken from the lecture: > "If more than 25% of the code needs refactoring, it's quicker to rewrite > it". Sounds plausible, but is it true? Where's the study backing this up? Is it true for all languages? And so on. OK, it's quite possible to take this to an extreme and not believe anything by anyone unless you have derived it yourself from first principles. That way lies madness (or maybe mathematics ;-) ). But, if someone comes up to you with a statement along the lines of "Hey, by doing this in [pick language of moment] we'll be able to boost productivity by [pick multiple of 10]%" are you inclined to just accept it, or are you going to ask for proven evidence? If it's the latter (and I hope it is) then   1. where would you go to find this evidence?    2. how stringent would you be? In short, if someone offers you an unverified statement, will you respond with "citation needed"?


title: How to implement a message queue over Redis?

text: ### Why Redis for queuing? I'm under the impression that Redis can make a good candidate for implementing a queueing system. Up until this point we've been using our MySQL database with polling, or RabbitMQ. With RabbitMQ we've had many problems - the client libraries are very poor and buggy and we'd like not to invest too many developer-hours into fixing them, a few problems with the server management console, etc. And, for the time being at least, we're not grasping for milliseconds or seriously pushing performance, so as long as a system has an architecture that supports a queue intelligently we are probably in good shape. Okay, so that's the background. Essentially I have a very classic, simple queue model - several producers producing work and several consumers consuming work, and both producers and consumers need to be able to scale intelligently. It turns out a naive `PUBSUB` doesn't work, since I don't want _all_ subscribers to consume work, I just want _one_ subscriber to receive the work. At first pass, it looks to me like `BRPOPLPUSH` is an intelligent design. ### Can we use BRPOPLPUSH? The basic design with `BRPOPLPUSH` is you have one work queue and a progress queue. When a consumer receives work it atomically pushes the item into the progress queue, and when it completes the work it `LREM`'s it. This prevents blackholing of work if clients die and makes monitoring pretty effortless - for instance we can tell if there is a problem causing consumers to take a long time to perform tasks, in addition to telling if there is a large volume of tasks. It ensures   * work is delivered to exactly one consumer   * work winds up in a progress queue, so it can't blackhole if a consumer ### The drawbacks   * It seems rather strange to me that the best design I've found doesn't actually use `PUBSUB` since this seems to be what most blog posts about queuing over Redis focus on. So I feel like I'm missing something obvious. The only way I see to use `PUBSUB` without consuming tasks twice is to simply push a notification that work has arrived, which consumers can then non-blocking-ly `RPOPLPUSH`.    * It's impossible to request more than one work item at a time, which seems to be a performance problem. Not a huge one for our situation, but it rather obviously says this operation was not designed for high throughput or this situation   * In short: _am I missing anything stupid?_ Also adding node.js tag, because that's the language I'm mostly dealing with. Node may offer some simplifications in implementing, given its single-threaded and nonblocking nature, but furthermore I'm using the node-redis library and solutions should or can be sensitive to its strengths and weaknesses as well.


title: Framework for Everything - Where to begin? [Longer post]

text: Back story of this question, feel free to skip down for the specific question * * * Hello, I've been very interested in the idea of abstract programming the last few years. I've made about 30 attempts at creating a piece of software that is capable of almost anything you throw at it. I've undertook some attempts at this that have taken upwards of a year, while getting close, never releasing it beyond my compiler. This has been something I've always tried wrapping my head around, and something is always missing. With the title, I'm sure you're assuming, "Yes of course you noob! You can't account for everything!" To which I have to reply, "Why not?" To give you some background into what I'm talking about, this all started with doing maybe a shade of gray hat SEO software. I found myself constantly having to create similar, but slightly different sets of code. I've gone through as many iterations of way to communicate on http as the universe has particles. "How many times am I going to have to write this multi-threaded class?" is something I found myself asking a lot. Sure, I could create a class library, and just work with that, but I always felt I could optimize what I had, which often was a large undertaking and typically involved frequent use of the CRTL+A keyboard shortcut, mixed with the delete button. It dawned on me that it was time to invest in a plugin system. This would allow me to simply add snippets of code. as time went on, and I could subversion stuff out, and distribute small chunks of code, rather than something that encompasses only a specific function or design. This comes with its own complexity, of course, and by the time I had finished the software scope for this addition, it hit me that I would want to add to everything in the software, not just a new http method, or automation code for a specific website. Great, we're getting more abstract. However, the software that I have in my mind comes down to a quite a few questions regarding its execution. I have to have some parameters to what I am going to do. After writing what the perfect software would do in my mind, I came up with this as a list of requirements:   * Should be able to use networking   * A "Macro" or "Expression system" which would allow people to do something like : =First(=ParseToList(=GetUrl("http://www.google.com?q=helloworld!"), Template.Google))   * Multithreaded   * Able to add UI elements through some type of XML -- People can make their own addons etc.   * Can use third party API through the plugins, such as Microsoft CRM, Exchange, etc. This would allow the software to essentially be used for everything. Really, any task you wish to automate, in a simple way. Making the UI was as also extremely hard. How do you do all of this? Its very difficult. * * * So my question: With so many attempts at this, I'm out of ideas how to successfully complete this. I have a very specific idea in my mind, but I keep failing to execute it. I'm a self taught programmer. I've been doing it for years, and work professionally in it, but I've never encountered something that would be as complex and in-depth as a system which essentially does everything. Where would you start? What are the best practices for design? How can I avoid constantly having to go back and optimize my software. What can I do to generalize this and draw everything out to completion. These are things I struggle with. P.s., I'm using c# as my main language. I feel like in this example, I might be hitting the outer limit of the language, although, I don't know if that is the case, or if I'm just a bad programmer. Thanks for your time.


title: Do other developers feel that as they get better, it becomes harder to get jobs?

text: When I was starting out, it seemed I had a much better time getting interviews and passing them. But now that I'm more experienced, I'm finding that its harder and harder to find a job. Do other developers out there feel the same way? I'll give you an example. I did an interview last Wednesday. It was a small start-up with only one other engineer and the CEO. They flew me in from Ohio (they are SF based). When I got there, they had me write them a link shortener, which took me about 10 minutes to write. I was supposed to be there all day working on this. When I finished it early, the interviewer seemed kind of shocked. After that, we were talking, and I asked him what they use to store data. He told me Mongo. I ask why he decided to use mongo. He then stammered and mumbled his answer, which basically boiled down to "We're using it because Mongo is a the trendy database technology and we don't want to be left out", which I've found is pretty much most common reason people use NoSQL these days. The interviewer quickly ended the interview and pretty much shoved me out the door. I was supposed to have lunch with the CEO, but I he kicked me out before I had a chance. The intervier wasn't mean or rude, (and neither was I). After I got back to Ohio, I got an email from them saying "I wasn't a fit". This sot of thing happens to me all the time. I'm starting to think "not a fit" can sometimes mean "are too high of a skill level that we are". Is this all in my head, or do other experienced developers notice the same thing happening? Back when I used to struggle with coding problems, I would work with the interviewer and it would be a positive thing and I'd get hired. But now I usually blow through the coding part, and the interviewer being left speechless is working against me. Should I feign struggling with coding problems?


title: IS a command-line (Console) is important to learn for ASP.NET developer?

text: I saw many RoR developers use command line to interact with interfaces and to deploy their web applications. Is that necessary step to earn for asp.net developer?


title: Are first-class functions a substitute for the Strategy pattern?

text: The Strategy design pattern is often regarded as a substitute for first-class functions in languages that lack them. So for example say you wanted to pass functionality into an object. In Java you'd have to pass in the object another object which encapsulates the desired behavior. In a language such as Ruby, you'd just pass the functionality itself in the form of an anonymous function. However I was thinking about it and decided that maybe Strategy offers more than a plain anonymous function does. This is because an object can hold state that exists independently of the period when it's method runs. However an anonymous function by itself can only hold state that ceases to exist the moment the function finishes execution. In an object-oriented language that supports first-class functions, does the strategy pattern have any advantage over using functions?


title: Measures of Javascript engine performances over time?

text: Since the beginning of the Javascript race -- which I would situate around Google Chrome launch in 2008 -- the improvement in the Javascript engine performances have been impressive. The web is crowded with comparisons such as "Firefox V3.42.7 vs. Safari 3.0-prealpha2", and the winner of those comparisons changes every few months and differs on each benchmark. But the big picture, independently of who got their new version out last, is that the average speed of current up-to-date browsers has improved a lot over the last years. Yet this long-term improvement is difficult to quantify:   * people usually compare the last version of each browser, and not different versions of one browser   * announced performance improvements do not generally pile up: when someone announce V3 twice as fast as V2, and later V4 twice as fast as V3, this does not mean that V3 is fourth times as fast as V1, because they usually mean "in a favorable case", and the favorable case in the V3-4 transition are not necessarily the same as in the V2-3 transition   * benchmarks themselves evolve over time; what is referred as "the Sunspider test" today is not the same as in 2008, so we cannot compare raw scores over time. Does anyone know of a valuable measurement of javascript engines performance improvement over the last few years?


title: Cross-platform desktop programming: C++ vs. Python

text: Alright, to start off, I have experience as an amateur Obj-C/Cocoa and Ruby w/Rails programmer. These are great, but they aren't really helpful for writing cross-platform applications (hopefully GNUStep will one day be complete enough for the first to be multi platform, but that day is not today). C++, from what I can gather, is extremely powerful but also a huge, ugly behemoth that can take half a decade or more to master. I've also read that you can very easily not only shoot yourself in the foot, but blow your entire leg off with it since memory management is all manual. Obviously, this is all quite intimidating. Is it correct? Python seems to provide most of the power of C++ and is much easier to pick up at the cost of speed. How big is this sacrifice? Is it meaningful or can it be ignored? Which will have me writing fast, stable, highly reliable applications in a reasonable amount of time? Also, is it better to use Qt for your UI or instead maintain separate, native front ends for each platform? EDIT: For extra clarity, there are two types applications I want to write: one is an extremely friendly and convenient database frontend and the other, which no doubt will come much later on, is a 3D world editor.


title: What are pros and cons of using temporary "references"?

text: In C and C++ (and I guess other languages that allow taking a "reference" to an array element or something similar), when you have an array like type, accessing individual elements of such an array can be done "directly" or via a temporary reference or pointer. Example:               // Like this:     for(int i=0; i<n; ++i) {        theArray[i].frobnicate();        theArray[i].shrub();        if(i % 2) {           theArray[i].modulize();        }     }          // Or like this:     for(int i=0; i<n; ++i) {        TheType& elem = theArray[i];        elem.frobnicate();        elem.shrub();        if(i % 2) {           elem.modulize();        }     }      Obviously _if_ the loop body becomes too complex some refactoring should be used and the whole access moved to a separate function/method that would naturally operate on a single element of the array, but for cases where there are few acesses that are only used in one loop, it may be more convenient to keep them directly in the loop. We have been debating which form we should prefer in our team and opinions are mixed, therefore I'm interested in whether there exist some guidelines, especially wrt. C++. Edit: This is purely about style if you will. Performance is irrelevant, as our C++ compiler actually should generate exactly the same code in both versions.