The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex
On a POSIX operating system (e.g. Linux or OS X) you can write the following into your Bash shell:
ReplyDeletewc -l `find . -iname "*.php"`
This will count the lines in all php-files in the current directory and also subdirectories. (Note that those single 'quotes' are backticks, not actual single quotes)
SLOCCount is an awesome tool that produces a line-count report for a large number of languages. It also goes further by producing other, related statistics such as expected developer cost.
ReplyDeleteHere's an example:
$ sloccount .
Creating filelist for experimental
Creating filelist for prototype
Categorizing files.
Finding a working MD5 command....
Found a working MD5 command.
Computing results.
SLOC Directory SLOC-by-Language (Sorted)
10965 experimental cpp=5116,ansic=4976,python=873
832 prototype cpp=518,tcl=314
Totals grouped by language (dominant language first):
cpp: 5634 (47.76%)
ansic: 4976 (42.18%)
python: 873 (7.40%)
tcl: 314 (2.66%)
Total Physical Source Lines of Code (SLOC) = 11,797
Development Effort Estimate, Person-Years (Person-Months) = 2.67 (32.03)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 0.78 (9.33)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 3.43
Total Estimated Cost to Develop = $ 360,580
(average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."
Unfortunately, SLOCCount is a bit long in the tooth and a pain in the neck for PHP projects, particularly ones that have a nested vendor directory you don't want counted. Also, it emits a warning for every PHP file that doesn't have a closing tag (which should be all of them if you aren't mixing HTML and PHP).
ReplyDeleteCLOC is a more modern alternative that does everything SLOCCount does, but also supports an --exclude-dir option and it doesn't suffer from the aforementioned close tag problem. It also emits a SQLite database that you can extract some pretty advanced metrics from.