patterns

Translations/Rule pattern

I have some code which translates one domain object to a second domain object. One of the field values in the second object is translated via a long function containing a lot of “If then else” and return statements (100 lines of code). You can say, that several of the fields from the first object is used to determined the value of 1 fiel...

amazon design doubt

I was looking at the amazon website and was wondering how one of the feature would have been implemented. The feature : what customers buy after viewing a particular item. If i were to develop such a feature i would probably generate a session id for each user session and store the session id-page id combination in a log file. and if a ...

Async Load JavaScript Files with Callback

Hi All, I am trying to write an ultra simple solution to load a bunch of JS files asynchronously. I have the following script below so far. However the callback is sometimes called when the scripts aren't actually loaded which causes a variable not found error. If I refresh the page sometimes it just works because I guess the files are ...

Only allow setting a property from a specific class / instance

Hello, imagine I have two classes A and B where B has the properties BProperty1 and BProperty2. The property BProperty1 shall only be settable by class A (no matter which instance) The property BProperty2 shall only be settable by a concrete instance of class A (the reference to this instance could e.g. be stored on BProperty1). I...

Is MVP pattern best way for every winforms app?

HI, i would like develop application about storing some information about books, i would like use MVP pattern - but i have some doubts if this pattern is always best practise for developing small/mid winform apps or maybe is not necessary? ps. I would like use Smart Client Factory from Microsoft, is there any framework for MVP in winfo...

GUI Pattern for showing that child is inheriting value from parent

What is good GUI pattern for showing that a child is inheriting a value from its parent. In other words, if the user sets some value in the Parent, how would we indicate in the child that the value was set from the parent? Parent | Value : Foo | |----Child Value : Foo => inheriting value from parent. ...

Looking for parsing patterns for a Silverlight bbcode-to-TextBlock/Run parser

I would like to create a simple parser class for Silverlight which parses this text: [size=15]This is the header[/size] This is [i]italicized text[/i] and this is [b]bolded text[/b] and this is a hyperlink: [url]http://example.org[/url] and so is this: [url=http://example.com]Example[/url]. into this kind of code: T...

Is there any concept for activity tracking from a conceptual perspective during programming time?

I would like to learn what kind of real time activity/problem tracking methods people use. Let me clarify what I mean: When programming, I usually take a note for the current problem that I try to solve. I write down a sentence to name the problem. During research or debugging, I come across several alternative solution ideas that might...

Recognize Patterns of images JPG or PNG

Hello friend I want to recognize and determine the type of object into photo jpg or png with php, for example determine if exists a apple or grapes, or car, or animals into any photo. Please if somebody know about that, because I want to make exactly that. Regards Gildus ...

Which ESBs implement EAI patterns directly?

I know that service-mix do it by using camel. Which other ESBs uses the EAI patterns as documented by Gregor Hohpe and Bobby Woolf? ...

Java \ Pattern - how to write a pattern that verifies the lack of a string?

I tried from http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html I have Pattern PATTERN = Pattern.compile("agg{0}.*"); Matcher m = PATTERN.matcher("agg_0_4_Jul_2010_13_32_53_759_0.csv"); if (m.matches() == true) => true. I want this to return FALSE - since it does contain agg in the string start. in short - how to...

.net winforms GUI pattern for blotter

I have to design a .Net winforms GUI which has around 10 tabs - each of which display a blotter grid. The rows correspond to records in cache and the cache data changes frequently. The amount of data is large and the requirement is that only those grid cells should be updated for which the corresponding data has changed in the cache. Is...

Design pattern for shared error handling code

I'm looking for some thoughts/opinions on architecture for a layer of code that invokes methods in an API. In my case, the calling code is C#/.NET and the API is part of an unmanaged legacy DLL. But the same question could apply in many different languages/environments. I'm basically writing a managed wrapper around an unmanaged API. ...

General Architecture Question.

I have previously really only worked on your general 3-tier system. I am now tasked with something slightly different. I now need to retrieve files from 3rd party location using FTP. In the few times in the past I would have built a console app run and ran it on a schedule. It would have worked but maybe not been the best. I am looking...

Creating custom events - Object Sender or Typed Sender?

I searched through the archives and I found lots of questions about what sender is and why you should use the pattern but I didn't see anything about a custom event and the type if sender. Say I am creating a custom class called Subscription and it implements ISubscription and I have some event args called SubscriptionEventArgs. If Subs...

UI pattern for editing temporal tables

I'm writing a web interface to edit several values that change over time (for each employee, the changing attributes are role/division/workplace/type of contract/etc) and show the history of each change, and server-side validation. The user must be able to add new values, amend previous ones, change dates between periods, and so on. I a...

Confusion about super keyword; Decorator Pattern implemented in Java.

Hi, the above explanation is very nice. However, I am slightly confused by the implementation of Decorator Pattern (DeP) as given in http://www.netobjectives.com/resources/books/design-patterns-explained/java-code-examples/chapter17/#17-1 The design for above linked code is given at tinypic.com/view.php?pic=xnaqlt&s=3 I am confused...

the best way to process event in nested user controls

I'm novice in the GUI development, in particular with WPF, and don't know related patterns. So I want to ask you about a problem which arises from time to time and I'm not sure about the best solution for it. Let we have three user controls A, B, C and control A include control B, control B include control C. Let control C has a button....

Incorrect SAXParseException for pattern check

I am getting this SAXParseException which seems inherently wrong [org.xml.sax.SAXParseException: cvc-pattern-valid: Value 'ARC1350000114' is not facet-valid with respect to pattern '[a-z,A-Z]{3}[0-9]{10}' for type 'OrderId'.] The problem seems to disappear after a restart. This ghostly nature of the problem makes me a bit nervous. Has...

Database Design Pattern for Adding Notes to Columns

Hi, I'm designing a new DataBase that at the moment has 50 Tables. For many of that tables I have to eventually store a "note" for every column of every tuple. For now I found only 2 solutions: For each column of tables that needs note add a "column note" so for example: create table tab (id integer, A varchar(100), B varchar(200)) ...