Search Results

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

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

  • Facebook Error: "The client token cannot be used for this API" - works on DEV and STAGE but not on LIVE app?

    - by Studio Temp
    I've built a notification sending system that sends notifications to all users of our app, using the app access token. This system is currently running on my localhost. When I configure it with the appid and appsecret for my dev and stage environments, it works fine. But when I put in the appid and appsecret of the LIVE app, I get this error: {"message":"The client token cannot be used for this API", "type":"OAuthException", "code":190} So what's different between dev and live? Dev and Stage are in sandbox mode, Live is not. So I tried disabling sandbox mode on Dev/Stage and they continue to function fine. Dev works fine, Stage works fine, Live gives this error. All other code is the same except for the appid, appsecret, and redirect_uri (changing it to match the domain of each environment). I have checked this post, but unfortunately resetting our appsecret on a site with 1,000,000 users is not something we can do at the moment (too much other functionality relies on it).

    Read the article

  • iOS Development: Should the "playersToInvite" property contain an array of strings or an array of GKPlayer objects?

    - by BeachRunnerJoe
    Should the playersToInvite property of the GKMatchRequest object contain an array of NSString objects that hold the player id's or should it contain an array of GKPlayer objects? The documentation on this critical property is not clear at all and I've tried both ways, but my code isn't working, so I can't tell by experimentation. Here's the description for that property in the docs... A list of players to invite to the match. Why did they even bother writing that? Thanks for your help!

    Read the article

  • Are there any XML Editors with FTP and file-tree browsing combined?

    - by JW
    Are there any (free preferably) XML Editors combined with FTP and file-tree browsing Project wide find+Replace I.e A bit like what Dreamweaver MX is but with fancier XML capabilities /XSLT /XSD Perhaps even DW does this...im still on an older version. I'd like to keep a smooth flow between find-edit-view-upload any ideas? Background: I have converted most of the html files of my legacy site into XML (which match the directory structure of my 'public docs' folder). Part of a step towards turning it into completely dynamic data via MVC /Front Controller Pattern.

    Read the article

  • Code Review: CLR RegexSubstring

    - by OMG Ponies
    Could this be better? .NET 2.0 compatibility for SQL Server 2005: public static SqlString RegexSubstring(SqlString regexpattern, SqlString sourcetext, SqlInt32 start_position) { SqlString result = null; if (!regexpattern.IsNull && !sourcetext.IsNull && !start_position.IsNull) { int start_location = (int)start_position >= 0 ? (int)start_position : 0; Regex RegexInstance = new Regex(regexpattern.ToString()); result = new SqlString(RegexInstance.Match(sourcetext.ToString(), (int)start_position).Value); } return result; }

    Read the article

  • Rails routes looking for show action

    - by user1334345
    I am pretty new to rails and basically I want to make a user registration form. I am currently using rails 3.2.3 Basically I want to make basic routes like user/register on top of basic REST route for user. Here are my routes.rb resources :user do collection do get 'register' end end And here are my rake routes: register_user_index GET /user/register(.:format) user#register user_index GET /user(.:format) user#index POST /user(.:format) user#create new_user GET /user/new(.:format) user#new edit_user GET /user/:id/edit(.:format) user#edit user GET /user/:id(.:format) user#show PUT /user/:id(.:format) user#update DELETE /user/:id(.:format) user#destroy From my understanding, since register user is on top of show, it should match with register first before going to show. However, when I try to do localhost:3000/user/register, it gives me this error: No route matches {:action="show", :controller="user"} Can somebody help me with this? Thanks!!

    Read the article

  • Extract and replace named group regex

    - by user557670
    I was able to extract href value of anchors in an html string. Now, what I want to achieve is extract the href value and replace this value with a new GUID. I need to return both the replaced html string and list of extracted href value and it's corresponding GUID. Thanks in advance. My existing code is like: Dim sPattern As String = "<a[^>]*href\s*=\s*((\""(?<URL>[^\""]*)\"")|(\'(?<URL>[^\']*)\')|(?<URL>[^\s]* ))" Dim matches As MatchCollection = Regex.Matches(html, sPattern, RegexOptions.IgnoreCase Or RegexOptions.IgnorePatternWhitespace) If Not IsNothing(matches) AndAlso matches.Count > 0 Then Dim urls As List(Of String) = New List(Of String) For Each m As Match In matches urls.Add(m.Groups("URL").Value) Next End If Sample HTML string: <html><body><a title="http://www.google.com" href="http://www.google.com">http://www.google.com</a><br /><a href="http://www.yahoo.com">http://www.yahoo.com</a><br /><a title="http://www.apple.com" href="http://www.apple.com">Apple</a></body></html>

    Read the article

  • About curse of dimensionality

    - by Dan
    My question is about this topic I've been reading about a bit. Basically my understanding is that in higher dimensions all points end up being very close to each other. The doubt I have is whether this means that calculating distances the usual way (euclidean for instance) is valid or not. If it were still valid, this would mean that when comparing vectors in high dimensions, the two most similar wouldn't differ much from a third one even when this third one could be completely unrelated. Is this correct? Then in this case, how would you be able to tell whether you have a match or not?

    Read the article

  • (.*) instead of (.*?)

    - by EBAGHAKI
    Suppose we have this html content, and we are willing to get Content1, Content2,.. with regular expression. <li>Content1</li> <li>Content2</li> <li>Content3</li> <li>Content4</li> If I use the line below preg_match_all('/<li>(.*)<\/li>/', $text, $result); i will get an array with a single row containing: Content1</li> <li>Content2</li> <li>Content3</li> <li>Content4 And by using this code: preg_match_all('/<li>(.*?)<\/li>/', $text, $result); i will get an array with 4 row containing Content1, Content2, ... Why (.*) is not working since it means match any character zero or more times

    Read the article

  • password/login system in php

    - by Jonathan
    For a login system in php would this be a suitable outline of how it would work: users types in username and password, clicks login button. Checks if user exists in database, if it does, then retrieve the salt for that user hash the password and salt (would this be done on the client or server side? I think client side would be better, but php is server side so how would you do this?) check value against value in database, if the values match then user has typed in correct password and they are logged in.

    Read the article

  • How do I compare vectors in C++?

    - by Sam Phelps
    I am trying to compare two vector objects, and return a single vector containing all the chars which appear in both vectors. How would I go about this without writing some horribly complex manual method which compares every char in the first vector to every char in the second vector and using an if to add it to a third vector (which would be returned) if they match. Maybe my lack of real experience with vectors is making me imagine this will be harder than it really is, but I suspect there is some simplier way which I have been unable to find through searching.

    Read the article

  • How do I get Xcode and TextMate to calibrate syntax highlighting colours the same way?

    - by Grant Heaslip
    This is a mostly insignificant problem, but it's been bugging me for a while and I figured someone on here might be as ridiculously OCD as I am (this is a programmer community after all). Basically, the problem is that TextMate doesn't seem to calibrate syntax highlighting colours, while Xcode does. What this means in practice is that, while I've faithfully recreated my TextMate theme in Xcode, the syntax highlighting in Xcode seems noticeably less vivid that it does in TextMate. If I use DigitalColor Meter to check the actual colours in Xcode, they don't match the values I entered, while in TextMate they do. Any ideas what's going on here? Thanks!

    Read the article

  • Scala, represent pattern of boolean tuple into something else.

    - by Berlin Brown
    This is a cellular automata rule (input Boolean == Left, Center, Right Cell) and output Boolean . What is a better way to represent this in Scala. trait Rule { def ruleId() : Int def rule(inputState:(Boolean, Boolean, Boolean)) : Boolean override def toString : String = "Rule:" + ruleId } class Rule90 extends Rule { def ruleId() = 90 def rule(inputState:(Boolean, Boolean, Boolean)) : Boolean = { // Verbose version, show all 8 states inputState match { case (true, true, true) => false case (true, false, true) => false case (false, true, false) => false case (false, false, false) => false case _ => true } } }

    Read the article

  • Highlight current page in jquery

    - by 3gwebtrain
    Hi, I have the 12 html pages. and all this pages are loads when the left navigation bar link clicked. in this, i need to add a class to the current link, which is clicked and loaded the page. i tried with this: $(function(){ $('#container li a').click(function(){ $('#container li a').removeClass('current'); var pathname = (window.location.pathname.match(/[^\/]+$/)[0]); var currentPage = $(this).attr('href'); if(currentPage==pathname){ $(this).addClass('current'); } else{ alert('wrong'); } // alert(pathname+' currentPage: '+currentPage); }) }) it works, but on page load, the class is removed, i don't know why it's happening.. any help?

    Read the article

  • How can I change ruby log level in unit tests based on context

    - by Stuart
    I'm new to ruby so forgive me if this is simple or I get some terminology wrong. I've got a bunch of unit tests (actually they're integration tests for another project, but they use ruby test/unit) and they all include from a module that sets up an instance variable for the log object. When I run the individual tests I'd like log.level to be debug, but when I run a suite I'd like log.level to be error. Is it possible to do this with the approach I'm taking, or does the code need to be restructured? Here's a small example of what I have so far. The logging module: #!/usr/bin/env ruby require 'logger' module MyLog def setup @log = Logger.new(STDOUT) @log.level = Logger::DEBUG end end A test: #!/usr/bin/env ruby require 'test/unit' require 'mylog' class Test1 < Test::Unit::TestCase include MyLog def test_something @log.info("About to test something") # Test goes here @log.info("Done testing something") end end A test suite made up of all the tests in its directory: #!/usr/bin/env ruby Dir.foreach(".") do |path| if /it-.*\.rb/.match(File.basename(path)) require path end end

    Read the article

  • regular expression not behaving as expected - Python

    - by philippe
    I have the following function which is supposed to read a .html file and search for <input> tags, and inject a <input type='hidden' > tag into the string to be shown into the page. However, that condition is never met:( e.g the if statement is never executed. ) What's wrong with my regex? def print_choose( params, name ): filename = path + name f = open( filename, 'r' ) records = f.readlines() print "Content-Type: text/html" print page = "" flag = True for record in records: if re.match( '<input*', str(record) ) != None: print record page += record page += "<input type='hidden' name='pagename' value='psychology' />" else: page += record print page Thank you

    Read the article

  • Dynamic Column lookup with different pages in excel

    - by CinCity
    I have a multi page spread sheet in excel that needs to read information dynamically from columns on other pages and have these values show up on a main page. This is the formula I'm using: =IF(VLOOKUP($B:$B,'CP01'!$B:$BN,3,FALSE)="r","r", IF(VLOOKUP($B:$B,'CP01'!$B:$BN,3,FALSE)="a","a","")) CP01 is a sheet in the excel file and instead of look at the specific sheet I want it to look at all of the sheets in the file. Is there a way to do this as an excel formula or with excel-VBA? Edit: I also tried CP* (* being a wildcard character) and it didn't work. Edit2: Is there a way to match the value where the 'CP' is placed with its a other columns value?

    Read the article

  • Design pattern: Polymorphism for list of objects

    - by ziang
    Suppose I have a class A, and A1, A2 inherits from A. There are 2 functions: List<A1> getListA1(){...} List<A2> getListA2(){...} Now I want to do something similar to both A1 and A2 in another function public void process(List<A>){...} If I want to pass the instance of either ListA1 or ListA2, of course the types doesn't match because the compiler doesn't allow the coercion from List< A1 to List< A. I can't do something like this: List<A1> listA1 = getListA1(); List<A> newList = (List<A>)listA1; //this is not allowed. So what is the best approach to the process()? Is there any way to do it in a universal way rather than write the similar code to both List and List?

    Read the article

  • Getting certain array from a multidimensional array

    - by Leron
    I have multidimensional array which is a query returning the info from a table named 'users'. In another part of my code I need to get the records of only one certain user and I want to take it using the array I mentioned above. It's of type: array(24) { [0]=>array(9) { ["id"]=>string(1) "1" ... } [1]=>array(9) { ["id"]=>string(1) "2" ... } [2]=>array(9) { ["id"]=>string(1) "5" ...} I'll use foreach compairing by ["id"] to find the record I need, but when I get a match I'm not sure how to extract only this array from the parent one. Thanks Leron

    Read the article

  • Python frequency detection

    - by Tsuki
    Ok what im trying to do is a kind of audio processing software that can detect a prevalent frequency an if the frequency is played for long enough (few ms) i know i got a positive match. i know i would need to use FFT or something simiral but in this field of math i suck, i did search the internet but didn not find a code that could do only this. the goal im trying to accieve is to make myself a custom protocol to send data trough sound, need very low bitrate per sec but im also very limited on the transmiting end so the recieving software will need to be able custom (cant use an actual hardware/software modem) also i want this to be software only (no additional hardware except soundcard) thanks alot for the help.

    Read the article

  • Would my situation be an appropriate place to use the ' /i ' REGEX attribute?

    - by Solignis
    I am making a large catalogue of all of the possible OS names that can be supported by my particular version of VMWare. Originally I was writing them all as they stood in the VMX files but then I found a website that had them all listed, the problem is they are not properly cased to provide a "perfect" match, would this be the perfect time to use the regex attribute for case insensitivity? Also as a side question, would it be possibly extract the list of OSs from the website?. They look to be in a HTML formated chart. It would save me a lot of time having to type them all out.

    Read the article

  • Type signature "Maybe a" doesn't like "Just [Event]"

    - by sisif
    I'm still learning Haskell and need help with the type inference please! Using packages SDL and Yampa I get the following type signature from FRP.Yampa.reactimate: (Bool -> IO (DTime, Maybe a)) and I want to use it for: myInput :: Bool -> IO (DTime, Maybe [SDL.Event]) myInput isBlocking = do event <- SDL.pollEvent return (1, Just [event]) ... reactimate myInit myInput myOutput mySF but it says Couldn't match expected type `()' against inferred type `[SDL.Event]' Expected type: IO (DTime, Maybe ()) Inferred type: IO (DTime, Maybe [SDL.Event]) In the second argument of `reactimate', namely `input' In the expression: reactimate initialize input output process I thought Maybe a allows me to use anything, even a SDL.Event list? Why is it expecting Maybe () when the type signature is actually Maybe a? Why does it want an empty tuple, or a function taking no arguments, or what is () supposed to be?

    Read the article

  • How can I strip line breaks from my XML with XSLT?

    - by Eric
    I have this XSLT: <xsl:strip-space elements="*" /> <xsl:template match="math"> <img class="math"> <xsl:attribute name="src">http://latex.codecogs.com/gif.latex?<xsl:value-of select="text()" /></xsl:attribute> </img> </xsl:template> Which is being applied to this XML (notice the line break): <math>\text{average} = \alpha \times \text{data} + (1-\alpha) \times \text{average}</math> Unfortunately, the transform creates this: <img class="math" src="http://latex.codecogs.com/gif.latex?\text{average} = \alpha \times \text{data} + (1-\alpha) \times&#10;&#9;&#9;&#9;&#9;&#9;\text{average}" /> Notice the whitespace character literals. Although it works, it's awfully messy. How can I prevent this?

    Read the article

  • Differences between extension methods in C#3 & 4

    - by Buh Buh
    I think I remember reading a long time ago that in C#3 extension methods could only be applied to primitive types and interfaces; and that in C#4 they could be used to extend any type. This doesn't seam to match up with what I am seeing now and I am finding it difficult to find this documented. Is there any truth to this or did my memory make it all up? What are the rules relating to which types can be extended? Are there any differences between C# 3 and 4?

    Read the article

  • Rails rabl json format

    - by brabertaser1992
    I'm displaying data from my db in json format using rabl to parse it for android... My json looks like so: [ { "bank":{ "central_office_address":"ololo", "license":"12312312", "location_id":3, "name":"Pbank", "tax_number":"12312312", "year_of_foundation":1987 } }, { "bank":{ "central_office_address":"sdfsdf sdf", "license":"321312", "location_id":3, "name":"Bbank", "tax_number":"321321", "year_of_foundation":1999 } } ] I need my json in a format like: { "contacts": [ { "id": "c200", "name": "Ravi Tamada", "email": "[email protected]", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } }, { "id": "c201", "name": "Johnny Depp", "email": "[email protected]", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } } ] } Such data is normally parsed in java.... My rabl view: object @banks attributes :central_office_address, :license, :location_id, :name, :tax_number, :year_of_foundation How do I change its output to match the second example?

    Read the article

  • Reading Characher from Image

    - by Chinjoo
    I am working on an application which requires matching of numbers from a scanned image file to database entry and update the database with the match result. Say I have image- employee1.jpg. This image will have two two handwritten entries - Employee number and the amount to be paid to the employee. I have to read the employee number from the image and query the database for the that number, update the employee with the amount to be paid as got from the image. Both the employee number and amount to be paid are written inside two boxes at a specified place on the image. Is there any way to automate this. Basically I want a solution in .net using c#. I know this can be done using artificial neural networks. Any ideas would be much appreciated.

    Read the article

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