我正在编写一个带有UIWebView的iPhone应用程序,它应该显示我在app资源文件夹中的各种html文件.在xcode我的项目概述中,这些html文件显示如下:
dirA
|---> index.html
|---> a1.html
|---> a2.html
|---> my.css
|---> dirB
|---> b1.html
|---> b2.html
|---> dirC
|---> c1.html
|---> c2.html
Run Code Online (Sandbox Code Playgroud)
这些资源如此添加到项目中:
我的html中的链接是相对的,这意味着它们看起来像这样:
<a href="a1.html">a1</a>
<a href="a2.html">a2</a>
<a href="dirB/b2.html">b2</a>
<a href="dirC/c1.html">c1</a>
Run Code Online (Sandbox Code Playgroud)
为了在应用启动时显示index.html,我使用以下代码:
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
Run Code Online (Sandbox Code Playgroud)
这很好用.索引文件中的以下链接也可以正常工作,只要请求的html文件直接在dirA下.如果后面的链接指向子目录中的文件,那么didFailLoadWithError将捕获该情况并报告所请求的文件不存在.
也,
[webView loadHtmlString:myHtml];
Run Code Online (Sandbox Code Playgroud)
不能成为解决方案的一部分,因为我需要后退和前进按钮才能在我的Web视图中工作.
所以问题是:如何在资源中的子目录中跟踪html文件的相对链接?
我已经遍布计算器和管在过去几天试图找出这一个的其余部分,但无处有我遇到解决这个确切的问题.任何见解都将非常非常感谢!
编辑: Yoohoo!我想到了!什么快乐!这是我做的:
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"dirA"];当我尝试使用suds/python-ntlm连接到MS CRM Web服务时,我的请求超时.但是,我正在尝试替换的代码 - 它调用cURL命令行应用程序来执行相同的调用 - 成功.
显然,cURL发送命令数据的方式有所不同,但如果我知道差异是什么,我会被诅咒.以下是各种电话的详细信息.有人有任何提示吗?
这是发出请求的代码,后跟输出.cURL命令代码低于该命令代码,其响应如下.当然,主机,用户和密码已经改变以保护无辜者.
wsdl_url = 'https://client.service.host/MSCrmServices/2007/MetadataService.asmx?WSDL'
username = r'domain\user.name'
password = 'userpass'
from suds.transport.https import WindowsHttpAuthenticated
from suds.client import Client
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
ntlmTransport = WindowsHttpAuthenticated(username=username, password=password)
metadata_client = Client(wsdl_url, transport=ntlmTransport)
request = metadata_client.factory.create('RetrieveAttributeRequest')
request.MetadataId = '00000000-0000-0000-0000-000000000000'
request.EntityLogicalName = 'opportunity'
request.LogicalName = 'new_typeofcontact'
request.RetrieveAsIfPublished = 'false'
attr = metadata_client.service.Execute(request)
print attr
Run Code Online (Sandbox Code Playgroud)
这是输出:
DEBUG:suds.client:sending to (http://client.service.host/MSCrmServices/2007/MetadataService.asmx)
message:
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/crm/2007/WebServices" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:Execute>
<ns1:Request xsi:type="ns1:RetrieveAttributeRequest">
<ns1:MetadataId>00000000-0000-0000-0000-000000000000</ns1:MetadataId>
<ns1:EntityLogicalName>opportunity</ns1:EntityLogicalName>
<ns1:LogicalName>new_typeofcontact</ns1:LogicalName>
<ns1:RetrieveAsIfPublished>false</ns1:RetrieveAsIfPublished>
</ns1:Request>
</ns1:Execute> …Run Code Online (Sandbox Code Playgroud) 我正在优化WinForms应用程序的启动.我发现的一个问题是加载了启动画面.它需要大约半秒到一秒.
我知道多线程在UI片段上是禁止的,然而,看看启动画面是一个相当独立的应用程序片段,是否有可能以某种方式通过抛出其他一些线程来缓解其性能损失(可能在Chrome的方式),以便应用程序的重要部分实际上可以开始.
我问过strtolower功能.但是当使用外来字符时,它不会将它们转换为大写,所以我必须使用:
mb_strtolower($a,"utf8");
Run Code Online (Sandbox Code Playgroud)
但是,如果我想使用ucfirst()功能,我该怎么办?我没有找到任何类似的功能,我可以设置编码类型.
我正在尝试创建一组我们实际上不删除它们的表,而是设置归档标志.当我们删除实体时,不应删除它,而应将其标记为已存档.
有什么编程模式可以支持这个?
如果有另一个解决方案,我也不想为每个拥有这些存档标志的表推出自己的存储过程.
采取这种方法
/**
* @return List of group IDs the person belongs to
*
*/
public List<String> getGroups() {
if (this.getId().equals("")) return null;
}
Run Code Online (Sandbox Code Playgroud)
我想抛出异常而不是返回null,当没有设置重要的参数/依赖项时抛出的异常是什么?
我需要检索运行晶体报告的存储过程的名称.有没有办法在C#中使用CrystalDecisions.CrystalReports.Engine.ReportDocument对象执行此操作?
我似乎无法找到一个属性,它将给我存储过程名称.
这甚至可能吗?我经历过几乎所有我能想到的属性.DataDefinition对象具有公式,参数,组名称和运行总计字段的集合,但不包含数据库字段的集合.
编辑:我需要以编程方式执行此操作,因为我有很多报告.我需要选择跳过报告的实际运行并只执行报告将使用的存储过程.因此,当使用该程序将报告信息插入到数据库中时,我希望能够提取其存储过程并单独存储该信息.
我需要两次构建相同的源树,
1 -正常CFLAGS建项目二进制
2 -用CFLAGS加上-fPIC建立一个静态库,这将是某种形式的SDK来开发项目动态模块.
只使用一个Makefile,完成此任务的最佳方法是什么?
做某种事情会很好:
all: $(OBJECTS)
lib_rule: $(OBJECTS)
CFLAGS += -fPIC
.cpp.o:
$(CC) -c $< -o $@ $(CFLAGS)
Run Code Online (Sandbox Code Playgroud)
但显然它无法完成.
谢谢
我是F#的初学者.我知道有使用PowerPack.dll创建Double Matrix的方法:
let B = matrix [ [ 1.0; 7.0 ];
[ 1.0; 3.0 ] ]
Run Code Online (Sandbox Code Playgroud)
如何使用我自己的类型的元素创建矩阵(例如使用[,]而不是Double),所以它看起来像:
let B = matrix [ [ [1,2]; [3,4] ];
[ [7,8]; [5,6] ] ]
Run Code Online (Sandbox Code Playgroud)