jskywalker Posted January 30, 2010 Share Posted January 30, 2010 When reading a question, that has some PHP-code in it, i sometimes copy this, and paste it in my editor I will get one loooong line of code Why are al 'carriage returns' and/or 'line-feeds' not in this copy? Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/ Share on other sites More sharing options...
ignace Posted January 30, 2010 Share Posted January 30, 2010 Code provided in these forums are not intended for production use merely act as an example for the user problem. For this same reason will you find almost never any validation on input like: $var = $_POST['var']; $query = "SELECT * FROM table WHERE var = '$var'"; mysql_query($query); Some examples even contain parse error's if you would execute them all because they only acted as an example and were not intended for production or any use just to give the OP the highlights on what may be a solution to their problem. We don't know your project specs inside-out and the provided example is based on the information you did or did not provide. If you want copy-paste code then you should buy a book, read a tutorial, or visit a snippet repository Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004169 Share on other sites More sharing options...
oni-kun Posted January 30, 2010 Share Posted January 30, 2010 Ignace, he means readability of the codebox, and what it gives out. Atleast on tags if someone on windows posts some code, the parser spews out 0D 0A 0D. (\r\n\r) Either causes a notepad to not read newlines, or to have it double spaced. I've seen come across this issue many times before actually.. where blocks of tabs and newlines would appear for no reason when copying to my IDE. EDIT, I actually get 0A0A ..\n\n when posting on linux, further messing things up for M$ viewers. Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004178 Share on other sites More sharing options...
jskywalker Posted January 30, 2010 Author Share Posted January 30, 2010 @ignace: i know that its my own problem if there is a bug in the script i copy/paste.... But i could be really helpfull if i try to help someone (i.e. http://www.phpfreaks.com/forums/index.php/topic,286072.msg1356641.html#msg1356641) that i can copy/paste his code to my editor, and tweak it a bit..... i wont buy a book, because i already have a PHPbook (its 'old' because its from 2000 about PHP4) and most scripts in here are useless to me anyway, so i wont use them... Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004203 Share on other sites More sharing options...
wildteen88 Posted January 30, 2010 Share Posted January 30, 2010 The message you linked to copied 'n pasted fine for me. I sometimes get odd occurrences where code is massively spaced out too. I guess there is a bug in the code parser or something. We can only hope the SMF devs fix this issue on the next release candidate. Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004211 Share on other sites More sharing options...
jskywalker Posted January 30, 2010 Author Share Posted January 30, 2010 hmmmm..... copying from IE8, and pasting in Notepad does not work copying from FF3.5.7, and pasting in Notepad does work Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004218 Share on other sites More sharing options...
oni-kun Posted January 30, 2010 Share Posted January 30, 2010 hmmmm..... copying from IE8, and pasting in Notepad does not work copying from FF3.5.7, and pasting in Notepad does work IE (along with MS's standards) relies on it being \r\n. (carriage return, newline). Linux \n, Mac just \r. If it is a mix of the two, or multiple, then yeah, IE may give you no lines or multiple lines. Firefox may possibly correct this when placing to clipboard. Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004231 Share on other sites More sharing options...
ignace Posted January 30, 2010 Share Posted January 30, 2010 i wont buy a book, because i already have a PHPbook (its 'old' because its from 2000 about PHP4) and most scripts in here are useless to me anyway, so i wont use them... You should ALWAYS be on the lookout to buy books. Knowledge and Research should be your top 2 priorities. We can't waste our lives (and our brain) to do nothing or contribute nothing to this society. To many people already waste their lives by never touching a book again after high school. Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004242 Share on other sites More sharing options...
jskywalker Posted January 30, 2010 Author Share Posted January 30, 2010 You should ALWAYS be on the lookout to buy books. Knowledge and Research should be your top 2 priorities. We can't waste our lives (and our brain) to do nothing or contribute nothing to this society. To many people already waste their lives by never touching a book again after high school. i find experience more valuable than reading books..... Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004278 Share on other sites More sharing options...
.josh Posted January 30, 2010 Share Posted January 30, 2010 Different people have different ways that work best for them. Some people find it easiest to watch video tuts, some like to take snippets of code and poke at it, some are fine reading tuts online, some like having a physical book. There's no "one way" that works best for everybody. Trick is to find the way that works best for you. The thing that seems to universally not work / be acceptable is expecting people to spoon-feed you stuff. Hard fact to accept, but if you need to be spoon-fed, you obviously won't be able to make it on your own...maybe find something else out there that suits you better. Some other language, or some other thing altogether. Too many people out there think coding is some easy thing that can be picked up on the fly, but it's not. Just like not everybody can be a doctor or scientist. Just that...coding, especially something open-source like php, really easy for average joe to get access to it, and that makes average joe think easy access == easy learning. Quote Link to comment https://forums.phpfreaks.com/topic/190342-this-forum-and-copy-ing-code/#findComment-1004328 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.