Hola, compadre,
Elliot Hallmark <[log in to unmask]> wrote:
> Other things beyond that seemed
> awkward, difficult, or impossible from what I knew. python immediately
> jumped out to me as a tool more suited to these tasks.
The fact that Python has a looping run-time environment is, of course,
a give-away to why most people think this, and perhaps to some degree,
rightly so, but PHP has got the same, it's just that *most* people use
PHP through some Apache module as a request/response module. Indeed,
that's where it started, and that's its forte.
> From my experience, it seemed php was a server side
> scripting language.
Strictly speaking, so is Python.
> Can you write a php script that gets key presses
> and doesn't pass them along to windows to process? I thought the OS
> would have to process the key press, pass it along to the php server
> and then php could process it. (pyhook)
A couple of obvious candidates;
- http://gtk.php.net/
- http://winbinder.org/
> Also, how would you go about using a GPU from a graphics card in php?
> (python cuda in google gives many results)
PHP is just a C program with various bindings, so I suspect in the
same way Python would do it. Whether anyone has done it, though, is a
different question.
> Has anyone written a scientific computing package along the lines of
> matlab in php (scipy, numpy, matplotlib)? Or a non-sequential optical
> raytracer?
Not seen any scientific packages, but I've seen a few ray-tracers,
although they're all demo apps and fun toys (although I think that
applies to Python, too). It's not so much about whether you can do it
or not (you can), but whether it makes sense to do so (it mostly
doesn't). Having said that, there's nothing stopping me making a local
run-time PHP program to do either, it's just that it's PHP and hence
slower than C. Python, too, is slower than C, except when it runs some
C module, which, uh, is C, the same as if PHP runs some C module. For
example, one of the fastest and best XSLT 1.0 processors and XML
libraries out there is XMLlib and XSLTlib (RedHat and Gnome?), written
in C, and is the defacto PHP XML and XSLT modules used. Whatever
you've got that runs in C, you can run in PHP, it's not really a big
deal, it just depends on whether it makes sense to patch it up with
the way you use your PHP.
> if you wanted to write a web interface for GNU cash or another well
> established accounting program, could you do it?
Sure. Here's someone who'dunnit back in 2008;
http://web.archiveorange.com/archive/v/LJV4vT1u2IqE3LstFA1V
> please feel free to point me to the php equivilants of pyhook, pycuda,
> scipy, numpy and some examples of widely used programs with php
> bindings.
You can bind PHP and Python the same, it's just a matter of doing and
whether it makes sense to do so. It's *not* a question of /if/ you can
do it, but if you /should/ do it. Your milage *will* vary.
>> For the sophisticated hacker, most languages can
>> be tweaked to solve almost any problem.
>
> I am sure that is true. Though, I feel many for many tasks php would
> require quite a bit more tweaking than python, with much less
> community support behind it (I mean, google comes up with fewer
> helpful links to the problems I sited above).
Maybe your Google-foo is weak. :)
> My impression, based on very little experience with php, is that if
> you asked in a forum about using php for advanced scientific
> computing, or writing music generation/sequencing software,
> knowledgeable folks would first ask: "are you sure you want to do this
> in php? how about java or python?"
Again, probably because they don't realize it can be done in a
non-request/response kinda way with PHP as well. But then, PHP itself
isn't all that fast if you have little knowledge of how to do proper
PHP, but this is a pitfall in any language.
> That said, php may be superior for generating websites from databases.
Not really, but the installations you'll find in the wild is readily
configured for it, so it's easy to get going. However, this has little
to do with the language itself, and more to do with default packaging
of it.
Anyway, I wasn't meaning to promote PHP over Python, just pointing out
that PHP is a lot more (and more often still, a lot better) than what
most people think it is.
Alex
--
Project Wrangler, SOA, Information Alchemist, UX, RESTafarian, Topic Maps
--- http://shelter.nu/blog/ ----------------------------------------------
------------------ http://www.google.com/profiles/alexander.johannesen ---
|