Hi, I have a web application where I would like to pull user settings from a database and store them for Global access. Would it make more sense to store the data in a Singleton, or a Session object? What's the difference between the two?
Is it better to store the data as an object reference or break it up into value type objects (ints ...
What is the proper usage pattern for LINQ to Lucene's Index<T>?
It implements IDisposible so I figured wrapping it in a using statement would make the most sense:
IEnumerable<MyDocument> documents = null;
using (Index<MyDocument> index = new Index<MyDocument>(new System.IO.DirectoryInfo(IndexRootPath)))
{
documents = index.Where(d...
Hi SO.
I have an applet that connects to a server, it receives some commands and based on that it haves to draw (or move) different things.
Which patterns should I use? I assume that the network connection and applet should run in two different threads?
Thanks,
Kristoffer
...
This question's been bugging me for a long time. I've always wondered how game developers were solving certain problems or situations that are quite common in certain genres.
For example, how would one implement the quests of a typical role-playing game (e.g. BG or TES)? Or how would you implement weapons with multiple stacking effects ...
I'm trying to designing a class and I'm having issues with accessing some of the nested fields and I have some concerns with how multithread safe the whole design is. I would like to know if anyone has a better idea of how this should be designed or if any changes that should be made?
using System;
using System.Collections;
namespace ...
Hello everybody!
I am having trouble correctly modeling related objects that can use templates. This is not homework, but part of a small project in the university.
In this application the user can add several elements, which can either be passive or active. Each concrete element has different attributes, these must be set by the user....
What would be the disadvantages of using the builder design pattern. Are there any??
edit - I want to know whether there is any bad consequence of using builder design pattern? As in the GOF book, they have mentioned the good and bad consequences of design patterns. But they haven't mentioned any bad consequence for builder design patte...
Windows-based client application and web-client application(consuming the same code which windows-client uses)
what is the preferable pattern for this scenario?
Is it ok to have the code in the common place where both the projects and refer it as dll i.e one which is a windows app and other which is going consume the same code which wind...
Just like we have www.corej2eepatterns.com for J2EE, when can we expect any resource(book) on patterns for JEE5/6?
...
Edit: Answered - error was method wasn't static
I'm used the Singleton Design Pattern
public class Singleton {
private static final Singleton INSTANCE = new Singleton();
// Private constructor prevents instantiation from other classes
private Singleton() {}
public static Singleton getInstance() {
return INSTANCE;
...
I am thinking about implementing a user interface according to the MVP pattern using GWT, but have doubts about how to proceed.
These are (some of) my goals:
the presenter knows nothing about the UI technology (i.e. uses nothing from com.google.*)
the view knows nothing about the presenter (not sure yet if I'd like it to be model-agno...
I need to generate HTML snippets using jQuery. The creation of those snippets depends on some data. The data is stored server-side, in session (where PHP is used).
At the moment I achieved this
- retrieving the data from the server via AJAX in form of JSON
- and building the snippets via specific javascript functions that read those dat...
Here's the deal/challenge,
We have to keep track of information and it's linear changes. We also have to keep track of changes that are out-of-sequence. For example A happened then B happened. Sometime later, we learn of C which actually happened before B. Along with this challenge, we have many objects that have to be versioned th...
I've seen quite a few examples of MVVM. I can see that the View should reference the ViewModel. I've seen recently an example of a ViewModel referencing a View, which seems wrong to me, as it would result in tighter coupling. Given that ViewModel is often described as an intermediary between the View and the Model, is there more to the V...
Hey everyone,
I read a book awhile back called PHP Design Patterns and Practice, and ever since then I have been using design patterns whenever I think they are needed. However it just occurred to me that maybe most companies do not use design patterns very often for PHP, or at all. What I was wondering is, do most companies use design ...
As a web developer, a common problem I find myself tackling is waiting for something to load before doing something else. In particular, I often hide (using either display: none; or visibility: hidden; depending on the situation) elements while waiting for a background image or a CSS file to load.
Consider this example from Last.FM. The...
Is there a Design Pattern for supporting different permutations object?
Version 1
public class myOjbect {
public string field1 { get; set; } /* requirements: max length 20 */
public int field2 { get; set; }
. . .
public decimal field20 { get; set; }
}
Version 2
public class myObject {
public string field1 { get; set; } /...
java.util.Collections currently provide the following utility methods for creating synchronized wrapper for various collection interfaces:
synchronizedCollection(Collection<T> c)
synchronizedList(List<T> list)
synchronizedMap(Map<K,V> m)
synchronizedSet(Set<T> s)
synchronizedSortedMap(SortedMap<K,V> m)
synchronizedSortedSet(SortedSet<T...
Is it possible to create a decorator which can be __init__'d with a set of arguments, then later have methods called with other arguments?
For instance:
from foo import MyDecorator
bar = MyDecorator(debug=True)
@bar.myfunc(a=100)
def spam():
pass
@bar.myotherfunc(x=False)
def eggs():
pass
If this is possible, can you provi...
OK, let's say I am creating a program that will list users contacts in a ListBox on the left side of the screen. When a user clicks on the contact, a bunch of messages or whatever appears in the main part of the window.
Now my question is: how should the MVVM triads look? I have two models: Contact, and Message. The Contact model co...