Search Results

Search found 20383 results on 816 pages for 'hello'.

Page 47/816 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • Loop over DOMDocument

    - by Zoredache
    I am following the suggestion from this question Robust, Mature HTML Parser for PHP, about parsing html that may be malformed with DOMDocument. Is there any easy way to loop over the parsed document? So I would like to loop over html like this. $html='<ul> <li>value1</li> <li>value1</li> <li>value3</li> </ul> <p>hello world</p>'; $doc = new DOMDocument(); $doc->loadHTML($html); ??? foreach (??? as $node) { print $node->nodeName.':'.$node->nodeValue; } And get results somewhat like this. ul: li:value1 li:value2 li:value3 p:hello world

    Read the article

  • Can Nokogiri use a SAX parser to parse an HTML fragment?

    - by .yahoo.co.jpaqwsykcj3aulh3h1k0cy6nzs3isj
    I have this code. class MyParser < Nokogiri::XML::SAX::Document def characters(string) LOG.debug("characters #{string}") end def start_element(name, attrs = []) LOG.debug("start_element #{name}") end def end_element(name) LOG.debug("end_element #{name}") end end parser = Nokogiri::HTML::SAX::Parser.new(MyParser.new) parser.parse(File.new($*[0], 'rb')) Run on an HTML fragment like this, <h1>Hello</h1> <p>Hi.</p> the output shows that only the first element is processed: start_element h1 characters Hello end_element h1 If I wrap the fragment in html and body tags, the whole input is parsed. Is there a way to use a SAX style parser on HTML fragments?

    Read the article

  • what's wrong in my C program ?

    - by user292084
    a cpp file: #include <iostream> #include <jni.h> #include "Hello.h" #include "windows.h" #include "stdafx.h" #define HINSTANCE "hDll" typedef void(__stdcall *Print_)(); int main(){ HINSTANCE hDll; //DLL?? Print_ print_; //???? hDll = LoadLibrary("Hello.dll"); if (hDll != NULL) { print_ = (Print_)GetProcAddress(hDll,"Java_Hello_sayHello@8"); if(print_!=NULL) { print_(); } FreeLibrary(hDll); } return 0; } //there is something wrong, it prints: http://i983.photobucket.com/albums/ae311/keatingWang/c_wrong.png ??????? means : Undeclared identifier

    Read the article

  • Opening a password encrypted access database using DAO VB.NET

    - by prasoon99
    I create a database like this: Sub Main() Dim wrkDefault As Workspace Dim dbE As DBEngine Dim dbs As Database 'Get default Workspace. dbE = New DBEngine wrkDefault = dbE.Workspaces(0) 'Set the database filename Dim DBFilename As String DBFilename = "c:\mydb.mdb" 'Make sure there isn't already a file with the same name of 'the new database file. If Dir(DBFilename) <> "" Then MsgBox("File already exists!") Exit Sub End If 'Create a new encrypted database with the specified 'collating order. 'lock database with the password 'hello' dbs = wrkDefault.CreateDatabase(DBFilename, _ LanguageConstants.dbLangGeneral & ";pwd=hello;", DatabaseTypeEnum.dbEncrypt) dbs.Close() End Sub How do I open this database again in VB.NET using DAO?

    Read the article

  • How to use SLF4J Log4jLoggerAdapter

    - by David Wong
    I'm deploying an enterprise application on Weblogic 8.1 which has log4j 1.2.8 on it's classpath. I'm getting the following error with SLF4J 1.6.1: SLF4J versions 1.4.0 and later requires log4j 1.2.12 or later http://www.slf4j.org/codes.html#log4j_version Above link recommends using Log4jLoggerAdapter. I've changed Logger logger = LoggerFactory.getLogger(HelloWorld.class); logger.info("Hello World"); to Log4jLoggerAdapter logger = (Log4jLoggerAdapter) LoggerFactory.getLogger(HelloWorld.class); logger.info("Hello World"); However, I'm still encountering the error. Any advice on how to correctly implement this? Thanks

    Read the article

  • weird behavior with acts_as_taggable_on

    - by macek
    For some reason, tags aren't showing up on a taggable object when an tagger is specified. testing the post class Post < ActiveRecord::Base acts_as_taggable_on :tags belongs_to :user end >> p = Post.first => #<Post id: 1, ...> >> p.is_taggable? => true >> p.tag_list = "foo, bar" => "foo, bar" >> p.save => true >> p.tags => [#<Tag id: 1, name: "foo">, #<Tag id: 2, name: "bar">] testing the user class User < ActiveRecord::Base acts_as_tagger has_many :posts end >> u = User.first => #<User id: 1, ...> >> u.is_tagger? => true >> u.tag(p, :with => "hello, world", :on => :tags) => true >> u.owned_tags => [#<Tag id: 3, name: "hello">, #<Tag id: 4, name: "world">] refresh the post >> p = Post.first => #<Post id: 1 ...> >> p.tags => [#<Tag id: 2, name: "bar">, #<Tag id: 1, name: "foo">] Where's the hello and world tags? Miraculously, if I modify the database directly to set tagger_id and tagger_type to NULL, the two missing tags will show up. I suspect there's something wrong with my User model? What gives?

    Read the article

  • Which method of creating javascript objects is better?

    - by Germaine
    I've seen objects defined in two different ways, which function similarly, but are, of course, fundamentally different. You can do it either like this: var myobject = {property: 'hello', act: function() { this.property += ' world'; }}; and like this: function myobject() { this.property = 'hello'; this.act = function() { this.property += 'world'; } } The second method could create objects like so var newobj = new myobject(); but you could do something similar using the first notation by making the object the return value of a function. The new keyword has the advantage of being able to pass parameters that can be used to initialize the properties of the object, but you could just as easily add an init function to the first kind of object. Just wondering if besides these two differences, if there was a fundamental difference that made one method definitely better than the other method.

    Read the article

  • Display a gallery of images that are stored as Drawables in a List

    - by Tyler
    Hello - I am trying to modify this example: http://developer.android.com/resources/tutorials/views/hello-gridview.html But instead of displaying images that are resources, I want to display Drawables that I currently am storing in a List. Can anyone instruct me on how I would modify private Integer[] mThumbIds = { R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7 }; To display my drawable items instead? Thanks!

    Read the article

  • Symfony2 - PdfBundle not working

    - by ElPiter
    Using Symfony2 and PdfBundle to generate dynamically PDF files, I don't get to generate the files indeed. Following documentation instructions, I have set up all the bundle thing: autoload.php: 'Ps' => __DIR__.'/../vendor/bundles', 'PHPPdf' => __DIR__.'/../vendor/PHPPdf/lib', 'Imagine' => array(__DIR__.'/../vendor/PHPPdf/lib', __DIR__.'/../vendor/PHPPdf/lib/vendor/Imagine/lib'), 'Zend' => __DIR__.'/../vendor/PHPPdf/lib/vendor/Zend/library', 'ZendPdf' => __DIR__.'/../vendor/PHPPdf/lib/vendor/ZendPdf/library', AppKernel.php: ... new Ps\PdfBundle\PsPdfBundle(), ... I guess all the setting up is correctly configured, as I am not getting any "library not found" nor anything on that way... So, after all that, I am doing this in the controller: ... use Ps\PdfBundle\Annotation\Pdf; ... /** * @Pdf() * @Route ("/pdf", name="_pdf") * @Template() */ public function generateInvoicePDFAction($name = 'Pedro') { return $this->render('AcmeStoreBundle:Shop:generateInvoice.pdf.twig', array( 'name' => $name, )); } And having this twig file: <pdf> <dynamic-page> Hello {{ name }}! </dynamic-page> </pdf> Well. Somehow, what I just get in my page is just the normal html generated as if it was a normal Response rendering. The Pdf() annotation is supposed to give the "special" behavior of creating the PDF file instead of rendering normal HTML. So, having the above code, when I request the route http://www.mysite.com/*...*/pdf, all what I get is the following HTML rendered: <pdf> <dynamic-page> Hello Pedro! </dynamic-page> </pdf> (so a blank HTML page with just the words Hello Pedro! on it. Any clue? Am I doing anything wrong? Is it mandatory to have the alternative *.html.twig apart from the *.pdf.twig version? I don't think so... :(

    Read the article

  • How to have a function with a nullable string parameter in Go?

    - by yuku
    I'm used to Java's String where we can pass null rather than "" for special meanings, such as use a default value. In Go, string is a primitive type, so I cannot pass nil (null) to a parameter that requires a string. I could write the function using pointer type, like this: func f(s *string) so caller can call that function either as f(nil) or // not so elegant temp := "hello"; f(&temp) but the following is unfortunately not allowed: // elegant but disallowed f(&"hello"); What is the best way to have a parameter that receives either a string or nil?

    Read the article

  • Change Toast Font

    - by mgpyone
    Currently, I'm trying to develop an app. and I don't know how to change the Toast font. . final OnClickListener clickListener = new OnClickListener() { public void onClick(View v) { try { Toast.makeText(nova.this,"Hello", 500000).show(); } catch (Exception e) { Toast.makeText(nova.this,"Exception:" +e, 500000); } } }; I want to change the text "Hello" with custom font I've tried with TypeFace. and Then, I want to set a variable at the place "TextClicked" .. I've tried with a local variable .. but it doesn't work any help with example source code will be really great for me.

    Read the article

  • Regex: Matching a space-joined list of words, excluding last whitespace

    - by Jesper
    How would I match a space separated list of words followed by whitespace and some optional numbers? I have this: >>> import re >>> m = re.match('(?P<words>(\w+\s+)+)(?P<num>\d+)?\r\n', 'Foo Bar 12345\r\n') >>> m.groupdict() {'num': '12345', 'words': 'Foo Bar '} I'd like the words group to not include the last whitespace(s) but I can't figure this one out. I could do a .strip() on the result but that's not as much fun :) Some strings to test and wanted result: 'Foo & Bar 555\r\n' => {'num': '555', 'words': 'Foo & Bar'} 'Hello World\r\n' => {'num': None, 'words': 'Hello World'} 'Spam 99\r\n' => {'num': 99, 'words': 'Spam'} 'Number 1 666\r\n' => {'num': 666, 'words': 'Number 1'}

    Read the article

  • How do I average the difference between specific values in TSQL?

    - by jvenema
    Hey folks, sorry this is a bit of a longer question... I have a table with the following columns: [ChatID] [User] [LogID] [CreatedOn] [Text] What I need to find is the average response time for a given user id, to another specific user id. So, if my data looks like: [1] [john] [20] [1/1/11 3:00:00] [Hello] [1] [john] [21] [1/1/11 3:00:23] [Anyone there?] [1] [susan] [22] [1/1/11 3:00:43] [Hello!] [1] [susan] [23] [1/1/11 3:00:53] [What's up?] [1] [john] [24] [1/1/11 3:01:02] [Not much] [1] [susan] [25] [1/1/11 3:01:08] [Cool] ...then I need to see that Susan has an average response time of (20 + 6) / 2 = 13 seconds to John, and John has an average of (9 / 1) = 9 seconds to Susan. I'm not even sure this can be done in set-based logic, but if anyone has any ideas, they'd be much appreciated!

    Read the article

  • how to work with strings and integers as bit strings in python?

    - by Manuel
    Hello! I'm developing a Genetic Algorithm in python were chromosomes are composed of strings and integers. To apply the genetic operations, I want to convert these groups of integers and strings into bit strings. For example, if one chromosome is: ["Hello", 4, "anotherString"] I'd like it to become something like: 0100100100101001010011110011 (this is not actual translation). So... How can I do this? Chromosomes will contain the same amount of strings and integers, but this numbers can vary from one algorithm run to another. To be clear, what I want to obtain is the bit representation of each element in the chromosome concatenated. If you think this would not be the best way to apply genetic operators (such as mutation and simple crossover) just tell me! I'm open to new ideas. Thanks a lot! Manuel

    Read the article

  • Problem with istringstream in C++

    - by helixed
    Hello, I'm sure I'm just doing something stupid here, but I can't quite figure out what it is. When I try to run this code: #include <iostream> #include <string> #include <sstream> using namespace std; int main(int argc, char *argv[]) { string s("hello"); istringstream input(s, istringstream::in); string s2; input >> s2; cout << s; } I get this error: malloc: *** error for object 0x100016200: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug The only thing I can think of is that I allocated s2 on the stack, but I thought strings manage their own content on the heap. Any help here would be appreciated. Thanks, helixed

    Read the article

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