是否有一个查询可以获得磁盘上FILESTREAM文件夹中文件的总文件大小?
我正在学习Cocoa,而且我没有遇到太多麻烦而无法工作.但是setActionName:方法令我感到困惑.这是一个简单的例子:一个玩具应用程序,其窗口包含一个文本标签和两个按钮.按"开"按钮,标签显示"开".按"关闭"按钮,标签将更改为"关闭".以下是两个相关的方法(我为应用程序编写的唯一代码):
-(IBAction) turnOnLabel:(id)sender
{
[[self undoManager] registerUndoWithTarget:self selector:@selector(turnOffLabel:) object:self];
[[self undoManager] setActionName:@"Turn On Label"];
[theLabel setStringValue:@"On"];
}
-(IBAction) turnOffLabel:(id)sender
{
[[self undoManager] registerUndoWithTarget:self selector:@selector(turnOnLabel:) object:self];
[[self undoManager] setActionName:@"Turn Off Label"];
[theLabel setStringValue:@"Off"];
}
Run Code Online (Sandbox Code Playgroud)
这就是我的期望:
事实上,除了最后一个之外,所有这些都是我所期望的."编辑"菜单中的项目显示"重做关闭标签",而不是"重做打开标签".(当我点击该菜单项时,标签确实会转为开启,正如我所料,但这使菜单项的名称更加神秘.
我有什么误解,怎样才能让这些菜单项显示我想要的方式?
我注意到当我尝试使用如下路径列出目录的内容时,filesize不起作用:
../
Run Code Online (Sandbox Code Playgroud)
例如,这工作:
if ($handle = opendir('./')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "File Name: $file | File Size: ". filesize($file)."<br />";
}
}
closedir($handle);
}
Run Code Online (Sandbox Code Playgroud)
但这不是:
if ($handle = opendir('../')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "File Name: $file | File Size: ". filesize($file)."<br />";
}
}
closedir($handle);
}
Run Code Online (Sandbox Code Playgroud)
在最后一个示例中,文件名列出正常,但不是获取文件大小,而是出现此错误:
Warning: filesize() [function.filesize]: stat failed …Run Code Online (Sandbox Code Playgroud) 这是Delphi DLL代码:
library Project2;
uses
SysUtils,
Classes;
{$R *.res}
function SimpleConv(const s: string): string;
var
i: Integer;
begin
Result := '';
for i := 1 to Length(s) do
if Ord(S[i]) < 91 then
Result := Result + S[i];
end;
function MsgEncode(pIn: pchar; InLen: Integer; var pOut: pchar; var OutLen: Integer): Boolean; stdcall;
var
sIn: string;
sOut: string;
begin
SetLength(sIn, InLen);
Move(pIn^, sIn[1], InLen);
sOut := SimpleConv(sIn); // Do something
OutLen := Length(sOut);
GetMem(pOut, OutLen);
Move(sOut[1], pOut^, OutLen);
Result := OutLen …Run Code Online (Sandbox Code Playgroud) 以下子例程用于迭代节点数组(每个节点的哈希值都有一个大陆)并返回所有国家/地区的列表:
sub getContinentsServed{
my $self = shift;
my $temp = $self->{cityListRef};
my %hash = {};
my $h_ref = \%hash;
foreach my $cont (@{$temp}){
$h_ref->{$cont->{continent}} = '1';
}
print "Continents Served: ";
foreach my $coord (keys %hash){
print $coord;
print " , ";
}
}
Run Code Online (Sandbox Code Playgroud)
我很确定这包含所有正确的数据,但是当我尝试打印这些值时,我得到了这个结果:
Continents Served: Australia Europe North America South America Asia Africa HASH(0x100949a70)
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么我会得到最后一个元素HASH(0x1009...).我宁愿这不会出现,但我所做的只是迭代键,所以我不确定为什么或如何那样.
SELECT
deal_woot.*,
site.woot_off,
site.name AS site_name
FROM deal_woot
INNER JOIN site ON site.id = site_id
WHERE site_id IN (2, 3, 4, 5, 6)
GROUP BY site_id
ORDER BY deal_woot.id DESC
LIMIT 5
Run Code Online (Sandbox Code Playgroud)
我想在分组之前先订购,我该如何做到这一点?
奇怪的具体问题,但我有一个解决方案已经<span contentEditable="true">通过使用隐藏粘贴纯文本textarea,这似乎工作得很好,除了它打破浏览器的撤消功能.马上,我并不担心跨浏览器解决方案; 我只关心Chrome.我的方法大致如下:
$('.editable').live('paste', function()
{
var $this = $(this);
//more code here to remember caret position, etc
$('#clipboard').val('').focus(); //put the focus in the hidden textarea so that, when the paste actually occurs, it's auto-sanitized by the textarea
setTimeout(function() //then this will be executed immediately after the paste actually occurs
{
$this.focus();
document.execCommand('insertHTML', true, $('#clipboard').val());
});
});
Run Code Online (Sandbox Code Playgroud)
所以这是有效的 - 我可以粘贴任何东西,并且在进入我的contentEditable字段之前它被简化为纯文本- 但是如果我在粘贴后尝试撤消:
#clipboard,将焦点从我的移开contentEditable.我已经尝试了所有我能想到的东西,让浏览器不要尝试撤消更改#clipboard- display:none当它没有主动使用时切换,切换readonly和 …
我编写以下代码
<?php
if ($id = mysql_real_escape_string(@$_GET['pid'])
&& $uid = mysql_real_escape_string(@$_GET['file']))
echo include "foo.php";
else
echo include "bar.php";
?>
Run Code Online (Sandbox Code Playgroud)
当我将include函数与设计用于输出到页面的函数结合使用时(例如,或echo包含'foo.php'),它返回include,但在包含的内容后面带有"1".
我正在编写一个应用程序,其中我希望近乎实时的文档协作编辑功能(非常类似于Google文档样式编辑).
我知道如何跟踪光标位置,这很简单.只需使用当前用户ID,文件名,行号和行号(可以存储在数据库中)半秒或秒来轮询服务器,并且此轮询请求的返回值是其他用户游标的位置.
我不知道该怎么做是以这样一种方式更新文档:它不会抛出你的光标并强制完全重新加载,因为这对于我的目的来说是很慢的.
这实际上只需要在谷歌浏览器中工作,最好也适用于Firefox.我不需要支持任何其他浏览器.