473,396 Members | 1,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Counting Lines of Code

I have an ASP.NET Web application that has dozens of aspx pages, associated
code-behind classes, class modules, etc.

I'm wondering how I can quickly count the number of lines of code I've
written - including HTM, C#, etc (Designer-generated code can be counted).

Any suggestions?
Nov 19 '05 #1
3 1258
open them all individually as text files and append them to the end of the
first

http://msdn.microsoft.com/library/de...dtexttopic.asp

Then you could read the final file in a line at a time and just use a
counter

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Frankie" <A@B.COM> wrote in message
news:e5****************@TK2MSFTNGP12.phx.gbl...
I have an ASP.NET Web application that has dozens of aspx pages, associated
code-behind classes, class modules, etc.

I'm wondering how I can quickly count the number of lines of code I've
written - including HTM, C#, etc (Designer-generated code can be counted).

Any suggestions?

Nov 19 '05 #2
"Frankie" <A@B.COM> wrote in message
news:e5****************@TK2MSFTNGP12.phx.gbl...
I have an ASP.NET Web application that has dozens of aspx pages, associated
code-behind classes, class modules, etc.

I'm wondering how I can quickly count the number of lines of code I've
written - including HTM, C#, etc (Designer-generated code can be counted).

Any suggestions?


I wasn't going to respond to this, but seeing as how you aren't getting much
response, I'll add my mediocre ideas.

Way back in 97, I had been programming for 3 years by myself, and had no
idea how I stacked up to other programmers, so I started tracking LOCs,
thinking I could find some kind of industry benchmark. Other than some
simple insight into my own work habits, it never did yield much value ...
but I'm sure you've heard that before and you either don't care or it
doesn't apply in your situation.

What I did, was set up a batch file to append all files matching a file
extension into a huge file called something like /Temp/AllCode.txt. Then
search on semi-colons (it was C++) ... I felt that semi-colons would be as
good as LOCs or better. I also recorded the number of lines all together,
and the number of comments. I ran this at the end of every day & entered
the values into an XL file.

Semi colons are probably still a good search item for C#, and as for html,
maybe you could use "</".

I hope this gives you some ideas. But in all honesty, I hope you can find a
better bench mark than LOCs.

Good luck,
John
Nov 19 '05 #3
<< I'll add my mediocre ideas >>

Thanks for your mediocre ideas! : )


"John" <Pl**********@To.the.group.com> wrote in message
news:OK**************@TK2MSFTNGP15.phx.gbl...
"Frankie" <A@B.COM> wrote in message
news:e5****************@TK2MSFTNGP12.phx.gbl...
I have an ASP.NET Web application that has dozens of aspx pages,
associated code-behind classes, class modules, etc.

I'm wondering how I can quickly count the number of lines of code I've
written - including HTM, C#, etc (Designer-generated code can be
counted).

Any suggestions?


I wasn't going to respond to this, but seeing as how you aren't getting
much response, I'll add my mediocre ideas.

Way back in 97, I had been programming for 3 years by myself, and had no
idea how I stacked up to other programmers, so I started tracking LOCs,
thinking I could find some kind of industry benchmark. Other than some
simple insight into my own work habits, it never did yield much value ...
but I'm sure you've heard that before and you either don't care or it
doesn't apply in your situation.

What I did, was set up a batch file to append all files matching a file
extension into a huge file called something like /Temp/AllCode.txt. Then
search on semi-colons (it was C++) ... I felt that semi-colons would be as
good as LOCs or better. I also recorded the number of lines all together,
and the number of comments. I ran this at the end of every day & entered
the values into an XL file.

Semi colons are probably still a good search item for C#, and as for html,
maybe you could use "</".

I hope this gives you some ideas. But in all honesty, I hope you can find
a better bench mark than LOCs.

Good luck,
John

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: jabailo | last post by:
Which would be faster for counting lines in a StreamReader: (a) iterate through a file using .ReadLine() and adding to a counter, i++ (b) doing a .ReadToEnd() and then using an IndexOf() method...
19
by: Alex Vinokur | last post by:
Is there any tool to count C-program lines except comments? Thanks, ===================================== Alex Vinokur mailto:alexvn@connect.to http://mathforum.org/library/view/10978.html...
5
by: Anders K. Jacobsen [DK] | last post by:
Hi We have a rather large asp.net project with serveral utility projects (written in C#). Is there at tool out there which can give an estimate of the total amount of code lines all projects...
1
by: j | last post by:
Hi, I've been trying to do line/character counts on documents that are being uploaded. As well as the "counting" I also have to remove certain sections from the file. So, firstly I was working...
4
by: Peter | last post by:
Currently I'm using the method below, is there someting more efficient?: Imports System.IO Public Class CountLine Public Shared Function CountLines(ByVal FileName As String) As Integer Dim fs...
5
by: andy.lee23 | last post by:
hi im having trouble counting lines in a text file, i have the following code int node1, node2, i; char name; float value; ifstream fin; fin.open(OpenDialog1->FileName.c_str()); i=1;
10
by: cj | last post by:
I'm writing a TCP/IP server app that will have many simultaneous connections. The main thread listens for new connections and starts a thread to handle each requested connection. These are short...
14
by: Dan | last post by:
Is this discouraged?: for line in open(filename): <do something with line> That is, should I do this instead?: fileptr = open(filename) for line in fileptr: <do something with line>
7
by: peraklo | last post by:
Hello, there is another problem i am facing. i have a text file which is about 15000 lines big. i have to cut the last 27 lines from that file and create a new text file that contans those 27...
1
by: powerej | last post by:
I have gotten the part of counting how many words are in the string, but the vowels just seem alien to me. Ive tried so many things but never close to a correct answer. I know I need to use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.