Search Results

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

Page 174/269 | < Previous Page | 170 171 172 173 174 175 176 177 178 179 180 181  | Next Page >

  • Deserialising Json to derived types in Asp.Net Web API

    - by IoChaos
    I'm calling a method of my WebAPI sending a json that I would like to match (or bind) with a model. In the controller I have a method like: public Result Post([ModelBinder(typeof(CustomModelBinder))]MyClass model); 'MyClass', wich is given as a parameter is an abstract class. I would like that at, depending of the type of json passed, the correct inherited class is instantiated. To achieve it, I'm trying to implement a custom binder. The problem is that (I don't know if it's very basic but I can't find anything) I don't know how to retrieve the raw Json (or better, some kind of serialization) that comes in the request. I see: actionContext.Request.Content But all methods are exposed as async. I don't know who this fits with passing the generate model to the controller method... Thanks a lot!

    Read the article

  • case-insensitive matching in xpath?

    - by Ethan
    For example, for the xml below <CATALOG> <CD title="Empire Burlesque"/> <CD title="empire burlesque"/> <CD title="EMPIRE BURLESQUE"/> <CD title="EmPiRe BuRLeSQuE"/> <CD title="Others"/> <CATALOG> How to match the first 4 records with xpath like //CD[@title='empire burlesque']. Is there xpath function to do this? Other solutions like PHP function are also accepted.

    Read the article

  • How do you escape double quotes inside a SQL fulltext 'contains' function?

    - by Richard Davies
    How do you escape a double quote character inside a MS SQL 'contains' function? SELECT decision FROM table WHERE CONTAINS(decision, '34" AND wide') Normally contains() expects double quotes to surround an exact phrase to match, but I want to search for an actual double quote character. I've tried escaping it with \, `, and even another double quote, but none of that has worked. P.S. I realize a simple example like this could also be done using the LIKE statement, but I need to use the fulltext search function. The query I provided here has been simplified from my actual query for example purposes.

    Read the article

  • Fibonacci Numbers in Haskell

    - by boraer
    Hi everbody I need to change my F# code to Haskell code but I am so new in Haskell and I can not this My code simply read data from keyboard if data not an integer return an error message then calculate the n fibonacci number then writes to a list after that writes the list into a txt file Here is my code open System let rec fib n = match n with |0->0 |1->1 |2->1 |n->fib(n-1)+fib(n-2);; let printFibonacci list = for i=0 to (List.length list)-1 do printf "%d " (list.Item(i));; let writeToFile list = let file = System.IO.File.Create("C:\out2.txt") let mutable s ="" let writer = new System.IO.StreamWriter(file) try for i=0 to (List.length list)-1 do s <- list.Item(i).ToString() writer.Write(s+" ") finally writer.Close() file.Dispose() printfn "Writed To File" let mutable control = true let mutable num = 0 while control do try printfn "Enter a Number:" num <- Convert.ToInt32(stdin.ReadLine()) let listFibonacci = [for i in 0 .. num-1->fib(i)] printFibonacci(listFibonacci) printfn "\n%A"(listFibonacci) writeToFile(listFibonacci) control<-false with | :? System.FormatException->printfn "Number Format Exception"; Console.ReadKey true|>ignore

    Read the article

  • python grep reverse matching

    - by thomytheyon
    Hi Alls, I would like to build a small python script that basicaly does the reverse of grep. I want to match the files in a directory/subdirectory that doesn't have a "searched_string". So far i've done that: import os filefilter = ['java','.jsp'] path= "/home/patate/code/project" for path, subdirs, files in os.walk(path): for name in files: if name[-4:] in filefilter : print os.path.join(path, name) This small script will be listing everyfiles with "java" or "jsp" extension inside each subdirectory, and will output them full path. I'm now wondering how to do the rest, for example i would like to be able if I forgot a session management entry in one file (allowing anyone a direct file access), to search for : "if (!user.hasPermission" and list the file which does not contain this string. Any help would be greatly appreciated ! Thanks

    Read the article

  • Grep for multiple patterns over multiple files

    - by prelic
    I've been googling around, and I can't find the answer I'm looking for. Say I have a file, text1.txt, in directory mydir whose contents are: one two and another called text2.txt, also in mydir, whose contents are: two three four I'm trying to get a list of files (for a given directory) which contain all (not any) patterns I search for. In the example I provided, I'm looking for output somewhere along the lines of: ./text1.txt or ./text1.txt:one ./text1.txt:two The only things I've been able to find are concerning matching any patterns in a file, or matching multiple patterns in a single file (which I tried extending to a whole directory, but received grep usage errors). Any help is much appreciated. Edit-Things I've tried grep "pattern1" < ./* | grep "pattern2" ./* "ambiguous redirect" grep 'pattern1'|'pattern2' ./* returns files that match either pattern

    Read the article

  • Returning a recordcount from a subquery in a result set.

    - by KeRiCr
    I am attempting to return a rowcount from a subquery as part of a result set. Here is a sample that I've tried that didn't work: SELECT recordID , GroupIdentifier , count() AS total , (SELECT COUNT() FROM table WHERE intActingAsBoolean = 1) AS Approved FROM table WHERE date_format(Datevalue, '%Y%m%d') BETWEEN 'startDate' AND 'endDate' GROUP BY groupIdentifier What I'm attempting to return for 'Approved' is the number of records for the grouped value where intActingAsBoolean = 1. I have also tried modifying the where clause by giving the main query a table alias and applying an AND clause to match the groupidentifier in the subquery to the main query. None of these are returning the correct results. The query as written returns all records in the table where intActingAsBoolean = 1. This query is being run against a MySQL database.

    Read the article

  • HELP! need to make a VoIP program for WiMAX in NS-2 work..

    - by janiemack
    I've been trying to get this working for the past 2 days and i'm completely stuck. I'm trying to make a simple VoIP program work in the NIST module for WiMAX http ://community.4gdeveloper.com/attachments/download/14/090720150504_ns2-Release-2.6.tar.gz version 2.6 , using NS-2.31 (remove space btw 'p' and ':' ) http ://downloads.sourceforge.net/nsnam/ns-allinone-2.31.tar.gz?modtime=1173548159&big_mirror=0 (remove space btw 'p' and ':' ) The installation process goes fine. When i run this program, I'm getting an error saying " OFDMAPhy : error did not find match for permutation and bw combination" Some help would be really appreciated. thanks!

    Read the article

  • C++ shared libraries

    - by saminny
    Hi, I am trying to get my head around the way shared libraries work in the c++ unix environment. I understand we only need header files and no shared libraries specification when compiling code. But if I want to create an executable or shared library from my compiled files, do I need to specify shared library dependencies (those are dynamic)? And do the paths of shared libraries need to match the path at runtime loading? I am using Linux 2.6.18-164.11.1.el5 #1 SMP x86_64 GNU/Linux I am having a problem where my code is not able to pick up a library at runtime. I have tried setting LD_LIBRARY_PATH and PATH. But at runtime when I run the executable, I get the following error: Error: librc.so: cannot open shared object file: No such file or directory Sam

    Read the article

  • MVC route with id and sub-action

    - by Dan Revell
    I can't figure out what I need to do with MVC routing to make this work Here's my one route: routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "{controller}/{id}/{action}", defaults: new { id = RouteParameter.Optional, action = RouteParameter.Optional } ); The request /Shipments/ works great. The request /Shipments/3/Packages works great. The request /Shipments/3 however fails with the error: Multiple actions were found that match the request: System.Linq.IQueryable`1[Api.Controllers.RequisitionsController+PackageRequisitionWithTracking] GetPackageRequisitions(Int32) on type Api.Controllers.RequisitionsController Api.Models.ShipmentRequisition GetShipmentRequisitions(Int32) on type Api.Controllers.RequisitionsController It can't seem to differentiate between: public ShipmentRequisition GetShipmentRequisitions(int id) and [ActionName("Packages")] public IQueryable<PackageRequisitionWithTracking> GetPackageRequisitions(int id) I would have thought the lack of action name on the get shipment by id would allow that route to work.

    Read the article

  • Address of array vs. address of array[0] - C language

    - by user324994
    My question is why does the address of an array differ from the address of its first position? I'm trying to write my own malloc, but to start out I'm just allocating a chunk of memory and playing around with the addresses. My code looks roughly like this: #define BUFF_SIZE 1024 static char *mallocbuff; int main(){ mallocbuff = malloc(BUFF_SIZE); printf("The address of mallocbuff is %d\n", &mallocbuff); printf("The address of mallocbuff[0] is %d\n", &mallocbuff[0]); } &mallocbuff is the same address every time I run it. &mallocbuff[0] is some random address every time. I was expecting the addresses to match each other. Can anyone explain why this isn't the case?

    Read the article

  • scala 2.8.0.RC2 compiler problem on pattern matching statement?

    - by gruenewa
    Why does the following module not compile on Scala 2.8.RC[1,2]? object Test { import util.matching.Regex._ val pVoid = """\s*void\s*""".r val pVoidPtr = """\s*(const\s+)?void\s*\*\s*""".r val pCharPtr = """\s*(const\s+)GLchar\s*\*\s*""".r val pIntPtr = """\s*(const\s+)?GLint\s*\*\s*""".r val pUintPtr = """\s*(const\s+)?GLuint\s*\*\s*""".r val pFloatPtr = """\s*(const\s+)?GLfloat\s*\*\s*""".r val pDoublePtr = """\s*(const\s+)?GLdouble\s*\*\s*""".r val pShortPtr = """\s*(const\s+)?GLshort\s*\*\s*""".r val pUshortPtr = """\s*(const\s+)?GLushort\s*\*\s*""".r val pInt64Ptr = """\s*(const\s+)?GLint64\s*\*\s*""".r val pUint64Ptr = """\s*(const\s+)?GLuint64\s*\*\s*""".r def mapType(t: String): String = t.trim match { case pVoid() => "Unit" case pVoidPtr() => "ByteBuffer" case pCharPtr() => "CharBuffer" case pIntPtr() | pUintPtr() => "IntBuffer" case pFloatPtr() => "FloatBuffer" case pShortPtr() | pUshortPtr() => "ShortBuffer" case pDoublePtr() => "DoubleBuffer" case pInt64Ptr() | pUint64Ptr() => "LongBuffer" case x => x } }

    Read the article

  • UITableViewCell height with 0 rows

    - by Typeoneerror
    I've got a moderately uncustomized UITableView in my application that presents an array of up to 6 peers for a networking game. When no peers are found the numberOfRowsInSection is 0, so when it loads up, there's no rows in the table: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 0; } Trouble is, the height of each cell is not adjusted to match heightForRowAtIndexPath unless the numberOfRowsInSection is 0. I hard-coded in "1" for this and the height is adjusted. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return kTableRowHeight; } Can anyone tell me why this is? Will once the data that is being presented is longer than "0" length, will the height of the table cells jump to the correct height? I'd like them to be the correct height even if the row length is 0.

    Read the article

  • issue with regex in C#

    - by Dilip
    my file is > A B C D unuse data <begin> Addd as ss 1 My name is 2323 33 text > </end> 34344 no need and my code is StringBuilder mSb = new StringBuilder(); StreamReader sr = new StreamReader(@"E:\check.txt"); String line; while (sr.ReadLine() != null) { mSb.AppendLine(sr.ReadLine()); } string matc = new Regex(@"(<begin>)(\n?.*)*</end>)?").Match(mSb.ToString()).ToString(); here it reading all file , but i just want till if i am removing ? from end , my program is crashing .. Thanks

    Read the article

  • What wiki tools exist to generate shippable user doc from a wiki?

    - by tletnes
    I am looking into using a wiki (prefer mediawiki, but not a req.) as the repository for developer generated documentation (User Guides, Release Notes, Application Notes, Errata, etc.) from a collaborative/easy-to-update point of view a wiki seems like a good match, however since this documentation will ultimately ship to customers we want to be able to export the documents in their final state (e.g. during the release cycle) to static versions that no longer include histories. Ideally the export would leave the document n a form where errors could be easily fixed by a non-programmer It would be good if niceties like section ordering and table of contents were available, or easy to add after the fact. Are any tools with features like these avalible?

    Read the article

  • scala xml rewrite rule (or, simple pattern help)

    - by williamstw
    I'm missing some fairly simple syntax I gather. I'm trying to rewrite an element label to something else and keep everything else intact. object htmlRule extends RewriteRule { override def transform(n: Node): Seq[Node] = n match { case Elem(prefix, "document", attribs, scope, child@_*) => Elem(prefix, "html", attribs, scope, child) case other => other } } Now, I ask for an explanation of two things: 1) What exactly does "child@_*" mean in plain English? 2) How can I capture the value of "child@_*" and just let it pass right through to the new element? Currently, I get the following error, which makes sense. [error] found : Seq[scala.xml.Node] [error] required: scala.xml.Node [error] Elem(prefix, "html", attribs, scope, child) I'm not wedded to this either, so if there's a better way to simply change the element name of a specific node, let's here it... Thanks, --tim

    Read the article

  • HELP with sql query involving two tables and a max date

    - by wes
    hello all....firstly any help is greatly appreciated! i have been searching for a solution to my problem for a while and haven't found exactly what i am looking for. i have two tables notifications and mailmessages. notifications has fields( notifytime, notifynumber, and accountnumber). mailmessages has fields(id, messagesubject, messagenumber, accountnumber) my goal is to create a single sql query to retrieve distinct rows from mailmessages WHERE the accountnumber is a specific number AND the notifynumber=messagenumber AND ONLY the most recent notifytime from the notifications table where the accountnumbers match in both tables. i am using sqlexpress2008 as a backend to an asp.net page....this query should return distinct messages for an account with only the most recent date from the notifications table..please help! i'll buy you a beer!!!

    Read the article

  • Question about ASP.NET MVC and static data (ie. images, scripts, etc)

    - by Pure.Krome
    Hi folks, If i have a request for a resource in my ASP.NET MVC1 (or 2) web app for a static resource, say ... an image or a javascript file or a css file ... does the .NET framework try and see if the request matches the route list ... and eventually can't find a controller for it? eg. Resource: /Content/Images/Foo.png Does this request go through my route list .. fails to match any controllers / actions to this request and then .. i donno ... attempt that path directly?

    Read the article

  • How to store Hierarchical K-Means tree for a large number of images, using Opencv?

    - by AquaAsh
    I am trying to make a program that will find similar images from a dataset of images. The steps are 1)extract SURF descriptors for all images 2)store the descriptors 3)Apply knn on the stored descriptors 4)Match the stored descriptors to the query image descriptor using KNN Now each images SURF descriptor will be stored as Hierarchical k means tree, now do I store each tree as a separate file or is it possible to build some sort of single tree with all the images descriptors and updated as images are added to dataset. This is the paper I am basing the program on www.ijest.info/docs/IJEST10-02-03-13.pdf.

    Read the article

  • Regex "or" Expression

    - by David
    This is probably a really basic question, but I can't find any answers. I need to match a string by either one or more spaces OR an equals sign. When I split this string: 9 x 13 = (8.9 x 13.4) (89 x 134) with ( +) I get: part 0: 9 x 13 = (8.9 x 13.4) part 1: (89 x 134) When I split it with (=) I get: part 0: 9 x 13 part 1: (8.9 x 13.4) (89 x 134) How can split by BOTH? Something like: (=)OR( +) Edit: This does not work(=)|( +) Test it here: http://myregexp.com/ under "split".

    Read the article

  • VBA for filtering columns

    - by Ampi Severe
    I have a big database-like sheet, first row contains headers. I would like a subset of rows of this table based on column values. Two issues: 1) VBA-wise I would like to loop through the columns, when the values for all necessary columns all match, copy the entire row into a new sheet. 2) The subset of rows is based on a list. This should be the first column to be looped through. For example I want all rows where the value in column A is equal to one of the values in my list. Is there any possibility to autofilter strings based on a list (column) of strings? EDIT Thanks to @Doug Glancy the autofiltering works now, so I've removed my (horrible) code and issue 1 is solved.

    Read the article

  • BeautifulSoup Parser Confusion - HTML

    - by lyngbym
    I'm trying to scrape some content off another site and I'm not sure why BeautifulSoup is producing this output. It is only finding a blank space inside the match, but the real HTML contains a large amount of markup. I apologize if this is something stupid on my part. I'm new to python. Here's my code: import sys import os import mechanize import re from BeautifulSoup import BeautifulSoup def scrape_trails(BASE_URL, data): #Get the trail names soup = BeautifulSoup(data) sitesDiv = soup.findAll("div", attrs={"id" : "sitesDiv"}) print sitesDiv def main(): BASE_URL = "http://www.dnr.state.mn.us/skiing/skipass/list.html" br = mechanize.Browser() data = br.open(BASE_URL).get_data() links = scrape_trails(BASE_URL, data) if __name__ == '__main__': main() If you follow that URL you can see the sitesDiv contains a lot of markup. I'm not sure if I'm doing something wrong or if this is just malformed markup that the script can't handle. Thanks!

    Read the article

  • Url Rewriting with Querystrings

    - by Alon
    In IIS 7.5, I'm trying to rewrite a Url such as /about to /content.asp?p=about, with support for QueryString-s, so if the orginal Url was /about?x=y, it should rewrite to /content.asp?p=about&x=y. The basic rewriting is now working, but when I'm trying to add a QueryString it doesn't work. Tried both /about?x=y and /about&x=y. My current rule: <rule name="RewriteUserFriendlyURL1" stopProcessing="false"> <match url="^([^/]+)/?$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="content.asp?p={R:1}" /> </rule> How can I fix this? Thank you.

    Read the article

  • jQuery sanitizing comments and linkifying URLs

    - by iWasRobbed
    In terms of jQuery (or Javascript), what happens behind the scenes when a person posts a comment on Facebook, Twitter, or a blog? For instance, do they sanitize the text first, and then pattern match URL's into an actual link? Are there other items of concern that the client-side should check in addition to doing some checks on the backend? I have found a few regex's for turning URL's into links, but I'm not sure if there are better solutions. I'm trying to wrap my head around the problem, but I'm having a difficult time knowing where to start. Any guidance you can provide is greatly appreciated!

    Read the article

  • function to remove duplicate characters in a string

    - by Codenotguru
    The following code is trying to remove any duplicate characters in a string.Iam not sure if the code is right??Can anybody help me with the working of the code i.e whats actually happening when there is a match in characters? public static void removeDuplicates(char[] str) { if (str == null) return; int len = str.length; if (len < 2) return; int tail = 1; for (int i = 1; i < len; ++i) { int j; for (j = 0; j < tail; ++j) { if (str[i] == str[j]) break; } if (j == tail) { str[tail] = str[i]; ++tail; } } str[tail] = 0; }

    Read the article

< Previous Page | 170 171 172 173 174 175 176 177 178 179 180 181  | Next Page >