首页 文章 精选 留言 我的

精选列表

搜索[action],共7507篇文章
优秀的个人博客,低调大师

[Hadoop In Action]学习笔记-Hadoop中的Streaming

Hadoop支持非java预言来编写程序,这就会用到Streaming的通用API。 Hadoop Streaming使用流与程序进行交互。从STDIN输入数据,输出到STDOUT。数据必须为文本,而且每一行被视为一条记录。 用Streaming处理键-值 默认情况下,Streaming使用制表符分离记录中的键与值。当没有制表符时,整个记录被视为键,而值为空白文本。 Streaming API把reducer输出的每一行用制表符分开,并将键值对送入默认的TextOutputFormat中,即在结果被写入文件之前,默认的重新插入一个制表符 本文转自 virusswb 51CTO博客,原文链接:http://blog.51cto.com/virusswb/838607,如需转载请自行联系原作者

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

关于“Unable to verify action class [xxx] exists at initialization”

在Struts+Spring的web架构中,如果在Spring配置文件中为bean定义了web专用的三种scope(request,session,globelsession),那么在服务器启动时就会出现标题所示的提示信息。如果在LOG4J里为rootLogger设置日志级别为DEBUG,还能看到spring记录的异常信息,提示初始化bean的时候没有request或session的上下文。这种情况是没法子通过lazy-init进行优化的,因为这个属性只对singletone或prototype的bean生效。看错误信息的提示,可以考虑代理的方法。不过还没有研究。 总之,眼下这个问题是没法子解决了。 本文转自 斯然在天边 51CTO博客,原文链接:http://blog.51cto.com/winters1224/797884,如需转载请自行联系原作者

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

Spark in action on Kubernetes - Spark Operator的原理解析

前言 在上篇文章中,向大家介绍了如何使用Spark Operator在kubernetes集群上面提交一个计算作业。今天我们会继续使用上篇文章中搭建的Playground进行调试与解析,帮助大家更深入的理解Spark Operator的工作原理。所以如果没有浏览过上篇文章的同学,可以通过传送门直达,先配置好Playground的环境。 Spark Operator的内部实现 在深入解析Spark Operator之前,我们先补充一些关于kubernetes operator的知识。2018年可以说是kubernetes operator泛滥的一年,各种operator如雨后春笋般出现。operator是扩展kubernetes以及与kubernetes集成的最佳方式之一。在kubernetes的设计理念中,有很重要的一条就是进行了抽象,

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

完美搞定《DOCKER IN ACTION》第二章示例

起来!!!命令如下: 建立第一个web docker docker run --detach --name web nginx:latest 建立第二个web_test docker docker run --interactive --tty \ --link web:web \ --name web_test \ busybox:latest /bin/sh 建立第三个mailer docker docker run -d --name mailer dockerinaction/ch2_mailer 建立第四个agent docker docker run -it \ --name agent \ --link web:insideweb \ --link mailer:insidemailer \ dockerinaction/ch2_agent 图:

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

Dart In Action -Dar的基本数据类型(一)

写在前面 本文基本上是将dart官网部分内容进行翻译,没兴趣的请出门左转至Dart的官网,有兴趣的同志请继续阅读本文。Flutter教程在这里 数字 Dart的数字一共分为2类: int 整型不大于64位,具体取决于平台。 在Dart VM上,值可以是-263到263 - 1.编译为JavaScript的Dart使用JavaScript 数字,允许从-253到253 - 1的值。 double 64位(双精度)浮点数,由IEEE 754标准规定。 int和double都是num的子类型。 num类型包括基本运算符,如+, - ,/和*,也是你可以找到abs(),ceil()和floor()以及其他方法的地方。 (按位运算符,如>>,在int类中有定义。)如果num及其子类没有您要想要内容,那dart:math库可能有您想要的。 整数是没有小数点的数字。 以下是定义整数文字的一些示例: int x = 1; int hex = 0xDEADBEEF; 如果数字包含小数,则为双精度数。 以下是定义双精度数字的一些示例: double y = 1.1; double exponents = 1.42e5; 以下是将字符串转换为数字的方法,反之亦然: // String -> int var one = int.parse('1'); assert(one == 1); // String -> double var onePointOne = double.parse('1.1'); assert(onePointOne == 1.1); // int -> String String oneAsString = 1.toString(); assert(oneAsString == '1'); // double -> String String piAsString = 3.14159.toStringAsFixed(2); assert(piAsString == '3.14'); int类型指定传统的按位移位(<<,>>),AND(&)和OR(|)运算符。 例如: assert((3 << 1) == 6); // 0011 << 1 == 0110 assert((3 >> 1) == 1); // 0011 >> 1 == 0001 assert((3 | 4) == 7); // 0011 | 0100 == 0111 文字数字是编译时常量。 许多算术表达式也是编译时常量,只要它们的操作数是编译为数字的编译时常量。(注:这是说如果一个表达式涉及到的变量也是编译时常量,那么表达式也是编译时常量。) const msPerSecond = 1000; const secondsUntilRetry = 5; const msUntilRetry = secondsUntilRetry * msPerSecond; 字符串 Dart字符串是一系列UTF-16代码单元。 您可以使用单引号或双引号来创建字符串: var s1 = 'Single quotes work well for string literals.'; var s2 = "Double quotes work just as well."; var s3 = 'It\'s easy to escape the string delimiter.'; var s4 = "It's even easier to use the other delimiter."; 您可以使用${expression}将表达式的值放在字符串中。 如果表达式是标识符,则可以跳过{}。 要获取对应于对象的字符串,Dart调用对象的toString()方法。 var s = 'string interpolation'; assert('Dart has $s, which is very handy.' == 'Dart has string interpolation, ' + 'which is very handy.'); assert('That deserves all caps. ' + '${s.toUpperCase()} is very handy!' == 'That deserves all caps. ' + 'STRING INTERPOLATION is very handy!'); 注意:==运算符测试两个对象是否相同。 如果两个字符串包含相同的代码单元序列,则它们是等效的。 您可以使用相邻的字符串文字或+运算符来连接字符串: var s1 = 'String ' 'concatenation' " works even over line breaks."; assert(s1 == 'String concatenation works even over ' 'line breaks.'); var s2 = 'The + operator ' + 'works, as well.'; assert(s2 == 'The + operator works, as well.'); 创建多行字符串的另一种方法:使用带有单引号或双引号的三重引号: var s1 = ''' You can create multi-line strings like this one. '''; var s2 = """This is also a multi-line string."""; 您可以通过在其前面加上r来创建“raw”字符串: var s = r'In a raw string, not even \n gets special treatment.'; 有关如何在字符串中表示Unicode字符的详细信息,请参阅Runes。 文字字符串是编译时常量,只要任何插值表达式是一个编译时常量,其值为null或数值,字符串或布尔值。 // 这些在const String可以使用. const aConstNum = 0; const aConstBool = true; const aConstString = 'a constant string'; // 这些在const String中不能使用. var aNum = 0; var aBool = true; var aString = 'a string'; const aConstList = [1, 2, 3]; const validConstString = '$aConstNum $aConstBool $aConstString'; // const invalidConstString = '$aNum $aBool $aString $aConstList'; 有关使用字符串的更多信息,请参阅字符串和正则表达式。 布尔值 为了表示布尔值,Dart有一个名为bool的类型。 只有两个对象具有bool类型: true和false,它们都是编译时常量。 Dart的类型安全意味着您不能使用if(nonbooleanValue)或assert(nonbooleanValue)等代码。 相反,明确检查值,如下所示: // Check for an empty string. var fullName = ''; assert(fullName.isEmpty); // Check for zero. var hitPoints = 0; assert(hitPoints <= 0); // Check for null. var unicorn; assert(unicorn == null); // Check for NaN. var iMeantToDoThis = 0 / 0; assert(iMeantToDoThis.isNaN); 列表 也许几乎每种编程语言中最常见的集合是数组或有序的对象组。 在Dart中,数组是List 对象,因此大多数人只是将它们称为列表。 Dart列表文字看起来像JavaScript数组文字。 这是一个简单的Dart List: var list = [1, 2, 3]; 注意:分析器推断列表的类型为List <int>。 如果尝试将非整数对象添加到此列表,则分析器或运行时会引发错误。 有关更多信息,请阅读类型推断。 List使用从零开始的索引,其中0是第一个元素的索引,list.length - 1是最后一个元素的索引。 您可以像在JavaScript中一样获取列表的长度并引用列表元素: var list = [1, 2, 3]; assert(list.length == 3); assert(list[1] == 2); list[1] = 1; assert(list[1] == 1); 要创建一个编译时常量的列表,请在列表文字之前添加const: var constantList = const [1, 2, 3]; // constantList[1] = 1; // 取消注释会导致错误。 List类型有许多方便的方法来操作列表。 有关列表的更多信息,请参阅泛型和集合。 映射 通常,映射是一个有键和值的对象。 键和值都可以是任何类型的对象。 每个键只出现一次,但您可以多次使用相同的值。 Dart的Map支持由映射文字和Map。 这里有几个简单的Dart映射,使用map文字创建: var gifts = { // Key: Value 'first': 'partridge', 'second': 'turtledoves', 'fifth': 'golden rings' }; var nobleGases = { 2: 'helium', 10: 'neon', 18: 'argon', }; 注意:分析器推断gifts的类型为Map <String,String>,而nobleGases的类型为Map <int,String>。 如果您尝试将错误类型的值添加到任一映射,则分析器或运行时会引发错误。 有关更多信息,请阅读类型推断。 您可以使用Map构造函数创建相同的对象: var gifts = Map(); gifts['first'] = 'partridge'; gifts['second'] = 'turtledoves'; gifts['fifth'] = 'golden rings'; var nobleGases = Map(); nobleGases[2] = 'helium'; nobleGases[10] = 'neon'; nobleGases[18] = 'argon'; 注意:您可能希望看到new Map() 而不仅仅是Map()。 从Dart 2开始,new关键字是可选的。 有关详细信息,请参阅使用构造函数。 像在JavaScript中一样,将新的键值对添加到现有Map: var gifts = {'first': 'partridge'}; gifts['fourth'] = 'calling birds'; // 新增一个键值对 以与在JavaScript中相同的方式从Map中检索值: var gifts = {'first': 'partridge'}; assert(gifts['first'] == 'partridge'); 如果您在Map中查找一个不存的键,则会返回null: var gifts = {'first': 'partridge'}; assert(gifts['fifth'] == null); 使用.length获取Map中键值对的数量: var gifts = {'first': 'partridge'}; gifts['fourth'] = 'calling birds'; assert(gifts.length == 2); 要创建一个为编译时常量的Map,请在map之前添加const: final constantMap = const { 2: 'helium', 10: 'neon', 18: 'argon', }; // constantMap[2] = 'Helium'; // 取消注释会导致错误。 有关地图的更多信息,请参阅泛型和映射。

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

浅谈3D Touch(1) -- Home screen quick action

1. 背景: 随着iOS9 和 iPhone 6s的普及,苹果官方提供的3D Touch将带给我们更好玩,更便捷的操作习惯,桌面快捷菜单可谓是3D Touch功能中最实用的一个,有了它,用户不再需要进入app后做额外的操作,便能快速进入指定的页面。 2. 前期工作: 由于手头“并(wo)没(xiang)有(yao)”iPhone 6s 的设备,很多人说,那我怎么开发这个功能呢?不怕,github上早有大神写好了模拟器的解决方案。按照这个文档上的方法依次执行,你的模拟器也能唤出快捷菜单。 3. 正式接入 ①.创建UIApplicationShortcutItem 我们先来看一下每个UIApplicationShortcutItem中能够包含哪些信息 key Description required UIApplicationShortcutItemType 事件的唯一标识,可以通过这个标识来辨别你具体点击了哪个事件 Y UIApplicationShortcutItemTitle 标题,在没有子标题的情况下如果标题太长能自动换行 Y UIApplicationShortcutItemSubtitle 子标题,在标题的下方 N UIApplicationShortcutItemIconType 枚举选取系统中的一个图标类型 N UIApplicationShortcutItemIconFile 自定义一个图标,以单一颜色35x35的大小展示,如果设置这个,UIApplicationShortcutItemIconType将不起作用 N UIApplicationShortcutItemUserInfo 字典,里面可以添加各种key、value对 N UIApplicationShortcutItem 的创建有2种方式 第一种是在info.plist里面静态添加: <key>UIApplicationShortcutItems</key> <array> <dict> <key>UIApplicationShortcutItemType</key> <string>3dtouch.homePage</string> <key>UIApplicationShortcutItemTitle</key> <string>首页</string> <key>UIApplicationShortcutItemSubtitle</key> <string>这是首页</string> <key>UIApplicationShortcutItemIconFile</key> <string>shouye.png</string> <key>UIApplicationShortcutItemUserInfo</key> <dict> <key>url</key> <string>index</string> </dict> </dict> <dict> <key>UIApplicationShortcutItemType</key> <string>3dtouch.guanzhupage</string> <key>UIApplicationShortcutItemTitle</key> <string>关注</string> <key>UIApplicationShortcutItemSubtitle</key> <string>这是关注</string> <key>UIApplicationShortcutItemIconFile</key> <string>guanzhu.png</string> <key>UIApplicationShortcutItemUserInfo</key> <dict> <key>url</key> <string>guanzhu</string> </dict> </dict> </array> 第二种是在程序初始化的时候用代码动态添加: 我们先看一下UIApplicationShortcutItem.h,发现它的使用非常简单,习惯完全符合官方API固有方式,而且和之前那种方式所构建的包含的信息是一一对应的,其中有3个@interface分别是: UIApplicationShortcutIcon UIApplicationShortcutItem UIMutableApplicationShortcutItem //创建快捷item的icon 即UIApplicationShortcutItemIconFile UIApplicationShortcutIcon *icon1 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"money"]; UIApplicationShortcutIcon *icon2 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"gouwuche"]; UIApplicationShortcutIcon *icon3 = [UIApplicationShortcutIcon iconWithTemplateImageName:@"wode"]; //创建快捷item的userinfo 即UIApplicationShortcutItemUserInfo NSDictionary *info1 = @{@"url":@"money"}; NSDictionary *info2 = @{@"url":@"gouWuche"}; NSDictionary *info3 = @{@"url":@"wode"}; //创建ShortcutItem UIMutableApplicationShortcutItem *item1 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"3dtouch.moneyPage" localizedTitle:@"资产" localizedSubtitle:@"这是资产" icon:icon1 userInfo:info1]; UIMutableApplicationShortcutItem *item2 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"3dtouch.shopPage" localizedTitle:@"购物车" localizedSubtitle:@"这是购物车" icon:icon2 userInfo:info2]; UIMutableApplicationShortcutItem *item3 = [[UIMutableApplicationShortcutItem alloc]initWithType:@"3dtouch.mypage" localizedTitle:@"我的" localizedSubtitle:@"这是我的" icon:icon3 userInfo:info3]; //把原有的shortcutItems拿出来,把动态的放进去 NSArray *items = @[item1, item2, item3]; NSArray *existingItems = [UIApplication sharedApplication].shortcutItems; NSArray *updatedItems = [existingItems arrayByAddingObjectsFromArray:items]; //塞回去 [UIApplication sharedApplication].shortcutItems = updatedItems; 最后我们来看一下效果: 看上去是不是非常和谐?其实我告诉你,我们已经踩到了坑里了 我在运行中发现: NSArray *existingItems = [UIApplication sharedApplication].shortcutItems; 所获得的existingItems并不是我们之前设置在info.plist里面的,而是上一次 [UIApplication sharedApplication].shortcutItems = updatedItems; 赋值给他的,又因为我自作聪明的做了一次 NSArray *updatedItems = [existingItems arrayByAddingObjectsFromArray:items]; 所以我们每运行一次,shortcutItems中的元素个数就会多3个, 那为什么展示出来没有问题呢? 仔细看刚刚发的那张效果图,我擦,只有4个,对了,这个就是表象上不出错的原因,在API上并没有写shortcutItems有任何个数限制,也没有写快捷窗口的个数,但是实际上,最多只能显示4个,而且shortcutItems这个里面的对象恐怕是早已被系统默默的存到了某个plist里了,每当程序启动时,会向系统要app的Bundle Identifier对应的shortcutItems,并非我们事先想要的info.plist中的items,当然以上只是我从现象做出的合理猜测,我们并不需要关心info.plist中的那些静态item,只需要动态创建的item直接打包赋值过去 [UIApplication sharedApplication].shortcutItems = @[item1, item2, item3]; 至于只展示4个的问题,这个我们无能为力了,系统做了限制。 ②.Item点击回调 当app在后台的时候UIApplication提供了一个回调方法 - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler NS_AVAILABLE_IOS(9_0); 我们依据这个回调中的shortcutItem的type和userinfo来做出不同的事件处理,而最后的completionHandler在API的说明中我们看到当应用并非在后台,而是直接重新开进程的时候,直接返回No,那么这个时候,我们的回调会放在 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions UIApplication又给我们一个从launchOptions中获取这个shortcutItem的key–UIApplicationLaunchOptionsShortcutItemKey,所以在这2个都进行对shortcutItem的操作后,我们这个功能算是完成了 在didFinishLaunchingWithOptions中,由于某些客户端会有启动动画,所以这边加了3秒,具体因程序而异 UIApplicationShortcutItem *item = [launchOptions valueForKey:UIApplicationLaunchOptionsShortcutItemKey]; __weak typeof(self) weakSelf = self; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ __strong typeof(weakSelf) strongSelf = weakSelf; if (strongSelf) { [strongSelf actionWithShortcutItem:item]; } }); 在performActionForShortcutItem回调中 - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler { if (shortcutItem) { [self actionWithShortcutItem:shortcutItem]; } if (completionHandler) { completionHandler(YES); } } 最后就是统一处理actionWithShortcutItem的地方,由于我这个demo中所有的type对应的行为都一样的,所以我这边没有对type做区分,甚至所以的item可以用同一个type -(void)actionWithShortcutItem:(UIApplicationShortcutItem *)item { if (item.userInfo) { NSLog(@"%@",item.userInfo[@"url"]); } } 好了,3D Touch的第一个功能就介绍到这里Demo。

资源下载

更多资源
Mario

Mario

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

腾讯云软件源

腾讯云软件源

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

Spring

Spring

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

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册
修改密码
忘记密码