[QUOTE=Tuntis;22047666]
The PHP way of doing things is simply flawed
[/quote]
I do not fully understand; can you further elaborate? For example, PHP seems very similar to how ASP.NET handles WebForms. As for the model-view-controller design, I view it as an overly abstracted "perfect" design that is not actually required (or always beneficial) in practice. At least, that's what I've observed from non-web programming.
[quote]and if hosting is an issue, you can get a decent [url=http://www.intovps.com/]VPS here[/url] (or any other of the 5000000 VPS providers on the internet) for 10$ a month.[/quote]
That, or I can get free practically unlimited hosting from my friend.
[quote]
So is Python - it's a modern generic purpose scripting & programming language with much more functionality than PHP.[/QUOTE]
My apologies, I worked my sentence incorrectly. I was talking about server-side scripting functionality, not necessarily general purpose functionality. The question is how well python interacts with web based things.
[QUOTE=nullsquared;22050066]My apologies, I worked my sentence incorrectly. I was talking about server-side scripting functionality, not necessarily general purpose functionality. The question is how well python interacts with web based things.[/QUOTE]
Python works as well with web-based things as with anything else you'd want to use it for, I haven't used Python a lot though.
ASP.NET has the advantage of not having to learn another language.
[QUOTE=nullsquared;22050066]As for the model-view-controller design, I view it as an overly abstracted "perfect" design that is not actually required (or always beneficial) in practice. At least, that's what I've observed from non-web programming.[/QUOTE]
That's true for desktop programming, but MVC is literally the perfect design pattern for web development. It keeps things so much cleaner, and it's matched up incredibly well with how the web works in the first place.
Model = Database/XML feed/whatever
Controller = Server-side logic
View = What gets sent to the user
I'd definitely look in to adopting it early if you're getting in to web development. I think once someone really wraps their head around using MVC for web projects they'll stick with it.
I tend to just do:
work out what the request is
get data from database, or put data, depending
if put, redirect here (or continue)
template uses data to display page
[editline]11:37PM[/editline]
Doing it right now for Mod Outlet, building some pages, but I really am in a bad mood and can't be bothered to code anymore :/
[QUOTE=KmartSqrl;22051168]
[...]I'd definitely look in to adopting it early if you're getting in to web development[...]
[/QUOTE]
Thanks for the advice; I'll keep it in mind as I explore the world of web programming :smile:
[QUOTE=jaybuz;22048801]Guess what google showcased today!?
Custom fonts have never been easier. yay
[/QUOTE]
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...
[QUOTE=Almost Dawn;22046151]but if it's unstable and crashes all the time[/QUOTE]
Microsoft's official ASP.NET implementation and Mono practically never crash.
The issues AnyHub had yesterday was my stupid error. Every request, some code was executing that would cause a NullReferenceException. Because I was being too clever and running that code in a seperate thread, instead of the exception being caught and an error page being displayed, the exception bubbled all the way up the call stack and ended up crashing the Mono runtime.
The mistake I made was putting one single line:
[cpp]
new Thread(()=>f.Hit(Context.Request.UserHostAddress)).Start();
[/cpp]
outside an if block when it was supposed to be in.
[editline]08:04PM[/editline]
Also, nullsquared, think about this:
You could learn PHP and go that way, or you could use your fantastic C# skills that you already have with ASP.NET
[editline]08:12PM[/editline]
[QUOTE='-[ Fizzadar ]-;22047633']I see the VPS is going nicely now turb_ cheers for clearing up the load issue too :)[/QUOTE]
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?
However, turb_, you even have a script set up to catch every time that Mono crashes and restart it. Which you said happens [b]often[/b]. Everyone has there preference of language, and good for you -- enjoy your ASP.NET and C#, however for my simpler needs on the web, I'll stick with PHP because it hasn't let me down. It's been fast [i]enough[/i], and that's all I need right now. If I was running a site that gets hundreds of thousands of people on it, [i]then[/i] I might consider running a compiled language on the server.
[QUOTE=andersonmat;22059863]However, turb_, you even have a script set up to catch every time that Mono crashes and restart it.[/quote]
In case shit goes down while I'm sleeping
[quote]Which you said happens [b]often[/b].[/QUOTE]
It used to happen often before I knew what I was doing.
[QUOTE=Maccabee;22049967]Why are you comparing a programming language to a server side scripting language? You're comparing apples to chairs.[/QUOTE]
Python is an excellent generic purpose programming language fit for everything from simple scripting to [b]server-side web applications[/b]. 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.
[quote=nullsquared]I do not fully understand; can you further elaborate? For example, PHP seems very similar to how ASP.NET handles WebForms.[/quote]
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>
[/code]
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 [url=http://php.net/manual/en/function.ob-start.php]output buffering[/url].)
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 [url=http://www.cherrypy.org/wiki/CherryPyTutorial]CherryPy[/url] (and a [url=http://www.cherrypy.org/wiki/ChoosingATemplatingLanguage]templating language of your choice[/url]), 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 [url=http://www.lightvc.org/]LightVC[/url] for a simple, unobtrusive view-controller system. And for database access, use [url=http://php.net/manual/en/book.pdo.php]PDO[/url].
Begun coding a WordPress theme, it's incredibly easy... Thought it'd be harder.
Fucking around with colors
[URL="http://www.errur.com/newrur/Blue/"]www.errur.com/newrur/Blue/[/URL]
[URL="http://www.errur.com/newrur/Orange/"]www.errur.com/newrur/Orange/[/URL]
[URL="http://www.errur.com/newrur/Green/"]www.errur.com/newrur/Green/[/URL]
[QUOTE=Tuntis;22061479]Python is an excellent generic purpose programming language fit for everything from simple scripting to [b]server-side web applications[/b]. 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>
[/code]
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 [url=http://php.net/manual/en/function.ob-start.php]output buffering[/url].)
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 [url=http://www.cherrypy.org/wiki/CherryPyTutorial]CherryPy[/url] (and a [url=http://www.cherrypy.org/wiki/ChoosingATemplatingLanguage]templating language of your choice[/url]), 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 [url=http://www.lightvc.org/]LightVC[/url] for a simple, unobtrusive view-controller system. And for database access, use [url=http://php.net/manual/en/book.pdo.php]PDO[/url].[/QUOTE]
[quote]instead of making it possible to cleanly handle the error and show some kind of error page for the user.[/quote]
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.
[url]http://php.net/manual/en/language.operators.errorcontrol.php[/url]
[url]http://www.php.net/manual/en/language.exceptions.php[/url]
[quote]seriously, you don't want to build web apps that have source code like this[/quote]
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.
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.
[QUOTE=Almost Dawn;22064538]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.[/quote]
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 [b]flawed[/b].
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.
[quote]No, because if you're making a small project you obviously want it spread out among a shitload of files.[/quote]
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 [url=http://www.sinatrarb.com/]Sinatra[/url], a simple Ruby web "framework". Here's a look at the directory structure:
[code]
survey
survey.rb
views
layout.erb
survey.erb
thanks.erb[/code]
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.
[quote]but for one small script or even medium-sized projects PHP's inline code approach is great, because it's easy to use.[/QUOTE]
No.
[QUOTE=Dr Magnusson;22063109]Fucking around with colors
[URL="http://www.errur.com/newrur/Blue/"]www.errur.com/newrur/Blue/[/URL]
[URL="http://www.errur.com/newrur/Orange/"]www.errur.com/newrur/Orange/[/URL]
[URL="http://www.errur.com/newrur/Green/"]www.errur.com/newrur/Green/[/URL][/QUOTE]
Go for the orange one, or change the blue to something like this:
[img]http://i49.tinypic.com/zjdzpy.png[/img]
(#14568e)
Or maybe add some buttons at the top to change the layout color?
[QUOTE=ddrl46;22065620]Go for the orange one, or change the blue to something like this:
[IMG]http://i49.tinypic.com/zjdzpy.png[/IMG]
(#14568e)
Or maybe add some buttons at the top to change the layout color?[/QUOTE]
Ooooh, that fits really well!
I'm just trying out different colors, seeing what fits best.
[url]http://errur.com/newrur/DarkBlue/[/url]
Thanks for the suggestion.
[QUOTE=Dr Magnusson;22065782]Ooooh, that fits really well!
I'm just trying out different colors, seeing what fits best.
[url]http://errur.com/newrur/DarkBlue/[/url]
Thanks for the suggestion.[/QUOTE]
Use <strong> instead of <b> and do some margin-top on the box rather than
[code]<div style="height:100px;"></div> <!-- Spacing -->[/code]
Other than that, nice job so far.
You can do the same in asp.net if you want......
[QUOTE=turb_;22059711]
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?[/QUOTE]
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.
[QUOTE=Tuntis;22064909]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 [b]flawed[/b].[/QUOTE]
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.
[QUOTE=Almost Dawn;22065832]Use <strong> instead of <b> and do some margin-top on the box rather than
[code]<div style="height:100px;"></div> <!-- Spacing -->[/code]Other than that, nice job so far.[/QUOTE]
I must've put it before the "margin: auto;"-segment last time, cause it didn't work then, and it works now.
Thanks :v:
[QUOTE=Tuntis;22064909]
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 [B]flawed[/B].
[/QUOTE]
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: [url]http://www.phpfreaks.com/blog/or-die-must-die[/url]
This is [I]similar[/I] 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:
[QUOTE=andersonmat;22040495]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.[/QUOTE]
[QUOTE=compwhizii;22066574]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.[/QUOTE]
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.
[quote=HeroicPillow]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[/quote]
I'm sorry, but if your SQL queries are failing, [b]something is wrong with your code[/b] 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).
[quote=andersonmat]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.[/quote]
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 [b]design of PHP[/b] 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.
Just got done coding the layout for the Muxdos admin panel.
[img_thumb]http://img.hexxeh.net/f3bb58ad0d15a97787df22e9d8593ddb.png[/img_thumb]
[QUOTE=Tuntis;22061479]
[code]
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<h1>Hello, World!</h1>
<?php mysql_query("bla"); ?>
</body>
</html>
[/code]
Your business logic (the SQL query in this case) should be separate from the "view" (HTML) layer.[/QUOTE]
You're 100% correct. I do not understand why you have PHP code embedded in your interface code.
[editline]03:31PM[/editline]
Also; you're saying that only small/unimportant websites use PHP? What about the behemoth that is Facebook?
[QUOTE=cosmic duck;22066996]Just got done coding the layout for the Muxdos admin panel.
[img_thumb]http://img.hexxeh.net/f3bb58ad0d15a97787df22e9d8593ddb.png[/img_thumb][/QUOTE]
ooooh
[editline]03:33PM[/editline]
I'm going to play with Ruby/RoR for a bit.
[QUOTE=nullsquared;22067285]Also; you're saying that only small/unimportant websites use PHP? What about the behemoth that is Facebook?[/QUOTE]
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 [url=http://www.modrails.com/]Passenger[/url] 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.
Getting to work on a lot of error handling and security features for PBA.
also ITT: People arguing over how awesome/bad PHP is
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.
Sorry, you need to Log In to post a reply to this thread.