design

Interfaces separated from the class implementation in separate projects?

We work on a middle-size project (3 developers over more than 6 months) and need to make following decision: We'd like to have interfaces separated from concrete implementation. The first is to store the interface in a separate file. We'd like to go further and separate the data even more: We'd like to have one project (CSPROJ) with in...

Progress reporting from background task

I have a background task that imports files into a database. I want the user to see what is currently happening (collecting files/ importing files), which file is currently processed and how far the task has progressed. How can I do this in an easy way? The interaction between Model and Controller is so close, that I could almost put the...

How can I wait for a button press in a loop?

Say I have simple program that emulates a board game with a number of players who take turns rolling dice to move across a board. The players can be human or computer. If this was a command-line style game, I could simply make a loop to iterate over the players which would call the diceRoll function for that player. If the player is ...

Multiple configurations for asp.net user control

I'm working on a site that can be displayed to the user in several different ways, kind of like themes, but more functionality related. So basically, the page you are viewing is in a certain state (based on the user, country etc). The rendering of the controls on a page will vary a bit depending on the current state, and I want this to ...

how to implement common functor for several classes in c++

Hi, suppose you have two (or more) classes with private member vectors: class A { private: std::vector<X> priv_vec; public: //more stuff } class B { private: std::vector<Y> priv_vec; public: //more stuff } and you have a functor-class which has a state and works on a generic vector (does sorting or counts...

How to divide responsibility between LDAP and RDBMS

I'm a lead developer on a project which is building web applications for my companies SaaS offering. We are currently using LDAP to store user data such as IDs, passwords, contanct details, preferences and other user specific data. One of the applications we are building is a reporting service that will both collect and present managem...

What is a Condition Variable in java?

Q1. What is a condVar in Java? If I see the code below, does a condition variable necessarily have to be within the 'mutex.acquire()' and 'mutex.release()' block? public void put(Object x) throws InterruptedException { mutex.acquire(); try { while (count == array.length) notFull.await(); array[putPtr] = x; ...

What is the difference between aggregation, composition and dependency?

What is the difference between aggregation, composition and dependency? ...

How do I implement such template engine?

What I got: I got a textual representation which my program converts to a much more readable format, especcially for forums, websites and so on. Why do I need such templage engine As there are many different forums and blogs, the syntax of each one might be different. Instead of hard-coding the different syntax I would like to genera...

Why doesn't Java have a file copy?

Why does Java not have a file copy method? This seems like such an obvious thing to have, and it saves people from writing things like this example. ...

Design: Having references in the subclass of a field in the superclass

First of all, I have no idea if the title even reflects my question. I apologize and kindly request to change it if you have a better idea. Now, the problem I have is mainly a design problem. I am not sure if what I want is a good practice but it's d*mn convenient. I have an Interface called IMovement. Two classes implement IMovement...

iPhone Utility App Design

I'm creating a "utility" type application with a main and flipside view, and an underlying "model" which the flipside view edits, and the main view "consumes". Following on from this question: http://stackoverflow.com/questions/263118/iphone-os-utility-app-flipside-view-and-main-view-communication My question is: where should the model...

C state-machine design

I am crafting a small project in mixed C and C++. I am building one small-ish state-machine at the heart of one of my worker thread. I was wondering if you gurus on SO would share your state-machine design techniques. NOTE: I am primarily after tried & tested implementation techniques. UPDATED: Based on all the great input gathered o...

Algorithm Question On Finding All Valid Words In Dictionary

Given a dictionary (just a list of strings). You receive a feed of an unknown number of letters from an external source. Given the string of letters, how would you go about listing all valid words (from the diciontary) you can make from any combination from those letters. So if you receive: abpplead You should find apple, bad, pad, le...

.NET class design question

I have a class called Question that has a property called Type. Based on this type, I want to render the question to html in a specific way (multiple choice = radio buttons, multiple answer = checkboxes, etc...). I started out with a single RenderHtml method that called sub-methods depending on the question type, but I'm thinking separat...

How can I create a "neon sign" dynamically? (non-Flash/Java solution)

Hi, I want to have a dynamically generated Neon sign on my site. I want to pass it some text, have it rendered as an image (in a neon sign - something like: http://www.pixelhivedesign.com/tutorials/Neon+Sign+on+a+Textured+Surface/ ) and then show the image to the user. I dont think CSS font tricks can do this - that would have been fa...

Designing an OS abstraction layer

While Developing an OS Abstraction layer for a multi-modular system, which approach should one take: Create a Shared Library of OS services and each module is built to use it and runs as individual processes. OR Create only a single instance of abstraction layer which provides memory, timer services and which alone spawns all in...

Design/Development of Portals

What things one should keep in mind while designing and developing Portals ? What design considerations would change with different types of portals like information portal, content management portal, application centric portal, content centric portal, vertical enterprise portals and horizontal enterprise portals ? ...

converting J2EE App from Sql to Oracle - suggestions with effecient approach

We have a J2EE app built on Struts2+spring+iBatis; not all DAO's use iBatis...some code still uses the old JDBC approach of interacting with Database. All our DAO's call Stored Procedures, we do not have any inline SQL. Since Oracle Stored Procedures return cursors, we have to drastically change our code. It is fairly easy for us to c...

Generic TryParse Extension method

Code taken from here I would like to hear some expert opinions on this extension method. I do plan to use it, but would like to hear about any known problems i may face. Am i better of using on primative types TryParse methods? public static T? TryParse<T>(this object obj) where T : struct { if (obj == null) retur...