Search Results

Search found 14593 results on 584 pages for 'pat inside'.

Page 49/584 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • Matching several items inside one string with preg_match_all() and end characters

    - by nefo_x
    I have the following code: preg_match_all('/(.*) \((\d+)\) - ([\d\.\d]+)[,?]/U', "E-Book What I Didn't Learn At School... (2) - 3525.01, FREE Intro DVD/Vid (1) - 0.15", $match); var_dump($string, $match); and get the following ouput: array(4) { [0]=> array(1) { [0]=> string(54) "E-Book What I Didn't Learn At School... (2) - 3525.01," } [1]=> array(1) { [0]=> string(39) "E-Book What I Didn't Learn At School..." } [2]=> array(1) { [0]=> string(1) "2" } [3]=> array(1) { [0]=> string(7) "3525.01" } } which matches only one items... what i need is to get all items from such strings. when i've added "," sign to the end of the string - it worked fine. but that is non-sense in adding comma to each string. Any advice?

    Read the article

  • Showing value of UISlider inside App Prefs?

    - by Garrett H
    I have a settings bundle, working perfectly, that I would like to customize a bit. I have, among other things, a PSSliderSpecifier and a PSTitleValueSpecifier. What I would like to do is change the value of the PSTitleValueSpecifier to show the current value of the slider, preferably updating every time the slider's value changes (Actually, what I'd like even more would be displaying the slider's value on the same row as the slider). I know the settings bundle is rather strict about what you're allowed to do in it, but is there any way of doing this?

    Read the article

  • Finding matching submatrics inside a matrix

    - by DaveO
    I have a 100x200 2D array expressed as a numpy array consisting of black (0) and white (255) cells. It is a bitmap file. I then have 2D shapes (it's easiest to think of them as letters) that are also 2D black and white cells. I know I can naively iterate through the matrix but this is going to be a 'hot' portion of my code so speed is an concern. Is there a fast way to perform this in numpy/scipy? I looked briefly at Scipy's correlate function. I am not interested in 'fuzzy matches', only exact matches. I also looked at some academic papers but they are above my head.

    Read the article

  • Exposing classes inside modules within a Python package directly in the package's namespace

    - by Richard Waite
    I have a wxPython application with the various GUI classes in their own modules in a package called gui. With this setup, importing the main window would be done as follows: from gui.mainwindow import MainWindow This looked messy to me so I changed the __init__.py file for the gui package to import the class directly into the package namespace: from mainwindow import MainWindow This allows me to import the main window like this: from gui import MainWindow This looks better to me aesthetically and I think it also more closely represents what I'm doing (importing the MainWindow class from the gui "namespace"). The reason I made the gui package was to keep all the GUI stuff together. I could have just as easily made a single gui module and stuffed all the GUI classes in it, but I think that would have been unmanageable. The package now appears to work like a module, but allows me to separate the classes into their own modules (along with helper functions, etc.). This whole thing strikes me as somewhat petty, I just thought I'd throw it out there to see what others think about the idea.

    Read the article

  • Can i have One form tag inside Another in ASP.net MVC RC2

    - by coolguy97
    Hi all, I am currently Developing application in MVC2 I have want to used mutiple form tags in My application In My View I have Created a table which has Delete option which i am doing through Post for Individual Delete so i have Create form tag for each button. i also want user to give option to delete mutiple records so i am providing them with checkboxes.This form should have all the values of checkboxes and all. so form gets render Like this for Each delete button <form action="/Home/MutipleDelete" method="post"> <input class="button " name="Compare" type="submit" value="Mutipledelete" style="margin-right:132px;" /> <input id="chk1" name="chk1" type="checkbox" value="true" /> <form action="/Home/Delete" method="post"> <input type="submit" class="submitLink" value="member1" /> <input type="hidden" name="hfmem1" id="hfmem1" value="1" /> </form> <input id="chk2" name="chk2" type="checkbox" value="true" /> <form action="/Home/Delete" method="post"> <input type="submit" class="submitLink" value="member2" /> <input type="hidden" name="hfmem2" id="hfmem2" value="2" /> </form> </form> The following is not working . but IF i write my code that form renders in this way <form action="/Home/MutipleDelete" method="post"> <input class="button " name="Compare" type="submit" value="Mutipledelete" style="margin-right:132px;" /> </form> <input id="chk1" name="chk1" type="checkbox" value="true" /> <form action="/Home/Delete" method="post"> <input type="submit" class="submitLink" value="member1" /> <input type="hidden" name="hfmem1" id="hfmem1" value="1" /> </form> <input id="chk2" name="chk2" type="checkbox" value="true" /> <form action="/Home/Delete" method="post"> <input type="submit" class="submitLink" value="member2" /> <input type="hidden" name="hfmem2" id="hfmem2" value="2" /> </form> it is working in Mozilla but not in IE.I have debug and Checked values in formcollection In contoller.What to do.?

    Read the article

  • Concatenating NSString inside of UITextView

    - by Jason
    I'm some trouble adding strings together for a UITextView in my app. The method I've been using is this (header) #import <UIKit/UIKit.h> @interface calculatorViewController : UIViewController { IBOutlet UITextView *output; } -(IBAction)b1; @property(nonatomic, copy) NSString *output; @end (main) #import "calculatorViewController.h" @implementation calculatorViewController -(void)b1 { [output stringByAppendingString:@"hi"]; } The problem I've been having with this method is when I use the button the app crashes. The warning it gives me is 'UITextView' may not respond to '-stringByAppendingString:' When I replace output with at string it works though and that confused me. Any suggestions? Am I doing something wrong? Thanks

    Read the article

  • Explain a block of crazy JS code inside Sizzle(the CSS selector engine)

    - by Andy Li
    So, here is the function for pre-filtering "CHILD": function(match){ if ( match[1] === "nth" ) { // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); // calculate the numbers (first)n+(last) including if they are negative match[2] = (test[1] + (test[2] || 1)) - 0; match[3] = test[3] - 0; } // TODO: Move to normal caching system match[0] = done++; return match; } The code is extracted from line 442-458 of sizzle.js. So, why is the line var test = ..., have the exec inputing a boolean? Or is that really a string? Can someone explain it by splitting it into a few more lines of code?

    Read the article

  • Scala: Can't catch exception thrown inside a closure

    - by Dmitriy
    Disclaimer: absolute novice in Scala :( I have the following defined: def tryAndReport(body: Unit) : Unit = { try { body } catch { case e: MySpecificException => doSomethingUseful } } I call it like this: tryAndReport{ someCodeThatThrowsMySpecificException() } While the call to someCodeThatThrowsMySpecificException happens just fine, the exception is not being caught in tryAndReport. Why? Thank you!

    Read the article

  • breakpoint inside QComboBox subclass not working

    - by yan bellavance
    I have subclassed QComboBox to customize it for special needs. The subclass is used to promote QComboBoxes in a ui file from QtDesigner. Everything works except that when I put a break point in a slot, the program does not stop at the breakpoint. I do however know that it is being called from the result it generates. I checked other slots in my program and they work fine with breakpoints. Doing a clean and rebuild all did not fix it. What could be causing this and is there anything I can do about it? The slot in question is the only one in the subclass and is called "do_indexChanged()". You can find the slot on line 37 of the class header below and the signal-slot connection on line 10 of the class source file. CLASS HEADER: #ifndef WVQCOMBOBOX_H #define WVQCOMBOBOX_H #include <QWidget> #include <QObject> #include <QComboBox> #include <QVariant> class wvQComboBox : public QComboBox { Q_OBJECT //Q_PROPERTY(bool writeEnable READ writeEnable WRITE setWriteEnable) public: explicit wvQComboBox(QWidget *parent = 0); bool writeEnable() { return this->property("writeEnable").toBool(); } void setWriteEnable(const bool & writeEnable){ this->setProperty("writeEnable",writeEnable); } bool newValReady() { return this->property("newValReady").toBool(); } void setNewValReady(const bool & newValReady){ this->setProperty("newValReady",newValReady); } QString getNewVal(); int getNewValIndex(); int oldVal; //comboBox Index before user edit began private slots: void do_indexChanged(){ this->setWriteEnable(true); if(oldVal!=currentIndex()){ this->setNewValReady(true); oldVal=currentIndex(); } } protected: void focusInEvent ( QFocusEvent * event ); //void focusOutEvent ( QFocusEvent * event );//dont need because of currentIndexChanged(int) }; #endif // WVQCOMBOBOX_H #include "wvqcombobox.h" wvQComboBox::wvQComboBox(QWidget *parent) : QComboBox(parent) { this->setWriteEnable(true); this->setNewValReady(false); oldVal=this->currentIndex(); connect(this,SIGNAL(currentIndexChanged(int)),this,SLOT(do_indexChanged())); } void wvQComboBox::focusInEvent ( QFocusEvent * event ) { this->setWriteEnable(false); oldVal=this->currentIndex(); } QString wvQComboBox::getNewVal(){ setNewValReady(false); return this->currentText(); } int wvQComboBox::getNewValIndex(){ setNewValReady(false); return this->currentIndex(); }

    Read the article

  • Accessing controller methods inside a model with Kohana/MVC Framework

    - by eth0
    Hi all, I need to able to access controller methods from a model using the Kohana V2.3 framework. At the moment I'm passing the controller object (by ref.) to the model on creation which works perfectly fine but I can't help think there is a more "cleaner" way - does anybody have any suggestions? Would Kohana V3 resolve this with its HMVC pattern? This may help: http://www.ifc0nfig.com/accessing-the-calling-controller-in-a-model-within-kohana/

    Read the article

  • Splitting lists inside list haskell

    - by user3713267
    Hi I need to split list by an argument in Haskell. I found function like this group :: Int -> [a] -> [[a]] group _ [] = [] group n l | n > 0 = (take n l) : (group n (drop n l)) | otherwise = error "Negative n" But what if lists that I want to divide are contained by another list? For example group 3 [[1,2,3,4,5,6],[2,4,6,8,10,12]] should return [[[1,2,3],[4,5,6]],[[2,4,6],[8,10,12]]] Is there any way to do that ?

    Read the article

  • Test whether pixel is inside the blobs for ofxOpenCV

    - by mia
    I am doing an application of the concept of the dodgeball and need to test of the pixel of the ball is in the blobs capture(which is the image of the player) I am stucked and ran out of idea of how to implement it. I manage to do a little progress which have the blobs but I not sure how to test it. Please help. I am a newbie who in a desperate condition. Thank you. This is some of my code. void testApp::setup(){ #ifdef _USE_LIVE_VIDEO vidGrabber.setVerbose(true); vidGrabber.initGrabber(widthS,heightS); #else vidPlayer.loadMovie("fingers.mov"); vidPlayer.play(); #endif widthS = 320; heightS = 240; colorImg.allocate(widthS,heightS); grayImage.allocate(widthS,heightS); grayBg.allocate(widthS,heightS); grayDiff.allocate(widthS,heightS); ////<---what I want bLearnBakground = true; threshold = 80; //////////circle////////////// counter = 0; radius = 0; circlePosX = 100; circlePosY=200; } void testApp::update(){ ofBackground(100,100,100); bool bNewFrame = false; #ifdef _USE_LIVE_VIDEO vidGrabber.grabFrame(); bNewFrame = vidGrabber.isFrameNew(); #else vidPlayer.idleMovie(); bNewFrame = vidPlayer.isFrameNew(); #endif if (bNewFrame){ if (bLearnBakground == true){ grayBg = grayImage; // the = sign copys the pixels from grayImage into grayBg (operator overloading) bLearnBakground = false; } #ifdef _USE_LIVE_VIDEO colorImg.setFromPixels(vidGrabber.getPixels(),widthS,heightS); #else colorImg.setFromPixels(vidPlayer.getPixels(),widthS,heightS); #endif grayImage = colorImg; grayDiff.absDiff(grayBg, grayImage); grayDiff.threshold(threshold); contourFinder.findContours(grayDiff, 20, (340*240)/3, 10, true); // find holes } ////////////circle//////////////////// counter = counter + 0.05f; if(radius>=50){ circlePosX = ofRandom(10,300); circlePosY = ofRandom(10,230); } radius = 5 + 3*(counter); } void testApp::draw(){ // draw the incoming, the grayscale, the bg and the thresholded difference ofSetColor(0xffffff); //white colour grayDiff.draw(10,10);// draw start from point (0,0); // we could draw the whole contour finder // or, instead we can draw each blob individually, // this is how to get access to them: for (int i = 0; i < contourFinder.nBlobs; i++){ contourFinder.blobs[i].draw(10,10); } ///////////////circle////////////////////////// //let's draw a circle: ofSetColor(0,0,255); char buffer[255]; float a = radius; sprintf(buffer,"radius = %i",a); ofDrawBitmapString(buffer, 120, 300); if(radius>=50) { ofSetColor(255,255,255); counter = 0; } else{ ofSetColor(255,0,0); } ofFill(); ofCircle(circlePosX,circlePosY,radius); }

    Read the article

  • binding a command inside a listbox item to a property on the viewmodel parent

    - by giddy
    I've been working on this for about an hour and looked at all related SO questions. My problem is very simple: I have HomePageVieModel: HomePageVieModel +IList<NewsItem> AllNewsItems +ICommand OpenNewsItem My markup: <Window DataContext="{Binding HomePageViewModel../> <ListBox ItemsSource="{Binding Path=AllNewsItems}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock> <Hyperlink Command="{Binding Path=OpenNews}"> <TextBlock Text="{Binding Path=NewsContent}" /> </Hyperlink> </TextBlock> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> The list shows fine with all the items, but for the life of me whatever I try for the Command won't work: <Hyperlink Command="{Binding Path=OpenNewsItem, RelativeSource={RelativeSource AncestorType=vm:HomePageViewModel, AncestorLevel=1}}"> <Hyperlink Command="{Binding Path=OpenNewsItem, RelativeSource={RelativeSource AncestorType=vm:HomePageViewModel,**Mode=FindAncestor}**}"> <Hyperlink Command="{Binding Path=OpenNewsItem, RelativeSource={RelativeSource AncestorType=vm:HomePageViewModel,**Mode=TemplatedParent}**}"> I just always get : System.Windows.Data Error: 4 : Cannot find source for binding with reference .....

    Read the article

  • Moving and resizing JPanels object inside JFrame.

    - by Gabriel A. Zorrilla
    Continuing my quest of learning Java by doing a simple game, i stumbled upon a little issue. My gameboard extends JPanel as well as each piece of the board. Now, this presents some problems: Cant set size of each piece, therefore, each piece JPanel ocupy the whole JFrame, concealing the rest of the pieces and the background (gameboard). Cant set the position of the pieces. I have the default flow manager. Tried setbounds and no luck. Perhaps i should make the piece to extend other JComponent?

    Read the article

  • HttpWebResponse get mixed up when used inside multiple threads

    - by Holli
    In my Application I have a few threads who will get data from a web service. Basically I just open an URL and get an XML output. I have a few threads who do this continuously but with different URLs. Sometimes the results are mixed up. The XML output doesn't belong to the URL of a thread but to the URL of another thread. In each thread I create an instance of the class GetWebPage and call the method Get from this instance. The method is very simple and based mostly on code from the MSDN documentation. (See below. I removed my error handling here!) public string Get(string userAgent, string url, string user, string pass, int timeout, int readwriteTimeout, WebHeaderCollection whc) { string buffer = string.Empty; HttpWebRequest myWebRequest = (HttpWebRequest)WebRequest.Create(url); if (!string.IsNullOrEmpty(userAgent)) myWebRequest.UserAgent = userAgent; myWebRequest.Timeout = timeout; myWebRequest.ReadWriteTimeout = readwriteTimeout; myWebRequest.Credentials = new NetworkCredential(user, pass); string[] headers = whc.AllKeys; foreach (string s in headers) { myWebRequest.Headers.Add(s, whc.Get(s)); } using (HttpWebResponse myWebResponse = (HttpWebResponse)myWebRequest.GetResponse()) { using (Stream ReceiveStream = myWebResponse.GetResponseStream()) { Encoding encode = Encoding.GetEncoding("utf-8"); StreamReader readStream = new StreamReader(ReceiveStream, encode); // Read 1024 characters at a time. Char[] read = new Char[1024]; int count = readStream.Read(read, 0, 1024); int break_counter = 0; while (count > 0 && break_counter < 10000) { String str = new String(read, 0, count); buffer += str; count = readStream.Read(read, 0, 1024); break_counter++; } } } return buffer; As you can see I have no public properties or any other shared resources. At least I don't see any. The url is the service I call in the internet and buffer is the XML Output from the server. Like I said I have multiple instances of this class/method in a few threads (10 to 12) and sometimes buffer does not belong the the url of the same thread but another thread.

    Read the article

  • Accessing parent 'this' inside a jQuery $.getJSON

    - by JP
    I'm going to assume that the overall structure of my code as it currently stands is 'best', otherwise this question gets too long, but if I've made any obvious mistakes (or if I've made life hard for myself) then please correct away! Using jQuery, I have a javascript 'class' set out something like this: function MyClass () { this.noise = "Woof" this.dostuff = function() { $.getJSON("http://cows.go",function(moo) { this.noise = moo.inEnglish; } } } var instance = new MyClass(); instance.doStuff() console.log(instance.noise) I'm expecting some kinda tea drinking moo in the console, but of course I'm getting an error about this.noise not being defined (because $.getJSON doesn't pass this through, right?) Any suggestions as to how to be able to affect instance.squeak for any and all instances of MyClass without interference?

    Read the article

  • Recursion inside while loop, How does it work ?

    - by M.H
    Can you please tell me how does this java code work? : public class Main { public static void main (String[] args) { Strangemethod(5); } public static void Strangemethod(int len) { while(len > 1){ System.out.println(len-1); Strangemethod(len - 1); } } } I tried to debug it and follow the code step by step but I didn't understand it.

    Read the article

  • More inside an IDE(eclipse cdt)

    - by symfony
    This is what I see in the Console when I clicked Project-Clean menu: g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\hw.o ..\src\hw.cpp g++ -ohw.exe src\hw.o But I've no idea how is these command generated? Can someone elaborate the lifecycle of the command?

    Read the article

  • Jetspeed 2.2 Nest or render one portlet inside another

    - by David Just
    I have a requirement to build an extensible wizard in a portlet. This wizard will list components that are installed and forward the user to a sub-wizard that is component specific. The requirement is that the components are to be developed by other people and dynamically plugged into this wizard (Jetspeed reboot is okay). I would like to be able to define the components as portlets themselves who's content is rendered into the primary portlet. Has anybody ever done something like this?

    Read the article

  • Trouble rendering a view inside a generic class

    - by Horace Loeb
    I'm trying to encapsulate the logic for generating my sitemap in a separate class so I can use Delayed::Job to generate it out of band: class ViewCacher include ActionController::UrlWriter def initialize @av = ActionView::Base.new(Rails::Configuration.new.view_path) @av.class_eval do include ApplicationHelper end end def cache_sitemap songs = Song.all sitemap = @av.render 'sitemap/sitemap', :songs => songs Rails.cache.write('sitemap', sitemap) end end But whenever I try ViewCacher.new.cache_sitemap I get this error: ActionView::TemplateError: ActionView::TemplateError (You have a nil object when you didn't expect it! The error occurred while evaluating nil.url_for) on line #5 of app/views/sitemap/_sitemap.builder: I assume this means that ActionController::UrlWriter is not included in the right place, but I really don't know

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >