The last challenge was rather simple. All the languages used had all the functions built into the language.
Here is the last challenge: http://ubuntuforums.org/showthread.php?t=884394
For this one, I ask that non beginners (that means you slavik) do not post anything except possible advice. DO NOT POST SOLUTIONS IF YOU ARE NOT A BEGINNER!
Now that we dealt with user IO and file IO, lets do a little networking. Most languages do not have this built in, but some have standard library functions for it.
The challenge will be simple, but will require the use of either another library or exploring the standard libraries. As many of you are using Python it seems, I will tell you that Python has standard libraries to do everything here, so explore the documentation page (you'll find that programmers spend a lot of time reviewing API's and documentation, so might as well practice now)
You will have to do the following:
- Write a program that will read a webpage and puts its text into a file named "index.xhtml"
- The test site will be: http://laroza.freehostia.com/home/index.php
- That is the bare minimum requirements, but I would ask you try to make it work for any site.
You do NOT have to:
- Have it do anything but download the single file of a web page, so ignore any external scripts or css.
- Have it to any rendering, just write it to a file (for opening with a browser, most likely)
For extra credit:
- Have either prompt or use a command line argument to do do this with any webpage
- Have it name the output file after the title of the document (hint: text in the elements <title></title>, you can use xml or html parsers for this, or you can use regular expressions)
The test page is valid XHTML 1.1 (and is valid XML). All conditions and extra credit can be done with standard Python. If you use another language or non standard libs, let me know exactly how to get your entry working.
Do not copy code, but you can obviously read it
Try not to comment on other submissions. It will be hard to judge changing entries. If you edit your code, post the new version and make it clear there is a new code.
How it will be judged
- It has to do what it is specified.
As before, try to follow the following (although I think it won't come down to judging on this, as the challenge will be tricky for beginners):
- Clean code. Readable code is a must for being a programmer who wishes to possibly interact with others. Some languages can be more readable than others, so it will be judged on the effort of writing clean code, not which language is easier to read by design.
- Logical code. Be a programmer, not a code monkey
- Commented code. If something is possibly unclear (like an obscure use of math), let the readers know. Do not over comment, and let the code speak for itself whenever you can. Have logical variable names and function names. (Excessive commenting is a minus factor)
- Working code. It has to work as it is posted. The codw will be read on the forum, so remember to use this guide to paste code if you don't know how: http://ubuntuforums.org/showthread.php?t=606009