我尝试了以下代码:
this.balancePanel.Location.X = this.optionsPanel.Location.X;
Run Code Online (Sandbox Code Playgroud)
在程序运行时更改我在设计模式下创建的面板的位置但它返回错误:
Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable
Run Code Online (Sandbox Code Playgroud)
所以问题是我该怎么做?
我已在我的服务器上安装了apache但是我无法通过服务器的IP浏览我的网站.apache的设置是/ var/www/htdocs /下的单个帐户服务器.
还有什么我需要做的才能通过我的服务器的IP查看帐户吗?
我在头文件中声明了一个变量:
@接口
int _nPerfectSlides;
Run Code Online (Sandbox Code Playgroud)
和
@property (nonatomic, readwrite) int _nPerfectSlides;
Run Code Online (Sandbox Code Playgroud)
我有一个我在标题中声明的方法:
+ (void) hit;
Run Code Online (Sandbox Code Playgroud)
该方法包含以下代码:
+ (void) hit {
NSLog(@"hit");
_nPerfectSlides = 0;
[_game showHit];
}
Run Code Online (Sandbox Code Playgroud)
现在由于某种原因我得到错误"实例变量'_nPerfectSlides'在类方法中访问"错误,似乎我无法访问方法内的任何变量.我究竟做错了什么?
好的,我正在学习I/O,我在其中一张幻灯片中找到了以下代码.有谁可以解释为什么需要有FileWrite,BufferedWriter和PrintWriter?我知道BufferedWriter是缓冲输出并将其全部放在一起,但为什么他们会使用FileWriter和PrintWriter?他们几乎没有做同样的错误处理等一点点差异?
还有他们为什么要传递bw
给他们PrintWriter
?
FileWriter fw = new FileWriter (file);
BufferedWriter bw = new BufferedWriter (fw);
PrintWriter outFile = new PrintWriter (bw);
Run Code Online (Sandbox Code Playgroud) 是否可以在C#中执行此操作?(在C++中没有)
function sum ( int a = 9, int b = 4){
}
Run Code Online (Sandbox Code Playgroud)
然后调用函数如:
int someValue = sum(, 14) // so 14 is for the second value
Run Code Online (Sandbox Code Playgroud) 可能重复:
如何在C++中拆分字符串?
我有一个数据输入文件,每行都是一个条目.在每一行中,每个"字段"由一个空格""分隔,所以我需要按空格分割线条.其他语言有一个叫做split(C#,PHP等)的函数,但是我找不到一个用于C++的函数.我怎样才能做到这一点?这是我的代码获取行:
string line;
ifstream in(file);
while(getline(in, line)){
// Here I would like to split each line and put them into an array
}
Run Code Online (Sandbox Code Playgroud) 我试图实现一个类似于搜索的Facebook,它会在用户输入时返回结果(自动完成),这里是我正在使用的jquery代码:
$(document).ready(function(){
$("#searchField").keyup(function()
{
var searchbox = $(this).val();
if(searchbox=='')
{
$("#searchDisplay").html('').hide();
}
else
{
$.ajax({
url: "ajax/?do=search_users&q="+ searchbox+"",
//data: dataString,
cache: false,
success: function(html)
{
$("#searchDisplay").html(html).show();
}
});
}return false;
});
});
$("#searchField").focusout(function(){
$("#searchDisplay").slideUp();
});
$("#searchField").focus(function(){
if($("#searchDisplay").html() != ''){
$("#searchDisplay").slideDown();
}
});
Run Code Online (Sandbox Code Playgroud)
返回的结果是div结构.我不知道怎么做是允许用户使用键盘上的[UP]和[DOWN]键来查看结果,然后按[ENTER]按钮选择结果.
额外信息
这是display_box
:
<div id="searchDisplay">
echo '<a href="'.$_config['http'].$username.'"><div class="display_box" align="left">';
echo '<img src="'.$img.'" style="width:25px; float:left; margin-right:6px" />';
echo $name.'<br/>';
echo '<span style="font-size:9px; color:#999999">'.$username.'</span></div></a>';
</div>
Run Code Online (Sandbox Code Playgroud)
HTML标记
<a href="ahoora"><div class="display_box" align="left">
<img src="http://domain.com/upload/thumbs/ahoora_1336145552.jpg" style="width:25px; float:left; margin-right:6px">
<strong>a</strong>hour<strong>a</strong><br>
<span …
Run Code Online (Sandbox Code Playgroud) 我正在尝试自定义脚本,需要使用perl从表单中获取POST值.我没有perl的背景,但这是一个相当简单的事情,所以我想它应该不难.
这是我希望在PERL中拥有的代码的php版本:
<?php
$download = ($_POST['dl']) ? '1' : '0';
?>
Run Code Online (Sandbox Code Playgroud)
我知道这可能与PERL版本无关,但它可以帮助我猜清楚我到底要做什么.
我想知道在mysql查询后获取最后一个插入ID的最佳解决方案是什么?
我找到了以下解决方案:
<?php
function get_current_insert_id($table)
{
$q = "SELECT LAST_INSERT_ID() FROM $table";
return mysql_num_rows(mysql_query($q)) + 1;
}
?>
Run Code Online (Sandbox Code Playgroud)
甚至使用mysql_insert_id
PHP函数,但显然这个函数不能很好地与bigint(这就是我用于ID字段)和如果有很多连续的SQL查询它可能是不可靠的.
有人能提供可靠而快速的解决方案来完成这项任务吗?
我创建了一个NSTimer
:
[NSTimer scheduledTimerWithTimeInterval:2.0
target:self
selector:@selector(createObject:)
userInfo:nil
repeats:YES];
Run Code Online (Sandbox Code Playgroud)
并createObject:
定义如下:
- (void)createObject:(ccTime) dt{
int r = arc4random() % 4;
for (int i=0; i < r; i++) {
character[charIndex] = [CCSprite spriteWithFile:@"o.png"];
}
}
Run Code Online (Sandbox Code Playgroud)
我想要实现的是将一些变量发送到方法中.我重写了这个函数:
- (void)createObject:(ccTime) dt cID:(int)cID {
int r = arc4random() % 4;
for (int i=0; i < r; i++) {
character[cID] = [CCSprite spriteWithFile:@"o.png"];
}
}
Run Code Online (Sandbox Code Playgroud)
但我无法将变量传递cID
给定时器中的函数.是否有可能做到这一点?
c# ×2
objective-c ×2
ajax ×1
apache ×1
autocomplete ×1
c++ ×1
centos ×1
cgi ×1
cocoa-touch ×1
controls ×1
filewriter ×1
ios ×1
java ×1
javascript ×1
jquery ×1
mysql ×1
nstimer ×1
perl ×1
php ×1
printwriter ×1
runtime ×1
string ×1
tokenize ×1
winforms ×1