design

References/examples on design and implementation of graphical tiles?

Remember the game Civilization, where there was a large scrollable map with different behavior of some tiles. Or in Google Maps there is also a map where tiles are loaded with Ajax. Where can I find more information on tiles classes (in C++)? How does a class hierarchy look like to implement a scrollable canvas with tiles? ...

Why does A work but not B?

I have a custom class written, which I instantiate from an event procedure similar to Private Sub EventHandler For intForCounter = 1 to intUserEntry Dim newObj As New MyClass newObj.Property newObj.Method() Next End Sub The class itself looks something like this Public Property Time As Date 'First atte...

Case Statement Question -- vb.net

So I have case statements grouped together here, but I have a few case statements that need extra decision based on a second variable after the original case is confirmed. This is what I have now: Case "PRIVATE_PARTY" If Condition = KBB_CONDITION_EXCELLENT Then Vehicle.MarketValue = Response.PrivatePartyExcellent ElseIf...

Cleaning up code littered with InvokeRequired

I know that when manipulating UI controls from any non-UI thread, you must marshal your calls to the UI thread to avoid issues. The general consensus is that you should use test InvokeRequired, and if true, use .Invoke to perform the marshaling. This leads to a lot of code that looks like this: private void UpdateSummary(string text) {...

Force a session to time out every 6h hours

A marketing guy came to me with a request to time out the session every 6 hours regardless of the user activity on the site. I understand that if the user leaves his computer for a certain period of time (Set right now to 30 minutes) the session should time out, but forcing a user to log in after a certain period of time just doesn't m...

Linux - Program Design for Debug - Print STDOUT streams from several programs

Let's say I have 10 programs (in terminals) working in tandem: {p1,p2,p3,...,p10}. It's hard to keep track of all STDOUT debug statements in their respective terminal. I plan to create a GUI to keep track of each STDOUT such that, if I do: -- Click on p1 would "tail" program 1's output. -- Click on p3 would "tail" program 4's output...

Have you ever seen design with reasonable usage of protected internal access modifier?

I haven't, but I don't say there isn't one. All of the C# developers who read this probably do know what is protected internal and when to use it. My question is simple : did you actually ever use it or worked on a successfully designed project using protected internal access modifier? If yes, please share your knowledge and post nice s...

Best way to implement a Favourites/Starred Tab?

What is the best and simplest way to have persistent data on android for a 'favourtes' tab? I have three types of objects which can be found on three different tabs and the user can choose to 'star' them and they get added to a favourites list. I'm not to sure what the best way of doing this is... Currently I'm adding the items to thre...

Nested(deep) iteration for loops ? Good or Bad Practice?

Hi All, I wanted to ask, If writing nested(deep) iteration loops (as shown in example) a bad practice (in OOPs)? For example : If i want to zip all files that in all Workspaces. Given example classes are Workspace, Project , File please ignore avoid syntax errors for each Workspace workspace in WorkSpaces { Pro...

Scala traits / cake pattern vs case classes

In my web application authorized user has at least 4 "facets": http session related data, persistent data, facebook data, runtime business data. I've decided to go with case class composition instead of traits for at least two reasons: traits mixing can cause name clashes i want the free case class goodies like pattern matching and co...

Understanding the design of std::istream::read

std::istream has the prototype istream& read (char* s, streamsize n) the actual number of bytes read should be gotten by calling istream::gcount(), also the validity of the istream can be known from ios::good. I was discussing another stream class' implementation I was trying to write with a colleague of mine, where I was saying I might...

How and when to deal with database that is down ?

My problem is that I have to deal somehow with cases when database is down in my MVC application. So, should I like try{} catch{} to open connection in every controller? Or what is the best practice? Note: For sample database access is isolated in few "manager" classes that work repository kind of way. ...

C# Software Design Question: IO Exception Handling Principles and MVC Architectural Strategy

Hi, I think it's a design question, and it's been haunting me since I started my project. I'm working on a project involving a lot IO operations, mainly reading and writing files. I'm trying to use MVC (Model-View-Controler) architectural strategy, but I found it's very difficult to implement, especially with the exception handling. ...

Help with the logic of an script for composing multiple videos.

Hi All, I'm working on a Video Application and would like to hear some opinionenter code here of other developer about the logic for this section of the application. The application I'm working on will allow two live video streams to be recorded, and combined into a single FLV file. The application will have two "channels", I will hav...

Is inheritence of concrete classes evil?

I use interfaces/abstract base classes for most of my types and don't often inherit from concrete classes but I've recently run into a situation where either inheritance or composition is desired. I've been aware of the adage "program to an interface, not an implementation" but recently decided to dig deeper. I've seen arguments again...

How do I span two divs side-by-side for the full screen width?

There are a lot of questions regarding side-by-side divs. I didn't miss those. But I need something that spans the whole width of the screen. This is the situation: I need three divs positioned side-by-side. The left, middle, and right divs we'll call them. The middle div holds the header contents of the site and is a fixed width (800px...

What are good software for creating icons?

I am looking for software that can draw some web ui icons like butttons or navigation tabs etc. I've tried fireworks and liked it but trial expired. I used to make simple buttons using ms paint but it drives me nuts trying to make it fancy. I could pay for fireworks but would like to know is there is any decent program I can get for fre...

How to handle pressure to deliver, when maintaining legacy code?

Here's a question that has been bugging me. I'd like to think that I prefer writing elegant C++ code. — You know, well designed, clean, documented code. But, what do you do if you are under pressure to deliver and maintain large legacy code which is supposed to meet functional and, especially, performance requirements? After a while, my...

White-box testing - friends or preprocessor?

So, imagine we have a class like this class Testee { public: void Func() private: void auxFunc() }; and we want to do white-box unit-testing on it. Which do you think is a better approach? To declare the tester class a friend of the testee class? Or use the preprocessor like this: class Testee { public: void Fu...

Design Pattern for creating a set of data objects

Hi, I'm writing some code to do some stuff and I'm pretty sure its not well designed at the moment but I can't think how I should be refactoring it to make it nicer... The simple summary is that I have some code which goes through some files in a directory structure and different directories contain different content types. I have a li...