Mryqu's Notes


  • 首页

  • 搜索
close

[OpenUI5] 在XMLView中使用带有参数的I18N消息

时间: 2017-03-01   |   分类: FrontEnd     |   阅读: 328 字 ~2分钟
在做的一个新项目中,美国团队那边齐刷刷地一色用XMLView而不是JSView,碰到一个小问题:那就是怎么在XMLView中设置带有参数的I18N消息。 参考Passing parameters to i18n model within XML view帖子中的方案,基本搞定: <Input id="myInput" type="Text" required="true" value="{myyquInput}" placeholder="{parts:['i18n>myKey.txt', 'myModel>myProp'], formatter: 'jQuery.sap.formatMessage'}" change=".handleChangeForMyInput"> <layoutData> <l:GridData span="L6 M8 S9" /> </layoutData> </Input> messagebundle.properties: myKey.txt="(Example: {0})" 使用sap.ui.model.CompositeBinding可以通过XMLView中的parts加载多个参数,达到我的目的。缺点就是每个参数只能是model/path组合,或者省略model的path。我没有找到直接输入参数值的便捷方法。 阅读sap.ui.base.ManagedObject的bindProperty方法可知,它对part中每一元素查找是否有“>”,有则认为是model/path组合,否则即为path。 ManagedObject.prototype.bindProperty = function(sName, oBindingInfo, _vFormat, _sMode) { var iSeparatorPos, bAvailable = true, oProperty = this.getMetadata().getPropertyLikeSetting(sName); // check whether property or alternative type on aggregation exists if (!oProperty) { throw new Error("Property \"" + sName + "\" does not exist in " + this); } // old API compatibility (sName, sPath, _vFormat, _sMode) if (typeof oBindingInfo == "string") { oBindingInfo = { parts: [ { path: oBindingInfo, type: _vFormat instanceof Type ?
阅读全文 »

[OpenUI5] 折腾了一下JSView转换XMLView

时间: 2017-02-21   |   分类: FrontEnd     |   阅读: 206 字 ~1分钟
根据OpenUI5 Developer Guide - Diagnostics Window中的介绍,尝试一下XML View Conversion。 Many code samples are written in JavaScript. To facilitate the conversion of these code samples into XML, OpenUI5 provides a generic conversion tool. To run the tool, proceed as follows: Run the OpenUI5 app in your browser, for example, open a page in the test suite. Open the support tool by choosing CTRL+ALT+SHIFT+S. Open the Control Tree panel. Select the root UI area in the tree on the left hand side.
阅读全文 »

TypeScript初体验

时间: 2017-02-08   |   分类: FrontEnd     |   阅读: 40 字 ~1分钟
TypeScript介绍 鉴于JavaScript这种脚本语言很难应用于大规模Web应用的开发,微软公司在2012年推出了新的开源编程语言——TypeScript。作为Object Pascal和C#之父Anders Hejisberg的又一作品,TypeScript是JavaScript的超集,但完全兼容JavaScript。相比于JavaScript,TypeScript增加了可选类型、类和模块,扩展了原有的语法,使得代码组织和复用变得更加有序,方便进行大型Web应用的开发。 安装 TypeScript可通过npm进行安装: npm install -g typescript 查看TypeScript版本: C:\quTemp>tsc -v Version 2.1.6 我开发主要使用IntelliJ IDEA,它可以很好的编辑TypeScript文件。不过对于一些小练习,还是安装Sublime的TypeScript插件好了: 初体验 menu.ts源文件(来自参看一): 编译: tsc menu.ts 执行: 编译结果menu.js: 测试: 下一步计划 学习一下《TypeScript Essentials》和《Mastering TypeScript》这两本书。 参考 Learn TypeScript in 30 Minutes Learn TypeScript in Y minutes

Upload file to Google Drive using LibCurl

时间: 2017-01-06   |   分类: DataBuilder     |   阅读: 2736 字 ~13分钟
This is a sequel to my last blog “Upload file to Google Drive using Postman and cURL”. I wrote C++ code using LibCurl to redo the three types of upload, and all of them work which shown in the below log snippet. Simple upload => Send header, 0000000309 bytes (0x00000135) 0000: 50 4f 53 54 20 2f 75 70 6c 6f 61 64 2f 64 72 69 POST /upload/dri 0010: 76 65 2f 76 33 2f 66 69 6c 65 73 3f 75 70 6c 6f ve/v3/files?
阅读全文 »

Upload file to Google Drive using Postman and cURL

时间: 2017-01-03   |   分类: DataBuilder     |   阅读: 233 字 ~2分钟
Simple upload For quick transfer of smaller files, for example, 5 MB or less. Postman cURL curl -T mytest.csv -X POST -H "Content-Type: text/csv" -H "Cache-Control: no-cache" "https://www.googleapis.com/upload/drive/v3/files?uploadType=media&access_token={YOUR_ACCESS_TOKEN}" Multipart upload For quick transfer of smaller files and metadata; transfers the file along with metadata that describes it, all in a single request. Postman At the beginning, I try to use form-data for body, then the second value can use file directly.
阅读全文 »

在Google Drive上创建存在多个目录下的文件

时间: 2016-12-29   |   分类: DataBuilder     |   阅读: 265 字 ~2分钟
准备环境 在Google Drive上创建两个目录: parent1和parent2 代码 package com.yqu.gd; import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.http.FileContent; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.services.drive.Drive; import com.google.api.services.drive.model.File; import com.google.api.services.drive.model.FileList; public class FileWithMultiParents { private static final String APPLICATION_NAME = "Hello Google Drive API"; private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); private static HttpTransport HTTP_TRANSPORT; static { try { HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); } catch (Throwable t) { t.
阅读全文 »

学习Java Annotation

时间: 2016-12-27   |   分类: Java     |   阅读: 58 字 ~1分钟
以前看过Java Annotation,走马观花,现在印象已经不深刻了。这次好好看一下Java Annotation和Spring Annotation。 阅读列表: The Java Tutorials - Annotations Java Annotation认知(包括框架图、详细介绍、示例说明) Annotations Gotchas and Best Practices Annotations: Don’t Mess with Java Java Annotations Are a Big Mistake Spring Annotation-based container configuration Spring Framework Annotations cheat sheet Spring Without XML: The Basics of Spring Annotations vs. Spring XML Files Spring Annotation Tutorial Spring Annotations [ Quick Reference ]

[C++] 将JSON转成字符串

时间: 2016-12-26   |   分类: C++     |   阅读: 5 字 ~1分钟
需要将如下JSON字符串作为GoogleSheets API POST请求的消息体。打算使用JsonCpp实现。 {"majorDimension":"ROWS","values":[["Name","Sex","Age","Height","Weight"],["阿尔弗雷德","男","14","69","112.5"],["爱丽丝","女","13","56.5","84"],["芭芭拉","女","13","65.3","98"],["凯露","女","14","62.8","102.5"],["亨利","男","14","63.5","102.5"],["詹姆斯","男","12","57.3","83"],["简","女","12","59.8","84.5"],["雅妮特","女","15","62.5","112.5"],["杰弗瑞","男","13","62.5","84"],["约翰","男","12","59","99.5"],["乔伊斯","女","11","51.3","50.5"],["茱迪","女","14","64.3","90"],["罗伊斯","女","12","56.3","77"],["玛丽","女","15","66.5","112"],["菲利普","男","16","72","150"],["罗伯特","男","12","64.8","128"],["罗纳德","男","15","67","133"],["托马斯","男","11","57.5","85"],["威廉","男","15","66.5","112"]]} 最终代码:

[C++] 调试libcurl程序

时间: 2016-12-25   |   分类: C++     |   阅读: 30 字 ~1分钟
最近在调试通过libcurl发送GoogleSheets API POST请求时,增加了一点经验,特此总结。 GoogleSheets API 请求 POST /v4/spreadsheets?access_token={YOUR_ACCESSTOKEN}&fields=spreadsheetId HTTP/1.1 Host: sheets.googleapis.com Content-Type: application/json;charset=UTF-8 Accept: application/json Cache-Control: no-cache {"properties":{"title":"newhaha"},"sheets":[{"properties":{"title":"Sheet1"}}]} libcurl调试 当GoogleSheets API 请求失败时,仅能获得返回的状态码和消息。感觉没有更多信息可以研究!后来通过CURLOPT_VERBOSE和CURLOPT_DEBUGFUNCTION获得了更多调试信息。 使用CURLOPT_VERBOSE curl_easy_setopt(m_curl, CURLOPT_VERBOSE, 1L); 这样就可以看到请求报头、响应报头和消息体了。 使用CURLOPT_DEBUGFUNCTION 使用libcurl API指南中CURLOPT_DEBUGFUNCTION示例代码即可。这样就可以看到完整的请求和响应内容了。

[OpenUI5] jQuery.sap.formatMessage的一点注意事项

时间: 2016-12-19   |   分类: FrontEnd     |   阅读: 5 字 ~1分钟
今天偶然发现I18N properties文件中有字符串包含替换符,可是没起作用,还是明晃晃输出了{0}。 仔细研究一下,才发现原因在于字符串中包含单个’,OpenUI5使用jQuery.sap.formatMessage替换I18N字符串,如果仅含有一个’字符的话,其/('')|'([^']+(?:''[^']*)*)(?:'|$)|\{([0-9]+(?:\s*,[^{}]*)?)\}|[{}]/g 就只触发第二组替换了。如果想显示单个字符’,需要用两个字符’转义。 不过问题来了,负责翻译I18N的同事是否清楚jQuery.sap.formatMessage关于字符’的限制呢?
6 7 8 9 10 11 12 13 14

Programmer & Architect

662 日志
27 分类
1472 标签
RSS 订阅
GitHub Twitter FB Page
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%