Page 12 of 14 FirstFirst ... 21011121314 LastLast
Results 111 to 120 of 138

Thread: [Beginner] Programming Challenge: 4

  1. #111
    Join Date
    Dec 2006
    Location
    Birmingham, England
    Beans
    83
    Distro
    Ubuntu 6.06 Dapper

    Re: [Beginner] Programming Challenge: 4

    Quote Originally Posted by Titan8990 View Post
    It also looks like converting the variable that contains the web page data into a string is not trivial either:

    PHP Code:
    Python 2.5.1 (r251:54863Jul 31 200823:17:40
    [
    GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
    Type 
    "help""copyright""credits" or "license" for more information.
    >>> 
    import urllib2
    >>> import re
    >>> web urllib2.urlopen('http://laroza.freehostia.com/home/index.php')
    >>> print 
    web
    <addinfourl at 3081093036L whose fp = <socket._fileobject object at 0xb7dc2304>>
    >>> 
    web str(web)
    >>> print 
    web
    <addinfourl at 3081093036L whose fp = <socket._fileobject object at 0xb7dc2304>>
    >>> 
    test str(web)
    >>> print 
    test
    <addinfourl at 3081093036L whose fp = <socket._fileobject object at 0xb7dc2304>> 
    I guess I will have to look in to another method of doing a grep type search of a variable containing web page code...
    I think I see your problem. urllib.urlopen returns the location, you need to end it with .read() . To use your example:
    Code:
    web = urllib2.urlopen('http://laroza.freehostia.com/home/index.php').read()
    This way, instead of storing the location it stores what is there.

  2. #112
    Join Date
    Jul 2008
    Beans
    1,706

    Re: [Beginner] Programming Challenge: 4

    when are we judging this...im curious to see the winners

  3. #113
    Join Date
    Apr 2007
    Beans
    14,781

    Re: [Beginner] Programming Challenge: 4

    Quote Originally Posted by jimi_hendrix View Post
    when are we judging this...im curious to see the winners
    I am not going to judge anymore (no polls)

    Hopefully, the challenges will be good learning experiences with feedback.

    I will make a new challenge soon with this new scheme explictly described in the first post.

  4. #114
    Join Date
    Mar 2008
    Beans
    1,755

    Re: [Beginner] Programming Challenge: 4

    Even though I am typically a very competitive person I do not view these challenges as a competition. They are good learning experiences and nothing more.

  5. #115
    Join Date
    Jul 2008
    Beans
    1,706

    Re: [Beginner] Programming Challenge: 4

    winner was the wrong word...i should have said if mine can compile and when the next one comes out

  6. #116
    Join Date
    Apr 2007
    Beans
    14,781

    Re: [Beginner] Programming Challenge: 4

    Quote Originally Posted by jimi_hendrix View Post
    winner was the wrong word...i should have said if mine can compile and when the next one comes out
    I tried this: http://ubuntuforums.org/showpost.php...0&postcount=67

    Because I felt sympathetic, I fixed two bugs in it, and it couldn't save (I was running it not in my home).

    Please look it over and fix the variable names (remember, they are case sensitive!) and have it save where ever it is being run.

  7. #117
    Join Date
    Jul 2008
    Beans
    1,706

    Re: [Beginner] Programming Challenge: 4

    ya i know what happend...it was late and my OCD to make my naming convention perfect and i kinda fell asleep halfway through me changing the capitalization

    any clue why it wont compile on my ubuntu computer...says something along the lines of System.Net doesnt exist

  8. #118
    Join Date
    May 2006
    Location
    Pakistan
    Beans
    425
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: [Beginner] Programming Challenge: 4

    Quote Originally Posted by jimi_hendrix View Post
    ya i know what happend...it was late and my OCD to make my naming convention perfect and i kinda fell asleep halfway through me changing the capitalization

    any clue why it wont compile on my ubuntu computer...says something along the lines of System.Net doesnt exist
    "System.Net" is a standard class library shipped with c# (both ms .net and mono).
    Perhaps the compiler u are using is old. Looks it is mcs try to use gmcs (mono 2). Otherwise the problem is of mono installation, as far as I think, because there is nothing "advanced" in this code that mono hasn't implemented.
    Regards

  9. #119
    Join Date
    Mar 2008
    Beans
    1,755

    Re: [Beginner] Programming Challenge: 4

    Ignore this post. I descided it was best to create a different thread geared towards my question (which is somewhat unrelated to the challenge).
    Last edited by Titan8990; August 20th, 2008 at 07:57 PM.

  10. #120
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,288
    Distro
    Kubuntu

    Re: [Beginner] Programming Challenge: 4

    It doesn't get any easier than this...
    PHP Code:
    #include <cstdlib>
    int main()
    {
      
    system"wget http://laroza.freehostia.com/home/index.php >& /dev/null; mv index.php index.xhtml" );
      return 
    0;


Page 12 of 14 FirstFirst ... 21011121314 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •