pattern

Reference Data Pattern

Similar to this thread, but not exactly: How To Cache Information In A Threadsafe Manner What is the usual pattern for dealing with "reference data" - data that is frequently read by an application, usually externalized in a database or properties file, but updated very infrequently (days, weeks, months)? When the data is updated, it wo...

Scaling a fill pattern in raphael.js

paper=Raphael('previewBody',480,480); paper.path({"stroke-width":1},'M0,0 L480,240 L480,480 L240,480 z') .attr('fill','url(bg.png)')) .scale(.5,.5,0,0); My problem is the fill is not scaled with the svg canvas, so proportionally, it ends up as twice the size it was before the scale of the path. Is there any easy way to scale the fi...

How to deal with unstable 3rd party object tree (sorry, I can’t come up with a better title)?

Let’s say I have to use an unstable assembly that I cannot refractor. My code is supposed to be the client of a CustomerCollection that is (surprise) a collection of Customer instances. Each customer instance has further properties like a collection of Order instances. I hope you get the idea. Since the assembly behaves not that well my...

ORM and Active Record Pattern in PHP?

Hi, There are two things that seem to be popular nowadays and I was wondering what are the pros and cons of using something like this: http://codeigniter.com/user_guide/database/active_record.html ? Another thing is ORM (Doctrine for instance). What are the benefits of using these? ...

Examples of "object dictionaries" in application protocols.

I am working on an application protocol for SCADA type applications. From previous experiences with SNMP and CAN Open, I like the idea of "Object Dictionaries" or "Information Bases" (MIB) as a generic way to describe a device and the fields it sends / receives in messages. Is there a proper name for this type of pattern? Further to t...

Makefile Pattern Issue

My compressed audio cafs, which should be copied by the 4th rule below, are being processed prematurely by the second rule because Assets/Audio/Compressed/Blah.caf matches the second rule (but I only want files in Assets/Audio (no deeper) to be handled by this rule). Ideas? I don't really want to simply change the rule order (as I think ...

MVC for a CMS? What about themes?

Hi I understand what is MVC and CMS. I understand MVC pattern and how CMS should working. But I have problem with theming and the pattern. Example: When CMS is installed on serwer I want to change my homepage. I want to display some additional data. I change my homepage template and add a function call to pull data from DB. My new dat...

Force Singleton Pattern on a Class implementing an Interface.

I better explain the question with an example. I have an Interface Model which can be used to access data. There can be different implementations of Model which can represent the data in various format say XMl , txt format etc. Model is not concerned with the formats. Lets say one such implementation is myxmlModel. Now i want to force m...

Pattern processing large knowledge sets from database using Drools?

Let's say you have a million entities persisted into the database. You want to fire your Drools rules on each persisted entity in order to check on what to do next with them. What would be the preferable way to do that? Would you prefetch data according to the rules (which would mean that you tie your DAO to your rules), or would you ju...

A/V pattern matching software

Hi All, I need a software that can do pattern matching of audio and video on a stream of data captured from say a Radio/TV. The software will know what to look for in the stream AND all this pattern matching should happen in real time. So, Is there any open source software that can do this. I know of commercial products. I m looking ...

Loading Subrecords in the Repository Pattern

Using LINQ TO SQL as the underpinning of a Repository-based solution. My implementation is as follows: IRepository FindAll FindByID Insert Update Delete Then I have extension methods that are used to query the results as such: WhereSomethingEqualsTrue() ... My question is as follows: My Users repository has N roles. Do I create...

Patterns for using EntityFramework ?

What is alternative patterns of using for Entity Framework ? Some I know are: "Plain" EntityFramework - aka Unity of Work using (Data.Model c = new Data.Model()) { var z = c.Users.Where(x=>x.Name=='John'); } Repository pattern //Model implements IRepository User user = Model.Instance.Get<User>(u => u.Name == "John"); What else...

Counting binary bit pattern combinations

I'm looking for an algorithm that will count the number of binary bit patterns in an n-bit word which are equal to or less than an arbitrary limit that is less than 2^n. Further, I want to generate the count for all 1-bit combinations, 2-bit combinations, etc.. Obviously, if the limit were 2^n, there would be 2^n combinations (C(n,1) 1-b...

How handle the CSS3 Spec. in a useful way?

The CSS3 Specifications are in the main browsers partly implemented and you get very nice results with less code, but there are many reasons not to use CSS3. E.g. not downwardly compatible, probably not similar renderd views on different browsers, etc. So I'm asking myself: Which is the best way to use CSS3 anyway with a option to inter...

Generic Java pattern recognition library - like regexps for List<Object>

Is there a library that would let me write regexp-like queries for lists of objects, just like java.util.regexp matches against strings, which are conceptually like lists of characters? I want to be able to use patterns with greedy/conservative quantifiers, identifying groups in matches, etc. Obviously I would have to provide the code f...

MVP pattern with dynamically created UI

using the MVP pattern in winforms is predicated on the presenter knowing about which controls to access as defined by the IViewInterface. for example if you had 2 textboxes and one button on your form, than you would define an IViewInterface with two properties for textbox and upon a button click event you forward the call to Presenter a...

MVC Specification

Of all MVC-capable GUI toolkits, which one do you think has the best spefication and which one the most drawbacks ? In which one do you find your code easy to maintain and extend? Which is one do you find crippled (if any) and for what reasons ? I' m mainly interested in Qt and Cocoa but i would like to hear about others too. Thank you...

How do you like the data access part (with SQL Server) of Agile Principles, Patterns, and Practices in C#

How do you think about data access code like this: public void AddCusotmer(Cusotmer customer) { //save customer into database ... // save payment type SavePaymentType(customer); //save other data ... } private void SavePaymentType(Customer customer) { if(customer.PaymentType is XXXPayment) { var payment ...

ASP.NET MVC ViewModel Pattern

EDIT: I made something much better to fill and read data from a view using ViewModels, called it ValueInjecter. http://valueinjecter.codeplex.com/ using the ViewModel to store the mapping logic was not such a good idea because there was repetition and SRP violation, but now with the ValueInjecter I have clean ViewModels and dry mapping ...

MVC - Separation of Concerns

I'm a newbie. I want to ask about the MVC model for separation of concerns. I have read up a few MVC tutorials but I don't yet have a full understanding of the roles of each of the Model, View and Controller. For instance say I am writing an application for a user to monitor a portfolio. I would like the landing page to display lists o...