Jump to content

redbullmarky

Staff Alumni
  • Posts

    2,863
  • Joined

  • Last visited

    Never

Everything posted by redbullmarky

  1. there's a fair few things you can do with CakePHP that can significantly increase performance. at the end of the day, it's been around for long enough, has a strong community and is considered one of the more "serious" candidates for full sites. In many ways, it's not necessarily down to the code itself as much as the server it's running on, so dont worry too much about that. Cake does force some conventions onto you, such as the way you structure your application, etc but this to me is not a bad thing as making changes, switching configuration, nice clean URL's, etc is made very easy. templates come in the form of layouts/view - that is, you have a "master" file, and each page has its own "view" file - just a template. however, it uses proper PHP code instead of special tags, meaning that you wont have to mess around learning a new language. validation, SQL queries (due to the way the model is structured), etc etc etc are all generally taken care of so you can jump in and get started. Run through the blog tutorial on their site, and you'll see what I mean. I have a lot of time for CodeIgniter, as it's much easier to get used to and comes with LOTS more out of the box - my only problem is that it's still quite new and written by a single developer, and doesnt do as much for you automatically/instinctively (eg, with Cake, stuff you ALWAYS do, like rendering the template and displaying it to the screen, is done for you - whereas with CodeIgniter, you do that manually). As they're similar frameworks, a bit of hacking will allow you to easily use CodeIgniters really useful libraries and helpers in Cake - and if you've installed Cake and have a basic grasp on it, I'd probably advise NOT to move to CodeIgniter. Don't overlook CMS/frameworks such as Joomla (which has come a LONG way since its mambo days) - there's a tonne of plugins/modules, etc for it, some of which may take care of your social networking elements for you. I swear I hated that CMS not all that long ago, but recently I gave it another blast and it's pretty good and quite easy to get into quickly these days. As for smarty, it's bloated and serves no purpose other than to force you to learn a whole new syntax to do what PHP can do anyway. It doesn't offer any more seperation of presentation code from your application than PHP does, regardless of how much spin+arguments are thrown on it or how they dress it up into "tags". if all of that still doesnt do the trick or help, and you need even MORE social network elements, take a look at http://www.phpizabi.net/ and see whether that covers your goals. Cheers
  2. still in your source: <a hrwef="webtoolz.php">WebToolz</a>
  3. you could do worse than reading up a bit more on Active Record: http://en.wikipedia.org/wiki/Active_record . I actually use an implementation based on CakePHP (which in turn is based on Rails), so I can just do stuff like: <?php // simple example to read user with 'id' of 3, change its username and change it back. // pointless exercise but just an example of what can be done.... $user = new User(); // user class extends model class $user->id = 3; $user->read(); // SELECT query: SELECT * FROM users WHERE id = 3 $oldusername = $user->username; $user->username = 'hello'; $id = $user->save(); // UPDATE or INSERT query depending if 'id' field is set in my object // UPDATE users SET username = '$oldusername' WHERE id = 3 $user->saveField('username', $oldusername); ?> the point really, as thorpe suggested, is that I dont need to keep rewriting common queries, or even escaping data for queries. my methods automatically run inputted data through mysql_real_escape_string and built the queries for me. Consider if I create a registration page. My User model can be used again and again on many sites, even if my table structure alters, with minimal changes rather than rewriting entire queries. I also dont need to check whether to use INSERT or UPDATE when saving data. I can also change the DB to something like MSSQL, Oracle, etc without breaking my main code. Hell, I can even use flat file DB if I want, yet my code remains the same. PHP does have __get , __set and __call magic methods should you need them, which you can see at work in my example where i use $user->username and $user->id . See here Hope that helps! Cheers
  4. many of the recent MVC (Model/View/Controller) frameworks are jumping on the "build a blog in 10 minutes" version of the classic "hello world", so you could do worse than check them out. Take a look at CakePHP (http://www.cakephp.org) for starters, as it might provide you with either the answer to your whole problem or at least give you some ideas about breaking down your functions into OOP classes/methods that concentrate on individual tasks. Cheers edit: cake's blog tutorial is here: http://manual.cakephp.org/appendix/blog_tutorial .
  5. the point is, many/most mobile phones are working like PDA's now - so PDA's really arent such an ancient technology at all. So as for other technologies such as WAP, they're a waste of time nowadays (at least as far as i'm concerned) And if anything, phone's will be made MORE like computers. Many already run fairly decent browsers. Opera/Firefox, etc are all muscling in to take advantage, with Safari getting in there too. As with anything similar, you've got to consider your audience. The averge Tom, Dick and Harry really doesnt browse the net on their phone - it's more the exec types. Consider the limitations. Consider the cost. People who browse on phones currently dont necessarily want/expect the same experience that computers can provide - they just want the info they search for for as cheap as possible, which generally means a much more limited output, limited graphics, not sprayed with Google ads, etc. Many times, designing sites/content output for a PDA/phone is no different for designing for different screen resolutions, with the addition that maybe you want to scale down the content as well as alter the layout of it. Last time I checked, BBC News (http://news.bbc.co.uk ) was a pretty good example of everything i've mentioned.
  6. hmm <?php $name = "Mark"; $letters = array(); // put all letters of name into an array. // use the array key to store the original letter (ie, to maintain case) for($i = 0; $i < strlen($name); $i++) { $letter = $name[$i]; $letters[$letter] = strtolower($letter); } // sort array maintaining the keys asort($letters); // stick the keys together and output. $name = implode('', array_keys($letters)); echo $name; // outputs akMr ?>
  7. it's not unusual for questions of a similar nature to be asked at interviews to see your reaction and how long you'll think about it for. some might think about it for a few seconds (or not at all) before giving in (ie, defeatist knowing they wont be able to do it, so dont even try). some might think for much longer and either get it or not. some will explain how they might go about trying to solve it, even if they dont actually do so (i'd probably fall into this category for puzzles and stuff like this). there are not too many regular people that can answer them without putting in some serious thought, and an interviewer doesnt plan sitting there all day whilst you solve puzzles - so dont worry too much about them. you say on your other topic that you got to one part - so obviously you started to tackle the problem the right way. explain this process to an interviewer, and my bet is it'd be almost as good an answer as giving the solution, for what he's looking for. coming up with a solution is not the be all and end all in many cases. problem solving is a huge part of programming/coding, yet most real situations wont require you to solve things like this on the spot - it's more about the way you approach and handle the task at hand.
  8. couldnt agree with you more - and it IS a great browser (and incidently it was you that made a fan out of me) but in my post i'm generally on about the main browser war between computer browsers rather than additional devices. my line: still stands IMO, because average user just wants to surf the net, check their hotmail/yahoo, do something on ebay and perhaps check the news - so speed, web standards, addons, toolbars, etc dont come into it as much. in that respect, there's no reason to switch. When I first came across FF, all I saw was them promoting that it was free and pushing across how many security issues IE has - which was enough for me. I believe Opera was not free software at that point, else maybe I would have gone down that road. In this case, "substantially different" was Free, secure and better features (ie, tabs etc). I still use Opera on my fone though
  9. Safari is a great little browser, but on a PC I reckon it'll suffer the same fate as Opera in that it doesnt offer anything substantially different to the average internet user. FF was free when many werent, and to be fair they rammed the point home - which is why it has taken the chunk from IE that it has. Until another browser really rams something special home, it'll be an IE vs FF battleground. Us developers will be its main users, I think - testing out for another popular browser, especially if the Win version renders the same as the Mac version (which is personally the only main reason for me being quite pleased with its release). And also because it's not generally your average user that cares much about web standards (unless a site appears purely mashed) - just developers and those with accessibility needs. It's been mentioned elsewhere but it wouldnt surprise me if Apple are up to something MUCH bigger as far as the PC/Windows is concerned, and this is just a start...
  10. yeah works for me ok: tried it on mac and PC.
  11. please do not double post... http://www.phpfreaks.com/forums/index.php/topic,144643.0.html
  12. As the title says, Apple have released public beta 3 of Safari. Downloading and installing as we speak.... http://www.apple.com/safari/
  13. lol.z
  14. depends what you need it for. most things can be achieved on either platform, but if you're (for example) into popular games, then a Windows PC is the way. If you like things simple, then Windows is the way. If you like to have full/greater control, then Linux is the way, but be prepared for a bit of a learning curve. Honestly - there really isn't anything between them. People harp on about security, yet Windows is bound to be the primary target for infections, etc because it's the most common - and 99% of people that get their computer messed up are either too lazy/inexperienced to figure out how to lock it down properly or spend too much time surfing for porn sites using an unpatched/unprotected computer. People go on about performance, yet for basic tasks such as running local test servers or web browsing or using Office, it really doesnt matter. Performance only really comes into play if you're (for example) a game developer using C++, or a musician running Cubase/Logic, etc, or a designer running intensive tasks using Photoshop, or a video editor, or a fan of modern games (most of which are built for Windows anyway, so again - performance not really an issue here). I tried Linux, and actually like it alot - notably desktops such as Ubuntu but i've toyed with others too - but at the end of the day, Windows is popular, well supported, well documented, easy to use, and does everything I need it for. I don't subscribe anymore to the fanboy attitude of "windoze is crap, linux/osx is the best, etc", simply cos when interrogated, most cant explain exactly why. A little like those new developers that claim to do all their coding using the original Notepad, or those that insist on AJAX for every last detail of the site even though they don't know the implications, or those that say "Firefox is better than everything else" but can't give you the reasons why - only that they were told by someone else. Bandwagons, etc. Sorry for harping on, but just run a Google search on "Windows vs Linux", and you'll see exactly what I mean. Windows (XP/Vista) is a powerful and capable OS, regardless of what people say.
  15. personally i'd say that (as long as data amount is fairly minimal) sessions are the best way of keeping persistent data - however, it really depends what it's for. I use sessions to maintain user details (when logged in) and when i'm maybe spreading a form over 2 or 3 (or more) pages and user might need to go back and forward a fair bit (or at least offer the option). as for security, my only golden rule is do not trust ANY user input, regardless of whom it might be using the site. filter it all (get/post/cookie or wherever the input is/can come from) out, validate it properly, etc. As for performance - that'd be for someone elses job to explain, but i'd pretty much stab a guess and a tenner that there's virtually no significant difference between $_SESSION and $_GET like i say tho - depends what you're using them for...
  16. thumbs up here for Windows, but mainly because i'm used to it - so i can get around both Windows itself and most applications that fit its "style". I've considered the switch quite a bit, but the learning curve/change of familiarity as an everyday machine puts me off. Same went for OS X - it's better than Windows in many ways, but I always just find that my extra knowledge of Windows carries me through what i need to do much quicker. Vista (whilst very different in terms of organisation) took me a day or two of working with to properly get my head around compared to XP - but otherwise, it fits the same mould so is easy enough. Like ober said tho - it's a loaded question. Some put it down to what's better or not, but I just put it down to whatever can help me do what I need to do as quickly and easily as possible. Windows therefore gets my vote here.
  17. every single link apart from 'main' and 'register' (top right), 'home' and 'web masters' in the footer and the javascript links in the search area all give me 500 internal server errors.
  18. an article worth reading: http://www.massassi.com/php/articles/template_engines/ both a 'why' and 'how to' of templating. mixed with a solid JS library (i like mootools for both ajax and other stuff like effects) you cant go far wrong. I'm personally not liking most of the template engines/frameworks with built in AJAX support as they tend to be tied to a particular one, and it can be a pain to untie them, hence my preference to do it all this way...
  19. i get "500 internal server" errors left, right and center. not much i can do....
  20. with all due respect, if you can't find the sources of information on the topic, and think that a PHP forum is the best place to ask, then i'd really not want you re-wiring my house... phone up your local college or university and see if they can send you some bits and pieces through
  21. please do not triple post, especially not in the incorrect forums.
  22. i cant explain why, how, who or what, etc (version control stuff not my strong point either) and it probably doesnt really relate directly to your problem, but I remember when initially looking for CVS type systems that it was recommended to use SVN (Subversion) instead. Whether SVN has any additional benefits over CVS in terms of your issue, I dont know...
  23. dude, if you want critique, fine - but as has been pointed out several times very clearly, this isn't the place for blatant, free advertising. please refer to the forum guidelines as well as the "READ BEFORE POSTING" at the top of the website critique board.
  24. yeah it's a browser issue. it's a pain, but to get rid of them quickly, right click over it. click somewhere away from the context menu and Bob's your Uncle.
  25. dj, nice link - tho i read the comments on that article, and I do think it's mad how some people have it deeply set that no matter what MS do, it's in the firing line to be belittled. Most dont even have any valid reason for hating MS and/or Bill Gates, apart from it's a bandwagon and "the norm" thing to do. I'm not a huge fan of MS, but you gotta give them credit. 2 weeks ago, I got a new comp with Vista and mostly am finding it pretty good - not a rip-off of OS X as many say. I also saw many articles about how much MS are losing in terms of their online market share - but love em or hate em, they always pull something out the bag which the majority are wowed by. This table being one of them. I aint gonna spend several thousand pounds on a fancy tic tac toe machine, but the idea of flicking the bubbles of my drink across the table has got me sold haha Seriously tho - as they've pretty much stated that Vista is prob their last proper windows release, they could do MUCH worse than focus on this piece of kit. If I was a bar owner and I could keep my drunk patrons calm as well as provide them a way of ordering food and drink at the same time as letting them hold a business meeting at the same time as offering them a jukebox and game of table football, I'd be lapping it up. In this case, well done MS.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.