1. Post #161
    Facepunch iSeries!
    rieda1589's Avatar
    November 2007
    4,196 Posts
    Begun coding a WordPress theme, it's incredibly easy... Thought it'd be harder.
    Reply With Quote Edit / Delete United Kingdom Show Events

  2. Post #162
    Gold Member
    Dr Magnusson's Avatar
    July 2008
    2,641 Posts
    Reply With Quote Edit / Delete Denmark Show Events

  3. Post #163
    Almost Dawn's Avatar
    May 2010
    74 Posts
    Python is an excellent generic purpose programming language fit for everything from simple scripting to server-side web applications. PHP on the other hand was designed to be a language for templating HTML files with small dynamic features, not something to be used for large web apps and the frameworks supporting them.

    Just because it was exclusively designed "exclusively for web programming" like PHP doesn't mean that it's better.


    I haven't used ASP.NET WebForms (nor ASP.NET), but seriously, you don't want to build web apps that have source code like this:

    Code:
    <html>
    <head>
      <title>Hello, World!</title>
    </head>
    <body>
      <h1>Hello, World!</h1>
      <?php mysql_query("bla"); ?>
    </body>
    </html>
    Your business logic (the SQL query in this case) should be separate from the "view" (HTML) layer.

    (This approach is especially bad in PHP because if the MySQL query were to fail, all the HTML code at that point would already have been sent to the browser and the user would be greeted with a PHP error message in the middle of the page, instead of making it possible to cleanly handle the error and show some kind of error page for the user. A hacky approach I've used to fix this in the past has been output buffering.)

    As KmartSqrl said, MVC is the perfect design pattern for web programming. Were you using an MVC setup, the MySQL query would be done in the model. The controller would then call the model, and pass the query results to the view for rendering.

    I really hope that you at least check out the web programming solutions available on other languages. If Python sounds promising, I'd get started with building some simple apps using something like CherryPy (and a templating language of your choice), and research other libraries for the purpose such as Django, web2py or Pylons.

    However, decide to stick to PHP (whatever the reason might be), I can recommend LightVC for a simple, unobtrusive view-controller system. And for database access, use PDO.
    instead of making it possible to cleanly handle the error and show some kind of error page for the user.
    Look, PHP is not my favorite language, it's true that it's practically a mess. But saying that it's not possible to control errors just shows that you can't code PHP for shit.

    http://php.net/manual/en/language.op...rorcontrol.php
    http://www.php.net/manual/en/language.exceptions.php

    seriously, you don't want to build web apps that have source code like this
    No, because if you're making a small project you obviously want it spread out among a shitload of files.
    If you're doing something huge, yes, I agree, ASP.NET organizes the data nicely, but for one small script or even medium-sized projects PHP's inline code approach is great, because it's easy to use.
    Reply With Quote Edit / Delete United States Show Events

  4. Post #164
    Gold Member
    Darkimmortal's Avatar
    April 2009
    2,535 Posts
    Comparing mod_php to ASP.NET in terms of stability isn't really fair. It is completely possible to crash a PHP FastCGI process with the right code and for that crash to have a huge knock-on effect without something in place to restart it.
    Reply With Quote Edit / Delete United Kingdom Show Events

  5. Post #165

    October 2005
    41 Posts
    Look, PHP is not my favorite language, it's true that it's practically a mess. But saying that it's not possible to control errors just shows that you can't code PHP for shit.
    I'm sorry, but exactly when did I ever make such an claim? Of course you can handle errors and exceptions in PHP, but the way of embedding your PHP code with your view layer, by default, will make it difficult to cleanly handle an error. This is why I even mentioned a simple solution I've used to get past that in the past.

    Let me explain once more: if you have a MySQL query in the middle of your HTML code, and if it fails, the browser will already have received some of your HTML code and then PHP will fail at the query. You can either add error checks to every single query spread in 50 different PHP files, or have an application structure that allows you to catch them all, log them and show the user a "Sorry, something went wrong" page. And this example explains exactly why the PHP way of mixing HTML and PHP is flawed.

    By immediately raging at me and saying that "I can't code PHP for shit" you only make yourself look like a total fool and jackass.

    No, because if you're making a small project you obviously want it spread out among a shitload of files.
    Let me give you a real-world scenario here. I wanted to build a simple website where the users of my Android application could fill out a small feedback form.

    I used Sinatra, a simple Ruby web "framework". Here's a look at the directory structure:

    Code:
    survey
      survey.rb
      views
        layout.erb
        survey.erb
        thanks.erb
    Exactly how is this "spread out along a shitload of files"? Exaggerating facts is not going to make your case any stronger. Of course, had my app been more than 3 pages big, I could have split the business logic from survey.rb to more files.

    but for one small script or even medium-sized projects PHP's inline code approach is great, because it's easy to use.
    No.
    Reply With Quote Edit / Delete Finland Show Events

  6. Post #166
    Gold Member
    ddrl46's Avatar
    October 2007
    3,526 Posts
    Go for the orange one, or change the blue to something like this:

    (#14568e)

    Or maybe add some buttons at the top to change the layout color?
    Reply With Quote Edit / Delete Netherlands Show Events

  7. Post #167
    Gold Member
    Dr Magnusson's Avatar
    July 2008
    2,641 Posts
    Go for the orange one, or change the blue to something like this:

    (#14568e)

    Or maybe add some buttons at the top to change the layout color?
    Ooooh, that fits really well!

    I'm just trying out different colors, seeing what fits best.

    http://errur.com/newrur/DarkBlue/

    Thanks for the suggestion.
    Reply With Quote Edit / Delete Denmark Show Events

  8. Post #168
    Almost Dawn's Avatar
    May 2010
    74 Posts
    Ooooh, that fits really well!

    I'm just trying out different colors, seeing what fits best.

    http://errur.com/newrur/DarkBlue/

    Thanks for the suggestion.
    Use <strong> instead of <b> and do some margin-top on the box rather than
    Code:
    <div style="height:100px;"></div> <!-- Spacing -->
    Other than that, nice job so far.
    Reply With Quote Edit / Delete United States Show Events

  9. Post #169
    Gold Member
    Nisd's Avatar
    October 2008
    423 Posts
    You can do the same in asp.net if you want......
    Reply With Quote Edit / Delete Denmark Show Events

  10. Post #170
    Dennab
    March 2009
    1,572 Posts
    About that, I 'fixed' the load by switching downloads back to my main server temporarily because I was fixing the mirror.

    Also, what kind of load was I putting on the physical host node?
    It was constantly (and exactly) 8.0, never changed, which was pretty strange I thought. As the email said, we have a 'limit' of 5.0 per VPS for extended periods of time.
    Reply With Quote Edit / Delete United Kingdom Show Events

  11. Post #171
    Gold Member
    compwhizii's Avatar
    February 2007
    8,400 Posts
    Let me explain once more: if you have a MySQL query in the middle of your HTML code, and if it fails, the browser will already have received some of your HTML code and then PHP will fail at the query. You can either add error checks to every single query spread in 50 different PHP files, or have an application structure that allows you to catch them all, log them and show the user a "Sorry, something went wrong" page. And this example explains exactly why the PHP way of mixing HTML and PHP is flawed.
    No the problem is that most people don't take the time to write full fledged error handling. If you had output buffering with a proper database class with error handling built in, this wouldn't be a problem.
    Reply With Quote Edit / Delete United States Show Events

  12. Post #172
    Gold Member
    Dr Magnusson's Avatar
    July 2008
    2,641 Posts
    Use <strong> instead of <b> and do some margin-top on the box rather than
    Code:
    <div style="height:100px;"></div> <!-- Spacing -->
    Other than that, nice job so far.
    I must've put it before the "margin: auto;"-segment last time, cause it didn't work then, and it works now.

    Thanks
    Reply With Quote Edit / Delete Denmark Show Events

  13. Post #173
    HeroicPillow's Avatar
    July 2009
    2,461 Posts
    Let me explain once more: if you have a MySQL query in the middle of your HTML code, and if it fails, the browser will already have received some of your HTML code and then PHP will fail at the query. You can either add error checks to every single query spread in 50 different PHP files, or have an application structure that allows you to catch them all, log them and show the user a "Sorry, something went wrong" page. And this example explains exactly why the PHP way of mixing HTML and PHP is flawed.
    First off, why would you place a query in the middle of your code? To make it harder on yourself?

    What if, per say, only one of ten queries failed? Instead of allowing the user to continue using the page if that one particular query wasn't needed in all nine other queries, you would completely strip functionality out of your webpage until you fix that one. And yes, you can log them if you desire it. I've personally never liked error pages, as it strips functionality away from the user, but if you'd like one you could most likely set up a custom error handler that redirects you to an "oops!" page.

    Oh, and here's some further information on that subject: http://www.phpfreaks.com/blog/or-die-must-die

    This is similar to how I view Java and C (albeit java is OOP), one is compiled on run-time, and one is compiled ahead of time. They both have their separate uses, and are each better at different projects.

    As andersonmat said a while back:
    Okay, just because it doesn't look great doesn't mean that PHP is bad. I can write clean and proper code in PHP that works well. Just because the majority of people suck at it doesn't mean it's bad.
    Reply With Quote Edit / Delete United States Show Events

  14. Post #174

    October 2005
    41 Posts
    No the problem is that most people don't take the time to write full fledged error handling. If you had output buffering with a proper database class with error handling built in, this wouldn't be a problem.
    Of course not - you can build well-structured applications with PHP: the point here is that the language is flawed and poorly designed (and the design encourages the kind of scenarios I've described). I mentioned output buffering myself as an solution to the example.

    HeroicPillow posted:
    What if, per say, only one of ten queries failed? Instead of allowing the user to continue using the page if that one particular query wasn't needed in all nine other queries, you would completely strip functionality out of your webpage until you fix that one
    I'm sorry, but if your SQL queries are failing, something is wrong with your code and you should fix it instead of ignoring it (and choosing to still proceed with rendering the page to the user might cause inconsistency or other side effects).

    andersonmat posted:
    Okay, just because it doesn't look great doesn't mean that PHP is bad. I can write clean and proper code in PHP that works well. Just because the majority of people suck at it doesn't mean it's bad.
    You can apply this same (non)argument to any language: the argument here *is not* that "people write bad code so PHP sucks". You can write good code in any language you consider to be bad.

    The point is, once again, that the design of PHP is flawed. You can write good code with PHP (and if you use PHP, you obviously should), but it doesn't fix the problems with the underlying programming language.
    Reply With Quote Edit / Delete Finland Show Events

  15. Post #175
    Moderator
    cosmic duck's Avatar
    September 2007
    2,553 Posts
    Just got done coding the layout for the Muxdos admin panel.

    Reply With Quote Edit / Delete United Kingdom Show Events Artistic Artistic x 1 (list)

  16. Post #176
    Gold Member
    nullsquared's Avatar
    November 2007
    2,450 Posts
    Code:
    <html>
    <head>
      <title>Hello, World!</title>
    </head>
    <body>
      <h1>Hello, World!</h1>
      <?php mysql_query("bla"); ?>
    </body>
    </html>
    Your business logic (the SQL query in this case) should be separate from the "view" (HTML) layer.
    You're 100% correct. I do not understand why you have PHP code embedded in your interface code.

    Edited:

    Also; you're saying that only small/unimportant websites use PHP? What about the behemoth that is Facebook?
    Reply With Quote Edit / Delete United States Show Events

  17. Post #177
    Gold Member
    compwhizii's Avatar
    February 2007
    8,400 Posts
    Just got done coding the layout for the Muxdos admin panel.

    ooooh

    Edited:

    I'm going to play with Ruby/RoR for a bit.
    Reply With Quote Edit / Delete United States Show Events

  18. Post #178

    October 2005
    41 Posts
    Also; you're saying that only small/unimportant websites use PHP? What about the behemoth that is Facebook?
    No, I'm not saying that - what I am saying is that PHP hasn't really been designed for writing large web apps, but instead for embedding pieces of dynamic code in otherwise static websites (as PHP's history says - Lerdorf created it for trivial things like a pageview counter). Regardless, PHP is used for so many large websites such as Wikipedia or Facebook - however, that is not a valid measure of how "good a language is".

    As an example, Twitter's frontend runs on Ruby (on Rails), reddit is Python, Stack Overflow is ASP.NET MVC... I could list tens of great web apps that run on different languages. (Facebook probably uses other languages for their backend, just like how Twitter's queuing runs on Scala.)

    PHP is so popular because at the time it was the best option for writing server-side code, and now it is so widely adopted among shared hosts. However, apps such as Passenger are starting to become popular in shared hosts - for example, I can run Rails apps on my Dreamhost package, because they have Passenger installed.

    But really, the decision on what language to go with is your choice.
    Reply With Quote Edit / Delete Finland Show Events

  19. Post #179
    Gold Member
    Bellmanator's Avatar
    August 2008
    1,608 Posts
    Getting to work on a lot of error handling and security features for PBA.

    also ITT: People arguing over how awesome/bad PHP is
    Reply With Quote Edit / Delete United States Show Events

  20. Post #180
    Dennab
    March 2009
    1,572 Posts
    My .htaccess is now 44 lines long because I refuse to have PHP work out what's going on when .htaccess is far faster, and just as dynamic. Just got rewrites for each different pre-set page type, with a general 'catch-all' at the bottom.
    Reply With Quote Edit / Delete United Kingdom Show Events

  21. Post #181
    Gold Member
    jaybuz's Avatar
    May 2006
    5,466 Posts
    I still prefer to make my own fonts and host them alongside the website i'm making and embed them with @font-face. Not only does it allow me to control all aspects of what's shown, but I can embed whatever you want that way. Not to mention I wanted a very specific style of font for my site with certain icons embedded so they could be colored whenever.

    But I guess it's handy for lazy people...
    It just helps save bandwidth and makes it easier really. Still nice of them.
    Reply With Quote Edit / Delete United Kingdom Show Events

  22. Post #182
    Almost Dawn's Avatar
    May 2010
    74 Posts
    Just got done coding the layout for the Muxdos admin panel.

    Yeah I stared at that for like a minute.

    Edited:

    You're 100% correct. I do not understand why you have PHP code embedded in your interface code.

    Edited:

    Also; you're saying that only small/unimportant websites use PHP? What about the behemoth that is Facebook?
    Because it's easier and if you only need to run a query or two there's little than can go wrong. The code is still easy to understand, and a single file is easier to maintain. Having it inline also gives you a better idea of how it's going to look in the actual browser.

    And I'm not saying that only small websites use PHP, however people seem to prefer ASP.NET for larger stuff (actually ASP.NET only makes sense to me for larger stuff) for its superior ability with MVC and classes, which, while indeed superior, are more work, which I really don't need if I'm making...say...an URL shortener (I made one a few days ago actually).

    Edited:

    No, I'm not saying that - what I am saying is that PHP hasn't really been designed for writing large web apps, but instead for embedding pieces of dynamic code in otherwise static websites (as PHP's history says - Lerdorf created it for trivial things like a pageview counter). Regardless, PHP is used for so many large websites such as Wikipedia or Facebook - however, that is not a valid measure of how "good a language is".

    As an example, Twitter's frontend runs on Ruby (on Rails), reddit is Python, Stack Overflow is ASP.NET MVC... I could list tens of great web apps that run on different languages. (Facebook probably uses other languages for their backend, just like how Twitter's queuing runs on Scala.)

    PHP is so popular because at the time it was the best option for writing server-side code, and now it is so widely adopted among shared hosts. However, apps such as Passenger are starting to become popular in shared hosts - for example, I can run Rails apps on my Dreamhost package, because they have Passenger installed.

    But really, the decision on what language to go with is your choice.
    Ruby appeals to me as well because it seems easy, powerful, and feasible for both small and large stuff. I actually read a bit of _why (<3) 's sublime guide but it never really amounted to anything for me. I'll probably play with it one day though.

    Edit:

    Heh, Ruby seems to be full of nifty stuff that's of moderate practical use but certainly interesting. http://en.wikipedia.org/wiki/Markaby
    Reply With Quote Edit / Delete United States Show Events

  23. Post #183
    Moderator
    cosmic duck's Avatar
    September 2007
    2,553 Posts
    Yeah I stared at that for like a minute.
    What?
    Reply With Quote Edit / Delete United Kingdom Show Events

  24. Post #184
    Gold Member
    compwhizii's Avatar
    February 2007
    8,400 Posts
    What's with the blurred out group descriptions?
    Reply With Quote Edit / Delete United States Show Events

  25. Post #185
    KSI
    Gold Member
    KSI's Avatar
    July 2007
    3,309 Posts
    Tagged for size


    Opinions?

    Edited:

    Based on this image that a friend did for a school project.
    Reply With Quote Edit / Delete United States Show Events

  26. Post #186
    Moderator
    cosmic duck's Avatar
    September 2007
    2,553 Posts
    What's with the blurred out group descriptions?
    Special features that haven't been announced yet.
    Reply With Quote Edit / Delete United Kingdom Show Events

  27. Post #187
    Gold Member
    Benjy355's Avatar
    January 2006
    264 Posts
    Spare time at school leads to:

    And that was my day.
    Code:
    javascript:var x = 98; function nextBottle() { if (document.getElementsByName('comment')[0].disabled) { setTimeout("nextBottle()", 100); } else { document.getElementsByName('add_comment_text')[0].value = x + " bottles of beer on the wall, " + x + " bottles of beer, take one down, pass it around, " + (x-1) + " bottles of beer on the wall."; document.getElementsByName('comment')[0].click(); x = x-1;  if (x > 0) { setTimeout("nextBottle()", 100); } } } nextBottle();
    I'm gonna look into doin' fun stuff with JS soon, although it's my least favorite language.
    Reply With Quote Edit / Delete Canada Show Events Funny Funny x 1 (list)

  28. Post #188
    turb_'s Avatar
    February 2010
    2,202 Posts
    (actually ASP.NET only makes sense to me for larger stuff)
    ASP.NET can be used in single pages if you wish, you don't have to setup a whole project in Visual Studio.

    Code:
    <%@ Page Language="C#" %>
    <html>
    <head>
    <title>The Time</title>
    </head>
    <body>
    The time is <%=DateTime.Now %>
    </body>
    </html>
    Reply With Quote Edit / Delete United Kingdom Show Events

  29. Post #189
    Almost Dawn's Avatar
    May 2010
    74 Posts
    It looks fucking sexy.
    Reply With Quote Edit / Delete United States Show Events

  30. Post #190
    Gold Member
    compwhizii's Avatar
    February 2007
    8,400 Posts
    Cleaned up CodeIgniter's default Debug output for SyncWiki

    Reply With Quote Edit / Delete United States Show Events

  31. Post #191
    Dennab
    March 2009
    1,572 Posts
    Cleaned up CodeIgniter's default Debug output for SyncWiki

    Looks nice :)

    Been working on Mod Outlet all morning, item pages mainly. Re-worked a few methods of doing things, including realizing each file actually only needs one download.

    Setup thumbnail system (well, half of it), now to build the cron which will process the thumbnail generation queue, and my thumbnails should start displaying nicely. Except it might be a manual cron in the end due to PHP execution limits, I may have to have it reload every thumbnail generation, and keep reloading (need to check if that actually works with a cron, it'll probably have to be a cron triggering a web-cron).
    Reply With Quote Edit / Delete United Kingdom Show Events

  32. Post #192
    Gold Member
    compwhizii's Avatar
    February 2007
    8,400 Posts
    Made it nicer

    Reply With Quote Edit / Delete United States Show Events

  33. Post #193
    turb_'s Avatar
    February 2010
    2,202 Posts
    Why don't you just step through the request in the debugger?

    Edited:

    Oh wait
    Reply With Quote Edit / Delete United Kingdom Show Events Dumb Dumb x 1 (list)

  34. Post #194
    Gold Member
    compwhizii's Avatar
    February 2007
    8,400 Posts
    Why don't you just step through the request in the debugger?

    Edited:

    Oh wait
    Why don't you not post like a fanboy every other post
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 6 (list)

  35. Post #195
    Gold Member
    arienh4's Avatar
    August 2007
    2,403 Posts
    Why don't you just step through the request in the debugger?

    Edited:

    Oh wait
    Speaking of which, how do you do that in ASP.NET?
    Reply With Quote Edit / Delete Netherlands Show Events

  36. Post #196
    turb_'s Avatar
    February 2010
    2,202 Posts
    Same way as you do in any other Visual Studio project.

    Click in the bar on the left of the code to set a breakpoint on that line, and when that code is about to be executed, it'll break and you can use step into and step over to debug. You can hover over variables to see values, works really well for objects.

    Good places to set a breakpoint are at Application_BeginRequest() in Global.asax or the Page_Load() method of your page's codebehind.

    I would post screenshots, but I'm on my iPod
    Reply With Quote Edit / Delete United Kingdom Show Events

  37. Post #197
    Almost Dawn's Avatar
    May 2010
    74 Posts
    Why don't you just step through the request in the debugger?

    Edited:

    Oh wait
    Fly away troll fly awaaay.
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 1 (list)

  38. Post #198
    Gold Member
    compwhizii's Avatar
    February 2007
    8,400 Posts
    Fuck off I'm so tired of you two going on about ASP.NET, give it a rest damn't
    Reply With Quote Edit / Delete United States Show Events Agree Agree x 1 (list)

  39. Post #199
    turb_'s Avatar
    February 2010
    2,202 Posts
    Fly away troll fly awaaay.
    Fly away on my zephyr...
    Reply With Quote Edit / Delete United Kingdom Show Events

  40. Post #200
    Apple extraordinaire~ ♥
    EDDY TT's Avatar
    November 2005
    12,231 Posts
    ASP.NET fan boys alert.
    Reply With Quote Edit / Delete United Kingdom Show Events