我有一个C++程序,我试图在hadoop上作为流媒体作业运行(它只有映射器,没有减速器).虽然简单的C++程序可以正常工作.与许多共享库链接的另一个C++程序无法在网格上运行.ldd在这个C++程序上显示如下:(它使用了许多第三方库,如opencv和boost_serialization)
/usr/local/lib/libboost_serialization.so.1.48.0 /usr/local/lib/libfftw3f.so.3 /usr/local/lib/libconfig++.so.9 /usr/local/lib/liblog4cpp.so.4 /usr/local/lib/libopencv_core.so.2.3 /usr/local/lib/libopencv_contrib.so.2.3
Run Code Online (Sandbox Code Playgroud)
我认为因为这些共享库没有安装在数据节点上,所以它失败了.我尝试将这些库放在tarball中,并使用-archives选项(分布式缓存)将其指定为流作业.这也不起作用(我不确定来自tarball的内容是否安装在数据节点上的相应目录中).
知道如何去做吗?
我们的程序在程序开头创建一个后台线程.后台线程使用Indy进行一些数据库完整性检查并检查Internet中的内容.10秒后,后台线程应该完成,因为FreeOnTerminate为true,它也会自行清理.
我们注意到,在某些情况下,如果用户过快地关闭程序,则该过程仍然有效,直到后台线程完成.
由于我们无法完全重现该问题,因此我创建了一个演示项目来尝试一些事情:
type
TBackgroundThread = class(TThread)
protected
procedure Execute; override;
end;
{ TForm1 }
var
bt: TBackgroundThread;
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
// Create a background thread which runs X seconds and then terminates itself.
bt := TBackgroundThread.Create(false);
bt.FreeOnTerminate := true;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
// The user closes the app while the background thread is still active
Sleep(2000);
Close;
end;
{ TBackgroundThread }
procedure TBackgroundThread.Execute;
var
i: integer;
x: cardinal;
begin
inherited;
// Simulate some …
Run Code Online (Sandbox Code Playgroud) 我试图阻止我的应用程序被Windows关闭.该应用程序在Windows 8上运行并以XE6编写.我尝试了下面的代码,但它似乎完全被忽略了.为了测试它,我只需通过任务管理器向其发送"结束任务".我需要的是一种方法,让我的应用程序完成它在用户关闭应用程序时所执行的操作,由Windows关闭的任务管理器完成.正常关闭不是问题,这由FormCloseQuery事件处理.但其他两种方法我都无法工作.直到windows XP,通过捕获wm_endsession和wm_queryendsession很容易,从vista开始你需要使用ShutDownBlockReasonCreate,它返回true但似乎无论如何都不起作用.
procedure WMQueryEndSession(var Msg : TWMQueryEndSession); message WM_QUERYENDSESSION;
procedure WMEndSession(var Msg: TWMEndSession); message WM_ENDSESSION;
function ShutdownBlockReasonCreate(hWnd: HWND; Reason: LPCWSTR): Bool; stdcall; external user32;
function ShutdownBlockReasonDestroy(hWnd: HWND): Bool; stdcall; external user32;
procedure TForm1.WMEndSession(var Msg: TWMEndSession);
begin
inherited;
Msg.Result := lresult(False);
ShutdownBlockReasonCreate(Handle, 'please wait while muting...');
Sleep(45000); // do your work here
ShutdownBlockReasonDestroy(Handle);
end;
procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
begin
inherited;
Msg.Result := lresult(False);
ShutdownBlockReasonCreate(Handle, 'please wait while muting...');
Sleep(45000); // do your work here
ShutdownBlockReasonDestroy(Handle);
end;
Run Code Online (Sandbox Code Playgroud)
更新
将消息结果更改为true并删除睡眠不会改变任何内容.
procedure TForm1.WMEndSession(var …
Run Code Online (Sandbox Code Playgroud) 看着调用堆栈我刚才注意到了这一点:
请注意Opt.out
顶部.
只是好奇,什么Opt.out
意思?
这是我要介绍的片段:
function BinaryEquals(Left, Right: pointer; Size: integer): boolean;
....
{$IFDEF CPUX64}
asm
....
sub r8,4
@loop1:
inc R8
Run Code Online (Sandbox Code Playgroud) 我需要制作一个简单的闹钟应用程序,而不是播放声音,将文件上传到ftp(让后者弄清楚).事实证明,在执行线程时,定时器无效.
这是我到目前为止所得到的:
var
ttime : tDateTime;
timerstr : string;
timealarm : string;
aThread : TMyThread;
begin
aThread := tMyThread.Create(false);
ttime := Now;
timestr := FormatDateTime('hh:nn:ss', ttime);
timealarm := '09:30:30';
if timestr = timealarm then
aThread.Resume; //The thread will execute once and terminate;
end;
Run Code Online (Sandbox Code Playgroud)
你们能想出另一种方法,让这种命令每天以更有效的方式发生一次吗?
谢谢.
我如何能够非常快速地将数百万条记录从tadotable加载到stringlist中?
procedure TForm1.SlowLoadingIntoStringList(StringList: TStringList);
begin
StringList.Clear;
with SourceTable do
begin
Open;
DisableControls;
try
while not EOF do
begin
StringList.Add(FieldByName('OriginalData').AsString);
Next;
end;
finally
EnableControls;
Close;
end;
end;
Run Code Online (Sandbox Code Playgroud) 这是一个要点:https://gist.github.com/973e70bde8e6a530c489
我有两个场景.一个工作,一个失败,即使代码完全相同.
ENOENT,没有这样的文件或目录'/Users/Home/dev/csv/TwFrI5vhdownload.csv
我已经尝试了超时,外部回调等等.但是对于动态创建的文件,它总是失败.
我在这里错过了什么?文件被锁定了,我不知道吗?
谢谢!
系统:
OSX Lion Node v0.6.7
请您解释以下 MySQL 指标的含义:
表缓存命中率 = open_tables / opens_tables。
据我所知,open_tables 是打开表的当前值,open_tables 是一个计数器,这两个状态变量之间没有任何相关性。
使用以下代码使无边框表单可调整大小非常有效:
type
TForm1 = class(TForm)
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
BorderStyle := bsNone;
inherited;
Params.ExStyle := Params.ExStyle or WS_EX_STATICEDGE;
Params.Style := Params.Style or WS_SIZEBOX;
end;
Run Code Online (Sandbox Code Playgroud)
但是,请看图片:
我正在尝试更改listviewitem中文本对象的文本颜色.我在listviewitem中有多个文本对象.我正在使用以下代码
Litem := ListView1.Items.Add;
Litem.Data['ytde'] := currtostrf(ytde,ffCurrency,2);
Litem.Data['ytdbe'] := currtostrf(ytdbe,ffCurrency,2);
Litem.Data['ytdetotal'] := currtostrf(ytdetotal,ffCurrency,2);
Litem.Objects.TextObject.TextColor := TAlphaColorRec.Green
Run Code Online (Sandbox Code Playgroud)
调试时出现错误说无法访问的对象,但是当我执行以下操作时,我没有问题更改颜色
LItemheader.Purpose := TListItemPurpose.Header;
Litemheader.Objects.TextObject.TextColor := TAlphaColorRec.blue;
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
delphi ×7
delphi-xe7 ×2
c++ ×1
callstack ×1
debugging ×1
file-io ×1
firemonkey ×1
hadoop ×1
indy ×1
javascript ×1
mapreduce ×1
mysql ×1
node.js ×1
performance ×1
shutdown ×1
tadotable ×1
terminate ×1
tstringlist ×1
vcl-styles ×1