我们的应用程序是一个庞大的项目,拥有超过3000个单位,重约350万行代码.
......或者至少是我们在D2007下编译它的时候.我们最近更新到D2010,现在如果我们运行完整版本,行数最终会停止在490万左右.相同的DPR,相同的代码库,相同的一切,但编译器在构建周期中以某种方式运行了大约40%的代码行,没有人知道为什么.
只是为了让事情更加混乱,在构建之后,我们可以转到IDE中的Project - > Information并报告3.8M行.在D2007中,编译器对话框和项目 - >信息对话框报告了相同的编号.
任何人都知道这里发生了什么?
可能重复:
如何获取<textarea>中的行数?
我有一个textarea
和我7 lines
在其中写的只是2 new line character
如下,想象下面的代码框是一个textarea
,只有两次输入键被按下.
A text box, text field or text entry box is a kind of widget used when building
a graphical user interface (GUI). A text box purpose is to allow the user to
input text information to be used by the program.
User-interface guidelines recommend a single-line text box when only one line of
input is required, and a multi-line text box only if more than …
Run Code Online (Sandbox Code Playgroud) 假设您打开一个文件,并在文件中的某处执行seek(),您如何知道当前文件行?
(我亲自解决了一个ad-hoc文件类,它在扫描文件后将搜索位置映射到该行,但我想看到其他提示并将此问题添加到stackoverflow,因为我无法在任何地方找到问题谷歌)
我有FixedDocument
页面,我想TextBlock
放在它上面,但它可能Textblock
不适合页面的高度。
所以我想从繁重的产生线TextBlock
带TextWrapping
,然后创建新的TextBlock
,即通过安装高度,并把它页。
TextBlock
有LineCount
私有财产,这意味着它TextLines
在包装后有,我可以以某种方式得到它。使用运行
创建TextBlock
:
public TextItem(PageType pageType, Run[] runs, Typeface typeFace, double fontSize)
: base(pageType)
{
this.TextBlock = new TextBlock();
this.TextBlock.Inlines.AddRange(runs);
if (typeFace != null)
this.TextBlock.FontFamily = typeFace.FontFamily;
if (fontSize > 0)
this.TextBlock.FontSize = fontSize;
this.TextBlock.TextWrapping = TextWrapping.Wrap; //wrapping
}
Run Code Online (Sandbox Code Playgroud)
TextBlock
用文本创建:
public TextItem(PageType pageType, String text, Typeface typeFace, double fontSize)
: base(pageType)
{
if (typeFace == null || fontSize == …
Run Code Online (Sandbox Code Playgroud) 我有一个txt文档,有超过14000个不同的行,其中许多是重复的,是否可以计算唯一条目的数量?
嗨:鉴于任意文件(java),我想计算行数.
这很容易,例如,使用Apache的FileUtils.readLines(...)方法......
但是,对于大文件,读取整个文件是荒谬的(即只计算行数).
一个自行开发的选项:Create BufferedReader或使用FileUtils.lineIterator函数,并计算行数.
但是,我假设可能有一个(低内存),最新的API用于执行简单的大型文件操作,只需少量的锅炉板用于java ---任何这样的库或功能都存在于任何地方的任何一个Google,Apache等......开源Java实用程序库?
我正在尝试阅读一个文本文件但在此之前我想知道我要阅读的元素数量.所以我需要计算文本文件的行数.到目前为止,我有这个:
int getLinecount (char *file)
{
int ch, count = 0;
FILE *fp = fopen(file, "r");
if(fp == NULL)
{
return -1;
}
while((ch = fgetc(fp)) != EOF)
{
if (ch == '\n');
{
count++;
}
}
fclose(fp);
return count;
}
Run Code Online (Sandbox Code Playgroud)
这很好用.我没有对文本文件做任何改变,但仍打印130,000,尽管文件只有10,000行.我在我的主要内容中唯一写的是:
linecount = getLinecount("...");
Run Code Online (Sandbox Code Playgroud)
我真的很好奇错误在哪里.此外,是否有更好的选择获得linecount?
我有一个文件,其中包含:
VoicemailButtonTest
VoicemailButtonTest
VoicemailButtonTest
VoicemailButtonTest
VoicemailButtonTest
VoiceMailConfig60CharsTest
VoicemailDefaultTypeTest
VoiceMailIconSelectableTest
VoiceMailIconSelectableTest
VoiceMailIconSelectableTest
VoiceMailIconSelectableTest
VoiceMailIconSelectableTest
VoicemailSettingsFromMessageModeScreenTest
VoicemailSettingsFromMessageModeScreenTest
VoicemailSettingsTest
VoicemailSettingsTest
VoicemailSettingsTest
VoicemailSettingsTest
VoicemailSettingsTest
VoicemailSettingsTest
VoicemailSettingsTest
Run Code Online (Sandbox Code Playgroud)
如何用计数替换重复行:
VoicemailButtonTest (5)
VoiceMailConfig60CharsTest (1)
VoicemailDefaultTypeTest (1)
VoiceMailIconSelectableTest (5)
VoicemailSettingsFromMessageModeScreenTest (2)
VoicemailSettingsTest (7)
Run Code Online (Sandbox Code Playgroud)
我将这对放入关联数组中。我尝试在“while”语句中使用“read”,但数组丢失了。这是我的尝试:
unset line
tests=$(cat file.log)
echo "$tests" |
while read l; do
if [ "$l" == "${line}" ]; then
let cnt++;
else
echo "${line} (${cnt})"
line=${l}
cnt=1
fi
export run_suites
done
Run Code Online (Sandbox Code Playgroud) 我现在正在上软件工程课程。我们的任务是评估 Mozilla 的 Thunderbird。我们的任务是评估雷鸟的大小。我们需要使用的指标之一是项目中的代码行数。(代码行意味着不包括注释或新行)。
是否有一种标准方法来查找行数,或者我最好只是编写一个脚本来执行此操作?
我想我可以做这样的事情:
# remove all comments
find -name *.java | \
sed "/\/*/,\*\// s/.*//g | \ # remove multiline comments
sed s/\/\///g # remove single line comments
# count not empty lines
find -name *.java | grep -c "<character>"
Run Code Online (Sandbox Code Playgroud)
但我需要对每种文件类型执行此操作。似乎应该已经有一些实用程序可以做到这一点。(最好是兼容 mac/unix 的)。
我试图弄清楚为一个应用程序编写了多少行代码。代码位于当前目录和子目录中。我正在使用 ubuntu。
line-count ×12
duplicates ×2
java ×2
apache ×1
awk ×1
bash ×1
c ×1
c# ×1
delphi ×1
delphi-2007 ×1
delphi-2010 ×1
file ×1
html ×1
javascript ×1
large-files ×1
metrics ×1
netbeans ×1
php ×1
python ×1
sed ×1
seek ×1
textarea ×1
textblock ×1
ubuntu ×1
wc ×1
wpf ×1