patterns

Generating a URL pattern when provided a set of 5 or so URLs

Provided with a set of URLs, I need to generate a pattern, For example: http://www.buy.com/prod/disney-s-star-struck/q/loc/109/213724402.html http://www.buy.com/prod/samsung-f2380-23-widescreen-1080p-lcd-monitor-150-000-1-dc-8ms-1920-x/q/loc/101/211249863.html http://www.buy.com/prod/panasonic-nnh765wf-microwave-oven-countertop-1-6-ft...

WCF. Patterns. SQL Server

I will develop a WCF service. The service will get data from SQL Server. What patterns I should use to separate access code to SQL Server and other code. In future I am planning to change access logic to SQL Server (LINQ to SQL or ADO.NET or Entity Framework). ...

jQuery code organization and performance

After doing some research on the subject, I've been experimenting a lot with patterns to organize my jQuery code (Rebecca Murphy did a presentation on this at the jQuery Conference for example). Yesterday I checked the (revealing) module pattern. The outcome looks a bit reminiscent of the YUI syntax I think: //global namespace MyNameSp...

Correctly disposing user controls and child controls in C#

Hi we are experiencing a few problems with the IDisposable pattern. In this case there is a user control 'ControlA' with a FlowLayoutPanel, which contains more usercontrols 'ControlB'. When calling Dispose(bool), I check if disposing if true, and if IsDisposed is false. I then try to explicitly dispose each ControlB in the FlowLayoutPa...

What approach should I take to understand a large J2EE application if I don't know any of the frameworks involved yet?

I started working in my company 5 or 6 years ago as a junior Java developer, and I got to do some J2EE programming using Servlets and Jsp. I didn't spend much time in that position and I went to work with databases, so I distanced myself from the software development world. Now I've had to go back to Java programming, and I was given a W...

main objective of using factory pattern?

Some of people recommend the factory pattern in java. I am not aware of that. What is the main objective to use the factory pattern in java and Give me your suggestion which type of pattern is useful? ...

Java - pattern for textfield

Hello, I want user to type some text in JTextField and it must match some "pattern". Pattern is - int x, String("hours"), so f.e. 5 hours ; 12 hours etc. I googled something with patterns, matchers, regex or whatever, and I am pretty confused. If someone ever experienced similar problem, or knows how to handle mine, please post. Or at...

MVC Patterns - controllers and views

When using the MVC pattern, should I implement a seperate controller for each view? ...

database independent Silverlight application - possible ?

I am developing my application in Silverlight with MVVM pattern support. Now I use Sql server 2008, but I am start thinking about in future use also Oracle and XML as storage for my data. I query with linq to sql. It is pattern which I can use to completely automated and independent from database my application? Where I will only replac...

UI Code Level Patterns?

Is there a book or some other online resource that covers common code-level UI patterns (not widgets/components per se) and idioms. I'm looking for a resource that goes into some depth on MVC, event models, delegates, etc. Something in a similar vein to the POSA series would be excellent. I'm looking for something that is as platform-agn...

Parallel programming patterns for C#?

With Intel's launch of a Hexa-Core(6) processor for the desktop, it looks like we can no longer wait for Microsoft to make many-core programming "easy". I just order a copy of Joe Duffy's book Concurrent Programming on Windows. This looks like a great place to start, though, I am hoping some of you who have been targeting multi/many co...

Service Oriented Architecture & Domain-Driven Design

I've always developed code in a SOA type of way. This year I've been trying to do more DDD but I keep getting the feeling that I'm not getting it. At work our systems are load balanced and designed not to have state. The architecture is: Website ===Physical Layer== Main Service ==Physical Layer== Server 1/Service 2/Service 3/Servi...

Best practice for DAO pattern ?

I've seen a lot of codes use a service-dao pattern , I don't know the origin of this pattern . It force the front layer call service , then delegates some of the service task to dao. I want to ask : Does DAO layer do purely data access related task ? What about things like exception encapsulation? Is there any other pattern can be ...

Detecting similar words among n text documents

Hi; I have n documents and want to find common words that are included in these documents. For example I want to say (n-3) documents include the word "web". Certainly I can do this by basic data structures but there maybe efficient algorithm or a way to handle same words with different suffix. Is there any algorithm for such purposes?...

How to make 2 incompatible types, but with the same members, interchangeable?

Yesterday 2 of the guys on our team came to me with an uncommon problem. We are using a third-party component in one of our winforms applications. All the code has already been written against it. They then wanted to incorporate another third-party component, by the same vender, into our application. To their delight they found that the ...

session facade Vs Singleton object design patterns in ASP.Net

Hi, Can any one tell me which one is better in "Session Facade Class" and "Singleton Object" design patterns in ASP.Net? Also, please state the scenarions where specific design pattern is advisable to use. Thanks Rupa ...

php regular expression to match specific url pattern

I'd like to "grab" a few hundred urls from a few hundred html pages. Pattern: <h2><a href="http://www.the.url.might.be.long/urls.asp?urlid=1" target="_blank">The Website</a></h2> ...

Whats the best way of using MVC + ajax (jquery) to load page content, aspx or ascx or both

I want to have a menu that when I click replaces the content of a "main" div with content from a mvc view. This works just fine if I use a .aspx page, but any master.page content is then doubled (like the and any css/js). If I do the same but uses a .ascx user control the content is loaded without the extras, but if any browser loads th...

Typical tasks/problems to demonstrate differences between programming languages

Somewhere some guy said (I honestly do not know where I got this from), that one should learn one programming language per year. I can see where that might be a good idea, because you learn new patterns and ways to look at the same problems by solving them in different languages. Typically, when learning a new language, I look at how cer...

C# event or delegate or other solution?

Looking for some help or programmng ideas or mayeb there is some pattern that would help. Have an application that needs to fire alot of events sequentially, it could up to 100 or more unique events, it will be dynamic depeneding on the situation. Trying to find the best practice for doing this. My main idea right now is to create a li...