首页 文章 精选 留言 我的

精选列表

搜索[监督学习],共10000篇文章
优秀的个人博客,低调大师

ios开发学习-指示器(HUD)效果源码分享

Spring LoadedView 介绍:实现特殊动画效果的Loading HUD (加载等待提示)。这种Loading HUD在最近比较火的 App LetterPress(一款拼字游戏)中用到。http://ios.itmdc.com/forum.php?mod=viewthread&tid=192&fromuid=15SGInfoAlert 介绍:显示一些信息然后自动消失的HUD,在不需要用户点击确定或者取消来关闭弹出对话框的时候,可以用于代替UIAlertView。http://ios.itmdc.com/forum.php?mod=viewthread&tid=193&fromuid=15DejalActivityView 介绍:实现多种HUD效果。多用于程序正在执行耗时较长命令,需要用户等待。除了显示等待的HUD,还可以显示命令执行成功或者失败的HUD。http://ios.itmdc.com/forum.php?mod=viewthread&tid=194&fromuid=15SVProgressHUD 介绍:实现多种HUD效果。多用于程序正在执行耗时较长命令,需要用户等待。除了显示等待的HUD,还可以显示命令执行成功或者失败的HUD。只支持ARC。http://ios.itmdc.com/forum.php?mod=viewthread&tid=195&fromuid=15Status HUD 介绍:实现多种HUD效果,但是只实现硬件或者其他重要的状态指示的HUD。比如锁定方向、静音、声音调整、网络状态等等。 http://ios.itmdc.com/forum.php?mod=viewthread&tid=196&fromuid=15Customized Progress HUD 介绍:实现各种HUD效果,包括在HUD上加文字,加进度条,加图片,HUD自动消失等等效果http://ios.itmdc.com/forum.php?mod=viewthread&tid=197&fromuid=15Progress HUD 介绍:实现多种HUD效果。实现多种正在加载(loading)、命令正在执行、等待任务完成等指示效果。http://ios.itmdc.com/forum.php?mod=viewthread&tid=198&fromuid=15 本文转自qianqianlianmeng博客园博客,原文链接:http://www.cnblogs.com/aimeng/archive/2012/11/25/2787303.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

【swift学习笔记】五.使用枚举优雅的管理Segue

在做页面转跳的时候,我们要给Segue命名,如果Segue多了,管理他们就是一个恶梦。我们可以枚举更优雅的管理这些Segue。 1.我们先来建立一个protocol,他的功能就是让实现类实现一个SegueIdentifier别名,这个SegueIdentifier必需为RawRepresentable类型,在后边我们就会用 protocol SegueHandlerType { associatedtype SegueIdentifier: RawRepresentable } 2.我们要对上边的protocol扩展,并且实现protocol必须为UIViewControl,SegueIdentifier的原值要为String类型 这个扩展有两个方法一个是用要实现的别名来调用执行Segue方法performSegueWithIdentifier。另一个方法segueIdentifierForSegue通过Segue的identifier来得到SegueIdentifier. extension SegueHandlerType where Self: UIViewController, SegueIdentifier.RawValue == String { func performSegueWithIdentifier(segueIdentifier: SegueIdentifier, sender: AnyObject) { performSegueWithIdentifier(segueIdentifier.rawValue, sender: sender) } func segueIdentifierForSegue(segue: UIStoryboardSegue) -> SegueIdentifier { guard let identifier = segue.identifier, segueIdentifier = SegueIdentifier(rawValue: identifier) else { fatalError("invalid segue identifier \(segue.identifier)") } return segueIdentifier } } 3.用ViewController实现SegueHandlerType。再用一个枚举来实现SegueIdentifier并且为String,里面有两个case这两个就要我们要打开的新窗体的名称。 下边有两个按钮Action是用SegueIdentifier枚举来打开相应的窗体。 class ViewController: UIViewController, SegueHandlerType { enum SegueIdentifier: String { case ShowView1 case ShowView2 } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func openView1(sender: AnyObject) { performSegueWithIdentifier(.ShowView1, sender: self) } @IBAction func openView2(sender: AnyObject) { performSegueWithIdentifier(.ShowView2, sender: self) } } 4.新建两个新窗体,分别用Segue联接这两个窗体。这两个Segue分别命名为我们的枚举类型的两个值:“ShowView1” “ShowView2”。再来两个Button连接后台的两个窗体的Action 源代码:segueTypeDemo.zip 本文转自lpxxn博客园博客,原文链接:http://www.cnblogs.com/li-peng/p/5561149.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

HBase学习笔记——高表与宽表的选择

hbase中的宽表是指很多列较少行,即列多行少的表,一行中的数据量较大,行数少;高表是指很多行较少列,即行多列少,一行中的数据量较少,行数大。 hbase的row key是分布式的索引,也是分片的依据。hbase的row key + column family + column qualifier + timestamp + value 是HFile中数据排列依据。HFile据此,对数据的索引到data block级别,而不是行级别。所以这种key是HFile内部的粗粒度(data block粒度)本地索引的主键。 据此,在HBase中使用宽表、高表的优劣总结如下: 查询性能:高表更好,因为查询条件都在row key中, 是全局分布式索引的一部分。高表一行中的数据较少。所以查询缓存BlockCache能缓存更多的行,以行数为单位的吞吐量会更高。 分片能力:高表分片粒度更细,各个分片的大小更均衡。因为高表一行的数据较少,宽表一行的数据较多。HBase按行来分片。 元数据开销:高表元数据开销更大。高表行多,row key多,可能造成region数量也多,- root -、 .meta表数据量更大。过大的元数据开销,可能引起HBase集群的不稳定、master更大的负担(这方面后续再好好总结)。 事务能力:宽表事务性更好。HBase对一行的写入(Put)是有事务原子性的,一行的所有列要么全部写入成功,要么全部没有写入。但是多行的更新之间没有事务性保证。 数据压缩比:如果我们对一行内的数据进行压缩,宽表能获得更高的压缩比。因为宽表中,一行的数据量较大,往往存在更多相似的二进制字节,有利于提高压缩比。通过压缩,缓解了宽表一行数据量太大,并导致分片大小不均匀的问题。查询时,我们根据row key找到压缩后的数据,进行解压缩。而且解压缩可以通过协处理器(coproesssor)在HBase服务器上做,而不是在业务应用的服务器上做,以充分应用HBase集群的CPU能力。 设计表时,可以不绝对追求高表、宽表,而是在两者之间做好平衡。根据查询模式,需要分布式索引、分片、有很高选择度(即能据此查询条件迅速锁定很小范围的一些行)的查询用字段,应该放入row key;能够均匀地划分数据字节数的字段,也应该放入row key,作为分片的依据。选择度较低,并且不需要作为分片依据的查询用字段,放入column family和column qualifier,不放入row key。

优秀的个人博客,低调大师

spring cloud 学习(8) - sleuth & zipkin 调用链跟踪

业务复杂的微服务架构中,往往服务之间的调用关系比较难梳理,一次http请求中,可能涉及到多个服务的调用(eg: service A -> service B -> service C...),如果想分析各服务间的调用关系,以及各服务的响应耗时,找出有性能瓶颈的服务,这时zipkin就派上用场,它是Twitter公司开源的一个tracing系统,官网地址为:http://zipkin.io/ , spring cloud可以跟它无疑集成。 使用步骤: 一、微服务方 1.1 添加依赖jar包 compile 'org.springframework.cloud:spring-cloud-starter-bus-kafka' compile 'org.springframework.cloud:spring-cloud-starter-sleuth' compile 'org.springframework.cloud:spring-cloud-sleuth-stream' 注:为了实现tracing数据埋点与采集的解耦,spring cloud引入了message bus(消息总线)的概念,微服务无需关心tracing系统在哪,长什么样,只要向bus总线上扔消息就行,所以引入了bus-kafka以及sleuth-stream。 1.2 application.yml配置 spring: ... cloud: bus: enabled: true stream: default-binder: kafka kafka: binder: brokers: 10.0.1.2,10.0.1.3,10.0.1.4 //kafaka的服务器集群列表 zkNodes: 10.0.1.5,10.0.1.6,10.0.1.7 //zk的服务器集群列表 defaultZkPort: 2181 //zk的端口 defaultBrokerPort: 9092 //kafka的broker端口 ... sleuth: sampler: percentage: 0.2 //采样率 0.2为20% 上面2项配置好就行了,代码不用任何修改,真正的代码零侵入 二、zipkin-server zipkin从kafka上接收过来数据后,有4种保存方式:in-memory(保存在内存中)、mysql、cassandra、elasticsearch 个人开发调试的话,推荐用in-memory模式,其它环境不要使用!(注:因为随着收集的数据越来越多,都放在内存中 很容易造成OOM) 2.1 mysql 存储 2.1.1 主要jar包依赖 dependencies { ... 关键是下面几个 compile 'org.springframework.cloud:spring-cloud-starter-sleuth' compile 'org.springframework.cloud:spring-cloud-sleuth-zipkin-stream' compile 'org.springframework.cloud:spring-cloud-starter-bus-kafka' compile 'io.zipkin.java:zipkin-server' compile 'io.zipkin.java:zipkin-autoconfigure-ui' compile 'io.zipkin.java:zipkin-autoconfigure-storage-mysql' #mysql的存储 ... 下面几个是spring-boot/cloud的常规项 compile 'org.springframework.boot:spring-boot-starter-actuator' compile 'org.springframework.boot:spring-boot-starter-web' compile 'org.springframework.boot:spring-boot-starter-security' compile 'log4j:log4j:1.2.17' //zipkin的storage jar包,依赖低版本的log4j compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.8.2' compile 'mysql:mysql-connector-java:6.0.5' } 2.1.2 application.yml配置 spring: application: name: zipkin-server datasource: //指定mysql数据源 schema: classpath:/mysql.sql url: jdbc:mysql://192.168.1.2:3306/zipkin?autoReconnect=true&useSSL=false username: root password: *** driver-class-name: com.mysql.cj.jdbc.Driver initialize: true continue-on-error: true sleuth: enabled: false cloud: bus: enabled: true ... stream: default-binder: kafka kafka: binder: brokers: ${kafka.brokers} zkNodes: ${kafka.zkNodes} defaultZkPort: ${kafka.zkPort} defaultBrokerPort: ${kafka.brokerPort} zipkin: storage: type: mysql //配置成mysql存储 2.1.3 main入口代码 @SpringBootApplication(exclude = { MybatisAutoConfiguration.class, RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class}) @EnableZipkinStreamServer public class ZipkinServer { public static void main(String[] args) { SpringApplication.run(ZipkinServer.class, args); } } 注:如果你的项目中依赖了redis,mybatis等其它包,可以参考上面的写法,排除掉这些自动配置,否则的话,不用加那一堆exclude。 2.2 cassandra 2.2.1 依赖jar包 注:cassandra和elasticsearch下,可能会遇到zipkin中的dependencies面板无数据,详情见github上的讨论:https://github.com/openzipkin/zipkin-dependencies/issues/22 compile 'org.springframework.boot:spring-boot-starter-data-cassandra' compile('io.zipkin.java:zipkin-autoconfigure-storage-cassandra3:1.29.3') { exclude group: "com.datastax.cassandra", module: "cassandra-driver-core" } compile 'com.datastax.cassandra:cassandra-driver-core:3.1.1' compile 'com.datastax.cassandra:cassandra-driver-mapping:3.1.1' 2.2.2 application.yml spring: data: cassandra: contact-points: localhost port: 9042 keyspace-name: zipkin3 ... zipkin: storage: type: cassandra3 2.3 elasticsearch 2.3.1 依赖jar包 compile 'io.zipkin.dependencies:zipkin-dependencies-elasticsearch:1.7.2' compile 'io.zipkin.java:zipkin-autoconfigure-storage-elasticsearch-http:1.29.2' 2.3.2 application.yml zipkin: storage: type: elasticsearch elasticsearch: cluster: elasticsearch hosts: http://localhost:9200 index: zipkin index-shards: 5 index-replicas: 1

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册