小编Red*_*ber的帖子

如何通过Facebook API发布多张照片

现在我像这样张贴一张照片到墙上:

$response = $facebook->api("/$group_id/photos", "POST", array(
    'access_token=' => $access_token,
    'message' => 'This is a test message',
    'url' => 'http://d24w6bsrhbeh9d.cloudfront.net/photo/agydwb6_460s.jpg',
   )
);
Run Code Online (Sandbox Code Playgroud)

它工作正常,但我可以以某种方式发布多张照片,如下所示:

在此输入图像描述

提前致谢!

php facebook facebook-graph-api facebook-php-sdk

11
推荐指数
3
解决办法
1万
查看次数

MySQL 如何索引 JSON 数组?

我有一个带有一维数组的 JSON 字段。事实上,在这个字段中我有一些 ID 的列表,如下所示:

[347470, 162063, 17315, 346852, 174776, 295865, 7833, 136813]
Run Code Online (Sandbox Code Playgroud)

在我的查询中,我这样引用该字段:

... AND JSON_CONTAINS(`users_actions`, 174776)=0 
Run Code Online (Sandbox Code Playgroud)

我的问题是:我应该为此字段创建一个索引吗?如果是的话,我应该使用哪个索引?

mysql sql indexing json query-optimization

10
推荐指数
1
解决办法
9586
查看次数

Delphi:我如何确定以kbps为单位的下载速度?

我用来下载wininet的一些函数文件:

 Url := source_file;

 destinationfilename := destination_file;
 hInet := InternetOpen(PChar(application.title), INTERNET_OPEN_TYPE_PRECONFIG,
   nil, nil, 0);
 hFile := InternetOpenURL(hInet, PChar(Url), nil, 0,
   INTERNET_FLAG_NO_CACHE_WRITE, 0);

 if Assigned(hFile) then
 begin
   AssignFile(localFile, destinationfilename);
   Rewrite(localFile, 1);
   repeat
     InternetReadFile(hFile, @Buffer, SizeOf(Buffer), bytesRead);
     BlockWrite(localFile, Buffer, bytesRead);
     current_size := current_size + bytesRead;
   until (bytesRead = 0) OR (terminated = True);
   CloseFile(localFile);
   InternetCloseHandle(hFile);
 end;
 InternetCloseHandle(hInet);
Run Code Online (Sandbox Code Playgroud)

我试图确定下载速度,但得到一些奇怪的值:

   ...
   repeat
     QueryPerformanceFrequency(iCounterPerSec);
     QueryPerformanceCounter(T1);

     InternetReadFile(hFile, @Buffer, SizeOf(Buffer), bytesRead);
     BlockWrite(localFile, Buffer, bytesRead);
     current_size := current_size + bytesRead;
     QueryPerformanceCounter(T2);

     _speed := round((bytesRead / 1024) / ((T2 …
Run Code Online (Sandbox Code Playgroud)

delphi wininet delphi-xe2

3
推荐指数
1
解决办法
1529
查看次数

如何通过TIdHTTP下载大文件?

我用这段代码下载小文件:

Var
 ms:TMemoryStream;
begin
  ms:=TMemoryStream.Create;
  Idhttp1.get('http://mydomain.com/myfile.zip',ms);
  ms.SaveToFile('myfile.zip');
  ms.Free;
end;
Run Code Online (Sandbox Code Playgroud)

但是文件在存储到磁盘之前保存在RAM中,因此可能难以下载文件> 1Gb,例如.有没有办法按部件下载文件?或者我需要使用WinInet吗?提前致谢!

delphi wininet indy10 delphi-xe2

3
推荐指数
1
解决办法
8196
查看次数

如何将两个文件连接成一个?

我有两个二进制文件(假设,这是一个以前分成两部分的ZIP文件).我如何将它们组合成一个文件?更准确地说,将第二个文件添加到第一个文件.

更新:伙计们,感谢所有回复我的人,但这并不是我需要的.基本上,我需要一个shell命令的模拟:"copy/b file.000 + file.001 + file.002 file.bin"

delphi file

3
推荐指数
1
解决办法
3209
查看次数

Delphi:如何处理动态创建的线程

我有一个来自TThread的孩子.一切正常,但我怎么能大规模暂停或恢复我创建的线程?或者我怎么才能暂停第二个线程(在Button2Click中创建)?这是我的代码的一部分:

TMyThread = class(TThread)
private
  source_file, destination_file: string;
  total_size, current_size, download_item_id: integer;
protected
  procedure ShowResult;
  procedure Execute; override;
public
end;

var
 MyThread: TMyThread;

begin

procedure TMyThread.Execute;
 begin
  //Some code for download file here, it doesn't matter
 end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  MyThread := TMyThread.Create(True);
  MyThread.source_file :='http://example.com/download1.zip';
  MyThread.destination_file := 'c:\download1.zip';
  MyThread.download_item_id := 0;
  MyThread.Priority := tpNormal;
  MyThread.FreeOnTerminate := True;
  MyThread.Resume;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  MyThread := TMyThread.Create(True);
  MyThread.source_file :='http://example.com/download2.zip';
  MyThread.destination_file := 'c:\download2.zip';
  MyThread.download_item_id := 1;
  MyThread.Priority := tpNormal;
  MyThread.FreeOnTerminate := …
Run Code Online (Sandbox Code Playgroud)

delphi multithreading delphi-xe2

1
推荐指数
1
解决办法
5980
查看次数

-4
推荐指数
1
解决办法
2613
查看次数