pattern

Xml pattern restriction. Pattern for "x.x" like attribute value representing a version number

I have an XML attribute representing the version numbering of a file. The file version is identified internally by two byte fields so that, theoretically the versión could go from: 0.1 to 255.255. Is there any way to express that as a pattern restriction or any other kind of restriction in an XML Schema? Note: The problem is not restr...

XSLT - Match element with multiple child elements

<xsl:template match="element[child]"> The above works. What is the real syntax for the following pseudo-syntax? : <xsl:template match="element[child1 AND child2]"> In the place on AND: and doesn't work & doesn't work , doesn't work What is it? Thanks. ...

Pattern/architecture advice?

I am doing a project that recognize human face from camera. Here is the workflow: acquire a frame of image from camera detect if there is motion in the frame, if motion detected in current frame, put the motion frame in queue for further process. search faces in the output frame from step2 if there is faces, save the face what I want...

Data Access Design Patterns

Hi, Im looking for a pattern which I can use for parent-child relationships when inserting records into a database. As the child record needs the parent record to exist first, Im having to use nasty things like storing the session id then updating the foreign key after saving the parent record. Are there any well know patterns to solve ...

Android: how to create a background from pattern?

Hi, I got a pattern (.png image 4x4px) and have to fill the layout with it. Does anyone know how to do it? If I simply select the drawable as a background the image is streched but it has to be repeated along the x and y axis. ...

MVC Pattern in cakephp

Could someone explain me about MVC pattern? How does it help cakephp framework? ...

How to reuse existing connection in Open Session In view pattern implementation of Hibernate?

I am using Hibernate by implementing "Open Session in view" pattern?It opens a new connection per request. Is there any way to use the existing connection? Is my understanding correct? May be i miss something during implementation which cause opening of new connection? ...

help with c# pattern.

Hello and thanks for any assistance. using .Net 3.5 C#; Say i have about 10 methods that all follow the same pattern Using 3 as an example: public Customer CreateCustomer(Customer c) { .. } public Car CreateCar(Car c) { .. } public Planet CreatePlanet(Planet p) { ..} the internal logic of each method has the exact same pattern. ...

XSD pattern to match a priority order of comma separated words

I have a tag like this <order>foo,bar,goo,doo,woo</order> that I need to validate with an xsd. How do I write a regexp pattern that matches the string that contains: List item any of {foo,bar,goo,doo,woo} maximum once or is empty. Valid examples: <order>foo,bar,goo,doo,woo</order> <order>foo,bar,goo</order> <order>foo,doo,goo,wo...

C# - Avoid duplicating logic between WinForm and UserControl

Hi all, I found a question that I belive is what I was looking for, but there were certain things that I was not following in the answers. Therefore, I'd like to ask the question in a different way (Thanks for your patience). Here is the link I am referring to: http://stackoverflow.com/questions/259508/how-to-avoid-duplicating-logic-...

How crucial is Model View Controller pattern for software?

Hi all, I just attended an enterprise architecture session at my firm. The architect (astronaut) made a strong statement within the first 10 minutes. "If your software does not use the Model View Controller pattern, it cannot be called software" Well, it did create some noise in the room. What do you folks think. ...

use strategy pattern for billing models that use different data for the calculation?

we have an invoice model that bills clients in a few different ways. for brevity sake, i'm going to focus on two: cost per impression and cost per phone inquiry. my thought was to implement these (and the rest) as strategies and then dynamically mix them in to the invoice class. this seems appropriate because there are different source...

adding date to Java util logger fileHandler name

Hi I currently have this in my .properties file: java.util.logging.FileHandler.pattern = %h/programName%u%g.log I would also like to append a timestamp / username to this so its easy to identify log files does anyone know how? ...

What is 'Churchillian knock-off'?

Hi, I've read xUnit Test Patterns. http://martinfowler.com/books.html There is 'Churchillian knock-off' expression in Martin Fowler's writes like this... If you go to junit.org, you'll see a quote from me: "never in the field of software development have so many owed so much to so few lines of code". JUnit has been criticized as a minor...

Any open source /free OCR(Pattern recognition) software? (for mobile platforms?)

Hi, I want to extract the text information (Chinese) from the images that picked by users with their mobiles. So I am here wondering is there any open source/free OCR (Pattern recognition) software for mobile platform. Currently I am doing with iPhone (And android, blackberry platform?) I've searched stackoverflow but seems there only ...

How to exclude file patterns in vimgrep?

In vim, I do search with vimgrep frequently. I have mapping like below: map <leader>s :execute "noautocmd vimgrep /\\<" . expand("<cword>") . "\\>/gj **/*.*" <Bar> cw<CR> 5 The problem is that there are some temporary subfolders (like obj, objd) that I don't want to search for. How can I exclude subfolders matching given patterns. Fo...

Open source OCR for Chinese

I've searched around for open source OCR for Chinese. But without any luck there rarely seems to be some open source OCR (for Chinese) that are usable. So I am here wondering: Is there any open source OCR for Chinese that could be used for production environment? What's the main differences when implementing an OCR for Latin-languages...

Understanding Pattern and Matcher

Consider this code: import java.util.regex.*; public class Pattern3 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Pattern p = Pattern.compile("Our"); //line 1 Matcher m = p.matcher("Our mom and Our dad"); //line ...

Validating a domain object for persistence

In the system I'm currently working on, I'm following SRP (I think!) by separating the validation of domain business rules vs persistence constraints. Let's employ the overused customer example. Say a customer must have a valid zip code, street address and name to satisfy the system's business rules. Let's further say that the customer...

Python string pattern recognition/compression

I can do basic regex alright, but this is slightly different, namely I don't know what the pattern is going to be. For example, I have a list of similar strings: lst = ['asometxt0moretxt', 'bsometxt1moretxt', 'aasometxt10moretxt', 'zzsometxt999moretxt'] In this case the common pattern is two segments of common text: 'sometxt' and 'mo...