有没有办法在flutter集成测试中获取当前项目目录?这是一个基本测试设置的示例。
import 'dart:io';
import 'package:flutter_driver/driver_extension.dart';
import 'package:ivori/main.dart' as app;
import 'package:glob/glob.dart';
void main() {
// This line enables the extension.
enableFlutterDriverExtension();
print("Where the working directory? ${Directory.current}");
print("What's under the current directory? ${Glob("*").listSync()}");
// Call the `main()` function of the app, or call `runApp` with
// any widget you are interested in testing.
app.main();
}
Run Code Online (Sandbox Code Playgroud)
中间两行添加的行Directory.current
和Glob("*").listSync()
都是尝试检查/显示当前工作目录。上面的输出是:
$ flutter drive --target=test_driver/app.dart
Changing current working directory to: /Users/yuchen/Documents/MyDemoApp
Using device iPhone SE (2nd generation).
Starting application: test_driver/app.dart
...
... …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在连接到我的 Google Cloud Platform 帐户的本地气流环境中运行 DAG,因此我能够创建新的 GCP 虚拟机实例并将它们配置为按计划的时间间隔处理来自暂存区域的文件。作为其中的一部分,我必须使用自定义操作符,它继承了标准气流操作符的属性。当我导入第一个自定义运算符并运行我的 DAG 时,它运行良好,但是,如果我尝试导入更多自定义运算符,那么我的 DAG 会失败并给出带有错误消息的下图。
如果有人可以帮助我确定这里可能出现的问题并分享任何有用的提示或要进行的检查,我将不胜感激!
____/ ( ( ) ) \___
/( ( ( ) _ )) ) )\
(( ( )( ) ) ( ) )
((/ ( _( ) ( _) ) ( () ) )
( ( ( (_) (( ( ) .((_ ) . )_
( ( ) ( ( ) ) ) . ) ( )
( ( ( ( ) ( _ ( _) ). ) …
Run Code Online (Sandbox Code Playgroud) 我正在玩Airdrop的想法.Apple运行示例代码时出错:
https://developer.apple.com/library/ios/samplecode/sc2273/Introduction/Intro.html
错误消息是:
LaunchServices: invalidationHandler called
Run Code Online (Sandbox Code Playgroud)
问题显然是由UIActivityViewController
.相关的代码是下#pragma mark - Actions
的这个文件,如果你可以去看看.
它仅在设备(iPhone和iPad)上运行时显示错误消息.如果在模拟器(iPhone和iPad)上运行,这一切都很好.这是什么原因?有关如何解决它的任何想法?它可能是一个错误吗?
以下提出了类似的问题,其中任何一个似乎都无法回答这个问题:
LaunchServices:invalidationHandler被调用 - iOS 8共享表
通过UIActivityViewController分享到Twitter/Facebook等导致崩溃
目前UIActivityViewController- LaunchServices:invalidationHandler被调用
我UIActivityViewController
用来通过电子邮件分享信息.我们能够发送带有正文,附件的电子邮件,没有任何问题.但是我们如何设置电子邮件的主题标题.
我注意到这个问题:如何在UIActivityViewController中设置邮件主题?
接受的解决方案是使用UIActivityItemSource
以下API activityViewController:subjectForActivityType : . 但是,我们的代码不符合,UIActivityItemSource
因为我们正在使用UIActivityItemProvider
.
UIActivityItemSource
在那里,你想从你的应用程序的现有对象而不是创建一个单独的UIActivityItemProvider对象的一个提供数据您可以使用情况下,这种协议.
所以完整的问题是:
如果我使用UIActivityItemProvider
而不是UIActivityItemSource,如何设置电子邮件主题?
我正在学习C ++ 11中的新多线程技术。我在网络上阅读的几乎所有教程都在教如何启动执行一个函数的新线程(一个或多个线程),如何稍后加入(或分离)一个或多个线程以及如何使用mutex
等避免竞争状况。
但是我没有看到它们显示如何使线程在程序的不同部分执行多个功能。问题是,使用C ++ 11线程是否可以实现以下目标?如果是这样,怎么办?(举个例子会很棒)。
void func1(std::vector<int> & data1){ ... }
void func2(std::vector<int> & data2){ ... }
// main function version I
int main(){
std::vector<int> data1;
// prepare data1 for func1;
std::thread t1(func1, std::ref(data1));
std::vector<int> data2;
// prepare data2 for func2;
if (func1 in t1 is done){
t1(func2, std::ref(data2));
}
t1.join();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
此外,如果我想将上述main
函数体放入循环中,如下所示。可能吗?如果是这样,怎么办?
//main function version II
int main(){
std::vector<int> bigdata1;
std::vector<int> bigdata2;
std::thread t1; // Can I do this without telling t1 …
Run Code Online (Sandbox Code Playgroud) 我正在阅读头文件winapifamily.h的定义并注意以下定义WINAPI_FAMILY_PARTITION
:
#define WINAPI_FAMILY_PARTITION(Partitions) (Partitions)
Run Code Online (Sandbox Code Playgroud)
宏的一般用法(例如)如下:
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
Run Code Online (Sandbox Code Playgroud)
现在好迷茫,好像就相当于
#if WINAPI_PARTITION_APP
Run Code Online (Sandbox Code Playgroud)
拥有它有什么意义#if WINAPI_FAMILY_PARTITION(...)
?
这是winapifamily.h头文件的相关部分:
Run Code Online (Sandbox Code Playgroud)/* * Header files use the WINAPI_FAMILY_PARTITION macro to assign one or * more declarations to some group of partitions. The macro chooses * whether the preprocessor will emit or omit a sequence of declarations * bracketed by an #if/#endif pair. All header file references to the * WINAPI_PARTITION_* values should be in the form of occurrences of * …
我在 Visual Studio 2010 中添加了这些预构建事件和后构建事件。
现在,如果我构建项目,我将能够看到以下内容:
1>------ Build started: Project: HelloWorld, Configuration: Debug Win32 ------
1>Build started 2015-08-18 5:50:09 PM.
1>InitializeBuildStatus:
1> Creating "Debug\HelloWorld.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>PreBuildEvent:
1> Hello
1>ClCompile:
1> HelloWorld.cpp
1> HelloWorld.vcxproj -> C:\Users\yuchen\Desktop\HelloWorld\Debug\HelloWorld.exe
1>PostBuildEvent:
1> Byebye
1>FinalizeBuildStatus:
1>
1>Build succeeded.
Run Code Online (Sandbox Code Playgroud)
我对 Visual Studio 2013 重复相同的过程,无论出于何种原因,我不确定预构建事件和后构建事件是否实际运行。
输出是否移动到不同的窗口?是否有其他设置可以使预构建和构建后事件正常工作?
1>------ Rebuild All started: Project: HelloWorld2, Configuration: Debug Win32 ------
1> stdafx.cpp
1> HelloWorld2.cpp
1> HelloWorld2.vcxproj -> C:\Users\yuchen\Desktop\Win32Project1\Debug\HelloWorld2.exe
Run Code Online (Sandbox Code Playgroud) 这是关于C++
(不同平台的共享代码)与C#
(Windows Universal App)之间的通信.我们知道,下面是我们如何从一个函数调用C++
来C#
.
C#
class FooCS
{
FooCS()
{
FooC c = new ref FooC();
c.m_GetSomeValueEvent = GetSomeValueEvent;
// Some other stuff ...
}
string GetSomeValueEvent()
{
// Some other stuff ...
return "Hello World";
}
}
Run Code Online (Sandbox Code Playgroud)
C++
public delegate Platform::String GetSomeValueEventHandler();
class FooC
{
public:
event GetSomeValueEventHandler^ m_GetSomeValueEvent;
void someFunction(){
Platform::String^ str = m_GetSomeValueEvent();
// Some other stuff ...
}
}
Run Code Online (Sandbox Code Playgroud)
以上是非常直截了当的.但问题是这个字符串GetSomeValueEvent()
在C#
做一些繁重的任务,比如从数据库中读取数据,我必须做到async
.
async Task<string> GetSomeValueEvent() …
Run Code Online (Sandbox Code Playgroud) 我正在阅读 zlib 的文档,它相当详细。但我读到这一行:
输出数据将采用zlib格式,不同于 gzip 或zip格式
http://www.zlib.net/zlib_how.html
似乎 zlib 创建的zlib格式与本 SO 中讨论的zip格式不同:
zlib、gzip 和 zip 有什么关系?它们有什么共同点,又有什么不同?
任何人都知道是否可以使用 zlib 创建 zip 格式?如何?
是否可以使用 RxSwift 映射错误类型?
例如,我有一个像这样的辅助函数:
enum InternalError: Error {
case fooError
case barError
}
private func helper() -> Observable<MyData> {
// ...
}
enum ServiceError: Error {
case fatalError(message: String)
case warning(message: String)
}
Run Code Online (Sandbox Code Playgroud)
我希望我们可以这样做,请注意以下内容mapError
不存在:
func getData() -> Observable<MyData> {
helper().mapError({ error: InternalError -> ServiceError
switch error {
case .fooError:
return ServiceError.fatalError(message: "This is bad.")
case .barError:
return ServiceError.warning(message: "Be careful.")
}
})
}
Run Code Online (Sandbox Code Playgroud)
是否可以?或者总体来说这是一个坏主意?