SunQuest
 
           ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 3 votes, 3.33 average. Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #31  
Old July 26th, 2007, 08:39 AM
chapman10s's Avatar
chapman10s chapman10s is offline
**Wanted Wizard**
ASP Free God (5000 - 5499 posts)
 
Join Date: Apr 2006
Location: Who knows...
Posts: 5,385 chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)chapman10s User rank is General 4th Grade (Above 100000 Reputation Level)  Folding Points: 12139 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 4 Days 6 h 17 m 7 sec
Reputation Power: 1252
Send a message via AIM to chapman10s Send a message via MSN to chapman10s
Quote:
Originally Posted by jmurrayhead
Something that hasn't been mentioned in this thread and that I see a lot of with new developers is unformatted code. Take these two samples for instance:

Code:
<%@ Language=VBScript %>
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=AdvWorks"
set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3  ' adUseClient
rs.Open "Select * from Employees", conn
rs.PageSize = 2
intPageCount = rs.PageCount
Select Case Request("Action")
case "<<"
intpage = 1
case "<"
intpage = Request("intpage")-1
if intpage < 1 then intpage = 1
case ">"
intpage = Request("intpage")+1
if intpage > intPageCount then intpage = IntPageCount
Case ">>"
intpage = intPageCount
case else
intpage = 1
end select
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>ASP & ADO Paging</TITLE>
</HEAD>
<BODY bgColor=White text=Black>
<%
rs.AbsolutePage = intPage 
For intRecord = 1 To rs.PageSize 
Response.Write "Record	number: " & intRecord & " " 
Response.Write rs.Fields("FirstName") & " " 
Response.Write rs.Fields("LastName") & "<br>" 
rs.MoveNext
If rs.EOF Then Exit For 
Next
rs.Close
set rs = Nothing
conn.Close
set conn = nothing
%>
<form name="MovePage" action="default.asp" method="post">
<input type="hidden" name="intpage" value="<%=intpage%>">
<input type="submit" name="action" value="<<">
<input type="submit" name="action" value="<">
<input type="submit" name="action" value=">">
<input type="submit" name="action" value=">>">
Page: <%=Intpage & " of " & intpagecount%>
</form>
</BODY>
</HTML>


Code:
<%@ EnableSessionState=False Language=VBScript %>
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=AdvWorks"

set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3  ' adUseClient
rs.Open "Select * from Employees", conn
rs.PageSize = 2
intPageCount = rs.PageCount

Select Case Request("Action")
	case "<<"
		intpage = 1
	case "<"
		intpage = Request("intpage")-1
		if intpage < 1 then intpage = 1
	case ">"
		intpage = Request("intpage")+1
		if intpage > intPageCount then intpage = IntPageCount
	Case ">>"
		intpage = intPageCount
	case else
		intpage = 1
end select
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>ASP & ADO Paging</TITLE>
</HEAD>
<BODY bgColor=White text=Black>

<%
rs.AbsolutePage = intPage 
For intRecord = 1 To rs.PageSize 
	Response.Write "Record	number: " & intRecord & " " 
	Response.Write rs.Fields("FirstName") & " " 
	Response.Write rs.Fields("LastName") & "<br>" 
	rs.MoveNext
If rs.EOF Then Exit For 

Next

rs.Close
set rs = Nothing
conn.Close
set conn = nothing
%>
<form name="MovePage" action="default.asp" method="post">
<input type="hidden" name="intpage" value="<%=intpage%>">
<input type="submit" name="action" value="<<">
<input type="submit" name="action" value="<">
<input type="submit" name="action" value=">">
<input type="submit" name="action" value=">>">
Page: <%=Intpage & " of " & intpagecount%>
</form>
</BODY>
</HTML>


Which one is easier to read? I hope you say the one on the bottom. When debugging code, having some type of formatted code (using indents, spaces, etc.) makes debugging much easier because the page is easier to read. Think about the first code sample above if it were a much larger application. Even if you have an editor that shows each line and an error shows the exact line..having formatted text still makes it much easier to debug.


Excellent point!!!
Comments on this post
richyrich agrees: random rep!!!
__________________
I would rather know than not know at all...



Reply With Quote
  #32  
Old August 2nd, 2007, 01:05 PM
sidhu.rs sidhu.rs is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 1 sidhu.rs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 26 sec
Reputation Power: 0
Yes its true, i tried many times. i agree

-Ravinderjit Singh Sidhu

Reply With Quote
  #33  
Old June 16th, 2008, 10:46 PM
thomasz thomasz is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 10 thomasz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 53 m 56 sec
Reputation Power: 0
I will use hight techniques for software.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > Debugging techniques


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway