Page 1 of 1
[SOLVED] copy-paste problem.....
Posted: Thu Sep 16, 2004 5:37 am
by dethron
Hi All;
I want to help people, but if i copy the code in their post, and paste it to my editor the code looks horrible

It lost all readability.
How do you test others' codes?
Posted: Thu Sep 16, 2004 5:51 am
by CoderGoblin
I generally don't,
If they are asking for help debugging code I may have a look at the code if it is not too large and see if I can see anything. Where it is large I try to give debugging advice.
The main thing I look for is the question itself. If the user states the error/line then I am more likely to find the error. If someone shows a long piece of code and says simply "What is wrong" with this I'll probably ignore them. After all if they cannot be bothered to spend a bit of time to provide enough information for me to help them why should I spend my time ?
If you want to check code, you may want to check your character font and tab/spacing values.
Posted: Thu Sep 16, 2004 6:05 am
by dethron
Yes you are right, but as you can see in many codes it is really hard to understand them.
I hate codes that is written just to do something. The code should contain some styling, some artwork in it. For example ;
Code: Select all
<?php
$res = mysql_query("SELECT * FROM ".$DBprefix."signup WHERE username like '%$searchname%' and fullname like'%$name%' and state like'%$state%' and gender like'$gender%' and userlevel='1' and actnum='0' and '$currentyear'-dobyear >= $lowage and '$currentyear'-dobyear <= '$highage' {$image}");
?>
It is really hard to track this sql statement. It is obviously bad written. I prefer
Code: Select all
<?php
$tablename = $DBprefix."signup";
$sqlstatement = "SELECT * FROM $tablename WHERE
username LIKE '%$searchname%' AND
fullname LIKE '%$name%' AND
state LIKE '%$state%' AND
gender LIKE '$gender%' AND
userlevel = '1' AND
actnum = '0' AND
'$currentyear'-dobyear >= $lowage AND
'$currentyear'-dobyear <= '$highage' {$image}
";
$runquery = mysql_query($sqlstatement);
?>
Moreover, it is better to seperate the sql and the html, so i rather choose the create query using a class. (I posted a class ex to
viewtopic.php?t=25412)
Soooo, anyway

thnx for your response....
Happy PHP-days to everyone.
Posted: Thu Sep 16, 2004 6:07 am
by John Cartwright
What you can do if copy + paste it into notepad .. then re-copy it from there.. it seems to work fine
Posted: Thu Sep 16, 2004 6:43 am
by dethron
i tried it, but nothing changed

anyway, it is not an important matter,
forum looks better now.
Posted: Thu Sep 16, 2004 7:49 am
by vigge89
i can just copy and paste directly into EditPlus 2?
Posted: Thu Sep 16, 2004 8:26 am
by dethron
i download and installed v2.12(76), and it was not worked

like notepad.
may be the problem stems from my computer, is there anyone who suffers from same promlem?
Re: copy-paste problem.....
Posted: Thu Sep 16, 2004 8:32 am
by CoderGoblin
dethron wrote:I want to help people, but if i copy the code in their post, and paste it to my editor the code looks horrible

It lost all readability.
In what way does it look horrible, strange characters, lack of line breaks or just indentation ?
Posted: Thu Sep 16, 2004 8:50 am
by dethron
i can not see line breaks, and indentation
if the code consists of 30 lines, it becomes 3-5 lines.
there is no strange character.
thnx.
Posted: Thu Sep 16, 2004 9:46 am
by Getran
happens to me too, i just use WordPad instead or some other editor like DzSoft PHP Editor, or Html-Kit...
Posted: Thu Sep 16, 2004 11:19 am
by feyd
I've never had any problems copying the code posted.. At least on Windows machines, the receiver of the paste determines how the paste looks.. maybe switching editors would help.. for the record, Visual Studio and TextPad receive the pastes correctly on my system.
Posted: Thu Sep 16, 2004 11:28 am
by dethron
some say notepad ok, but it is not ok for me.
some say ultraedit ok, but it is not ok for me.
most probably yours will not too.
i tried dreamweaver, notepad, homesite, ultraedit; and i give up trying.
and we are not concerning your system, because you are admin, and we are users

"the pastes correctly on my system" => it smells selfishly.
Posted: Thu Sep 16, 2004 11:47 am
by feyd
very few things are different for me on the pages compared to the rest of you. All the posts (ignoring some buttons) are exactly the same.
The new
Code: Select all
tags are set up almost exactly the same as the old ones, with a few feature additions that were needed. The code still appears in a single table cell, by itself.
Posted: Thu Sep 16, 2004 11:50 am
by dethron
thanx for explaining
