我想做一些听起来很简单的事情,但我找不到解决方案.
我的应用程序需要编辑包含页面的文档.
这是我的模型:
MyApplication.Document = DS.Model.extend({
title: DS.attr('string'),
pages: DS.hasMany('page', {async: true})
});
MyApplication.Page = DS.Model.extend({
document: DS.belongsTo('document', {async: true}),
title: DS.attr('string'),
params: DS.attr(),
objects: DS.attr()
});
Run Code Online (Sandbox Code Playgroud)
路线:
MyApplication.Router.map(function () {
this.resource('document', {path: '/document/:document_id'});
});
MyApplication.Document = Ember.Route.extend({
model: function (params) {
return this.store.find('document', params.document_id);
}
});
Run Code Online (Sandbox Code Playgroud)
当我加载文档1时,应用程序调用http://www.myserver.com/api/document/1
.
问题是,当我想找到文档的页面时,它会调用
http://www.myserver.com/api/pages/ID
代替
http://www.myserver.com/api/document/1/pages/ID
这些嵌套URL在我的应用程序中很重要.
我在主题上发现了不同的内容,例如添加links
JSON响应:
{
"document": {
"id": "1",
"title": "Titre du document",
"pages": ["1", "2", "3"],
"links": {"pages" : "pages"}
},
Run Code Online (Sandbox Code Playgroud)
但是当我呼叫页面时,它http://www.myserver.com/api/document/1/pages
没有id 请求. …
我必须用delphi将文件发送到php脚本.我最终选择使用Wininet功能,因为我必须通过NTLM身份验证代理.
当我发送文件时,我的内容请求的每个字符之间都有空字符(00):
POST /upload.php HTTP/1.1
User-Agent: MYUSERAGENT
Host: 127.0.0.1
Cookie: ELSSESSID=k6ood2su2fbgrh805vs74fvmk5
Pragma: no-cache
Content-Length: 5
T.E.S
Run Code Online (Sandbox Code Playgroud)
这是我的Delphi代码:
pSession := InternetOpen('MYUSERAGENT', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
pConnection := InternetConnect(pSession, PChar('127.0.0.1'), INTERNET_DEFAULT_HTTP_PORT, nil, nil, INTERNET_SERVICE_HTTP, 0, 0);
pRequest := HTTPOpenRequest(pConnection, PChar('POST'), PChar('/upload.php'), 'HTTP/1.0', nil, nil, INTERNET_SERVICE_HTTP, 0);
HTTPSendRequest(pRequest, nil, 0, Pchar('TESTR'), Length('TESTR'));
Run Code Online (Sandbox Code Playgroud)
对于发生了什么的任何想法?
我们需要在delphi应用程序的命令窗口中执行ffmpeg.
我们找到了使用"ExtractShortPathName"函数保护路径的解决方案.
但是在某些计算机上我们无法获得8.3路径(HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation为2),我们想找到另一种逃避空间的方法.
这是代码:
sParameters := '"C:\Users\[...]\input.wav" -r 12.03 -f image2 -i "C:\Users\[...]\delphilm%d.png" -vf "scale=1024:704" -ab 96k -r 24 -b 2000k -pass 1 -vcodec libx264 -fpre "C:\[...]\libx264-normal.ffpreset" "C:\Users\[...]\export.mp4"';
sCommand := 'C:\Program Files\My application\utils\bin\ffmpeg.exe';
Handle := CreateProcess(nil, PChar('cmd.exe /C '+ProtectPath(sCommand)+' '+sParameters),nil, nil, True, 0, nil, nil, SI, PI);
Run Code Online (Sandbox Code Playgroud)
使用ProtectPath功能:
function ProtectPath(sCommand:Widestring):Widestring;
begin
Result := sCommand;
// get the 8.3 path
Result := ExtractShortPathName(sCommand);
// if 8.3 path is not accessible
if(Pos(' ', Result)>0)then begin
//Result := '"'+sCommand+'"'; --> do not work …
Run Code Online (Sandbox Code Playgroud)