我在TCL编程方面相当新,通过基础知识我遇到了以下代码片段:
set x 0;
while "$x < 3" {
set x [expr $x + 1]
if {$x >6} break;
if "$x > 2" continue;
puts "x is $x";
}
puts "exited second loop with X equal to $x\n"
Run Code Online (Sandbox Code Playgroud)
执行时,结果如下:
x是1
x是2个
退出的第二个循环,X等于7
令我惊讶的是,当执行continue命令时,似乎没有评估while循环测试(x <3).但是在tcl联机帮助页中声明" 正文中的continue语句将停止代码的执行,并且将重新评估测试. "
我错过了什么?
我试图重置一些CSS,但点击后有一个延迟.出于某种原因,延迟似乎被忽略了.有任何想法吗?
$("#closeMe").live("click", function() {
$("#selectContainer").fadeOut( function() {
scrollerPos = 1
$(".scroller").delay(3000).css({"margin-left":"0px"});
$("#selectContainer img").delay(3000).css({"background-color":"#FFF"});
$("#selectContainer img:eq(0)").delay(3000).css({"background-color":"#000"});
});
});
Run Code Online (Sandbox Code Playgroud) 我使用windows xp x86,wamp,apache2,php 5.3 x86,eclipse php和xdebug,在localhost上运行同时作为虚拟主机和https虚拟主机
eclipse版本信息
Eclipse for PHP Developers版本:Helios发布版本号:20100617-1415
我不知何故成功地设置了eclipse和xdebug,一切都很顺利.
然后我必须创建我的项目的svn分支,并使用2个新的虚拟主机重新配置apache,并更新我的Windows主机文件.
现在,当我在eclipse中启动调试模式时,一切都会消失.
具体来说,如果我没有设置断点,应用程序运行正常,除了我试图首先调试的问题.
如果我设置断点,应用程序会在断点处停止,而eclipse似乎正在控制球.但是现在,当我按下继续,或者跳过,或者进入或打喷嚏时,eclipse告诉我执行已经恢复,但是应用程序继续挂起,我必须重新启动apache.
我怀疑eclipse和xdebug之间的通信有一些中断,因为它看起来像eclipse正在发送我的继续或步骤命令,但xdebug没有收到它.
但即便如此,我也不知道如何应对.我应该在哪里看?
更新:
我已经成功地使用notepad ++,其xdebug插件进行调试,并且像一个穴居人一样,在URL中输入&XDEBUG_SESSION_START = session_name.然而,尽管我喜欢npp,但它的调试插件却非常错误......
所以我注意到了一个名为"phpstorm"的stackoverflow上的广告,它声称是一个轻量级但功能齐全的php ide,具有本机xdebug支持.该演示需要重新启动以使其工作,并且感觉有点像在摇摆的草稿表上工作,但它设法调试我的小测试应用程序和真正的应用程序非常好,这比我可以说的更多的日食那一刻,即使它可能是我的错.
我可能应该早些发布这个:/这是我的phpinfo()xdebug部分
xdebug
xdebug support enabled
Version 2.1.0
Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $
Directive Local Value Master Value
xdebug.auto_trace Off Off
xdebug.collect_assignments Off Off
xdebug.collect_includes On On
xdebug.collect_params 0 0
xdebug.collect_return Off Off
xdebug.collect_vars Off Off
xdebug.default_enable On On
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES …Run Code Online (Sandbox Code Playgroud) 我来自阿根廷,但我认为每个参加数据结构课程的人都知道图表是什么.如果你这样做,你可能知道什么样的实现是"常见的"或"标准的".它可以通过List或数组实现.甚至维基百科都这么说.还有Mark Allen Weiss,Bruno Preiss和Luis Joyanes Aguilar.
事情是.没有人认为这不是一个好方法吗?最推荐的方法是通过List.但是考虑到顶点之间只有一条边,我不认为List是这样做的好界面.我的意思是,如果Vertex V1与Vertex V2连接,那么只有一个且只有一个边缘.
难道你不认为它会是一个Set而不是一个列表吗?
Class Vertex{
private Set edges;
private Object data;
/** Methods**/
}
Run Code Online (Sandbox Code Playgroud)
只是想知道一些意见,你怎么看?
谢谢!!
编辑: 此外,如果我们认为图形不能有重复的元素,HashSet将是一个很好的选择,以最小化插入中的顶点的查找.
我正在使用自己的样式创建自定义Tweet按钮,但是当您选择自定义自己时,您似乎无法使用数据属性(data-text,data-url等).当您使用使用小部件javascript(http://platform.twitter.com/widgets.js)的Twitter样式按钮时,数据属性的使用似乎才可用.
以下是一些来自Twitter开发网站的代码.下面是使用数据属性的Tweet按钮:
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<div>
<a href="http://twitter.com/share" class="twitter-share-button"
data-url="http://dev.twitter.com/pages/tweet_button"
data-via="twitterapi"
data-text="Checking out this page about Tweet Buttons"
data-related="anywhere:The Javascript API"
data-count="vertical">Tweet</a>
</div>
Run Code Online (Sandbox Code Playgroud)
现在,这里是'Build your Own'推文按钮:
<style type="text/css" media="screen">
#custom-tweet-button a {
display: block;
padding: 2px 5px 2px 20px;
background: url('http://a4.twimg.com/images/favicon.gif') left center no-repeat;
border: 1px solid #ccc;
}
</style>
<div id="custom-tweet-button">
<a href="http://twitter.com/share?url=http%3A%2F%2Fdev.twitter.com%2Fpages%2Ftweet-button" target="_blank">Tweet</a>
</div>
Run Code Online (Sandbox Code Playgroud)
希望一切都有意义......
我有一个接受Enum(基类)作为参数的函数:
public void SomeFunction(Enum e);
Run Code Online (Sandbox Code Playgroud)
但是由于某种原因我无法将其转换为int.我可以得到枚举值的名称,但不是它的整数表示.
我真的不关心枚举的类型,我只需要积分值.我应该通过int吗?或者我在这里做错了什么?
我收到了一个源代码包.在src目录树里面有一些属性文件(.properties),我想把它们保存在同一个地方的输出jar中.例如:我想要
src/main/java/com.mycompany/utils/Myclass.java
src/main/java/com.mycompany/utils/Myclass.properties
Run Code Online (Sandbox Code Playgroud)
在罐子里保持不变:
com.mycompany/utils/Myclass.class
com.mycompany/utils/Myclass.properties
Run Code Online (Sandbox Code Playgroud)
无需将属性文件添加到单独的资源文件夹中.有没有办法告诉maven?
使用Oracle 11g
假设我们有两个表:
CREATE TABLE items (
item_id NUMBER(22,0)
);
CREATE TABLE messages (
item_id NUMBER(22,0),
message_code NUMBER(22,0)
);
Run Code Online (Sandbox Code Playgroud)
哪里有一个(项目)到多个(消息)的关系.我想在单个查询中选择所有内容以将其转换为java.有可能写这样的查询,它会给我输出像:
ID MESSAGE
----------------------------------
1 (100, 105, 201)
2 (100, 105)
Run Code Online (Sandbox Code Playgroud)
MESSAGE列是一个数组或类似的东西(不是连接字符串)?
一个.在哪些情况下此代码失败:
try
{
Monitor.Enter(someObj);
//Do something important
}
finally
{
Monitor.Exit(someObj);
}
Run Code Online (Sandbox Code Playgroud)
而且这段代码不会失败:
Monitor.Enter(someObj);
try
{
//Do something important
}
finally
{
Monitor.Exit(someObj);
}
Run Code Online (Sandbox Code Playgroud)
湾 当您没有使用using语句包装临界区时,您使用哪一个
谢谢
我得到了一些与准备UIImage一个相关的问题UIView.我有时(但不总是)看到错误
<Error>: CGContextSaveGState: invalid context 0x0
Run Code Online (Sandbox Code Playgroud)
我正在使用iPhone SDK 4.0.我的代码:
-(void)drawRect:(CGRect)rect
{
// Customized to draw some text
}
-(UIImage*) PrepareBackImage:(CGRect) aRect // aRect = (0,0,1800,1200)
{
UIImage* background;
background = [self GetImageFromView:self toRect:self.frame];
UIGraphicsBeginImageContext(aRect.size);
CGPoint backgroundPoint = CGPointMake(0,0);
[background drawAtPoint:backgroundPoint];
UIImage* backImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return backImage;
}
- (UIImage *) GetImageFromView:(UIView *)aView toRect:(CGRect)aRect
{
CGSize pageSize = aRect.size;
UIGraphicsBeginImageContext(pageSize);
[aView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
Run Code Online (Sandbox Code Playgroud)