patterns

Swing/SwingWorker Beginer's question

Hi, I am trying to implement a GUI in java but I am beginner in swing. I want to make something clear. I read that in order to keep the GUI responsive I should use the SwingWorker class to do the task in a separate thread. Ok so far. No I have a model with around 15 methods that are remote methods. Each method returns different object ty...

Approach for mapping web service classes to local client classes

I have Java web serivce and .NET client application that consume this web service. When we connect to the service we generate service classes (serialization) in our project. But using this web service classes in code directly is wrong approach. I have some ideas about how to create and map my local class to web service class. But I am in...

New Design Patterns

is there any new design patterns available other than the patterns covered by GoF book and Head First Design Patterns? Have any one of you used your own design patterns in your projects? Please let me know. if possible give some UML Diagrams. Thanks in advance. ...

Why/Where/When shoud I do this? (enclose js code inside a function and then execute it)

Possible Duplicate: JavaScript scope and closure What is this for? (function(){ //The code to be executed })(); Also, has this anything to do with closures? ...

Pattern for class instantiation from only one single place?

C# .Net 4.0 I'd like to know how I can have a class which can only be instantiated from one single place. An example: I've got a Provider class. This class exposes a method called GetData. When GetData is called, the Provider will instanciate a Data class, populate and return it. The Data class cannot be instanciated by anybody differe...

RRDTool and projects that use it (cacti etc) - HOWTO, storage, backup etc.

I want to create an application similar to cacti. I would like to store time-series data in a MySQL database (that is rotated on schedule). Where does cacti (nagios, zenoss) store polled data? a) in a MySQL database b) in a RRD database c) both? How does cacti (nagios, zenoss) make room for more data when it runs out of space? Ho...

dynamically add different strings into an array list base on a pattern/algorithm/formula

is there a way to dynamically add this whole adding process instead of the manually entering the values like a.Add("1 & 2"); and so on by the way, this only happens if i select 5 conditions -i am doing the adding base on the maximum condition i cater which is 5 the subsets that i show below must be in that pattern although its ok that ...

When does an object qualify as a DTO?

Hi, DTO (Data Transfer Objects) are objects used to transfer information between multiple subsystems of an application, often separated by either a network or a process boundary. This is my understanding. However, from Java perspective, do the subsystems/modules have to be on different JVM instances for the objects they use between...

correct design pattern for employee vacation program?

Hi! I have what seems to be a simple employee time request web application I have to make (C#, Silverlight or ASP.NET). An employee can request vacation time, sick time, maternity leave, comp time, etc (there are probably about 10 different types of leave and could be more in the future) and their manager has to approve each request. ...

Lua Pattern for extracting/replacing value in / /

I have a string like "hello /world today/" I need to replace /world today/ with /MY NEW STRING/ Reading the manual I have found newString = string.match("hello /world today/","%b//") which I can use with gsub to replace, but I wondered is there also an elegant way to return just the text between the '/', I know I could just trim it, b...

NHibernate and AutoMapper

What is the best way to run raw SQL against NHibernate, then push it into List using AutoMapper? Example: public virtual List<T> GetList<T>(string mainsql) { IQuery q = GetSession().CreateSQLQuery(mainsql); IEnumerable srcAllRows = q.List(); List<T> targetAllRows = new List<T>(); *** do AutoMapper thing to get srcAllR...

Is there a standard pattern for avoiding latency in a job queue due to a single blocked task?

I have a basic queue of tasks executing (c# WinForms App that talks to 3 separate systems). Everything is great until one of the web services decides not to respond in with the usual speed. I'm not interested in speeding things up via multi threading the jobs, but now that I am using it in production, I can see the benefit of having at...

F#: Pattern Composition?

I'm trying to write a pattern that composes two other patterns, but I'm not sure how to go about it. My input is a list of strings (a document); I have a pattern that matches the document header and a pattern that matches the document body. This pattern should match the entire document and return the results of the header and body patter...

Is There any design pattern to make reports in my application?

Hi! I am doing an application and i will show some reports to the users. I would like to know if there is a pattern that helps me doing any report that i want. I also would like to provide the user to choose the fields that he wants in the report. I think it would help many people here, because we usually have reports in our applicatio...

Standard idiom for property change notifications on iPhone

Lets say I have a simple object that represents the state of a puzzle. The puzzle can be either solved or unsolved. I have two controllers with references to this puzzle object and they are visually representing the state in two different ways - say an on/off switch and a red/green light. When the 'solved' property of the puzzle changes...

Design Patterns Chain of Resposibility Vs Decorator..

How Chain of Responsibility Pattern Differs from Decorator Pattern..? ...

How to create default instances of the memento in a Memento Pattern ?

Hi, I use the Memento Pattern to save properties of a multi-instance form, where n forms are created by user inside a parent form. The purpose of the memento is to regain the same number of forms, and their settings, when a user close and later reopen the parent form. The saving of the form mementos are done by a "save" button on the pa...

Jee patterns - Registry and others - relevance

I am reading the book Patterns of enterprise application architecture. While going through the basic patterns - such as Registry pattern I am finding that possibilities that these patterns which were first published in Nov,2002 may not be the best possible solutions to go for. For example take the Registry pattern. In our organization w...

multi-wildcard pattern rules of GNU Make

I want to write something like regex: SRC:="a.dat.1 a.dat.2" $(SRC): %.dat.%: (\\1).rlt.(\\2) dat2rlt $^ $@ so that a.dat.1 and a.dat.2 will give a.rlt.1 and a.rlt.2. In GNU Make info page, it says "the % can be used only once". Is there some trick to achieve this in GNU Make? ...

What pattern is this refactoring?

I have an example with a bunch of logic in my GUI class (winforms). I am going to refactor that so that there is no logic in the gui and a separate class holds all the logic. What is that pattern? Say I had a form class called AddAddressForm, what would you call the associated file that holds the logic? AddAddressMediator (doesn't qu...