label

cocos2d-x 3.3 显示中文

佐手、 提交于 2020-01-10 18:56:02
Resources文件夹下的strings.xml: <dict> <key>targetScore</key> <string>目标分数</string> </dict> 保存为UTF-8编码格式。 c++代码: log("目标分数");//输出:?????? ValueMap valueMap=FileUtils::getInstance()->getValueMapFromFile("strings.xml"); std::string str=valueMap.at("targetScore").asString(); log(str.c_str());//输出:目标分数 Label* label=Label::createWithTTF(str.c_str(),"fonts/jianzhi.ttf",50); label->setPosition(Vec2(200,200)); addChild(label); 关于ttf字体的精简看文章 http://www.cnblogs.com/kingBook/p/5512784.html 来源: https://www.cnblogs.com/kingBook/p/5531353.html

(2)Cocos2d-x中文显示

前提是你 提交于 2020-01-10 07:48:11
  Cocos使用UTF8编码来处理文字, 要显示中文需要将中文转换为UTF8编码,这里使用xml来保存文字资源。 StringResources_zh.xml <?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> <dict> <key>hello_world</key> <string>你好,世界!</string> </dict> </plist> StringResourcesManager.h 1 #ifndef StringResourcesManager_h__ 2 #define StringResourcesManager_h__ 3 #include "cocos2d.h" 4 USING_NS_CC; 5 6 class StringResourcesManager 7 { 8 public: 9 static StringResourcesManager* GetInstance() 10 { 11 if (Instance == NULL) 12 { 13 Instance = new StringResourcesManager(); 14 } 15 return Instance; 16 } 17 18 std::string GetString(const std::string&

How can a hover effect be created for a grouping of controls?

落花浮王杯 提交于 2020-01-10 03:26:24
问题 This seems so simple but I just can't seem to figure it out. See the image below: It is a panel with 5 labels on it. The behavior I want is that if the mouse enters the box (anywhere), the background color changes (for ex: AliceBlue instead of White). The problem is in Windows Forms, the transparency is wierd among other problems. If I set the background of the panel on mouse enter, the labels all still have white backgrounds and so I have white blocks around the labels. Etc. I am sure others

雷达图 点击事件

痴心易碎 提交于 2020-01-09 16:40:26
onImageClick(e){ let lables = this.props.image_label; if(e.componentType==='radar'&& e.name.length>0){ //点击 雷达图的 名称label      let label = e.name }else { //点击雷达图的坐标 let index = e.event.topTarget.__dimIdx; if(index!=undefined){       //通过 indicator 获取lable let label = this.props.image_radar.radar.indicator[index].text; } }}注意: 想使用富文本rich,一定要渲染成 canvas ,svg 不好用 <ReactEcharts opts={{renderer: 'svg'}} lazyUpdate={true} notMerge={true} onEvents={{ 'click':props.onImageClick }} opts={{renderer: 'canvas'}} option={image_radar} style={{height: '220px', width: '100%', margin: 'auto'}}/> radar:{   name:

A #define in C with three dots

二次信任 提交于 2020-01-09 10:06:50
问题 #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__)) #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__)) This is definition for these 2 macros; later in the code LOGI and LOGW are used this way LOGI("accelerometer: x=%f y=%f z=%f", event.acceleration.x, event.acceleration.y, event.acceleration.z); and this way LOGW("Unable to eglMakeCurrent"); Since I try to avoid complex macros and #define in general, I

A #define in C with three dots

99封情书 提交于 2020-01-09 10:06:34
问题 #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__)) #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__)) This is definition for these 2 macros; later in the code LOGI and LOGW are used this way LOGI("accelerometer: x=%f y=%f z=%f", event.acceleration.x, event.acceleration.y, event.acceleration.z); and this way LOGW("Unable to eglMakeCurrent"); Since I try to avoid complex macros and #define in general, I

jQuery Validation Engine 表单验证

大兔子大兔子 提交于 2020-01-09 09:29:32
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 中文汉化版,官方只有英文的。同时根据中国国情修改了部分验证规则。 这个插件支持大部分的浏览器,但由于有使用到了css3的阴影和圆角样式,所以在IE浏览器下无法看到圆角和阴影效果(万恶的IE)。 官方下载地址: http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ 普通验证的例子: http://www.position-relative.net/creation/formValidator/ ajax验证的例子: http://www.position-relative.net/creation/formValidator/demoSubmit.html 一:简单说明下使用教程: 引入jquery和插件js、css <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" charset="utf-8" /> <script src="js/jquery.js" type="text/javascript"></script> <script

RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed

别等时光非礼了梦想. 提交于 2020-01-08 23:13:07
运行torch函数 torch.nn.functional.cross_entropy(pre, label, ignore_index=0)时报错,pre的shape为[ batch_size , n] label 的shape为[ batch_size]. 其中batch_size是batch的大小,n为类别数 所以  label的每一个数的取值范围都应该在[ 0,n-1 ], 代表该下标的真实类别,即cur_target < n_classes'   label的每一个数的取值范围都应该大于0, 即cur_target >= 0 来源: https://www.cnblogs.com/dongfangshenqi/p/12169027.html

prometheus.(二)监控集群

99封情书 提交于 2020-01-08 14:43:46
目录 node_exporter监控集群节点 1.node-exporter.yaml 2.查看DaemonSet字段 3.启动 prometheus.yaml文件说明 1.Pod的安全策略 2.监控master节点 3.启动参数 4.映射端口 5.服务发现 热更新: prometheu_configmap 配置文件 容器监控 Api-Service 监控 Service 监控 1.添加service监控 2.service添加prometheus标签 3.kube-state-metrics node_exporter监控集群节点 通过prometheus来采集节点的监控指标,可以通过node_exporter获取,node_exporter就是抓取用于采集服务器节点的各种运行指标,目前node_exporter几乎支持所有常见的监控点,比如cpu、distats、loadavg、meminfo、netstat等,详细的监控列表可以参考github repo 这里使用DeamonSet控制器来部署该服务,这样每一个节点都会运行一个Pod,如果我们从集群中删除或添加节点后,也会进行自动扩展 1.node-exporter.yaml # cat >>prometheus-node-exporter.yaml apiVersion: apps/v1 kind: DaemonSet

从零开始的vue学习笔记(一)

笑着哭i 提交于 2020-01-08 14:02:40
数据与方法 当一个 Vue 实例被创建时,它将 data 对象中的所有的属性加入到 Vue 的响应式系统中。data的数据和视图同步更新。 实例创建后添加一个新的属性,对这个属性的的改动将不会触发任何视图的更新。 如果需要一个属性,但是一开始它为空或不存在,仅需要设置一些初始值。 Object.freeze()方法可以阻止修改现有的属性 除了数据属性,Vue 实例还包含 实例属性与方法 ,前缀为 $ ,例如:vm.$data,vm.$el,vm.$watch()(这里假设vm是某个实例名),详情可以参考 API 实例生命周期钩子 Vue实例有自己的生命周期,提供了一些钩子函数给我们写自己的逻辑代码: beforeCreate created beforeMount mounted beforeUpdate updated ps: 不要在选项属性或回调上使用箭头函数,即这些钩子函数不要用箭头函数的写法,因为他们没有this 生命周期图 模板语法 文本 数据绑定最常见的形式就是使用 “Mustache” 语法 (双大括号) 的文本插值 <span>Message: {{ msg }}</span> v-once 指令,你也能执行一次性地插值,当数据改变时,插值处的内容不会更新 <span v-once>这个将不会改变: {{ msg }}</span> 原始 HTML v-html