Phpajax



  • I thought http://www.phpajax.org/ was rather funny. Not only does it have one of the worst layouts i have ever seen, there is a bit of engrish mixed in.



  • Business Plan

    1. Write some library for PHP to handle AJAX - how come nobody had that idea before?
    2. Put a site on the internet (spellchecking not required)
    3. Fill the site with adwords crap kind tips for the readers about some other fantastic products and services
    4. ???
    5. PROFIT!


  •  Eww, not only is there a massive amount of whitespace on the left of the page, but also the words in the sample class definition overlap one another.  Yuck.

    Here's an interesting opinion on AJAX: http://valorin.net/thoughts/forget_ajax_use_jue/



  • Holy crap.  Check out the "show source" on the example page.  A few highlights:

     

    Always be sure to map members over to local scope for easier code time! 

    /*
     *  The variables that was read in the method
     *  "input" is referenced here as local variable
     *  for made easy in the code time.
     */
    $a = & $this->input1;
    $b = & $this->input2;



    Ahh, the "sleep in php because the developer doesn't know about setTimeout" design pattern: how I know your broken, misguided ways!

    /* Sleep awhile for show the loading */
    sleep(3);
    


  • @morbiuswilters said:



    Ahh, the "sleep in php because the developer doesn't know about setTimeout" design pattern: how I know your broken, misguided ways!

    /* Sleep awhile for show the loading */
    sleep(3);

     

     

    Well, that would not be really a WTF if you read their goal:

    We're a project with the goal "write ajax without javascript"

     Still not that smart tough



  • @dtech said:

    Still not that smart tough
    Your spelling isn't any better than theirs, unless you're being funny.



  • Well, I'm not native English. Can't detect an error in that sentence, and neither can Firefox. So it must be grammar, not my strongest point.
    O wait, it's though isn't it. Stupid th's and gh's, and xh's. I aso always spell "height" wrong. Very irritating if you're making an CSS-website and don't understand why the heihgt of something is wrong.



  • @dtech said:

    Very irritating if you're making an CSS-website and don't understand why the heihgt of something is wrong.
     

    Tell me about it... I usually write "heigth" instead of "height".

    Now what's more interesting that my rubbish English grammar skills don't mean that my native speaking friends' grammar is any better. My favourite is their eternal misery with "their", "they're" and "there".



  • @DrJokepu said:

    My favourite is their they're eternal misery with "their", "they're" and "there".

    FTFY. 



  • @dtech said:

    Well, that would not be really a WTF if you read their goal:


    We're a project with the goal "write ajax without javascript"

     Still not that smart tough

    I don't know if you are serious or not, but the project itself uses JS.  By "write ajax without javascript" they mean end-users don't have to touch JS to get their program to work.  Obviously wrapping an entire language in another would be a WTF in the best of scenarios and these guys aren't even close to being that competent. 



  • @Eternal Density said:

    Here's an interesting opinion on AJAX: http://valorin.net/thoughts/forget_ajax_use_jue/
     

    TRW is the comments on that site calling JavaScript "Java." As much as I hate Java, being a C# devloper I'd never sink to calling Java somthing that low!

     

    Then there is AWTF where MS's JScript is included the .NET framwork! WTF is with that anyway?



  • I kind of expected the site to use AJAX, wouldn't that be a good demo? But I guess you couldn't change the template on every link if you were using AJAX. :)



  • @spacix said:

    TRW is the comments on that site calling JavaScript "Java." As much as I hate Java, being a C# devloper I'd never sink to calling Java somthing that low! Then there is AWTF where MS's JScript is included the .NET framwork! WTF is with that anyway?

     

    I don't know, I almost never use JavaScript but what I've heard is that it is a quite powerful client-side scripting language. Maybe that's why Microsoft provides an implementation of JavaScript in the .NET Framework.

    Too bad that for some reason it's usually used to program WTFs, annoying status bar marquees etc. I think it has more to do with the lack of training of many people who do web development.



  • @morbiuswilters said:

    @dtech said:

    Well, that would not be really a WTF if you read their goal:


    We're a project with the goal "write ajax without javascript"

     Still not that smart tough

    I don't know if you are serious or not, but the project itself uses JS.  By "write ajax without javascript" they mean end-users don't have to touch JS to get their program to work.  Obviously wrapping an entire language in another would be a WTF in the best of scenarios and these guys aren't even close to being that competent. 

    Yes, ofcourse their project uses JS, but I thought the origional reply was based on user-end code. If they are consistent with their code users shouldn't have to use setTimeOut but must use sleep()



  • @DrJokepu said:

    I don't know, I almost never use JavaScript but what I've heard is that it is a quite powerful client-side scripting language. Maybe that's why Microsoft provides an implementation of JavaScript in the .NET Framework.

    Too bad that for some reason it's usually used to program WTFs, annoying status bar marquees etc. I think it has more to do with the lack of training of many people who do web development.

    I was big into Java before being exposed to JS and I really hated JS at first.  Over time my opinions have changed somewhat and I dislike Java more than JS now.  I still think JS has a lot of problems, but it is quite powerful.  Obviously the abuses of JS have given it a bad name as well, but it still needs some serious work. 



  • @dtech said:

    Yes, ofcourse their project uses JS, but I thought the origional reply was based on user-end code. If they are consistent with their code users shouldn't have to use setTimeOut but must use sleep()

    That would make sense if sleep() were a function provided by their "framework" that output a setTimeout.  However, it is built into php so all it does is stop the output of the page for awhile, to make it appear that something dynamic is happening.  Really awful web developers will put something like "sleep(5)" at the end of their script and then dump out a script tag that does something so it emulates a 5 second timeout. 



  •  Oh... I just came up with a swell new acronym that can be used in meetings to talk about a new development environment.

     

    PHLAAPJAX (flapjacks)

     PHp

    Linux Architecture

    APache 

    aJAX

     

    Think about it and let me know. ;)

     

    Spuds 



  • Thought I was being funny-- but there is a FLAPJAX -- AJAX with a standard javascript style.

     

    /me shakes his head. 



  • @morbiuswilters said:


    We're a project with the goal "write ajax without javascript"

    I don't know if you are serious or not, but the project itself uses JS.  By "write ajax without javascript" they mean end-users don't have to touch JS to get their program to work.  Obviously wrapping an entire language in another would be a WTF in the best of scenarios and these guys aren't even close to being that competent. 

    "write ajax without javascript" could also mean they write a converter that converts your PHP classes into JSON so that you don't have to learn JavaScript because you only learned PHP's "hello world" using the book "Learn tha PHP on 4/20 'n Yo"

    Note: for things about 4/20 read 4/20 (cannabis culture)



  • @dtech said:

    Well, I'm not native English. Can't detect an error in that sentence, and neither can Firefox. So it must be grammar, not my strongest point.
    O wait, it's though isn't it. Stupid th's and gh's, and xh's. I aso always spell "height" wrong. Very irritating if you're making an CSS-website and don't understand why the heihgt of something is wrong.
     

    Don't be sad, I'm a native English speaker and I have trouble with "xh's" too. Like if I want to say, "High Overlord Xhantharxh, your rexharcapod is waiting at the traxha bay", I usually get something wrong.



  • @morbiuswilters said:

    @dtech said:

    Yes, ofcourse their project uses JS, but I thought the origional reply was based on user-end code. If they are consistent with their code users shouldn't have to use setTimeOut but must use sleep()

    That would make sense if sleep() were a function provided by their "framework" that output a setTimeout.  However, it is built into php so all it does is stop the output of the page for awhile, to make it appear that something dynamic is happening.  Really awful web developers will put something like "sleep(5)" at the end of their script and then dump out a script tag that does something so it emulates a 5 second timeout. 

    Not neccesairily. If you write your functions that require AJAX [b]entirely in PHP[/b]. There isn't much difference between:

    1. sending AJAX request. Waiting 5 seconds to receive it (PHP sleep). Execute it
    2. sending AJAX request. Receiving it. Waiting 5 seconds to execute it. (JS setTimeout)

    Well, maybe the difference is that the second one is more efficient because the connection to the server closes, which is one process less (server-side), which is less memory (ss) and uses a little less bandwith (both sides)



  • @Nether said:

    Don't be sad, I'm a native English speaker and I have trouble with "xh's" too. Like if I want to say, "High Overlord Xhantharxh, your rexharcapod is waiting at the traxha bay", I usually get something wrong.

    It's "trahxa bay"! Idiot.



  • @Nether said:

    @dtech said:

    Well, I'm not native English. Can't detect an error in that sentence, and neither can Firefox. So it must be grammar, not my strongest point.
    O wait, it's though isn't it. Stupid th's and gh's, and xh's. I aso always spell "height" wrong. Very irritating if you're making an CSS-website and don't understand why the heihgt of something is wrong.
     

    Don't be sad, I'm a native English speaker and I have trouble with "xh's" too. Like if I want to say, "High Overlord Xhantharxh, your rexharcapod is waiting at the traxha bay", I usually get something wrong.

    Wow, English is the official language in Xharbaxhit now too? And all the while I though the star trek/stargate "every alien speaks English so it's less easy to film" thingie was rubbish!
    Oo wait, I think they fixed that in ST by having universal translators or something, or that I remeber from a episode of Enterprise (I'm not really that much of a fan actually)
    Still not entirely fixed in Stargate [b]though[/b]. They do try something with aliens that lived on earth and spread humanity like 5000 years ago, but they didn't have English back then.



  • @dtech said:

    Well, maybe the difference is that the second one is more efficient because the connection to the server closes, which is one process less (server-side), which is less memory (ss) and uses a little less bandwith (both sides)
     <hints id="hah_hints"></hints>

    And you don't think that's a pretty big difference?  Try to imagine 2500 users all loading the page at once. 



  • @Aaron said:

    @dtech said:

    Well, maybe the difference is that the second one is more efficient because the connection to the server closes, which is one process less (server-side), which is less memory (ss) and uses a little less bandwith (both sides)
     

    And you don't think that's a pretty big difference?  Try to imagine 2500 users all loading the page at once. 

    Well, that's about 4MB p/p (at least, that's what it is at about 50 processes). 10 Gigs of memory, yes a bit much, but nothing to a server(-cluster) that should maintain 1,8 million users per hour (2500 users / 5 seconds = 500 users per second = 3600*500 users per hour, at peak times)

    Btw: the forum makes a installation of Firefox crash everytime it loads. I can prove it! Not my PC [b]though[/b]



  • Don't get me wrong, I've written whole applications (1000's lines of code) in JScript using DHTML contained in a .HTA before...

    I just don't get using javascript in .NET, they use their own .NETish style. I think Calling .NET's JScript the same as IE's JScript is like calling VB6 and VB.NET the same, but the inverse case as JScript is better without .NET. 

    For those of you that's never seen this, here is an example JScript.NET application:
    In my view the only thing wrose than JScript.NET is J# and we should just advoid that subject all together...

    @http://msdn2.microsoft.com/en-us/library/ms974588.aspx#scripting0714_topic9 is the page this was found on said:

    /*   Simple JScript service
    Andrew Clinick July 2000
    */

    // Import the required .NET namespaces.
    import System;
    import System.ServiceProcess;
    import System.Diagnostics;
    import System.Timers;

    class SimpleService extends ServiceBase
    {
    private var timer : Timer;

    // Constructor -- setup the service properties
    function SimpleService()
    {
    CanPauseAndContinue = true;
    ServiceName = "JScript Service";

    timer = new Timer();
    timer.Interval = 1000;
    timer.AddOnTimer(OnTimer);
    }

    // Method called when the service starts
    protected override function OnStart(args : String[])
    {
    // Create an entry in the event log, and start the timer
    EventLog.WriteEntry("JScript Service started");
    timer.Enabled = true;
    }

    // Method called when the service stops
    protected override function OnStop()
    {
    EventLog.WriteEntry("JScript Service stopped");
    timer.Enabled = false;
    }

    // Method called when the service pauses
    protected override function OnPause()
    {
    EventLog.WriteEntry("JScript Service paused");
    timer.Enabled = false;
    }

    // Method called when the service continues
    protected override function OnContinue()
    {
    EventLog.WriteEntry("JScript Service continued");
    timer.Enabled = true;
    }

    // Method called every time the timer clicks
    function OnTimer(source : Object, e : EventArgs)
    {
    EventLog.WriteEntry("Hello World from JScript!");
    }
    }

    // Create and run the service
    ServiceBase.Run(new SimpleService());

     

     



  • @spacix said:

    Don't get me wrong, I've written whole applications (1000's lines of code) in JScript using DHTML contained in a .HTA before...

    I just don't get using javascript in .NET, they use their own .NETish style. I think Calling .NET's JScript the same as IE's JScript is like calling VB6 and VB.NET the same, but the inverse case as JScript is better without .NET. 

    For those of you that's never seen this, here is an example JScript.NET application:
    In my view the only thing wrose than JScript.NET is J# and we should just advoid that subject all together...

    @http://msdn2.microsoft.com/en-us/library/ms974588.aspx#scripting0714_topic9 is the page this was found on said:


    [....Code....]
     

     

    I don't see whats wrong with it. Doesn't look much different from i.e. C# to me.
    I my opinion a language is never that bad (the applications can be)



  • @dtech said:

    maintain 1,8 million users
    you mean 1 TDWTF::COMMON::SYMBOLS::SEPARATORS::DECIMAL 8 right? 



  • Writing code that is interface with an explicit type declaration in the CIL (MSIL) from a non typed language is a WTF to me. JScript.NET does also allows for privileged code execution from a string though the eval() function from the .NET run time dynamically as it is compiled and ran on the spot much like it's normal JScript cousin's eval() function.

    Now lets link our input boxes to eval() functions, that couldn't cause a problem ever...

    If you have to use static types in a dynamic type langue then somthing has gone horrible wrong... My guess is the same guy who did this was the one that allowed injecting of ActiveX objects in IE's using DHTML's .innerHTML

     I know all of the .NET stuff goes to the same Bytecode for the CIL, but I just don't see how JScript would be used/required...



  • @dtech said:

    Not neccesairily. If you write your functions that require AJAX entirely in PHP. There isn't much difference between:

    1. sending AJAX request. Waiting 5 seconds to receive it (PHP sleep). Execute it
    2. sending AJAX request. Receiving it. Waiting 5 seconds to execute it. (JS setTimeout)

    Well, maybe the difference is that the second one is more efficient because the connection to the server closes, which is one process less (server-side), which is less memory (ss) and uses a little less bandwith (both sides)

    Yeah, there's a big difference.  The first doesn't work with output buffering (which should be using anyway) and it adds unnecessary network traffic.  It also relies on outputting screwed up HTML with script tags at the end of the document or even after the document.  Keep connections open adds a tremendous amount of strain to the server and most of all, the whole thing is just idiotic.  You don't do client-side scripting on the server.  Emulating setTimeout by dumping JS out after the document is just as retarded as emulating body.onload by dumping your HTML at the end of the body.  It has nothing to do with it being "entirely in PHP" because they easily could have provided an "asleep" function that just wrote out the appropriate setTimeout.  Please stop justifying truly godawful programming practices. 



  • No, see the tag, of both posts.



  • @dtech's sig said:

    There is no error
    I had a university lecturer who would say "if you do such and such there is error... but if you do such and such else, there is no error".


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.