Search Results

Search found 10046 results on 402 pages for 'repository pattern'.

Page 34/402 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • Ignore duplicates in regex pattern

    - by gAMBOOKa
    I have a regex pattern that searches for words in a text file. How do I ignore duplicates? For instance, take a look at this code $pattern = '/(lorem|ipsum|daboom|pahwal|ababaga)/i'; $num_found = preg_match_all( $pattern, $string, $matches ); echo "$num_found match(es) found!"; echo "Matched words: " . implode( ',', $matches[0] ); If I have more than one say lorem in the article, the output will be something like this 5 matches found! Matched words: daboom,lorem,lorem,lorem,lorem I want the pattern to only find the first occurrence, and ignore the rest, so the output should be: 2 matches found! Matched words: daboom,lorem

    Read the article

  • What design pattern do you use the most?

    - by spoon16
    I'm interested in understanding what design patterns people find themselves using often. Hopefully this list will help other recognize common scenarios and the associated design pattern that can be used to solve them. Please describe a common problem you find yourself solving and the design pattern(s) you use to solve it. Links to blogs or documentation describing the pattern are also appreciated. Edit: Please expand on your answers a bit, I would like this to be a useful reference for someone who wants to learn more about design patterns and is curious on what situations a specific design pattern might be used. Nobody has linked to any "more learning" resources.

    Read the article

  • Post/Redirect/Get Pattern and Sticky Forms

    - by Scott Christopherson
    I'm using the Post/Redirect/Get pattern on a form of mine. I've never used this approach before and I'm trying to figure something out: Normally, I always just displayed the posted form again when there were validation errors and displayed POST values in the form (sticky form). However with the PRG pattern, the form is displayed after a redirect, so there aren't any POST values. So my question is, how can I implement the PRG pattern and still have sticky forms?

    Read the article

  • Android pattern locking

    - by JonF
    I have been able to lock the screen using LOCK_PATTERN_ENABLED, however in many cases when I enable this pattern locking it will take any pattern and move past the pattern check. Has anyone else run across this?

    Read the article

  • Regular Expression to replace a pattern at runtime(C#3.0)

    - by deepak.kumar.goyal
    I have a requirement. I have some files in a folder among which some file names looks like say **EUDataFiles20100503.txt, MigrateFiles20101006.txt.** Basically these are the files that I need to work upon. Now I have a config file where it is mentioned as the file pattern type as EUDataFilesYYYYMMDD, MigrateFilesYYYYMMDD. Basically the idea is that, the user can configure the file pattern and based on the pattern mentioned, I need to search for those files that are present in the folder. i.e. at runtime the YYYYMMDD will get replaced by the Year Month and Date Values. It does not matter what dates will be there(but not with time stamp ; only dates)). And the EUDataFiles or MigrateFiles names will be there.(they are fixed) i.e. If the folder has a file name as EUDataFile20100504.txt(i.e. Year 2010, Month 05, Day 04) , I should ignore this file as it is not EUDataFiles20100504.txt (kindly note that the name is plural - File(s) and not file for which the system will ignore the file). Similarly, if the Pattern given as EUDataFilesYYYYMMDD and if the file present is of type EUDataFilesYYYYDDMM then also the system should ignore. How can I solve this problem? Is it doable using regular expression(Replacing the pattern at runtime)? If so can anyone be good enough in helping me out? I am using C#3.0 and dotnet framework 3.5. Thanks

    Read the article

  • Is Webhooks a style/pattern or a specification?

    - by Emilio
    I've been reading about Webhooks and I'm trying to determine if it's a specification vs a style/pattern. By "specification" I mean that the implementation details, e.g. headers, payload and so on are well defined. By "style" or "pattern" I mean in the sense that REST is a style (as opposed to a spec) or a pattern which describes usage but doesn't define implementation details. From what I see, Webhooks is a style/pattern. That the event(s) which triggers the http callbacks are generated however the developer wants, and that the http callbacks have no specific implementation requirements except to be an http post. Is this correct?

    Read the article

  • Delete all characters in a multline string upto a given pattern

    - by biffabacon
    Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like: #remove all chars up to first occurrence of cat or dog or rat $pattern = 'cat|dog|rat' $pagetext =~ s/(.*)($pattern)/$2/xms; What's the best way to do it in Python?

    Read the article

  • Bash Script using Grep to search for a pattern in a file

    - by atif089
    I am writing a bash script to search for a pattern in a file using GREP. I am clueless for why it isnt working. This is the program echo "Enter file name..."; read fname; echo "Enter the search pattern"; read pattern if [ -f $fname ]; then result=`grep -i '$pattern' $fname` echo $result; fi Or is there different approach to do this ? Thanks

    Read the article

  • Exploring the Factory Design Pattern

    - by asksuperuser
    There was an article here: http://msdn.microsoft.com/en-us/library/Ee817667%28pandp.10%29.aspx The first part of tut implemented this pattern with abstract classes. The second part shows an example with Interface class. But nothing in this article discusses why this pattern would rather use abstract or interface. So what explanation (advantages of one over the other) would you give ? Not in general but for this precise pattern.

    Read the article

  • Delete all characters in a multline string up to a given pattern

    - by biffabacon
    Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like: #remove all chars up to first occurrence of cat or dog or rat $pattern = 'cat|dog|rat' $pagetext =~ s/(.*?)($pattern)/$2/xms; What's the best way to do it in Python?

    Read the article

  • Decorator Pattern - Multiple wrappers or quantity property?

    - by Jiminizer
    I'm making use of the decorator pattern for one of the first times, as part of a Uni project. As far as I can see, the pattern seems to be meant more for adding functionality in a modular manner, however we've been taught it with uses such as a coffee or pizza maker, where the object has modular components that are added - changing properties rather than behaviour. I'm trying to make the most of both uses, however I've come up with a question. In the example in the book we're using (Head First Design Patterns), the pattern is used in a coffee shop creating different coffees. So, for example, milk, froth, sugar, sprinkles are all decorators. How would you implement a system that used the same decorator multiple times (for example, a coffee with two sugars)? Would you rewrap the coffee, or give sugar a quantity property? Or (as i'm starting to suspect) would this never be an issue as the pattern isn't designed to be used this way?

    Read the article

  • String pattern matching in Javascript

    - by kwokwai
    Hi all, I am doing some self learning about Patern Matching in Javascript. I got a simple input text field in a HTML web page, and I have done some Javascript to capture the string and check if there are any strange characters other than numbers and characters in the string. But I am not sure if it is correct. Only numbers, characters or a mixture of numbers and characters are allowed. var pattern = /^[a-z]+|[A-Z]+|[0-9]+$/; And I have another question about Pattern Matching in Javascript, what does the percentage symbol mean in Pattern matching. For example: var pattern = '/[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/';

    Read the article

  • Is this the Crudy anti pattern?

    - by miker169
    Currently I am creating a WCF service which has to connect to a DAL which, just connects to a database using ADO.net and stored procedures. The DAl writes its responses from the database to a datacontract which is passed over the wire to the client via the service. I was reading that this may possibly be the anti pattern 'CRudy Interface', but I wasn't sure as I am sharing the datacontract. If I am using an anti pattern, can anyone suggest a better pattern to use for the behavior I require? Thanks

    Read the article

  • Cygwin diff won't exclude files if a directory is included in the pattern

    - by Dean Schulze
    I need to do a recursive diff using cygwin that needs do exclude all .xml files from certain directories, but not from other directories. According to the --help option I should be able to do this with with the --exclude=PAT option where PAT is a pattern describing the files I want to exclude from the diff. If I do this: diff -rw --exclude="classes/Services.xml" the diff does not ignore the Services.xml file in the classes directory. If I do this diff -rw --exclude="Services.xml" the diff does ignore the Services.xml file in all directories. I need to do something like this: diff -rw --exclude="*/generated/resources/client/*.xml" to ignore all .xml files in the directory */generated/resources/client/. Whenever I add path information to the --exclude pattern cygwin does not ignore the file(s) I've specified in the pattern. Is there some way to make cygwin diff recognize a pattern that identifies certain files in certain directories? It seems to not be able to handle any directory information at all.

    Read the article

  • PHP : Pattern Replacement Query.

    - by Rachel
    Currently I have ‘customer_id’ . ‘+’ . ‘operator_domain’ pattern, e.g., '123456789'.'+'.'987654321' Desired Pattern: ‘customer_id.operator_domain’ pattern, e.g., '123456789987654321' How can I achieve this using in php ?

    Read the article

  • efficientcy effort: grep with a vectored pattern or match with a list of values

    - by Elad663
    I guess this is trivial, I apologize, I couldn't find how to do it. I am trying to abstain from a loop, so I am trying to vectorize the process: I need to do something like grep, but where the pattern is a vector. Another option is a match, where the value is not only the first location. For example data (which is not how the real data is, otherswise I would exploit it structure): COUNTRIES=c("Austria","Belgium","Denmark","France","Germany", "Ireland","Italy","Luxembourg","Netherlands", "Portugal","Sweden","Spain","Finland","United Kingdom") COUNTRIES_Target=rep(COUNTRIES,times=4066) COUNTRIES_Origin=rep(COUNTRIES,each=4066) Now, currently I got a loop that: var_pointer=list() for (i in 1:length(COUNTRIES_Origin)) { var_pointer[[i]]=which(COUNTRIES_Origin[i]==COUNTRS_Target) } The problem with match is that match(x=COUNTRIES_Origin,table=COUNTRIES_Target) returns a vector of the same length as COUNTRIES_Origin and the value is the first match, while I need all of them. The issue with grep is that grep(pattern=COUNTRIES_Origin,x=COUNTRIES_Target) is the given warning: Warning message: In grep(pattern = COUNTRIES_Origin, x = COUNTRIES_Target) : argument 'pattern' has length > 1 and only the first element will be used Any suggestions?

    Read the article

  • Setting up a GIt server

    - by lindenb
    Hi all, My team is working with several RedHat linux servers and we'd like to synchronize our sources from one server to another (for several distinct projects). I'd like to set-up a git-server as a version control; however I'm new to git and I'm confused by the terms ('server', "daemon', 'repository', etc...). Moreover we're working behind a firewall. Can anyone point me to a link about how to setup a git server ? Thanks. Pierre

    Read the article

  • How to setup Mercurial on Mac OS X 10.5.8 for remote access

    - by Abhic
    Hello I have a stable hackintosh box running 10.5.8 at home with py 2.5.1 and mercurial 1.5.2 setup successfully. Now I do not have any ports opened from this box and the associated router nor do I have any web servers running on this system. What are the steps that I have to take to setup this machine to be a remotely available as a mercurial repository? Thank you folks.

    Read the article

  • Are there free FTP serer backup repositories

    - by Saif Bechan
    I was wondering if there is a free service that provides a repository for your backups. These are backups of my server, there are usually about 200mb. I want to FTP the last 2 or 3. I am looking for a service that maybe provide some gigs of space and with FTP access. Looking at email providers such as gmail and hotmail that give you a couple of gigs of free space, this should also be possible or am i horribly wrong.

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >