POV-Ray : Newsgroups : povray.off-topic : Automation : Re: Automation Server Time
29 Jul 2024 10:17:29 EDT (-0400)
  Re: Automation  
From: Invisible
Date: 16 Nov 2011 08:22:13
Message: <4ec3b905$1@news.povray.org>
On 15/11/2011 02:51 PM, Invisible wrote:

> Step 2: Write a program to download the HTML.
> Step 3: Write a program to extract meaningful data from the mangled HTML.
> Step 4: Convert the dozens of files into one giant file.

Without labouring the point too much, this is one of the reasons why I 
use Haskell and not C++. It took me about 5 minutes to write a working 
HTTP client, totalling 906 bytes of source code. I shudder to think how 
much time I would have wasted trying to do such a task in C. String 
management becomes vastly easier in C++, but I still wouldn't have a 
clue how to, say, open a socket. [Is there even a portable way of doing 
that? Or would you have to ask the native OS?]

The Haskell code I wrote isn't optimised in the slightest. I could 
easily make it a lot faster, but it's not slow enough to be worth 
bothering. The fact that C or C++ would be faster is a complete non-issue.

Then again, this program is quite atypical of what I write. It's a 
one-off, quick and dirty hack to get me some information. All it really 
does is push data from A to B. So many it's not such a great example to 
hold up.

(If this was something that I wanted to "work properly", I would of 
course have used a real HTTP library, and a real HTML parser library, 
and so on. As it is, quickly throwing something together that has the 
limited functions that I need right now was easier than trying to learn 
how to use a new library.)

Of course, now somebody is going to point out that in Perl, the entire 
program would have been 3 lines. But I'm not using Perl unless somebody 
pays me. :-P


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.