编辑:
在这里,它显示这是一个评论.在我的IDE中,它将此视为代码.太奇怪了(代码集#2):
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="bootstrap-3.3.2-dist/js/bootstrap.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
我有两个文件.一个有评论,一个没有.第一组代码功能完美.第二组代码Uncaught ReferenceError: $ is not defined在JavaScript控制台中告诉我,并且不会调用警报.为什么评论会影响我的脚本?
代码集#1
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="bootstrap-3.3.2-dist/js/bootstrap.min.js"></script>
</head>
<body>
<script>
$(function () {
alert("JQUERY!");
});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
代码集#2
<!DOCTYPE html>
<html lang="en">
<head>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="bootstrap-3.3.2-dist/js/bootstrap.min.js"></script>
<![endif]-->
</head>
<body>
<script> …Run Code Online (Sandbox Code Playgroud) 我的评论以反斜杠结尾.就像是
...
// use \
..
Run Code Online (Sandbox Code Playgroud)
Clang(++)警告我,这是多行评论
warning: multi-line // comment [-Wcomment]
// use \
^
Run Code Online (Sandbox Code Playgroud)
所以我尝试在最后添加一些空格,但没有帮助.我可以以某种方式逃避反斜杠吗?
简介:我正在设置Disqus,以在MVC .net站点内的页面上显示评论数。我之前已经在Tumblr页面上“修复”了此功能,所以我认为我具有在此站点上相当容易地做到这一点的必要技能,但是失败了。我也查看了所有Ryan(/sf/users/95966951/)适用的答案,但没有找到解决方案。
我正在按照Disqus.com的指示进行操作:
https://help.disqus.com/customer/portal/articles/565624
但没有成功。我的理解是,我需要做的是:
完成此操作后,我认为脚本应插入注释计数编号并将其显示在页面上-但这对我不起作用。
在tumblr中,您应该插入一个meta标签
<meta name='text:Disqus Shortname' content='' />
Run Code Online (Sandbox Code Playgroud)
但我不认为这适用于我的设置(尽管这并没有阻止我尝试一下)。
我只能以为我缺少明显的东西。我不知道本地主机环境是否正在中断我的测试,因为我正在使用指向显示disqus注释的本地主机页面的链接。我还使用现场Disqus评论页面进行了测试,但结果相同。
详细信息:目前我已经测试了许多错误的东西,但是我认为以下是最不错误的:
脚本:
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'My-Shortname'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js'; …Run Code Online (Sandbox Code Playgroud) 我想知道是否可以在批处理文件命令中发表评论.具体来说,我有一个很长的SED命令,如下所示:
@SED -r -e "s/.../.../"^
-e "s/.../.../"^
-e "s/.../.../"^
fileName >outFileName
Run Code Online (Sandbox Code Playgroud)
我想在每个"-e"选项中添加注释,如以下示例所示:
:: Option #1: At the end of the line
@SED -r -e "s/.../.../"^ // First comment
-e "s/.../.../"^ // Second comment
-e "s/.../.../"^ // Third comment
fileName >outFileName
:: Option #2: Between lines
@SED -r
@REM First comment
-e "s/.../.../"^
@REM Second comment
-e "s/.../.../"^
@REM Third comment
-e "s/.../.../"^
fileName >outFileName
Run Code Online (Sandbox Code Playgroud)
有没有办法实现这个目标?
我试图使用正则表达式查找所有VBA注释.我有一些主要有用的东西,但有一些我无法弄清楚的例外.
我正在使用的表达式:
'(?!.*").*
Run Code Online (Sandbox Code Playgroud)
拿我们的测试代码:
Working - This is a test 'This should be captured
Working - "this is a test" 'This should be captured
Not Working - "this is a test" 'This should be "captured"
Not Working - This is a test 'This should be "captured"
Working - "this is a test 'this should not capture'" 'this should capture
Working - "this isn't a test" 'this should capture
Run Code Online (Sandbox Code Playgroud)
以下是RegExr中此示例的链接:http: //regexr.com/3f24h
由于某种原因,第三和第四个例子没有捕获.问题似乎是在评论中有一个字符串值,我无法弄清楚如何解决它.
有什么建议?
最近包含调试覆盖的代码已发布到生产中.代码清楚标明
// TODO - Remove before releasing to production
但我们没有集成到Maven中,这会阻止项目的建立.我见过一个名为Taglist的maven插件,可以生成一个报告.但不会停止产生构建错误.
你们如何捕获调试代码并阻止构建?
这是一个非常简单的问题,我很惊讶我在SO上没有找到任何其他地方.我想知道哪些评论应该或不应该在标题/源文件中.如果在标题和源上都声明,那将是redondant或required.到目前为止,我一直这样做:
main.c或main.cpp
int main()
{
// Comments to describe what happens in main
}
Run Code Online (Sandbox Code Playgroud)
foo.h中
// Comments for documentation and which gives information about the function itself
/**
* \fn void aFunction(void)
* \brief This function is a function
*/
void aFunction(void);
Run Code Online (Sandbox Code Playgroud)
foo.c或foo.cpp
void aFunction(void)
{
// Comments to describe and explain what happens within this function
}
Run Code Online (Sandbox Code Playgroud)
这就是我所知道的.主,源或标题中是否需要更多注释?我是否应该添加我通常只在源代码中添加标题的注释,如下所示:
foo.c或foo.cpp
/**
* \fn void aFunction(void)
* \brief This …Run Code Online (Sandbox Code Playgroud) 当我使用注释快捷方式(Ctrl + /)时,斜杠放在行的开头,如下所示:
protected function before()
{
// echo "(before) ";
}
Run Code Online (Sandbox Code Playgroud)
但是,我希望这种行为:
protected function before()
{
//echo "(before) ";
}
Run Code Online (Sandbox Code Playgroud)
如何配置PhpStorm以使用后一种方法?
在我看来,样本#2似乎是更易读的评论方式.
但是,如果我将PSR-2应用于两个样本,样本#1将不会改变,但样本#2的结果将如下变化,并且它不是正确的评论.
在这些案例中评论的最佳方式是什么?
样品#1/* Read cached data */
if ($useCache == true){
// do something
/* Download and cache data */
} else {
// do something
}
Run Code Online (Sandbox Code Playgroud)
样品#2
/* Read cached data */
if ($useCache == true){
// do something
}
/* Download and cache data */
else {
// do something
}
Run Code Online (Sandbox Code Playgroud)
样品#2的PSR-2结果
/* Read cached data */
if ($useCache == true){
// do something
} /* Download and cache data …Run Code Online (Sandbox Code Playgroud) 如果文件以注释开头,C编译器是否缓存头文件并仅解析一次?
// Some comment
#ifndef HEADER_GUARD
#define HEADER_GUARD
#endif
Run Code Online (Sandbox Code Playgroud)
问题是关于编译器,它可以缓存标题,不会多次解析它们.