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

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?


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

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 ?


Why is the "kill" command called so?

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.


Open Source Etiquette

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.


When should I use AtomPub?

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?


Reasons to Use Version Control

> **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?


What is the value of using version control?

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?


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

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._


MASS equivalent for intel compilers and architectures

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.


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

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).


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

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?


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

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?


How to guarantee invariants / Inner logic in setter methods

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?


Entity Framework eager loading/reference data

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.


Best practices for backing out a feature from a QA trunk

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!!


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

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.


Are programmers good at learning "spoken" languages?

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.]_


Does comparison operand order affect speed?

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?


How can architects work with self-organizing Scrum teams?

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?


Using work time effectively: How to create code quickly?

> **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?


How to code on a very tight schedule?

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.


tracking web traffic with Python

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)?


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

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?


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

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?


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

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?


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

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?


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

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?


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

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?


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

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?


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

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?


Developer to team leader

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)


What kinds of copyright or privacy issues apply to tweets?

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.


Are value converters more trouble than they're worth?

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.


Comparing Visual Foxpro with .NET

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?


Scrum re-estimation of stories

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?


Javascript - is this a grey area for anyone else?

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...


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

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...


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

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?


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

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 ?


How to get requirements from Non-technical client?

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?


From Imperative to Functional Programming

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


schedule compliance and keeping technical supports and resolving issues

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).


Should I Use WCF For My Purpose?

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?


is Java free for mobile development?

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?


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

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?


How to store currency ranges in a Postgres table?

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 ?


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

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.


How big sites scale up and optimize to massive traffic?

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.


Why Was Python Written with the GIL?

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?


Reflective discovery of an inner class in an API

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.


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

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?


Social networking sites static caching

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?


Allocating memory inside a function and returning it back

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?


Who should participate in time estimation?

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?


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

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?


Responding or Maintaining Emails - best practice

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.


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

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.


POST and PUT requests – is it just the convention?

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


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

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


certified scrum master

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!!


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

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?**


I code rarely. Is this a bad sign?

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?


Can't I just use all static methods?

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.


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

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.


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

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.)


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

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?


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

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"?


How to implement a message queue over Redis?

### 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.


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

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.


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

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?


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

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?


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

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?


Measures of Javascript engine performances over time?

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?


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

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.


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

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.


How have you got chances to learn multiple languages?

I read A programmer should concentrate on at least how many languages?, and I found out that I don't know languages in number 2, 3 of first answer. I want to learn more languages to increase my knowledge and programming skill. However, usually in companies they use fixed framework and languages and changes seldom. So I'm not sure if I can get a chance to learn those languages and I think it would be same to other programmers. However, I've seen many developers who knows multiple languages in here. How do you get chances to learn many languages? **Update** I think, there are many people who feel uncomfortable because it seems I don't want study in my spare time at all. Actually, that's not true.:) I'm an enthusiast programmer and that's why I posted this kind of question here. I study in my spare time but I just thought it would be not enough to be skillful in languages. Anyway, thanks for all answers!


Is there any design pattern to remove elements from a hash map?

In my application I keep track of the running threads via a hash map, in that way I can retrieve the correct thread and do any actions. The app evolved in a way that new threads are created and old threads must be destroyed. My concern is if I'm removing the elements of the hash correctly, or if there's any efficient pattern. I'm developing in Java but I'll share the pseudo code:               # HashMap mainHashmap already initialized     List toDelete = new List();     # First step, stop the threads     For (each element in HashMap)     {       if (element.value is ThreadA)       {         element.value.stopThread();         toDelete.add(element.key);       }      }      # Then remove the element from the array      For (each key in toDelete)      {         mainHashmap.remove(key);      }      Thanks


How should I assess answers to the programming assignment I use for hiring

After our phone screen, but before a face to face interview, I ask our candidates to complete a short programming assignment. It involves writing a small command line program in C, which should run to around 100-200 LoC and take 3-4 hours to complete. We allow the candidate 72 hours to complete the task and get it back to us. It involves a little simple file and string handling and a simple data structure (which the candidate has to select appropriately). We ask for a solution that is "reasonably efficient, concise and easy to understand" to hint that we don't expect it to be super clever or micro-optimized at the expense of readability. The task is not completely specified, so we make it clear that we'd like to see any assumptions document. **So my question is: how should I rate the solution?** I have seen a couple of solutions so far (it's early days). But I'm a bit disappointed that there have been bugs that I've found within a few minutes of hand testing or looking at the code. But what sort of standard should I expect? If anyone has any links to good general advice on the topic, it would be very much appreciated.


What is Module Object and Function Object?

I am currently teaching myself Python, using the GNU licensed book "Introduction to Computer Science using Python." In chapter 3, functions are covered. While I understand the concept of functions and how they simplify code by executing a defined sequence of statements whenever they care called, and that Modules are collections of related functions and variables, stored in a file, I do not understand the concept of module objects and function objects. For example, when "import math" is executed, it says, a module object is created. Also, when a function is defined and is executed, a function object is created. Could someone please explain what these "objects" are to me?


How do you guys feel about organization specific frameworks?

I know that there should be a kind of standard for developing software but in the organization where I work for (30,000+ employees), we have a very strict framework for Java development. In my opinion such a framework is prehistoric as we are therefor running at least 10 years behind (Standard is Java 1.5 but with support 'til java 1.2). Further the framework slows down performance, user satisfaction drops and I'm writing more boilerplate code than is good for my health :-). Any suggestions on the advantages of such a framework? What are good practices for such a framework for not running behind the facts?


As the current draft stands, what is the most significant change the "National Strategy for Trusted Identities in Cyberspace" will provoke?

A current draft of the "National Strategy for Trusted Identities in Cyberspace" has been posted by the Department of Homeland Security. This question is not asking about privacy or constitutionality, but about how this act will impact developers' business models and development strategies. When the post was made I was reminded of Jeff's November blog post regarding an internet driver's license. Whether that is a perfect model or not, both approaches are attempting to handle a shared problem (of both developers and end users): How do we establish an online identity? The question I ask here is, with respect to the various burdens that would be imposed on developers and users, what are some of the major, foreseeable implementation issues that will arise from the current U.S. Government's proposed solution? For a quick primer on the setup, jump to page 12 for infrastructure components, here are two stand-outs:   * An Identity Provider (IDP) is responsible for the processes associated with enrolling a subject, and establishing and maintaining the digital identity associated with an individual or NPE. These processes include identity vetting and proofing, as well as revocation, suspension, and recovery of the digital identity. The IDP is responsible for issuing a credential, the information object or device used during a transaction to provide evidence of the subject’s identity; it may also provide linkage to authority, roles, rights, privileges, and other attributes.    * The credential can be stored on an identity medium, which is a device or object (physical or virtual) used for storing one or more credentials, claims, or attributes related to a subject. Identity media are widely available in many formats, such as smart cards, security chips embedded in PCs, cell phones, software based certificates, and USB devices. Selection of the appropriate credential is implementation specific and dependent on the risk tolerance of the participating entities. Here are the first considered actionable components of the draft:   * Action 1: Designate a Federal Agency to Lead the Public/Private Sector Efforts Associated with Achieving the Goals of the Strategy   * Action 2: Develop a Shared, Comprehensive Public/Private Sector Implementation Plan   * Action 3:Accelerate the Expansion of Federal Services, Pilots, and Policies that Align with the Identity Ecosystem   * Action 4:Work Among the Public/Private Sectors to Implement Enhanced Privacy Protections   * Action 5:Coordinate the Development and Refinement of Risk Models and Interoperability Standards   * Action 6: Address the Liability Concerns of Service Providers and Individuals    * Action 7: Perform Outreach and Awareness Across all Stakeholders    * Action 8: Continue Collaborating in International Efforts    * Action 9: Identify Other Means to Drive Adoption of the Identity Ecosystem across the Nation


When to write Unit Tests : Is there any or list of terms to take right decision

To write Unit Tests we have to write extra bits of code. For several projects we do Unit Tests and for several projects we do not. As a Team Leader I face trouble to make the right decision. Is there any or list of terms by which I can take the right decision whether we will do Unit tests or not? **EDIT:** Please provide a comment while down voting the question. It will help me to improve my question.


Why are some languages (e.g Visual Basic) considered more enterprise ready than others (Python)

Reading about various techie sites, there is often a feeling that Microsoft Languages / Oracle etc. are considered "enterprise ready", while there seems to be more doubt about languages such as Python or Ruby. Why is this? Do Microsoft languages actually have less security holes or not?


Should a programmer always be able to do everything a user could do?

Should a programmer be able to perform all operations programmatically on a object that a user could do? By way of example, I'm working with a list selection object. To populate the list List.AddItem(itemData) is repeatedly called until it is built. A user can then:   * View the entire list   * Select a single item from the list However there is no programmatic way to list all of the items. Nor is there an easy way to set an item as selected. You can if you keep track of what was added to the list and call List.SelectItem(itemData). This means you'd have to maintain an independent list of the items separate from the object, which could cause it's own problem (This bit of ugliness isn't necessary to the question, but part of the motivation). In general if a user can get information about an object or perform an action on an object should this same functionality be available to the programmer and not hidden? I suspect the answer is "yes" but recognized I may be overgeneralizing from this one case that I'm unhappy with.


Why does flask use Jinja2 and not xpath?

I'm just starting out with python and since I'm coming from a PHP background (thus have to adjust my mind to wrap around new concepts) one major question still stands without answer - why does Flask need a **template engine**? The way I was used to go about things, was to have a `template.html` that contained valid html without any logic and then, when needed, just load the file into a `DOMDocument` object and navigate it using `DOMXpath`. This made perfect sense to me - leave the UI part separate from the LOGIC part. But now since I'm starting to learn a new language, it kinda forces me to get back to mixing in logic with the UI. So it boils down to this - is it me, is the DOM and xpath route just something I do to make my life "harder", or is Flask wrong to use a template engine?


Using TSQL for the first time some basic instructions

I am writing an application that will use many tables and I've been told that I must not use stored procedures in this project because it will be too slow. It has been suggested that I use TSQL. I have only used stored procedures until now. Is using TSQL different? Is this the way to go for faster data access or are there other methods?


How to do pragmatic high-level/meta-programming?

Imagine you have implemented the creation of a nice path-based star shape in Lisp. Then you discover Processing and you re-implement the whole code, because Processing/Java/Java2D is different. Then you want to tinker with libcinder, so you port your code to C++/Cairo. You are (re)writing a lot of boiler plate code, while the actual requirement "create a star shape" (or "create a path, moveto x y, lineto x y") has not changed. What are the options to encapsulate those implementation details? Some sort of pragmatic meta-programming? Maybe an expert system? How would you define your core business logic as language-independent as possible? **EDIT:** This has been a real business problem for some people, if you look at Schlep or Stella. The idea is that you've written your core library e.g. in Java and now need to write an iOS app. On what language do you bet you future? How can you save your investment in your current code base?


Best open source ASP.NET MVC e-commerce projects

I need to get a e-commerce site up and running, but I really don't want to program it from the bottom up if I don't need to. I want to program it using ASP.NET MVC. I'm looking for a good open source alternative (or one for purchase if it's modular enough) that I can use as a base and enhance with the needed functions? It has to have all "normal" e-commerce functions, and also the possibility to integrate with a credit card API of my choice. If anyone have any recommendations for me here, I would appreciate it :)