design

How to implement a cache with binary array as key and binary arrays as values in Java

I have a requirement to create a java cache which holds all the cities and airports. So, if i query the cache for a location, lets say a city, it should return all the airports in that city and if I query a location which is an airport, i should get back that airport. Also, each location has to be stored as a byte array in cache.(as the...

What is the best way to create a custom derived grid control?

I want to create a custom grid derived from DevExpress grid control. I just want to add several columns and add custom painting. I will then use this control in 2 different forms. The problem is that if I go straightforward and create a class like this: public class GenerateInvoiceGrid : DevExpress.XtraGrid.GridControl then I will not...

Wrapping STL container without code duplication

I have a simple struct struct A { int t; int s; }; Those were contained in std::list<A>. The problem is that I group A depending on s. I can avoid duplication of s if I'd wrap A in another struct and keep s in a separated container. This has a lot of benefits (e.g. I don't need to do stupid and potentially dangerous things like AC...

MVC / ASP.NET design templates

Does anyone know of any good sites to download good design templates (master pages, css files) for MVC projects, or ASP.NET projects in general? I've used the asp.net mvc gallery but the options there are pretty limited. I'm willing to pay for some if they are good. ...

MVP, design question

Hi, I working on a MVP designed application and have some design questions. When writing code in the presenter-layer how should the comunication go between different presenter/viwes? Lets say I have a WindowPresenter with its WindowView and I want to set the window title on a window from another window. I have a title/set:er on the wind...

Any C# SmartDate converters out there, e.g. "sun 11" --> 2009-12-06 11:00:00

In the spirit of not reinventing the wheel, can anyone point me to free C# code that does the following kinds of conversions? "sun" --> 2009-12-06 00:00:00 "tom" --> 2009-12-06 00:00:00 "tomorrow" --> 2009-12-06 00:00:00 "mon 8pm" --> 2009-12-07 20:00:00 "jan 5 at 10" --> 2010-01-05 10:00:00 and durations that return two datetimes l...

CSS make set minimum page height/width

Hey, In the page layout I am creating, for some reason, the scrollbars never seem to show and rather the content tries to rearrange itself. Is there a way to lock in a set width and height for the whole page so that if the window is scaled it shows scrollbars? The page: http://thetalkingcloud.com/clipit.com/ Specifically, if you make t...

dreamweaver for css and html?

im a pure backend programmer and i find it so difficult to position divs and add css styles. what are your advices to make this as simple as possible for me? use dreamweaver? what can it help me with exactly. i have no idea how to add style to my prototype or handling positionings of divs and elements. some guides? tools? softwares? o...

Tricky data conversion excercise

I have weather history data which I need to plot on a web page using (highly recommended) jquery flot. The app behind is in RoR. One of the data series describes overall weather state for a date such as 'heavy showers', 'light snow', etc. Now flot expects decimals in data input. Flot also allows to reformat data when it comes down to s...

Should a function's comment include descriptions of work done by functions it calls?

Let's say I have a function called DisplayWhiskers() which puts some slashes and backslashes on the screen to represent an animal's whiskers like this: /// \\\. I might write a comment for this function along the lines of // Represents an animal's whiskers by displaying three // slashes followed by a space and three backslashes But ...

PHP MVC Framework Design

Hi there, I currently ran into a problem I can not really solve by myself: I ve started to code a "small" framework (browsergame-framework), which follows the MVC pattern in some way. Now I have my index, bootstrap, db adapter, dispatcher, wrapper, but I do not really know "how" to link them. I coded their methods etc. but I do not kn...

Design choice with a container class that several classes use

I have a class that wraps around a list called ExplosionGroup (previously called AllExplosions for reasons I'll explain) which is a list of 'Explosion's (another class). My original design choice, and what ran for awhile, was to have an ExplosionGroup in the 'Level' class that runs all the levels. Any classes (like ships or bosses) that...

Sharing object by reference or pointer

Say I have an object of type A having Initialize() method. The method receives object B, which are kept as the object data member. B object is shared between several objects, thus A should contain the originally received B object and not its copy. class A { public: bool Initialize(B?? b); private: ...

Java Architecture - Question about ActionListener Conventions

I am making a user interface which shows graphs and manipulates graphs. The class extends JFrame implements ActionListener. The ActionListener then calls different classes to manipulate graphs depending on the action. This worked while the class had few ActionListeners; however, now the class is becoming unmanageable. I know that in the...

WPF control design guidance - timeline

I'm working on a control for one of our apps. The control shows the currently focused day as a gird, the X-axis being time of day. The Y axis doesn't have a scale as such, rather it will separate out the items to be displayed. The overall look of the control will be quite similar to a gantt chart, showing the times of day of various t...

Observer Design Pattern

In the Observer design pattern, the subject notifies all observers by calling the update() operation of each observer. One way of doing this is void notify() { for (observer: observers) { observer.update(this); } } But the problem here is each observer is updated in a sequence and update operation for an observer might no...

Help designing database for a twitter web application

Hello. I'm trying to create a small website in ASP.NET MVC that uses twitter. I want to be able to pull some information about twitter users and store it in a database, which I will update periodically. I am using the following tables: Users user_id - uses the twitter id (int) twitter_name - nvarchar(255) last_updated - datetime Tw...

Philosophical Design Questions for OOP-Tetris

You are writing a Tetris program in Java. How would you set up your class design with regards to the following aspects? Piece class: Have one Piece class, with an internal array which determines the shape of the piece, versus having seven Piece classes, one for each of the pieces. They are all subclasses of one generic Piece class. Pie...

Can I Change Look / Feel Of Scaffolded Pages With Mostly CSS?

I am using a web framework (Grails, similar to Rails) that has abilities to auto-generate a lot of code through scaffolding. As a result, all of my CRUD pages are currently automatically generated, and I even have ability to inject additional HTML code whenever I want to to further customize the content of those pages. I can control t...

Custom captcha design

Hi there, I currently ran into the issue that I do not have the money to buy/rent any professional captchaing service. So I tried to look around for OS captcha generators, and captcha designs. I also had a brief brainstorm about my own and simple captcha design. Do you have any preferences, or can give me a good advice handling captch...