language-agnostic

Application wide messaging... without singletons?

So, I want to go for a more Singleton - less design in the future. However, there seem to be a lot of tasks in an application that can't be done in meaningful way without singletons. I call them "application wide services", but they also fall into the same category as the cross cutting concerns, which I usually fix via AOP. Lets take a...

WPF custom user widgets. Will UI components be standardized?

There are lots of articles and video lessons that describe how to create your unique user widget (graphical control) with WPF. There are tons of technical details what is behind the scene and I feel people enthusiasm with ability to customize widgets as never before. I remember those days when VCL library (Delphi) appeared and there wa...

MVP pattern. Presenter requires new view instance. Best practice

I try to apply MVP pattern for win.forms application. I have 2 forms: main & child. Main has a button and when you click it - child form should appear. There are 2 views interfaces that forms implement IMainView { event OnClick; ... } IChildView { ... } There are two presenters MainPresenter(IMainView) & ChildPresenter(I...

Algorithm possible amounts (over)paid for a specific price, based on denominations

In a current project, people can order goods delivered to their door and choose 'pay on delivery' as a payment option. To make sure the delivery guy has enough change customers are asked to input the amount they will pay (e.g. delivery is 48,13, they will pay with 60,- (3*20,-)). Now, if it were up to me I'd make it a free field, but app...

Does this pattern have a name?

Disclaimer: I'm trying to learn proper OO programming/design, so I'm pretty new to this stuff. I guess this is a general design patterns question, but I'll base my example on a game engine or something that renders objects to the display. Consider the following: How can this sort of separation between physical objects (e.g., cubes,...

How do you refactor a large messy codebase?

I have a big mess of code. Admittedly, I wrote it myself - a year ago. It's not well commented but it's not very complicated either, so I can understand it -- just not well enough to know where to start as far as refactoring it. I violated every rule that I have read about over the past year. There are classes with multiple responsibili...

Naming conversion functions

Which naming convention for conversions is standard across most languages? convert_from_typea_to_typeb(arg) or convert_to_typeb_from_typea(arg) Or is there another standard? ...

Code Golf: Diamond Pattern

The challenge The shortest code by character count to output a a pattern of diamonds according to the input. The input is composed of 3 positive numbers representing the size of the diamond and the size of the grid. A diamond is made from the ASCII characters / and \ with spaces. A diamond of size 1 is: /\ \/ The size of the grid c...

Code Golf - Banner Generation

When thanking someone, you don't want to just send them an e-mail saying "Thanks!", you want to have something FLASHY: Input: THANKS!! Output: TTT H H AAA N N K K SSS !!! !!! T H H A A NNN K K S !!! !!! T HHH AAA NNN KK SSS !!! !!! T H H A A N N K K S T H H A A N N K K SSS !!! !!! Write a program to genera...

Help me choose a web development framework/platform that will make me learn something

I'm having a bit of an overload of information these past two days. I'm planning to start my own website that will allow local businesses to list their items on sale, and then users can come in and search for "Abercrombie t-shirt" and the stores that sell them will be listed. It's a neat little project I'm really excited for and I'm su...

UK Postcode search

I want to build a website where you can search by entering the postcode (UK). I know that RoyalMail owns the Database to do this (it's only very expensive, $100K). What are my options? ...

Any Open Source Pregel like framework for distributed processing of large Graphs?

Google has described a novel framework for distributed processing on Massive Graphs. http://portal.acm.org/citation.cfm?id=1582716.1582723 I wanted to know if similar to Hadoop (Map-Reduce) are there any open source implementations of this framework? I am actually in process of writing a Pseudo distributed one using python and multip...

Language Learning Application Flow

Hi, No, I'm not talking about learning programming language. I'm talking about application like Rosetta Stone or Babble. In both applications, we can find that in learning languages (well, in learning any topics perhaps), there are several components like presenting the lesson and generating questions (presenting quizes). I am wonderin...

Should I test == 1 or != 0?

Hey. I was coding here the other day, writing a couple of if statements with integers that are always either zero or one. I asked myself: Should test against 1 or 0? For example, given an int n, if I want to test if it's "true", should I use n == 1 or n != 0? Is there any difference at all? Please don't answer with stuff regarding t...

Contributing to a Linux distribution

I'm interested in contributing to a Linux distro, but regarding the various distro's developer communities, I'm having a bit of trouble figuring out which one I'd most like to join. What languages I know: C, C++, Lua, Python, and fairly familiar with Perl (though I wouldn't say I "know" it). In particular, I have very little experience ...

Fastest sorting algorithm for a specific situation

What is the fastest sorting algorithm for a large number (tens of thousands) of groups of 9 positive double precision values, where each group must be sorted individually? So it's got to sort fast a small number of possibly repeated double precision values, many times in a row. The values are in the [0..1] interval. I don't care about sp...

How to differentiate between exceptions i can show the user, and ones i can't?

i have some business logic that traps some logically invalid situations, e.g. trying to reverse a transaction that was already reversed. In this case the correct action is to inform the user: Transaction already reversed or Cannot reverse a reversing transaction or You do not have permission to reverse transactions or ...

Class design: is creating an object just for creation of objects from child classes bad form?

I currently have a message system which writes to two tables, sent and received, which largely have the same schema. I wrote a class called Message which populates the user inputted data before instantiating the two child classes which use a common method in Messageto set the rest of the properties and writing each to the database. The...

Algorithm for Determining Variations of Differing Lengths

I have four objects - for the sake of arguments, let say that they are the following letters: A B C D I need to calculate the number of variations that can be made for these under the following two conditions: No repetition Objects are position agnostic Taking the above, this means that with a four object sequence, I can have only o...

How do game companies handle programming for multiple platforms?

You often see that a new game will be released on Xbox 360, PS3 and Windows PC. How do gaming companies do this? Is it a common source code compiled using different compilers? Are actual different source codes required? example news article announcing this: http://www.gameranx.com/updates/id/502/article/dungeon-siege-3-announced-to-be-...