• (cs)

    Looks like it's cool again to bash PHP.

    First of all, PHP should be used for webpages, and cronjobs related to webpages. That's about it.

    Now then, please do suggest a good alternative to PHP that:

    • Doesn't suck balls
    • Isn't slow as hell (in the sense of slower than PHP)
    • Is widely supported
    • Isn't expensive to deploy
    • Doesn't add ages to development time
    • Isn't platform-specific

    So now that we've ruled out the fanboy languages and ASP(.NET), what's left?

    For the love of programming, I'd expect people on here to have a brain once in a while and not jump on the first bandwagon they see.

  • convicted felon (unregistered) in reply to elbekko
    elbekko:
    Looks like it's cool again to bash PHP.

    First of all, PHP should be used for webpages, and cronjobs related to webpages. That's about it.

    Now then, please do suggest a good alternative to PHP that:

    • Doesn't suck balls
    • Isn't slow as hell (in the sense of slower than PHP)
    • Is widely supported
    • Isn't expensive to deploy
    • Doesn't add ages to development time
    • Isn't platform-specific

    So now that we've ruled out the fanboy languages and ASP(.NET), what's left?

    For the love of programming, I'd expect people on here to have a brain once in a while and not jump on the first bandwagon they see.

    Wide support is a non-issue for this WTF. They were running a customized PHP with a customized HTTP server on the local machine.

    Because of that, I would suggest Perl, Ruby, Python, or Lua. Hell, even C++ if the object oriented speed is absolutely essential.

  • rycamor (unregistered) in reply to elbekko
    elbekko:
    Looks like it's cool again to bash PHP.

    First of all, PHP should be used for webpages, and cronjobs related to webpages. That's about it.

    Actually, I'm not a PHP-basher, and I would even take some exception to your restrictions above, having found PHP to be quite robust at doing simple systems programming... for example, running a socket daemon for an IPC protocol (not meant for scalability, only for a handful of processes to interact), and other such fun stuff.

    Yes, I hear the gasps but the fact is it worked, and worked quite well, so stuff it. Basically, I just treated PHP like a scripting-language version of C and it worked.

    PHP isn't bad as long as you A) don't program Java in PHP, B) keep it simple (see A), and don't try to be clever or cute with your programs (see A and B).

  • (cs) in reply to snoofle

    double post

  • Yazeran (unregistered) in reply to elbekko
    elbekko:
    Looks like it's cool again to bash PHP.

    First of all, PHP should be used for webpages, and cronjobs related to webpages. That's about it.

    Now then, please do suggest a good alternative to PHP that:

    • Doesn't suck balls
    • Isn't slow as hell (in the sense of slower than PHP)
    • Is widely supported
    • Isn't expensive to deploy
    • Doesn't add ages to development time
    • Isn't platform-specific

    So now that we've ruled out the fanboy languages and ASP(.NET), what's left?

    For the love of programming, I'd expect people on here to have a brain once in a while and not jump on the first bandwagon they see.

    Well Perl does that job just fine. I don't know the speed of Perl versus PHP (no PHP experience), but on all the other counts it does fit the bill.

    Yours Yazeran

    Plan: To go to Mars one day with a hammer

  • (cs) in reply to snoofle
    snoofle:
    This comment on php-driven raid controllers *beep* is being written because *Beep* it is important to note that *BEEP* php may not be the best choice for this purpo... *Plug yanked*

    Let me guess, Promise SX**** ?

  • (cs) in reply to operagost
    operagost:
    Tim:
    Dear God,

    Please kill PHP.

    Sincerely,

    Everyone except PHP programmers (and VB programmers).

    Ha ha, I get it. You're an elitist programmer. You probably only know C on BSD or Linux, spell "Windows" with a Z, and laugh at "User Friendly." You do a little web programming in Perl, but dismiss its inferiorities as being part of a "more powerful" scripting language "not for MC$E idiots." Your fatal slip was attacking VB and PHP in the same sentence, whereas they are two totally different languages and, for one, PHP is actually cross-platform. Ha ha, I and every other quasi-programmer who even knows how to spell PHP should kill ourselves. That's hilarious. I can't wait to hear your splendid C-pound material.

    I like it - slag on someone for hating php. Seriously, it's you who has the problem; php is godawful, has little consistency, and is generally useful only because it's easy to use. It's the VB of the web world. But I guess you can't deal with someone pointing out the flaws of your baby.

  • skin256 (unregistered) in reply to Franz_Kafka

    But I use VB in the web world too, I like PHP also and C# and Perl and Python and C and C++ and Java etc...I like programming..why bash at all??

  • rycamor (unregistered) in reply to convicted felon
    convicted felon:
    Wide support is a non-issue for this WTF. They were running a customized PHP with a customized HTTP server on the local machine.

    Because of that, I would suggest Perl, Ruby, Python, or Lua. Hell, even C++ if the object oriented speed is absolutely essential.

    Perl, Ruby, and Python are well within the same performance range as PHP, and would require pretty much the same sort of solution (ignoring the specific idiocy of the PHP code quoted above). Actually, Ruby is considerably slower than PHP.

    The question of running an HTTP server with then CGI, thus re-starting the scripting environment for each refresh (THUS re-invoking every system call you just made) makes the whole thing a joke, no matter what scripting language you use. Lua alone might be a winner here just because of its small start-up footprint.

    More to the point, as I was saying, the overall architecture is the problem. Lua would solve this nicely if you just installed Kepler, thus having an HTTP daemon running continuously, with no need for external server or CGI. But even lighttpd with PHP running as a module would be much preferable to HTTP/CGI/Python, for example.

  • (cs) in reply to convicted felon
    convicted felon:
    elbekko:
    Looks like it's cool again to bash PHP.

    First of all, PHP should be used for webpages, and cronjobs related to webpages. That's about it.

    Now then, please do suggest a good alternative to PHP that:

    • Doesn't suck balls
    • Isn't slow as hell (in the sense of slower than PHP)
    • Is widely supported
    • Isn't expensive to deploy
    • Doesn't add ages to development time
    • Isn't platform-specific

    So now that we've ruled out the fanboy languages and ASP(.NET), what's left?

    For the love of programming, I'd expect people on here to have a brain once in a while and not jump on the first bandwagon they see.

    Wide support is a non-issue for this WTF. They were running a customized PHP with a customized HTTP server on the local machine.

    Because of that, I would suggest Perl, Ruby, Python, or Lua. Hell, even C++ if the object oriented speed is absolutely essential.

    I'd say use java, ruby, or python. I don't really see the appeal of straight perl if php is out.

  • (cs) in reply to operagost
    operagost:
    Ha ha, I get it. You're an elitist programmer. You probably only know C on BSD or Linux, spell "Windows" with a Z, and laugh at "User Friendly." You do a little web programming in Perl, but dismiss its inferiorities as being part of a "more powerful" scripting language "not for MC$E idiots." Your fatal slip was attacking VB and PHP in the same sentence, whereas they are two totally different languages and, for one, PHP is actually cross-platform. Ha ha, I and every other quasi-programmer who even knows how to spell PHP should kill ourselves. That's hilarious. I can't wait to hear your splendid C-pound material.

    While I agree that VB and PHP are different languages they have 2 things in common:

    1. They are used by not-the-most-proficient-programmers
    2. They are hard to use and encourage bad code and bad/no design.

    PS. VB is kind of cross-platform. There is gambas and mono-basic.

  • SomeCoder (unregistered) in reply to Franz_Kafka
    Franz_Kafka:
    operagost:
    Tim:
    Dear God,

    Please kill PHP.

    Sincerely,

    Everyone except PHP programmers (and VB programmers).

    Ha ha, I get it. You're an elitist programmer. You probably only know C on BSD or Linux, spell "Windows" with a Z, and laugh at "User Friendly." You do a little web programming in Perl, but dismiss its inferiorities as being part of a "more powerful" scripting language "not for MC$E idiots." Your fatal slip was attacking VB and PHP in the same sentence, whereas they are two totally different languages and, for one, PHP is actually cross-platform. Ha ha, I and every other quasi-programmer who even knows how to spell PHP should kill ourselves. That's hilarious. I can't wait to hear your splendid C-pound material.

    I like it - slag on someone for hating php. Seriously, it's you who has the problem; php is godawful, has little consistency, and is generally useful only because it's easy to use. It's the VB of the web world. But I guess you can't deal with someone pointing out the flaws of your baby.

    I like it - slag on someone for liking php. Seriously....

    That argument can go both ways, you know.

    You can write bad code in any language. PHP has some flaws that make it easier to write bad code in it but it's still possible to write perfectly functioning, fast, code in PHP. You are free to insert your favorite language in place of PHP in this comment.

  • Montoya (unregistered)

    I love love LOVE the part where they unset() a global variable ($new_str), then start building a string with the same variable (now in the function's scope) and then return it. Or maybe it was never global. It just shows a lack of basic programming comprehension :(

  • (cs) in reply to skin256
    skin256:
    But I use VB in the web world too, I like PHP also and C# and Perl and Python and C and C++ and Java etc...I like programming..why bash at all??

    You use VB6? I guess that would make VB the VB of the web world, along with PHP. VB.Net is a bit different, enough so that VB programmers were fairly unhappy with the switch.

    As an addendum to my last comment, I'd write the raid i/f as a persistent process that accepted tcp connections from localhost or updated a text file as the situation required; all depends on the actual use case, but I bet it'd get rid of some of the slowness and overall braindamage.

  • (cs) in reply to SomeCoder
    SomeCoder:
    Franz_Kafka:
    operagost:
    Tim:
    Dear God,

    Please kill PHP.

    Sincerely,

    Everyone except PHP programmers (and VB programmers).

    Ha ha, I get it. You're an elitist programmer. You probably only know C on BSD or Linux, spell "Windows" with a Z, and laugh at "User Friendly." You do a little web programming in Perl, but dismiss its inferiorities as being part of a "more powerful" scripting language "not for MC$E idiots." Your fatal slip was attacking VB and PHP in the same sentence, whereas they are two totally different languages and, for one, PHP is actually cross-platform. Ha ha, I and every other quasi-programmer who even knows how to spell PHP should kill ourselves. That's hilarious. I can't wait to hear your splendid C-pound material.

    I like it - slag on someone for hating php. Seriously, it's you who has the problem; php is godawful, has little consistency, and is generally useful only because it's easy to use. It's the VB of the web world. But I guess you can't deal with someone pointing out the flaws of your baby.

    I like it - slag on someone for liking php. Seriously....

    That argument can go both ways, you know.

    You can write bad code in any language. PHP has some flaws that make it easier to write bad code in it but it's still possible to write perfectly functioning, fast, code in PHP. You are free to insert your favorite language in place of PHP in this comment.

    I'm slagging on OG for his kneejerk reaction - I don't care if he likes php or not. if he does, he should be familiar with the warts.

    anyone can write bad code in any language, but PHP makes it really easy.

  • Montoya (unregistered)

    PHP installed as an Apache module is really fast, and that's what you'll get with any stock server nowadays. Add one module, APC, which caches your compiled scripts, and you have an insanely fast site environment.

    We all know that PHP shouldn't be used for devices, or desktops, or (insert-non-server enviroment here).

    It started out as "Personal HomePage." It's obvious. It's for websites. And if you use it right, it's REALLY GOOD for them. It's a lot faster than any RoR or Java or .NET setup you can get, and it's a heck of a lot easier to setup than Python or Perl, where the speed is comparable.

    But those of us who use it professionally don't need to defend it; we don't code to be trendy. We also don't mind that script kiddies make the language look bad. We just keep doing what we do.

  • (cs) in reply to elbekko
    elbekko:
    Now then, please do suggest a good alternative to PHP that: * Doesn't suck balls * Isn't slow as hell (in the sense of slower than PHP)

    What do you mean by 'slow'? For example GC in theory slows down programs. But since programers don't have to worry to track leaks (except logicall leaks) they have more time to optimalisation. In many cases caching can speed up the whole process and/or speed little matters (compared to transfers).

    elbekko:
    * Is widely supported

    What do you mean 'widely'? Nearly all of languages (python, ruby, perl...) has it's own active community grouped around newsgroup or irc channel.

    elbekko:
    * Isn't expensive to deploy

    In short of long run?

    elbekko:
    * Doesn't add ages to development time

    Nearly all (except initial treining).

    elbekko:
    * Isn't platform-specific

    Nearly all

  • rycamor (unregistered) in reply to Montoya
    Montoya:
    I love love LOVE the part where they unset() a global variable ($new_str), then start building a string with the same variable (now in the function's scope) and then return it. Or maybe it was never global. It just shows a lack of basic programming comprehension :(

    No, it is not a global. In PHP you need to define globals inside the function or the variable is local. Ergo, what they are doing is just plain idiotic: unsetting a variable that does not yet exist.

    Maybe they thought it had something to do with concurrency, but that betrays an abysmal ignorance of PHP.

  • (cs) in reply to elbekko
    elbekko:
    Looks like it's cool again to bash PHP.

    First of all, PHP should be used for webpages, and cronjobs related to webpages. That's about it.

    Now then, please do suggest a good alternative to PHP that:

    • Doesn't suck balls
    • Isn't slow as hell (in the sense of slower than PHP)
    • Is widely supported
    • Isn't expensive to deploy
    • Doesn't add ages to development time
    • Isn't platform-specific

    So now that we've ruled out the fanboy languages and ASP(.NET), what's left?

    For the love of programming, I'd expect people on here to have a brain once in a while and not jump on the first bandwagon they see.

    Java?

    I for one, like PHP for small projects and budget-strapped web applications; if you're good enough you can even do MVC on PHP. But for beefier stuff, I will tend to jump into Java with its EE framework; it does a good job on managing DB transactions without much hassle.

  • (cs)

    Is it only me or does this feel like a re-run? I could have sworn that i have read about a raid controller that abuses exec and uses php a lot already.

  • Brompot (unregistered) in reply to skin256
    skin256:
    But I use VB in the web world too, I like PHP also and C# and Perl and Python and C and C++ and Java etc...I like programming..why bash at all??

    Because bash is a much nicer scripting language than all the other ones.

  • Saturday League Devver (unregistered)

    If I dad wrote this piece of code, I would have written it in PHP too since C is too difficult to spell out for me.

    Serious. PHP is able to do things like this, but still. I would prefer a more low-level language for critical applications.

  • (cs) in reply to Chiper
    Chiper:
    Evo:
    PHP was designed?
    Absolutely. By about 5000 different people with completely different ideas.
    PHP has more depreciated function calls and features then any other language I've ever used

    This is a good thing. That gives it the potential to not suck someday.

  • (cs) in reply to jspenguin
    jspenguin:
    tdb:
    WTF for does an LCD controller module write events to log? Shouldn't it, like, control the LCD and let other parts of the system do the logging and whatnot?

    No, it doesn't handle logging. The log daemon is written in C -- but running 'strings' on it reveals that it abuses 'exec' just as much:

    $ strings qlogd
    ...
    /bin/umount -f %s >/dev/null 2>&1
    /sbin/e2fsck -p %s >/dev/null 2>&1
    /bin/mount -t ext3 %s %s >/dev/null 2>&1
    /sbin/mke2fs -j -b 4096 %s >/dev/null 2>&1
    ...
    ifconfig eth0 | awk '/inet addr:/{print $2}' | awk -F: '{print $2}'
    ...
    /usr/bin/snmptrap -v 1 -c %s %s %s %s 6 %d ""  %s s "%s"
    ...
    %s %s: "%s" "%s" "%s" "%s" "%d" "%s" "%s" "%s" >/dev/null 2>&1
    

    So it unmounts and fscks for you...that's what they mean by software RAID. :P

  • (cs) in reply to jonnyq
    jonnyq:
    Chiper:
    Evo:
    PHP was designed?
    Absolutely. By about 5000 different people with completely different ideas.
    PHP has more depreciated function calls and features then any other language I've ever used

    This is a good thing. That gives it the potential to not suck someday.

    No, it's a bad thing - it points to a lack of coherent design and that means it's probably simpler to toss it and go with something else.

  • (cs) in reply to jspenguin
    jspenguin:
    $ strings qlogd
    ...
    %s %s: "%s" "%s" "%s" "%s" "%d" "%s" "%s" "%s" >/dev/null 2>&1
    

    hehehe...

  • (cs) in reply to Matt
    Matt:
    operagost:
    Tim:
    Dear God,

    Please kill PHP.

    Sincerely,

    Everyone except PHP programmers (and VB programmers).

    Ha ha, I get it. You're an elitist programmer. You probably only know C on BSD or Linux, spell "Windows" with a Z, and laugh at "User Friendly." You do a little web programming in Perl, but dismiss its inferiorities as being part of a "more powerful" scripting language "not for MC$E idiots." Your fatal slip was attacking VB and PHP in the same sentence, whereas they are two totally different languages and, for one, PHP is actually cross-platform. Ha ha, I and every other quasi-programmer who even knows how to spell PHP should kill ourselves. That's hilarious. I can't wait to hear your splendid C-pound material.

    Wow. Who made you king jack-ass?

    Who asked you, Captain I'm-Not-Registered-But-I'm-Still-Entitled-To-Pontificate?

  • (cs) in reply to Franz_Kafka
    Franz_Kafka:
    operagost:
    Tim:
    Dear God,

    Please kill PHP.

    Sincerely,

    Everyone except PHP programmers (and VB programmers).

    Ha ha, I get it. You're an elitist programmer. You probably only know C on BSD or Linux, spell "Windows" with a Z, and laugh at "User Friendly." You do a little web programming in Perl, but dismiss its inferiorities as being part of a "more powerful" scripting language "not for MC$E idiots." Your fatal slip was attacking VB and PHP in the same sentence, whereas they are two totally different languages and, for one, PHP is actually cross-platform. Ha ha, I and every other quasi-programmer who even knows how to spell PHP should kill ourselves. That's hilarious. I can't wait to hear your splendid C-pound material.

    I like it - slag on someone for hating php. Seriously, it's you who has the problem; php is godawful, has little consistency, and is generally useful only because it's easy to use. It's the VB of the web world. But I guess you can't deal with someone pointing out the flaws of your baby.

    I don't slag on people for hating something; I slag on them for summarily dismissing various technologies and affixing labels to those who use them.

    It's not my baby, and that's where your rant falls flat. Maybe if you'd use more descriptive terms than "godawful" and "VB of the web world," you'd have some credibility.

    If it's easy to use, it can't be too inconsistent, can it?

  • (cs) in reply to operagost
    operagost:
    I don't slag on people for hating something; I slag on them for summarily dismissing various technologies and affixing labels to those who use them.

    It's not my baby, and that's where your rant falls flat. Maybe if you'd use more descriptive terms than "godawful" and "VB of the web world," you'd have some credibility.

    If it's easy to use, it can't be too inconsistent, can it?

    Who said i dismiss people for using PHP? I hate PHP, but it works for some stuff - so what? It is the VB of the web world - simple to use and responsible for a lot of nasty code riddled with security holes and slow sites.

    And yes, it can be easy to use and inconsistent - anyone can make it do something, but there are three ways to do lots of different thing, and you have to go looking for the way that does what you want. There may be something in the api for your specific needs, but it's named funny, so you don't find it and use an exec hack. Woops, security hole.

  • (cs) in reply to SomeCoder
    SomeCoder:
    Tim:
    Dear God,

    Please kill PHP.

    Sincerely,

    Everyone except PHP programmers (and VB programmers).

    I like it - slag on someone for liking php. Seriously....

    That argument can go both ways, you know.

    You can write bad code in any language. PHP has some flaws that make it easier to write bad code in it but it's still possible to write perfectly functioning, fast, code in PHP. You are free to insert your favorite language in place of PHP in this comment.

    (Puts on Carl Sagan voice)"Since time immemorial, people who take pride in their coding ability have pointed out that 'You can write bad code in any language.' Billyuns and Billyuns of scripting languages are out there..."

    Well, it's simply not true. I'd defy anybody to write bad code in Brainf*ck. Or indeed any code.

    More to the point, it's a pretty bloody stupid statement. Yes, it's possible. It's possible to write Alexandrine verse in anything other than French -- but it's bloody difficult. I imagine that Hawaiian might work well, but not much else will. (Mr Pope might care to disagree, but I'll bet it caused him severe gout.)

    Who cares about bad code? (Other than this site, obviously.) The objective is to write ... well, actually, good code is a fairly minimal step, but we'll leave it at that. Why don't we turn this perenially stupid argument on its head?

    "Language X encourages you to write good code because ..."

    Language X is clearly not PHP. That doesn't mean you don't use PHP where appropriate. It does mean that you don't use PHP where it's a synonym for tranquillising a horse.

    My personal bread-basket of non-X includes, in no particular order: Java, Visual Basic (in any form), ASP, JSP, Ada, Fortran, and Ruby (although the internal jury's still out on that one).

    80% of coding is maintenance. I've used and maintained PHP, but I wouldn't recommend it; needs must. It's a fine little language if you've got a small web-site and you don't mind castrating the MVC model.

    Perl also fails on this basis, although it's more than fine for a quick hack.

    For the job in the OP, I myself would probably pick Forth. I mean, jeez, it's a hardware controller. Who the fuck needs all the rest of this scripting/execing rubbish?

    I did, however, enjoy the following:

    %s %s: "%s" "%s" "%s" "%s" "%d" "%s" "%s" "%s" >/dev/null 2>&1

    For some reason, this makes me want to sing 'Spam Spam: "Spam" "Spam" Spam" "Spam" "Beans" "Spam "Spam" "Spam" ...

    ... but I doubt that /dev/null is listening.

  • Chris (unregistered) in reply to jspenguin
    jspenguin:
    tdb:
    WTF for does an LCD controller module write events to log? Shouldn't it, like, control the LCD and let other parts of the system do the logging and whatnot?

    No, it doesn't handle logging. The log daemon is written in C -- but running 'strings' on it reveals that it abuses 'exec' just as much:

    $ strings qlogd
    ...
    /bin/umount -f %s >/dev/null 2>&1
    /sbin/e2fsck -p %s >/dev/null 2>&1
    /bin/mount -t ext3 %s %s >/dev/null 2>&1
    /sbin/mke2fs -j -b 4096 %s >/dev/null 2>&1
    ...
    ifconfig eth0 | awk '/inet addr:/{print $2}' | awk -F: '{print $2}'
    ...
    /usr/bin/snmptrap -v 1 -c %s %s %s %s 6 %d ""  %s s "%s"
    ...
    %s %s: "%s" "%s" "%s" "%s" "%d" "%s" "%s" "%s" >/dev/null 2>&1
    
    So what happens when you don't use ext[2|3]?
  • (cs) in reply to henke37
    henke37:
    Is it only me or does this feel like a re-run? I could have sworn that i have read about a raid controller that abuses exec and uses php a lot already.

    It's from the forums: http://forums.thedailywtf.com/forums/p/8748/165703.aspx

  • (cs) in reply to danixdefcon5
    danixdefcon5:
    elbekko:
    Looks like it's cool again to bash PHP.

    First of all, PHP should be used for webpages, and cronjobs related to webpages. That's about it.

    Now then, please do suggest a good alternative to PHP that:

    • Doesn't suck balls
    • Isn't slow as hell (in the sense of slower than PHP)
    • Is widely supported
    • Isn't expensive to deploy
    • Doesn't add ages to development time
    • Isn't platform-specific

    So now that we've ruled out the fanboy languages and ASP(.NET), what's left?

    For the love of programming, I'd expect people on here to have a brain once in a while and not jump on the first bandwagon they see.

    Java?

    I for one, like PHP for small projects and budget-strapped web applications; if you're good enough you can even do MVC on PHP. But for beefier stuff, I will tend to jump into Java with its EE framework; it does a good job on managing DB transactions without much hassle.

    I meant for web development. I probably should've made that clearer. If you use Java for that, I WILL come over there and kill you.

    And to those suggesting Perl: seriously? I'd much rather stick to using PHP, which atleast has a decent interface for Apache.

  • blunder (unregistered) in reply to Bored Bystander
    Bored Bystander:
    Chiper:
    ...snip... PHP has more depreciated function calls and features then any other language I've ever used. ...snip...

    Give it a while, Python will definitely have more.

    How many does PHP have? I've never used it so I'm curious.

    IMO Python's not bad (yet): http://www.python.org/dev/peps/pep-0004/

    But it seems like they do a decent job of pulling out them out after a while. Which makes me sort of wish they'd "deprecate" Tkinter.

  • (cs) in reply to elbekko
    elbekko:
    And to those suggesting Perl: seriously? I'd much rather stick to using PHP, which atleast has a decent interface for Apache.

    My biggest issue with PHP is that part of its grammar is simple enough that even someone with no real understanding of programming, such as my father, could actually write significant amounts of code without too much difficulty.

    Many people would tell you that's a good thing. However, I believe it allows people who are only able to code WTFs to extend them much farther. In a language like Perl, if you can't think like a computer, you will have a very difficult time making a royal WTF. You're much more likely to give up in frustration.

    Also, while mod_perl may not be the greatest Apache interface, EmbPerlObject (written on top of mod_perl) seems to work fairly well to me.

    Now, I wouldn't recommend Perl for all programmers. It works well for me because my mind works that way. There are many perfectly competent programmers whose minds do not work in the way of perl, and I'd recommend they don't try too hard - not only will they hurt themselves, but, when I look at their code, they'll hurt me, too.

    Addendum (2008-11-03 19:27):

    elbekko:
    And to those suggesting Perl: seriously? I'd much rather stick to using PHP, which atleast has a decent interface for Apache.

    My biggest issue with PHP is that part of its grammar is simple enough that even someone with no real understanding of programming, such as my father, could actually write significant amounts of code without too much difficulty.

    Many people would tell you that's a good thing. However, I believe it allows people who are only able to code WTFs to extend them much farther. In a language like Perl, if you can't think like a computer, you will have a very difficult time making a royal WTF. You're much more likely to give up in frustration.

    Also, while mod_perl may not be the greatest Apache interface, EmbPerlObject (written on top of mod_perl) seems to work fairly well to me.

    Now, I wouldn't recommend Perl for all programmers. It works well for me because my mind works that way. There are many perfectly competent programmers whose minds do not work in the way of perl, and I'd recommend they don't try too hard - not only will they hurt themselves, but, when I look at their code, they'll hurt me, too.

    Addendum: All that having been said, the brief overview of what the PHP code was supposed to do sounds like something that PHP is very suited for. However, it also sounds like there's far too much code there. Furthermore, using Apache + PHP without using the Apache PHP module is a tremendous WTF. I do not see any benefit for this configuration.

    I'm still confused why a logging daemon would need to mount, fsck, or mkfs. I'm suspecting it's a fundamental confusion regarding what a logging daemon is supposed to do.

  • SomeCoder (unregistered) in reply to tgape
    tgape:
    My biggest issue with PHP is that part of its grammar is simple enough that even someone with no real understanding of programming, such as my father, could actually write significant amounts of code without too much difficulty.

    I often hear this argument used in the opposite way. "We need GC languages" or "We need languages that are easier" because "developer cycles are more expensive than CPU cycles!"

    Therefore, the argument goes, we need EASIER languages.

    To me, it just sounds like an excuse for programmers to be lazy. "They've got 1 GB of RAM so who cares if I'm frugal with memory?"

  • katastrofa (unregistered) in reply to SomeCoder
    SomeCoder:
    I often hear this argument used in the opposite way. "We need GC languages" or "We need languages that are easier" because "developer cycles are more expensive than CPU cycles!"

    Therefore, the argument goes, we need EASIER languages.

    To me, it just sounds like an excuse for programmers to be lazy. "They've got 1 GB of RAM so who cares if I'm frugal with memory?"

    No, it sounds like people do programming for money, not for bragging rights. Buying more RAM will often be cheaper than spending two weeks rewriting the damn thing from Java to C++. It is different with shrinkwrap software, but they're a different league from your typical in-house systems.

  • (cs) in reply to uzytkownik
    uzytkownik:
    operagost:
    Ha ha, I get it. You're an elitist programmer. You probably only know C on BSD or Linux, spell "Windows" with a Z, and laugh at "User Friendly." You do a little web programming in Perl, but dismiss its inferiorities as being part of a "more powerful" scripting language "not for MC$E idiots." Your fatal slip was attacking VB and PHP in the same sentence, whereas they are two totally different languages and, for one, PHP is actually cross-platform. Ha ha, I and every other quasi-programmer who even knows how to spell PHP should kill ourselves. That's hilarious. I can't wait to hear your splendid C-pound material.

    While I agree that VB and PHP are different languages they have 2 things in common:

    1. They are used by not-the-most-proficient-programmers
    2. They are hard to use and encourage bad code and bad/no design.

    PS. VB is kind of cross-platform. There is gambas and mono-basic.

    No it isn't - Mono can't run VB, only VB.Net. Gambas doesn't count either, because VB requires its legion of VB components in order to be what it is.

  • (cs) in reply to katastrofa
    katastrofa:
    SomeCoder:
    I often hear this argument used in the opposite way. "We need GC languages" or "We need languages that are easier" because "developer cycles are more expensive than CPU cycles!"

    Therefore, the argument goes, we need EASIER languages.

    To me, it just sounds like an excuse for programmers to be lazy. "They've got 1 GB of RAM so who cares if I'm frugal with memory?"

    No, it sounds like people do programming for money, not for bragging rights. Buying more RAM will often be cheaper than spending two weeks rewriting the damn thing from Java to C++. It is different with shrinkwrap software, but they're a different league from your typical in-house systems.

    You could just spend a couple hours removing and redoing the worst of your code - java isn't that small, but there's no reason a decent java programmer can't make things play nicely in limited memory environments.

  • (cs) in reply to Chris
    Chris:
    jspenguin:
    tdb:
    WTF for does an LCD controller module write events to log? Shouldn't it, like, control the LCD and let other parts of the system do the logging and whatnot?

    No, it doesn't handle logging. The log daemon is written in C -- but running 'strings' on it reveals that it abuses 'exec' just as much:

    $ strings qlogd
    ...
    /bin/umount -f %s >/dev/null 2>&1
    /sbin/e2fsck -p %s >/dev/null 2>&1
    /bin/mount -t ext3 %s %s >/dev/null 2>&1
    /sbin/mke2fs -j -b 4096 %s >/dev/null 2>&1
    ...
    ifconfig eth0 | awk '/inet addr:/{print $2}' | awk -F: '{print $2}'
    ...
    /usr/bin/snmptrap -v 1 -c %s %s %s %s 6 %d ""  %s s "%s"
    ...
    %s %s: "%s" "%s" "%s" "%s" "%d" "%s" "%s" "%s" >/dev/null 2>&1
    
    So what happens when you don't use ext[2|3]?

    This isn't for the actual volume. It reserves 256MB from each drive, which it places into a hidden RAID-1, which it formats as ext3 and stores the event log. Until I figured out that the event log follows the drives and not the controller, I was very confused as to why a brand-new controller had logged errors when I used test drives.

  • (cs) in reply to SomeCoder
    SomeCoder:
    tgape:
    My biggest issue with PHP is that part of its grammar is simple enough that even someone with no real understanding of programming, such as my father, could actually write significant amounts of code without too much difficulty.

    I often hear this argument used in the opposite way. "We need GC languages" or "We need languages that are easier" because "developer cycles are more expensive than CPU cycles!"

    Therefore, the argument goes, we need EASIER languages.

    Perl has automatic garbage collection. Unlike some languages, it actually does it as variables go out of scope, so you're not hit with big pauses when a GC cycle is run.

    To me, Perl is about as easy as these newer 'easier' languages. It's harder to learn, but once you know the language, it's just as quick to code in it. Quicker, in many cases, thanks to the sheer quantity of stuff in CPAN.

    The biggest difficulties with perl seem to be:

    1. Regexes. Perl considers regexes to be a first-class programming technique, as part of its rubbish listing focus. Many people therefore use them, sometimes extensively. Simple regexes make code difficult to read for the uninitiated. Complex regexes (such as the heart of Email::Valid) make code difficult to read even for the likes of me.

    2. Shell escapes are either a first or second class programming technique. As a result, people use them. This is rarely a good idea. (Hint: if you're ever tempted to do 'system("rm $file");', don't.)

    3. Some people have problems understanding simple variable references such as ${$hashrefs->[$i]}{$hashkey1}[$elem]{$1}. Other people don't. (Personally, I try to not write code like the above - but I can read it just fine.) There are also some people who go for complex variable references.

    4. Perl includes some easy array handling options, which should only be used under certain circumstances. It is left to the programmer to determine what those circumstances are.

  • (cs) in reply to jspenguin
    jspenguin:
    This isn't for the actual volume. It reserves 256MB from each drive, which it places into a hidden RAID-1, which it formats as ext3 and stores the event log. Until I figured out that the event log follows the drives and not the controller, I was very confused as to why a brand-new controller had logged errors when I used test drives.

    When you say 'logging', are you saying 'something similar to what syslog does', or are you saying 'journaling'? 256MB seems to me to be a lot to reserve to 'something similar to what syslog does', at least for low-end systems. I can't^Wdon't want to imagine something like what you are describing being used for something which is not low-end...

  • Andrew Eddie (unregistered) in reply to jspenguin
    jspenguin:
    Bad programmers can write PHP in any language, though.
    Bad programmers write code. Good programmers write code. The only difference between good and bad code is the programmer, not the language *sighs*
  • Santa Claus (unregistered)

    Jeez, I really HATE this language. It's killing cells in my brain every time I see code written in PHP!

    Why would somebody decide to use PHP in firmware unless he is brainless?

  • OldSchoolGeek (unregistered)

    FIRST!

    But my exec() abuse might have delayed the post a little bit.

  • Duke of New York (unregistered)

    Any language lets you write bad code. Some languages even encourage you.

    But there are a few languages, very few, that go so far as to punish you for not writing bad code.

  • (cs) in reply to Andrew Eddie
    Andrew Eddie:
    jspenguin:
    Bad programmers can write PHP in any language, though.
    Bad programmers write code. Good programmers write code. The only difference between good and bad code is the programmer, not the language *sighs*

    Damn straight. Choice of language is usually a follow-on problem caused by the first (as it certainly was in this case).

  • Peter (unregistered)

    I'm sure I'm not the first person to say this, but do you think we could have syntax highlighting on the code snippets?

    From a teaching perspective, it makes it a lot easier to see what the coder was thinking, and therefore where he went wrong.

  • (cs) in reply to tgape
    tgape:
    jspenguin:
    This isn't for the actual volume. It reserves 256MB from each drive, which it places into a hidden RAID-1, which it formats as ext3 and stores the event log. Until I figured out that the event log follows the drives and not the controller, I was very confused as to why a brand-new controller had logged errors when I used test drives.

    When you say 'logging', are you saying 'something similar to what syslog does', or are you saying 'journaling'? 256MB seems to me to be a lot to reserve to 'something similar to what syslog does', at least for low-end systems. I can't^Wdon't want to imagine something like what you are describing being used for something which is not low-end...

    Yes. It is just like syslog. In fact, it has an option to send log events to a remote syslog server. The log is stored as a plain text file with a binary index file.

  • Kagome Higurashi (unregistered)

    When all you have is a pineapple, and you're stupid enough, every problem looks like a nail.

Leave a comment on “Raiding the RAID”

Log In or post as a guest

Replying to comment #:

« Return to Article