我需要运行一些依赖于用户决策的验证(例如,如果批准购买超过支出限制),并且如果失败则拒绝"完成"操作.
然而,看起来像是不可能有一个真正的模态动作,如与其他语言(如showmessage,alert()等),一切都是由代表.
但后来我不知道该怎么办.如果用户按下"完成"按钮,程序会询问"你确定吗?" 他说"取消"流程继续,视图被推回!
如何在可可世界解决这个问题?
我想将我的移动POS系统与quickbooks集成.我需要客户,卖家,库存和过帐订单和发票.
我还没有找到一个python库.有可用吗?
我想在工具栏中显示一个完整内容.我把UILabel放在工具栏的顶部.
但是,当我运行应用程序时,UILabel完全不可见(但可以在代码上设置值).
最奇怪的是,在其他形式,所有工作都很好.我不明白为什么在一种形式的工作,而不是在另一种形式......
怎么解决这个问题?或者为什么会发生这种情况?
我有一个简单的web.py程序来加载数据.在服务器中我不想安装apache或任何web服务器.
我尝试将其作为后台服务http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
子类化:(来自http://www.jejik.com/files/examples/daemon.py)
class Daemon:
def start(self):
"""
Start the daemon
"""
... PID CHECKS....
# Start the daemon
self.daemonize()
self.run()
#My code
class WebService(Daemon):
def run(self):
app.run()
if __name__ == "__main__":
if DEBUG:
app.run()
else:
service = WebService(os.path.join(DIR_ACTUAL,'ElAdministrador.pid'))
if len(sys.argv) == 2:
if 'start' == sys.argv[1]:
service.start()
elif 'stop' == sys.argv[1]:
service.stop()
elif 'restart' == sys.argv[1]:
service.restart()
else:
print "Unknown command"
sys.exit(2)
sys.exit(0)
else:
print "usage: %s start|stop|restart" % sys.argv[0]
sys.exit(2)
Run Code Online (Sandbox Code Playgroud)
但是,web.py软件无法加载(即:服务没有收听)
如果我直接调用它(即:不使用守护程序代码)工作正常.
我知道如何得到一个随机的UIColor,但我想知道是否存在一种只返回具有某种特定质量的颜色的方法.我不知道是否存在一个特定的术语,但是,例如,我只需要获得不透明的颜色,深色调......对于背景上有明亮文本/图像的颜色.
我可以亲自挑选一些,但在我的情况下,我想为一大堆图标背景提供一个非常好的默认值.
更新:
我的解决方案基于这里的答案:
float r = arc4random() % 12;
return [UIColor colorWithHue:(30*r)/360 saturation:0.5f brightness:0.8f alpha:1.0f];
Run Code Online (Sandbox Code Playgroud)
我得到了一个很小的可能答案列表,但这给了我一个良好的开端.
我有这个rutine知道文件大小:
(基于http://delphi.about.com/od/delphitips2008/qt/filesize.htm)
function FileSize(fileName : String) : Int64;
var
sr : TSearchRec;
begin
if FindFirst(fileName, faAnyFile, sr ) = 0 then
{$IFDEF MSWINDOWS}
result := Int64(sr.FindData.nFileSizeHigh) shl Int64(32) + Int64(sr.FindData.nFileSizeLow)
{$ELSE}
result := sr.Size
{$ENDIF}
else
result := -1;
FindClose(sr) ;
end;
Run Code Online (Sandbox Code Playgroud)
但是,这会发出此警告:
[DCC Warning] Funciones.pas(61): W1002 Symbol 'FindData' is specific to a platform
Run Code Online (Sandbox Code Playgroud)
我想知道是否存在一种干净的跨平台方式来做到这一点.我检查了TFile类而没找到它......
我正在为我的新项目应用程序实现dropbox api.api基于代表和回调,成对(成功+失败),如:
- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata;
- (void)restClient:(DBRestClient*)client loadMetadataFailedWithError:(NSError*)error;
- (void)restClient:(DBRestClient*)client loadedAccountInfo:(DBAccountInfo*)info;
- (void)restClient:(DBRestClient*)client loadAccountInfoFailedWithError:(NSError*)error;
Run Code Online (Sandbox Code Playgroud)
我想知道是否存在将其转换为obj-c异步块的方法,所以我可以这样做:
+ (void)loadMetadata:(DBRestClient *)client queue:(NSOperationQueue *)queue completionHandler:(void (^)(DBMetadata*, NSError*))handler
Run Code Online (Sandbox Code Playgroud)
存在一种可用于此的模式?或者必须从一开始就用块构建库?
我试图用Delphi将+100文件上传到azure.但是,调用会阻塞主线程,因此我想通过异步调用或后台线程来执行此操作.
这就是我现在所做的事情(如此处所述):
procedure TCloudManager.UploadTask(const input: TOmniValue;
var output: TOmniValue);
var
FileTask:TFileTask;
begin
FileTask := input.AsRecord<TFileTask>;
Upload(FileTask.BaseFolder, FileTask.LocalFile, FileTask.CloudFile);
end;
function TCloudManager.MassiveUpload(const BaseFolder: String;
Files: TDictionary<String, String>): TStringList;
var
pipeline: IOmniPipeline;
FileInfo : TPair<String,String>;
FileTask:TFileTask;
begin
// set up pipeline
pipeline := Parallel.Pipeline
.Stage(UploadTask)
.NumTasks(Environment.Process.Affinity.Count * 2)
.Run;
// insert URLs to be retrieved
for FileInfo in Files do
begin
FileTask.LocalFile := FileInfo.Key;
FileTask.CloudFile := FileInfo.Value;
FileTask.BaseFolder := BaseFolder;
pipeline.Input.Add(TOmniValue.FromRecord(FileTask));
end;//for
pipeline.Input.CompleteAdding;
// wait for pipeline to complete
pipeline.WaitFor(INFINITE); …Run Code Online (Sandbox Code Playgroud) 我无法想象如何为路径设置路由器:
/store/category/%s/brand/%s
Run Code Online (Sandbox Code Playgroud)
我有网上商店演示,它适用于简单的URL,但我不知道如何使更灵活的配置.
这就是我所拥有的:
type StrPath = PrintfFormat<(string -> string),unit,string,string,string>
// How do this?
type Str2Path = PrintfFormat<(string -> string),unit,string,string,string>
let withParam (key,value) path = sprintf "%s?%s=%s" path key value
module Store =
//Don't know what put here
let browseBrand = sprintf "/store/category/%s/brand/%s"
//This work ok
let browseCategory : StrPath = "/store/category/%s"
// I need to capture query parameters
let browseBrand cat brand = request (fun r ->
Views.browse(cat brand))
let webPart =
localizeUICulture >>
choose [
path Path.Store.overview >=> …Run Code Online (Sandbox Code Playgroud) 我试图显示 firebird 3.x 数据库的结果,但得到:
文件“/...../Envs/pos/lib/python3.6/site-packages/fdb/fbcore.py”,第 479 行,在 b2u 中返回 st.decode(charset) UnicodeDecodeError: 'utf-8' 编解码器无法解码位置 9 中的字节 0xd1:无效的连续字节
尽管我到处都设置了utf-8:
# -- coding: UTF-8 --
import os
os.environ["PYTHONIOENCODING"] = "utf8"
from sqlalchemy import *
SERVIDOR = "localhost"
BASEDATOS_1 = "db.fdb"
PARAMS = dict(
user="SYSDBA",
pwd="masterkey",
host="localhost",
port=3050,
path=BASEDATOS_1,
charset='utf-8'
)
firebird = create_engine("firebird+fdb://%(user)s:%(pwd)s@%(host)s:%(port)d/%(path)s?charset=%(charset)s" % PARAMS, encoding=PARAMS['charset'])
def select(eng, sql):
with eng.connect() as con:
return eng.execute(sql)
for row in select(firebird, "SELECT * from clientes"):
print(row)
Run Code Online (Sandbox Code Playgroud) iphone ×3
python ×3
cocoa-touch ×2
delphi ×2
objective-c ×2
.net ×1
api ×1
azure ×1
delegates ×1
delphi-xe2 ×1
f# ×1
filesize ×1
interface ×1
ios ×1
ios5 ×1
python-3.x ×1
quickbooks ×1
routes ×1
sqlalchemy ×1
suave ×1
uicolor ×1
uikit ×1
unicode ×1
xcode4 ×1