Older Contests
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP ContestsOlder Contests

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old June 9th, 2004, 02:55 AM
jcaughel jcaughel is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Buffalo, NY, USA
Posts: 283 jcaughel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 4 sec
Reputation Power: 2
Send a message via ICQ to jcaughel Send a message via AIM to jcaughel Send a message via Yahoo to jcaughel
[appleeaters]Length (lines) excluding conmments?

Purely out of curiosity... What is the length of the script(s) you consider to be your best candidate so far (excluiding comments...)

I have been hovering right around 150 lines... give or take.

I figure that is an innocuous way to get an idea of what I am up against apart from the benchmarking... which has been interesting to say the least (Thanks Fidian & Cypher!)

Reply With Quote
  #2  
Old June 9th, 2004, 02:01 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[appleeaters]RE: Length (lines) excluding conmments?

modified the script at http://www.evilwalrus.com/viewcode.php?codeEx=313

usage:
php countcodelines.php [directory or just . for current]

php Code:
Original - php Code
  1.  
  2. <?php
  3. function countCodeLines ($directory) {
  4.     static $totalCodeLines;
  5.     $dir = opendir($directory);
  6.     while ($item = readdir($dir)) {
  7.         if ((is_dir($item)) && ($item != ".") && ($item != "..")) {
  8.             countCodeLines($item);
  9.         } elseif (strrchr($item, ".") == ".php") {
  10.             $filepath = realpath($directory . "/" . $item);
  11.             $lines = file($filepath);
  12.              $totalCodeLines=0;
  13.             foreach ($lines as $line) {
  14.                 if (preg_match("/;/", $line) || (preg_match("/{/", $line) xor preg_match("/}/", $line))) {
  15.                     $totalCodeLines++;
  16.                 }
  17.             }
  18.             echo "$item $totalCodeLinesn";
  19.         }
  20.     }
  21. }
  22. echo "Files from ".$_SERVER['argv'][1]."n";
  23. countCodeLines ($_SERVER['argv'][1]);
  24. ?>
  25.  

Reply With Quote
  #3  
Old June 9th, 2004, 03:15 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[appleeaters]RE: Length (lines) excluding conmments?

Are you taking into account multiline comments and single line comments at the end of a code line?

Reply With Quote
  #4  
Old June 9th, 2004, 03:16 PM
Pests Pests is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 27 Pests User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[appleeaters]RE: Length (lines) excluding conmments?

Forgot to login.

Reply With Quote
  #5  
Old June 11th, 2004, 11:11 PM
fidian fidian is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 45 fidian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[appleeaters]RE: Length (lines) excluding conmments?

cat robot.php | grep -vE "^[[:space:]]*(//.*)?$" | wc -l

This results in 373 lines of code. However, this is not accounting for programming style. I use a more spaced out method:

php Code:
Original - php Code
  1. if (some test)
  2. {
  3.    do_something();
  4. }
  5. elseif (other_test)
  6. {
  7.    echo "whatever";
  8. }

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [appleeaters]Length (lines) excluding conmments?


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





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