Search Results

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

Page 158/269 | < Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >

  • Custom Providers & Design Patterns

    - by Code Sherpa
    Hi. I am using ASP.NET 2.0 and its various providers. I have overridden most of the methods I need and have the following custom providers: ProjectMembershipProvider ProjectProfileProvider ProjectRoleProvider In the design of my project, my intention was to wrap the custom providers in a facade - style design - mixing and matching profiling, membership, and roles in API methods to simplify things for developers. But, I am finding that a lot of the methods in my custom providers don't need to change, really. And, it seems silly to wrap a stand-alone method in another method that does exactly the same thing. So - is my approach wrong? Or, should I allow end - users to instantiate the custom providers when needed and the mix/match api when needed? This seems a bit redundant to me but I can't see another way. Advice appreciated. Thanks.

    Read the article

  • How to convert DateTime string into a Format string

    - by AMissico
    With .NET, I have "Thursday, April 10, 2008 1:30:00 PM" and I want "dddd, dd MMMM, yyyy h:m:s t", "6:09:01 PM" and want ""hh:mm:ss tt", "Fri 29 Aug" and want "ddd d MMM", and so on. It seems I should be able to use DateTimeFormatInfo in some way. I figured I can format the date with each pattern returned by GetAllDateTimePatterns, and when the original date string and the formated date string match then I have the format. Yet, I want to generate custom formats, not the standard formats. I want the format string. I do not want the date. I have both the DateTime value and the formatted string value for the date. I need <formatString> as in ToString(<formatString>).

    Read the article

  • .NET - downloading multiple pages from a website with a single DNS query

    - by lampak
    I'm using HttpRequest to download several pages from a website (in a loop). Simplifying it looks like this: HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create( "http://sub.domain.com/something/" + someString ); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); //do something I'm not quite sure actually but every request seems to resolve the address again (I don't know how to test if I'm right). I would like to boost it a little and resolve the address once and then reuse it for all requests. I can't work out how to force HttpRequest into using it, though. I have tried using Dns.GetHostAddresses, converting the result to a string and passing it as the address to HttpWebRequest.Create. Unfortunately, server returns error 404 then. I managed to google that's probably because the "Host" header of the http query doesn't match what the server expects. Is there a simple way to solve this?

    Read the article

  • Regex to validate SMTP Responses?

    - by Alix Axel
    I'm writing a regular expression that can interactively validate SMTP responses codes, once the SMTP dialog is completed it should pass the following regex (some parentheses added for better readability): ^(220)(250){3,}(354)(250)(221)$ Or with(out) authentication: ^(220)(250)((334){2}(235))?(250){2,}(354)(250)(221)$ I'm trying to do rewrite the above regexes so that I can interactively check if the dialog is going as expected, otherwise politely send a QUIT command and close the connection saving bandwidth and time, but I'm having a hard time writing an optimal regex. So far I've managed to come up with: ^(220(250(334(235(250(354(250(221)?)?)?){0,})?){0,2})?)?$ Which, besides only matching authenticated connections, has some bugs... For instance, it matches: 220250334235250354250221 220250334334235250354250221 I've also tried the following modification: ^(220(250)?)?((334(235)?){2})?(250(354(250(221)?)?)?){0,}$ This one accepts non-authenticated responses but it fails to match 220250334 and wrongly matches 220250334334235250354250221 (at least 2 250 are needed before the 354 response code). Can someone help me out with this? Thanks in advance.

    Read the article

  • Odd results when searching for numbers using IXSSO.Query

    - by Vic
    Hi, from classic asp on Windows 2008, using an IXSSO.Query, when searching for a string of numbers, for example 10000000001, I receive results that also include variations to this, like 10000000002 10000000003 and so on. If I change the first digit so the search string is 20000000001 I dont get anything. If I keep moving the last digit from my first example to the left, I keep getting hits until I reach the half way point when I get no results! So in other words 10000020000 will return results like in the first example but 10000200000 does not. This all sounds like to me that its doing a match on the first 6 characters and it ignores the rest... Here is relevant parts of the Set oQuery = Server.CreateObject("IXSSO.Query") oQuery.Catalog = SEARCH_CATALOG oQuery.Query = "@all " & searchstr Set oRS = oQuery.CreateRecordset("nonsequential") Anyone got any ideas and/or suggestions? Thanks, Vic.

    Read the article

  • C2244 when trying to call the pow function from inline assembly

    - by schrödingers cat
    I would like to call the pow function from inline assembly. The problem is i'm getting error C2244: 'pow' : unable to match function definition to an existing declaration. I'm new to assembly so this may be a trivial question but how do i resolve this? I guess it has something to do with the compiler not beeing able to properly resolve the overload of pow. The following code fragment is causing the error: do_POW: // push first argument to the stack sub esp, size value_type fld qword ptr [ecx] fstp qword ptr [esp] // push second argument to the stack sub esp, size value_type fld qword ptr [ecx - size value_type] fstp qword ptr [esp]and pop fpu stack // call the pow function call pow sub ecx, size value_type fstp qword ptr [ecx] add esp, 2 * size value_type jmp loop_start

    Read the article

  • Programming on Leopard for iPhone OS 3.1.3

    - by Blank6
    Hey, I got Leopard with XCode 3.1 and SDK 3.0, when opening the organizer and trying to debug on my ipod I received "The version of iPhone OS on "..." does not match any of the versions of iPhone OS supported for development with this copy of xCode...". It tells me with my xCode I can only develop for iPhone OS 3.0 or less, so I downloaded the new xCode + SDK installation bundle, knowing the SDK can't be installed on Leopard. In the installation it tells me "If you don't want to install the SDK, press disagree", and so I did, but in the next screen he forces me to choose a drive for the SDK, and then says "you can't install the SDK on leopard system", and I can't pass this screen. My question is: is it even possible to program on Leopard for iPhone OS 3.1.3? I really want to debug my apps on my iPod (framework 3.1.3, 3G) Thanks ahead!! By the way: I can't so simply upgrade to snow leopard because it's a hackintosh, so I prefer a different way..

    Read the article

  • Need help with using regular expression in Java

    - by richard
    Hi, I am trying to match pattern like '@(a-zA-Z0-9)+ " but not like 'abc@test'. So this is what I tried: Pattern MY_PATTERN = Pattern.compile("\\s@(\\w)+\\s?"); String data = "[email protected] #gogasig @jytaz @tibuage"; Matcher m = MY_PATTERN.matcher(data); StringBuffer sb = new StringBuffer(); boolean result = m.find(); while(result) { System.out.println (" group " + m.group()); result = m.find(); } But I can only see '@jytaz', but not @tibuage. How can I fix my problem? Thank you.

    Read the article

  • Is strftime (hour) showing wrong time?

    - by ander163
    I'm using this line to get the beginning time of the first day of the month. t = Time.now.to_date.beginning_of_month.beginning_of_day When i display this using t.strftime("%A %b %e @ %l:%m %p") it shows: Monday Feb 1 @ 12:02 AM The hour is always 12 (instead of 00), and more wierd the minute changes to match the month in integers. For the February date, it shows 12:02 AM I use .prior_month and .next_month on the variable to move forward or backwards in time. So when I move to June, this would display as Tuesday June 1 @ 12:06 AM But when I just show the value of "t" using a straight t.to_s, I get this time of 00:00:00, which is what I expect: Mon Feb 01 00:00:00 -0700 2010 A similar error occurs using end_of_day, but the hour is always 11 PM and the minute is the same integer value that matches the month in integers, i.e the time is 11:06 PM in June, 11:02 PM in February. Qurky? Admittedly a noob to Rails. Thanks for any comments or explanations.

    Read the article

  • How should I compensate for a bad WSDL?

    - by Brabster
    I've come across several examples of SOAP-based web services where automated tooling fails to build a client that works. Investigating these examples leads me to believe that the WSDL the service uses to describe itself doesn't quite match the service that's being provided. Maybe a wrong type somewhere, a different data structure - something. I'm unsure what the most appropriate response is - if we assume that the obvious one (get the provider to fix their stuff) isn't available. Some options I can think of: Make a fixed WSDL? Hack the generated code? Any other options? No good options? What good experiences have people had? What works in a real environment? Thanks

    Read the article

  • How do you change the subdocument location in a Word 2007 master document programmatically?

    - by boost
    We have had the unenviable happen: various master documents refer to sub-documents that are no longer where they used to be due to a directory renaming. Is there a programmatic way of tweaking the HYPERLINK field without losing the master/sub-document relationship? I've got this far ... Sub FixyaLinks() Dim s 'As String Dim i As Long Dim bTrackRevFlag As Boolean Dim bShowRevFlag As Boolean bTrackRevFlag = ActiveDocument.TrackRevisions bShowRevFlag = ActiveDocument.ShowRevisions ActiveDocument.TrackRevisions = False ActiveDocument.ShowRevisions = False For i = 1 To ActiveDocument.Fields.Count s = ActiveDocument.Fields.Item(i).Code.Text If InStr(s, "CURRICULUM\\NEW") Then s = Replace(s, "NEW Foundation Units-in developing", "Foundation Programme Units") ActiveDocument.Fields.Item(i).Code.Text = s End If Next ActiveDocument.TrackRevisions = bTrackRevFlag ActiveDocument.ShowRevisions = bShowRevFlag End Sub It bombs on ActiveDocument.Fields.Item(i).Code.Text = s, with an error 5686 ("The operation cannot be completed because the Track Changes option in the master document does not match the option the the subdocument. Make the Track Changes option the same in the master document and subdocument.") However, I'm not entirely sure what that means. Ideas anyone?

    Read the article

  • F# return type coercion

    - by Alex
    Hi, In F# I have a function that returns System.Linq.Expression instances: and System.Object with member this.ToExpression() = match this with | :? System.Int32 -> Expression.Constant(this) :> Expression | :? System.Boolean -> Expression.Constant(this) :> Expression | :? Tml.Runtime.Seq as s -> s.ToExpression() | _ -> failwith "bad expression" If I omit the type coercions on the return values F# will infer the return type of the function to ConstantExpression. My first thought was to explicitly mark the return type as being : #Expression, but that didn't work. Is there a more elegant way of doing this that doesn't involve manually casting return types to the most generic type? Thanks.

    Read the article

  • Numerical Pattern Matching

    - by Timothy Strimple
    A project I'm researching requires some numerical pattern matching. My searches haven't turned up many relevant hits since most results tend to be around text pattern matching. The idea is we'll have certain wave patterns we'll need to be watching for and trying to match incoming data vs the wave database we will be building. Here is and example of one of the wave patterns we'll need to be matching against. There is clearly a pattern there, but the peaks will not have the exact same values, but the overall shape of the wave iterations will be very similar. Does anyone have any advice on how to go about storing and later matching these patterns, and / or other search terms I can use to find more information on the subject of pattern matching? Thanks, Tim.

    Read the article

  • J2ME TextField Exception

    - by Bob
    When I instantiate a textField, I have a number in it that I want to be the default text. The problem is, I can't seem to be able to place that value into the textfield without getting an error. The strange thing about it is that the same TextField is what I use to set the value of the variable containing the number. TextField myTF = new TextField("Number", value, 10, TextField.NUMERIC); When I run this code, I receive an exception stating that value doesn't match the constraints of TextField.NUMERIC. However, when I check the vale of the value of the variable, I get the following output: value = 1234567890 value.length() = 10 The value is set by the same TextField, saved to the phone that I am working on, and when loaded from the phone's settings, throws an exception.

    Read the article

  • implicit parameter definition in class

    - by coubeatczech
    implicit val odkaz = head; def vypis(implicit odkaz:Prvek):String = { odkaz match{ case null => "" case e => e.cislo + " " + e.pocet + "\n" + vypis(e.dalsi) } } ... def main(args:Array[String]){ val q = new MyQueue() // insert some values println(q.vypis) } This method(vypis) is a member of an queue-class so I'll always want to implicity start the recursion from the start of the queue, when calling the method from outside. Is there a way how to write it, that the method from outside calling, there's no paramter, but in inside, there's a parameter - for recursion...? The compiler complains that the parameter is not defined when called from outside

    Read the article

  • Returning partial address matches and mismatch position using L2S or SQL

    - by peter3
    I need to implement a method that takes an address split up into individual parts and returns any matching items from an address table. If no matches are found, I want to be able to return a value indicating where it failed. Each input param has a corresponding field in the table. The signature would look something like this: List<Address> MatchAddress(string zipCode, string streetName, string houseNumber, string houseLetter, string floor, string appartmentNo, out int mismatchPosition) { // return matching addresses // if none found, return the position where it stopped matching // zipCode is position 0, appartmentNo is position 5 // // an empty param value indicates "don't check" } I know I can construct the method such that I start with all the parameters, execute the query and then remove param by param (from the right side) until either a match is found or I run out of parameters, but can I construct a query that is more effective than that, i.e minimizing the number of calls to the db, maybe even as a single call?

    Read the article

  • Building path independent mod_rewrite statements for generic .htaccess file

    - by Pekka
    Say I have three small web applications stored under a shared web root: www.example.com/app1/ www.example.com/app2/ www.example.com/app3/ www.example.com/app4/ each application has a .htaccess file containing some run-off-the-mill mod_rewrite statements to rewrite urls like RewriteCond %{REQUEST_URI} ^/app1/([^/]+)/([^/]+)\.html$ RewriteRule .* /app1/index.php?selectedProfile=%1&match=%2&%{QUERY_STRING} now, I would like to have a generic .htaccess file in each /app{n} directory. So, no RewriteBase and no /app{n} prefix in the RewriteConds. One idea I had was making the first level a wildcard directory as well: RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/([^/]+)\.html$ seeing as the .htaccess file gets triggered only when the /app{n} directory is entered, this should work. Is this an acceptable solution? Are there other, better ones?

    Read the article

  • cant get my listbox to display objects

    - by Silvia Stoyanova
    Hello everyone I've been trying to put some objects in an ASP.NET list box but its just not working. I do have an overriden ToString method so I cant understand why this statement wont work. Here's the code that I use: for (int i = 0; i < fitnessClassList.Count(); i++) { lbDisplayItems.Items.Add(fitnessClassList.getFitnessClass(i)); } And the errors that I get: Error 2 Argument 1: cannot convert from 'FitnessClassManager.FitnessClassOpportunity' to 'System.Web.UI.WebControls.ListItem' Error 1 The best overloaded method match for 'System.Web.UI.WebControls.ListItemCollection.Add(System.Web.UI.WebControls.ListItem)' has some invalid arguments

    Read the article

  • Need to devise a number crunching algorithm

    - by Ravi Gupta
    I stumbled upon this question: 7 power 7 is 823543. Which higher power of 7 ends with 823543 ? How should I go about it ? The one I came up with is very slow, it keeps on multiplying by 7 and checks last 6 digits of the result for a match. I tried with Lou's code: int x=1; for (int i=3;i<=100000000;i=i+4){ x=(x*7)%1000000; System.out.println("i="+ i+" x= "+x); if (x==823543){ System.out.println("Ans "+i);} } And CPU sounds like a pressure cooker but couldn't get the answer :(

    Read the article

  • How to see a branch created in master

    - by richard
    Hi, I create a branch in my master repository (192.168.1.2). And in my other computer, I did '$ git pull --rebase ', I see Unpacking objects: 100% (16/16), done. From git+ssh://[email protected]/media/LINUXDATA/mozilla-1.9.1 62d004e..b291703 master -> origin/master * [new branch] improv -> origin/improv But when I do a 'git branch' in my local repository, I see only 1 branch and I did '$ git checkout improv ' $ git branch * master $ git checkout improv error: pathspec 'improv' did not match any file(s) known to git. Did you forget to 'git add'?

    Read the article

  • DataSetProvider - DataSet to ClientDataSet

    - by nomad311
    I am trying to take data from a TMSQuery which is connected to my DB and populate a ClientDataSet with some of that data using a DataSetProvider. My problem is that I will need to modify some of this data before it can go into my ClientDataSet. The ClientDataSet has persistent fields that will not match up with the raw DB data. I can't even get a string from the DB into a memo field in ClientDataSet. The ClientDataSet is a part of my data tier so I will need to conform the data from the DB to the ClientDataSet field by field (well most will be able to go right through, but many will require routing and/or conversion). Does anyone have experience with this?

    Read the article

  • Regexing it up with IIS re-write module

    - by Michael Jasper
    I am developing a profile-based web application where each user is assigned there own url through their username & iis rewrite mod's magic. A typical user's profile url would be http://www.mymark.com/mike Each user is also created a blog in a multi-user wordpress installation. The wordpress url would look like this: http://www.mymark.com/blog/mike I am trying to use the rewrite module to create more canonical urls for the user (http://www.mymark.com/mike/blog), and have tried several regex variations that I have created through RegExr(a regex generation tool) and come up with this as the pattern to match (www.|)mymark.com/([^/]+)/blog but haven't had any success so far. What am I doing wrong here? Here is a screen shot of my re-write rule:

    Read the article

  • MySQL 5.1 implicit cast from now() to a date field

    - by Savageman
    Hello, I have an issue with MySQL 5.1. A datetime data type isn't implicitly casted to match a date column. SELECT * FROM my_table WHERE my_date_field = NOW() This request doesn't return any rows using MySQL 5.1, but works well with version 5.0. If we use CURDATE() instead of NOW() it works both in MySQL 5.0 and MySQL 5.1. If the cast is explicit (CAST(NOW() AS DATE)), it also works both in MySQL 5.0 and MySQL 5.1. The problem only appears with implicit cast from datetime to date. Doesn't anyone already encountered this issue or has a clue about how to solve this problem? I know it's not the best to use NOW() instead of CURTIME(), but this isn't the question here. It is currently used in an application and the purpose is to avoid rewriting everything. Thanks!

    Read the article

  • double left MYSQL join?

    - by Haroldo
    I've been trying left joins but as there are 2 joins, i think the problem is the 2nd join roots from table_B not table_A. i am not getting any results where there is the required data in the db. I am not getting a query error the query (simplified) SELECT events.*, ven.*, events_genres.* FROM events LEFT JOIN ven //OPTIONAL JOIN ON events.ven_id = ven.ven_id //OPTIONAL JOIN LEFT JOIN events_genres //REQUIRED JOIN ON events.event_id = events_genres.event_id //REQUIRED JOIN WHERE events.date >= '$this->now' AND WHERE events_genres.g_id = $g_id //REQUIRED MATCH ORDER BY date ven = optional, i'll have the info if its there. events_genres = required, i dont want any results that do not have a genre

    Read the article

  • Programmatically determine DPI via the browser?

    - by Brandon Pelfrey
    Hi all. I would like to programmaticaly determine the DPI of a user's display in order to show a web page at a precise number of units (centimeters/inches). I know it a weird request: it's for a visualization research project and it's kind of a control. We currently do it by having the user place a credit card to the screen and match a resizable div (via Mootools) to the real credit card, and voila we can get the DPI and display the page correctly. Can anyone think of a programmatic way to do this?

    Read the article

< Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >