Search Results

Search found 6715 results on 269 pages for 'preg match'.

Page 116/269 | < Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >

  • Simple Regex Question

    - by Jim B
    Hey Everyone, I need to search a bunch of files for anything that contains either "tblPayment" or "tblInvoice" I also want to match any tables named "tblPaymentMethod", "tblInvoiceItem", "tblInvoicePayment" Anybody care to help me out with how to write a regular expression for this? Thanks again!

    Read the article

  • Correcting a plist with dictionaries

    - by ingenspor
    Plist is copyed to documents directory if it doesn't exist. If it already exists, I want to use the "Name" key from NSDictionary in bundleArray to find the matching NSDictionary in documentsArray. When the match is found, I want to check for changes in the strings and replace them if there is a change. If a match is not found it means this dictionary must be added to documents plist. This is my code: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self managePlist]; return YES; } - (void)managePlist { NSError *error; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Objects.plist"]; NSString *bundle = [[NSBundle mainBundle] pathForResource:@"Objects" ofType:@"plist"]; NSFileManager *fileManager = [NSFileManager defaultManager]; if (![fileManager fileExistsAtPath: path]) { [fileManager copyItemAtPath:bundle toPath:path error:&error]; } else { NSArray *bundleArray = [[NSArray alloc] initWithContentsOfFile:bundle]; NSMutableArray *documentArray = [[NSMutableArray alloc] initWithContentsOfFile:path]; BOOL updateDictionary = NO; for(int i=0;i<bundleArray.count;i++) { NSDictionary *bundleDict=[bundleArray objectAtIndex:i]; BOOL matchInDocuments = NO; for(int ii=0;ii<documentArray.count;ii++) { NSMutableDictionary *documentDict = [documentArray objectAtIndex:ii]; NSString *bundleObjectName = [bundleDict valueForKey:@"Name"]; NSString *documentsObjectName = [documentDict valueForKey:@"Name"]; NSRange range = [documentsObjectName rangeOfString:bundleObjectName options:NSCaseInsensitiveSearch]; if (range.location != NSNotFound) { matchInDocuments = YES; } if (matchInDocuments) { if ([bundleDict objectForKey:@"District"] != [documentDict objectForKey:@"District"]) { [documentDict setObject:[bundleDict objectForKey:@"District"] forKey:@"District"]; updateDictionary=YES; } } else { [documentArray addObject:bundleDict]; updateDictionary=YES; } } } if(updateDictionary){ [documentArray writeToFile:path atomically:YES]; } } } If I run my app now I get this message: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object' How can I fix this? When this is fixed, do you think my code will work? If not, I would be happy for some suggestions on how to do this. I have struggled for a while and really need to publish the update with the corrections! Thanks a lot for your help.

    Read the article

  • scp all files starting with 'file' from a server

    - by user209691
    Hi, I use this command to copy all files whose names start with 'file' from a server. scp -vp me@server:/location/files* ./ But i got a 'No Match' error. probably Concerning the '' in the command. How can i protect the '' for ssh to understand that this refers to a list of files and not taking it as a filename. Thx August

    Read the article

  • Java regular expression: how to include '-'

    - by changed
    I am using this pattern and matching a string. String s = "//name:value /name:value"; if (s.matches("(//?\\s*\\w+:\\w+\\s*)+")) { // it fits } This works properly. But if I want to have a string like "/name-or-address:value/name-or-address:value" which has this '-' in second part, it doesn't work. I am using \w to match A-Za-z_, but how can I include - in that?

    Read the article

  • removing items from a generic List<t>

    - by frosty
    I have the following method, I wish to remove items from my collection that match the product Id. Seems fairly straight forward, but i get an exception. Basically my collection is getting out of sync. So what is the best way to remove an item from a collection. public void RemoveOrderItem(Model.Order currentOrder, int productId) { foreach (var orderItem in currentOrder.OrderItems) { if (orderItem.Product.Id == productId) { currentOrder.OrderItems.Remove(orderItem); } } } Exception Details: System.InvalidOperationException: Collection was modified; enumeration operation may not execute

    Read the article

  • PCRE (recursive) pattern that matches a string containing a correctly parenthesized substring. Why d

    - by Anton N. Petrov
    Well, there are other ways (hmmm... or rather working ways) to do it, but the question is why does this one fail? / \A # start of the string ( # group 1 (?: # group 2 [^()]* # something other than parentheses (greedy) | # or \( (?1) \) # parenthesized group 1 ) # -group 2 + # at least once (greedy) ) # -group 1 \Z # end of the string /x Fails to match a string with nested parentheses: "(())"

    Read the article

  • Different values for Time.now when using activerecord

    - by Josué Lima
    I have this weird situation: When I do on rails console Time.now or Time.zone.now I get the same values (suppose they run at the sime time: 2014-06-05 23:38:06 -0300) But when I use Time.now in a query like: Match.where("datetime = ?", Time.now) it returns the time 3 hours ahead! .to_sql output: SELECT `matches`.* FROM `matches` WHERE (datetime = '2014-06-06 02:38:06') any thoughts on that? Rails 4 Mysql 5.5

    Read the article

  • How to return string name of calling method?

    - by keruilin
    Right now my code works as such: def method_a self.method_b ==> 'method_b' end def method_b puts self.name_of_calling_method end def name_of_calling_method if /`(.*)'/.match(caller.first) return $1 else return nil end end Instead of method_b printing 'method_b', how can I print the name of the calling method - 'method_a'?

    Read the article

  • Batch file to perform a looped search based on the line items of a text file.

    - by Tulga
    I have been reading great posts in this forum and got close to what I want to do but couldn't figure out the exact code. I want to create a windows batch file to do following: Perform a looped search for each line item of a text file (this is a list of keyword) to locate files in a a specific directory For this search partial match is okay. Each time a file is found, move it to a predefined directory (e.g. C:\temp\search_results) Thanks.

    Read the article

  • Using MSBuild, how to construct a dynamic string from iterating over files in an ItemGroup?

    - by RyBolt
    I need to create multiple /testcontainer: parameters to feed into a task that exec's MsTest. I have the following : <ItemGroup> <TestFiles Include="$(ProjectPath)\**\UnitTest.*.dll" /> </ItemGroup> for each match in TestFiles I would like to build a string like so: "/testcontainer:UnitTest.SomeLibrary1.dll" "/testcontainer:UnitTest.SomeLibrary2.dll" "/testcontainer:UnitTest.SomeLibrary3.dll" I am trying to use the internals of MSBuild without having to create a custom task, is this possible ? TIA

    Read the article

  • Regular Expression - Block Spam

    - by Immanuel
    Could someone lead me on finding a regular expression that blocks a comma separated list of Spam words I already have? The regular expression needs to match a string with the spam word list I already have. Not that it matters, but I am using PHP.

    Read the article

  • how to ensure comparison is case sensitive?

    - by newguy
    Hi there, im trying to do a comparison in MYSQL but wish for it to be case sensitive ex: $userID="test" $q = db_query("select * from users where user_id = '" . $userID . "'"); In DB: userid = "TEST" Ho do i go about making sure the mysql query does not return TRUE for this query as the userid varialbe doesnt match the case of the userid in the database thanks

    Read the article

  • 'Timeout Expired' error against local SQL Express on only 2 LINQ Methods...

    - by Refracted Paladin
    I am going to sum up my problem first and then offer massive details and what I have already tried. Summary: I have an internal winform app that uses Linq 2 Sql to connect to a local SQL Express database. Each user has there own DB and the DB stay in sync through Merge Replication with a Central DB. All DB's are SQL 2005(sp2or3). We have been using this app for over 5 months now but recently our users are getting a Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Detailed: The strange part is they get that in two differnt locations(2 differnt LINQ Methods) and only the first time they fire in a given time period(~5mins). One LINQ method is pulling all records that match a FK ID and then Manipulating them to form a Heirarchy View for a TreeView. The second is pulling all records that match a FK ID and dumping them into a DataGridView. The only things I can find in common with the 2 are that the first IS an IEnumerable and the second converts itself from IQueryable - IEnumerable - DataTable... I looked at the query's in Profiler and they 'seemed' normal. They are not very complicated querys. They are only pulling back 10 - 90 records, from one table. Any thoughts, suggestions, hints whatever would be greatly appreciated. I am at my wit's end on this.... public IList<CaseNoteTreeItem> GetTreeViewDataAsList(int personID) { var myContext = MatrixDataContext.Create(); var caseNotesTree = from cn in myContext.tblCaseNotes where cn.PersonID == personID orderby cn.ContactDate descending, cn.InsertDate descending select new CaseNoteTreeItem { CaseNoteID = cn.CaseNoteID, NoteContactDate = Convert.ToDateTime(cn.ContactDate). ToShortDateString(), ParentNoteID = cn.ParentNote, InsertUser = cn.InsertUser, ContactDetailsPreview = cn.ContactDetails.Substring(0, 75) }; return caseNotesTree.ToList<CaseNoteTreeItem>(); } AND THIS ONE public static DataTable GetAllCNotes(int personID) { using (var context = MatrixDataContext.Create()) { var caseNotes = from cn in context.tblCaseNotes where cn.PersonID == personID orderby cn.ContactDate select new { cn.ContactDate, cn.ContactDetails, cn.TimeSpentUnits, cn.IsCaseLog, cn.IsPreEnrollment, cn.PresentAtContact, cn.InsertDate, cn.InsertUser, cn.CaseNoteID, cn.ParentNote }; return caseNotes.ToList().CopyLinqToDataTable(); } }

    Read the article

< Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >