Using the Microsoft Graph API to get Office 365 data in your mobile apps
Using the Microsoft Graph API to get Office 365 data in your mobile apps Alex Ziskind Technical Director @digitalix www.nuvious.com Hi, I’m Alex From + 750 Million 50 Million per month Problems0 码力 | 15 页 | 7.00 MB | 1 年前3Making Libraries Consumable for Non-C++ Developers
that later.What assumptions are being made? void get_size(size_t dev, long* size); Non-C/C++ language. Caller of get_size(). C/C++ binary. Provides get_size(). gcc and clang, sizeof(long) == sizeof(size_t) “width”.What isn’t being declared? struct data_t { int a; int b; }; /* Get data from device ‘dev’. */ data_t get_data_from(size_t dev); What defines how dev is passed or data_t is returned? being used here? push ... call data_t get_data_from(unsigned int) add esp, 4 add eax, edx Caller cleanup (cdecl) push ... call data_t get_data_from(unsigned int) add eax, edx0 码力 | 29 页 | 1.21 MB | 5 月前3Working with Asynchrony Generically: A Tour of C++ Executors
compute_intensive(int); int main() { unifex::static_thread_pool pool{8}; ex::scheduler auto sched = pool.get_scheduler(); ex::sender auto work = ex::when_all( ex::then(ex::schedule(sched), [] { return compute_intensive(int); int main() { unifex::static_thread_pool pool{8}; ex::scheduler auto sched = pool.get_scheduler(); ex::sender auto work = ex::when_all( ex::then(ex::schedule(sched), [] { return compute_intensive(int); int main() { unifex::static_thread_pool pool{8}; ex::scheduler auto sched = pool.get_scheduler(); ex::sender auto work = ex::when_all( ex::schedule(sched) | ex::then([] { return0 码力 | 121 页 | 7.73 MB | 5 月前3C++高性能并行编程与优化 - 课件 - 03 现代 C++ 进阶:模板元编程
的类型。 • 之后可以用 std::get<0> 获取第 0 个 元素, std::get<1> 获取第 1 个元素, 以此类推(从 0 开始数数)。 tuple :如何化简 1. 当用于构造函数时, std::tuple<...> 尖 括号里的类型可以省略,这是 C++17 的新特性: CTAD 。 2. 通过 auto 自动推导 get 的返回类型 。 tuple :结构化绑定 :结构化绑定 • 可是需要一个个去 get 还是好麻烦。 • 没关系,可以用结构化绑定的语法: • auto [x, y, ...] = tup; • 利用一个方括号,里面是变量名列表,即 可解包一个 tuple 。里面的数据会按顺序 赋值给每个变量,非常方便。 tuple :结构化绑定为引用 • 结构化绑定也支持绑定为引用: • auto &[x, y, ...] = tup; • • 其实,结构化绑定不仅可以解包 std::tuple , 还可以解包任意用户自定义类: • 配合打包的 {} 初始化表达式,真是太便利了! • 惊不惊喜?意不意外? • 可惜 std::get 并不支持自定义类。 tuple :用于函数多个返回值 • std::tuple 可以用于有多个返回值的函数。 • 如上一讲中所说,当函数返回值确定 时, return 可以用 {} 表达式初始化,不0 码力 | 82 页 | 12.15 MB | 1 年前3C++高性能并行编程与优化 - 课件 - 17 由浅入深学习 map 容器
用法对比(运算符重载展开成普通函数后) 简单粗暴的 Java 用法 • 与 Python 和 C++ 不同, Java 放弃了花里胡哨的运算符重载,索性都采用成员函数 get put 来表示,非常明确。主要是为了把 get 和 put 作为接口函数,可以对应多个具体 实现。 错误示范 • 小彭老师说过,读取必须用 at 。 • 而这位同学却用了 [] 来读取 items 里的值。 • count(“key”) ? m.at(“key”) : “default”; 找不到时,自动采用默认值 • template• typename M::mapped_type map_get(M &m, typename M::key_type const &key, typename M::mapped_type const &defl) { • if (auto it = return it->second; } else { • return defl; • } • } • 封装成函数方便使用: • auto val = map_get(m, “key”, “default”); • ss map 常用函数不同情况下的行为分析 类型 C++ 代码 key 已存在 key 不存在 读取 val = m.at(key) 读取这个值 0 码力 | 90 页 | 8.76 MB | 1 年前3A Crash Course in Calendars, Dates, Time, and Time Zones
gps_clock, and file_clock Every clock has a now() method21 Clocks – Examples Example: // Get current time as a time_point. system_clock::time_point tpoint { system_clock::now() }; // Or: auto // Get start time. auto start { high_resolution_clock::now() }; // Execute code to benchmark. double d { 0 }; for (int i { 0 }; i < 1'000'000; ++i) { d += sqrt(sin(i) * cos(i)); } // Get end std::chrono::get_tzdb() List all available time zones: const auto& database { get_tzdb() }; for (const auto& timezone : database.zones) { cout << timezone.name() << endl; }40 Time Zones Get a specific0 码力 | 43 页 | 551.60 KB | 5 月前3Secure your microservices with istio step by step
4. Cert signed with SPIFFE format Istio-proxy CA server #IstioCon Istio identity – how to get configuration ● Format: "spiffe:///ns/ /sa/ ” ● istioctl proxy-config selector: matchLabels: app: productpage rules: - to: - operation: methods: ["GET"] apiVersion: "security.istio.io/v1beta1" kind: "AuthorizationPolicy" metadata: name: "details-viewer" ["cluster.local/ns/default/sa/bookinfo-productpage"] to: - operation: methods: ["GET"]" apiVersion: "security.istio.io/v1beta1" kind: "AuthorizationPolicy" metadata: name: "reviews-viewer" 0 码力 | 34 页 | 67.93 MB | 1 年前3C++高性能并行编程与优化 - 课件 - Zeno 中的现代 C++ 最佳实践
apply 的定义 通过 get_input(“name”) 获取端口名 name 上类型为 T 的对象,如果类型不是 T ,则出错。 NumericObject 的定义 • NumericObject 是基于 std::variant 的。 • 注意他的 get 成员函数,这和 std::get 相 比更安全,例如 value 是 int 类型,但用 户却调用了 get 。则这里 。则这里 is_constructible 是 true ,不会出错,而是 会自动把 float 转换成 int 类型。同样地如 果输入是 float ,却调用了 get 的 话,那么就相当于 vec3f(val) 也就是三个分 量都是 val 的三维矢量,同样不会出错。 MaxBoxPrimitive 节点的内部: apply 的定义 通过 set_output(“name” 0 码力 | 54 页 | 3.94 MB | 1 年前3C++20's
represent a local time with respect to a not-yet- specified time zone • More to come on this when we get to time zones and related matters soon!24 clock_cast clock_cast allows you to convert a time_point between sys_time and local_time are usually uncontroversial, but there are a few cases where things get tricky! (Spoiler alert: it’s all Daylight Saving Time’s fault)40 sys_time and local_time conversions be accessed via the get_tzdb_list() function. Then you can access individual tzdbs from the list using the tzdb_list::const_iterator. • Alternatively, you can just use the get_tzdb() function which0 码力 | 55 页 | 8.67 MB | 5 月前3C++高性能并行编程与优化 - 课件 - 05 C++11 开始的多线程编程
main 里面做一些别的事 情, download 会持续在后台悄悄运行。 • 最后调用 future 的 get() 方法,如果此时 download 还没完成,会等待 download 完成,并获取 download 的返回值。 显示地等待: wait() • 除了 get() 会等待线程执行完毕 外, wait() 也可以等待他执行完,但是不 会返回其值。 等待一段时间: wait_for() • std::async 的第一个参数可以设为 std::launch::deferred ,这时不会创建一个 线程来执行,他只会把 lambda 函数体内 的运算推迟到 future 的 get() 被调用时。 也就是 main 中的 interact 计算完毕后。 • 这种写法, download 的执行仍在主线程 中,他只是函数式编程范式意义上的异步 ,而不涉及到真正的多线程。可以用这个 帮你自动创建线程 ,想要手动创建线程,可以直接用 std::promise 。 • 然后在线程返回的时候,用 set_value() 设置返回值。在主线程里,用 get_future() 获取其 std::future 对象,进一步 get() 可 以等待并获取线程返回值。 std::future 小贴士 • future 为了三五法则,删除了拷贝构造 / 赋 值函数。如果需要浅拷贝,实现共享同一个0 码力 | 79 页 | 14.11 MB | 1 年前3
共 27 条
- 1
- 2
- 3