design

CSS Sprite for images which have vertical as well as horizontal repeats

I have four images, one of which has background repeat property in horizontal direction and three of which have background repeat in vertical direction. I have different CSS classes which currently uses this images as under: .sb_header_dropdown { background: url(images/shopping_dropdown_bg.gif) repeat-y top left; padding: 8...

Can one Python project use both 2.x and 3.x code?

Hi all - I'm going to start on a long (~1-year) programming project in Python. I want to use wxPython for my GUI (supports 2.6), but I also want to use 3.1 for the rest of the project (to start using the 3.x syntax). Is there any way for me to design a project that mixes 2.x and 3.x modules? Or should I just bite the bullet and use eit...

C++ Inheritance Question edit: more troubles

I have a base class MessageHandler and 2 derived classes, MessageHandler_CB and MessageHandler_DQ. The derived classes redefine the handleMessage(...) method. MH_DQ processes a message and puts the result in a deque while MH_CB processes the message and then executes a callback function. The base class has a static callback functio...

Example of Eric Raymond's "smart data structures" principle

In Eric Raymond's essay The Cathedral and the Bazaar, he states this oft-cited principle: Smart data structures and dumb code works a lot better than the other way around. Could anyone offer a strong example of this in either a procedural or object oriented language? ...

How can I display a full designer file in c#?

So I just got a C# program from someone that compiles and gives me a fully functional application. However, when I want to see the .cs{Design] file it gives me the following error: .ErrorStyle { font-family: tahoma; font-size: 11 pt; .... How can I convert this to an actual Design file? I am working on Visual Studio C#. Thank you ve...

Design Question - how do you break the dependency between classes using an interface?

Hello, I apologize in advance but this will be a long question. I'm stuck. I am trying to learn unit testing, C#, and design patterns - all at once. (Maybe that's my problem.) As such I am reading the Art of Unit Testing (Osherove), and Clean Code (Martin), and Head First Design Patterns (O'Reilly). I am just now beginning to unde...

how to elegantly duplicate a graph (neural network)

I have a graph (network) which consists of layers, which contains nodes (neurons). I would like to write a procedure to duplicate entire graph in most elegant way possible -- i.e. with minimal or no overhead added to the structure of the node or layer. Or yet in other words -- the procedure could be complex, but the complexity should no...

What is a good architecture for a Lift-JPA application?

I was wondering what is the best practice for a JPA model in Lift? I noticed that in the jpa demo application, there is just a Model object that is like a super object that does everything. I don't think this can be the most scalable approach, no? Is it is wise to still do the DAO pattern in Lift? For example, there's some code that loo...

What's the best way to communicate the purpose of a string parameter in a public API?

According to the guidance published in New Recommendations for Using Strings in Microsoft .NET 2.0, the data in a string may exhibit one of the following types of behavior: A non-linguistic identifier, where bytes match exactly. A non-linguistic identifier, where case is irrelevant, especially a piece of data stored in most Microsoft W...

Network communication for a turn based board game

Hi all, my first question here, so please don't be to harsh if something went wrong :) I'm currently a CS student (from Germany, if this info is of any use ;) ) and we got a, free selectable, programming assignment, which we have to write in a C++/CLI Windows Forms Application. My team, two others and me, decided to go for a network-co...

Using Doctrine to abstract CRUD operations

This has bothered me for quite a while, but now it is necessity that I find the answer. We are working on quite a large project using CodeIgniter plus Doctrine. Our application has a front end and also an admin area for the company to check/change/delete data. When we designed the front end, we simply consumed most of the Doctrine cod...

Object serialization practical uses?

How many software projects have you worked on used object serialization? I personally never came across a scenario where object serialization was used. One use case i can think of is, a server software storing objects to disk to save memory. Are there other types of software where object serialization is essential or preferred over a dat...

Python - Converting CSV to Objects - Code Design

Hi, I have a small script we're using to read in a CSV file containing employees, and perform some basic manipulations on that data. We read in the data (import_gd_dump), and create an Employees object, containing a list of Employee objects (maybe I should think of a better naming convention...lol). We then call clean_all_phone_numbers...

How would you show which tab is selected on a website built from a template?

When you click Questions, Tags, Users etc. at the top of stackoverflow, the one you're looking at becomes highlighted orange. This is (usually) done by changing the css of one of them to be 'selected'. If you have a single template that all your pages are built with, and that template includes these buttons across the top, how do you hi...

How do you keep yourself and your co-workers from creating huge classes

Stackoverflow users, How do you keep yourself from creating large classes with large bodied methods. When deadlines are tight, you end up trying to hack things together and it ends up being a mess which would need to be refactored. For me, the one way was to start with test driven development and that lends itself to good class design a...

How many databases to support eCommerce?

I have a system with two databases, one that the customer-facing website uses, the second that is used by the "backroom" order-fulfillment system. I've been asked to run queries from the website to the backroom system. I'd rather not, it seems risky to allow web-based request to run unheeded on the internal system. Additionally, this m...

C# ProgressBar design pattern

Hi, I'm working on a database upgrader application. The upgrader updates the schema of a database ( adds new columns, renames columns , adds new tables, new views to an existing database by executing SQL statements ). When a user wants to upgrade from version 1.0 to 2.0 , "Upgrader" objects are taken from an object factory and the "Exec...

Is there a standard practice for storing default application data?

Our application includes a default set of data. The default data includes coefficients and other factors that are unlikely to ever change but still need to be update-able by the user. Currently, the original default data is stored as a populated class within the application. Data updates are stored to an external XML file. This des...

How do you find the balance between Javascript (jQuery) and code behind in ASP.NET.

Stackoverflow members, How do you currently find the balance between javascript and code behind. I have recently come across some extremely bad (in my eyes) legacy code that lends itself to chaos (someHugeJavafile.js) which contains a lot of the logic used in many of the pages. Let's say for example that you have a Form that you need to...

C#: Method to return object whose concrete type is determined at runtime?

I'm thinking about designing a method that would return an object that implements an interface but whose concrete type won't be know until run-time. For example suppose: ICar Ford implements ICar Bmw implements ICar Toyota implements ICar public ICar GetCarByPerson(int personId) We don't know what car we will get back until runtime....