首页 文章 精选 留言 我的

精选列表

搜索[Solon框架],共10000篇文章
优秀的个人博客,低调大师

在 Ionic 框架移动应用中支持 iBeacons

Ionic framework 构建的 Android 或 iOS 应用中使用 iBeacons 我最近购买了一些 Estimote IBeacons 模块玩,并想将它们接入到基于 Ionic Framework 创建的 Android 与 iOS 应用中。 如果你对 iBeacons 感到陌生,没关系,它其实是用于近距离数据传输的蓝牙设备。Estimote 模块的优点在于其低功耗和电池寿命,目前已经有很多制造商已经正在制造 Estimote 模块。iBeacons 通常可以以 100ms 到 1000ms 的间隔发送广播信息,其间隔因配置或其制造商不同而不同。iBeacons 发送的广播信息包括 UUID、主版本号和次版本号。 在开始讨论代码前,我分享些可以应用 iBeacons 的场景: 1.在博物馆通过特定 iBeacons 触发你的手机显示出一段文字或播放一段音频。将一个 iBeacons 放在意大利的大卫雕像旁,当人们靠近时,人们就可以得到这个作品的信息。 2.用来追踪你商店里的人流量。也许你拥有一个像沃尔玛一样大小的商店,在每个部门都安装有iBeacons,你可以通过它来查看哪个部门的人流量最多。 3.通过 iBeacons 技术,可以计算你在游乐园的排队等待时间。 iBeacons 的应用不只在这些场景。 到现在你应该对 iBeacons 有一些了解了,下面我们将讨论代码。假设在你的机器上已经有 Ionic,在终端或命令提示符里运行以下命令:``ionic start IonicBeacon blankcd IonicBeaconionic platform add iosionic platform add android 如果你使用的不是 Mac,不要执行第三条命令。因为只有 Android 可以在 Linux 和 Windows 机器上运行。 插件我们使用 Peter Metz 的 cordova-plugin-ibeacan。在我写这个文档时,我可以获取的最新版本是 50315dbc。你也可以尝试使用新的版本。 打开终端或命令提示符,输入以下命令安装 IonicBeacon 插件: cordova plugin add https://github.com/petermetz/cordova-plugin-ibeacon.git 下面我们可以开始编码了。因为 Peter Metz 的 iBeacon 插件是使用 JavaScript 编写的,在 Ionic 这并不是最好的方式。因此我们使用 AngularJS 封装了这个插件。封装后的 ng-cordova-beacon 可以在我的 GitHub 上下载。从 dist 目录下载 ng-cordova-beacon.min.js 并将它拷贝到你的工程的 www/js 目录下。 下一步,打开你的工程中 www/index.html 文件,并在 app.js 行之前添加以下 JavaScript 代码: 打开 www/js/app.js 文件并添加以下代码来引入 AngularJS: angular.module('starter', ['ionic', 'ngCordovaBeacon']).run(function($ionicPlatform) { $ionicPlatform.ready(function() { if(window.cordova && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); } if(window.StatusBar) { StatusBar.styleDefault(); } }); }).controller("ExampleController", function($scope, $rootScope, $ionicPlatform, $cordovaBeacon) { $scope.beacons = {}; $ionicPlatform.ready(function() { $cordovaBeacon.requestWhenInUseAuthorization(); $rootScope.$on("$cordovaBeacon:didRangeBeaconsInRegion", function(event, pluginResult) { var uniqueBeaconKey; for(var i = 0; i < pluginResult.beacons.length; i++) { uniqueBeaconKey = pluginResult.beacons[i].uuid + ":" + pluginResult.beacons[i].major + ":" + pluginResult.beacons[i].minor; $scope.beacons[uniqueBeaconKey] = pluginResult.beacons[i]; } $scope.$apply(); }); $cordovaBeacon.startRangingBeaconsInRegion($cordovaBeacon.createBeaconRegion("estimote", "b9407f30-f5f8-466e-aff9-25556b57fe6d")); }); }); 让我们看下这里发生了什么。 angular.module('starter', ['ionic', 'ngCordovaBeacon']) 首先我们需要将 ng-cordova-beacon 添加到 AngularJS 模块中。好了,我们可以按我们的想法去用它了。 在插件使用设备相关的代码前,我们需要在 $ionicPlatform.ready 接口中进行相关的设置。在 iOS 应用中,我们需要申请权限去访问本地服务,而 Android 应用则不必如此。 我们调用 $rootScope.$on 用来监测距离。如果我们接收到了 iBeacon,我们需要知道其距离我们有多远。我们也可以通过一个对象将广播信息显示到前端。 现在我们可以在一定范围广播我们消息了。如果你希望广播多个不同的消息,可以使用不同的配置多次调用下面代码,但我只想广播一个消息。其代码如下: $cordovaBeacon.createBeaconRegion("estimote", "b9407f30-f5f8-466e-aff9-25556b57fe6d") 我选择使用具有可读性的描述符作为 estimote 的 UUID。UUID 中也可以包含主版本号与次版本号,但当你使用它们时需要使用通配符。你可以为每个 UUID 使用多个不同的主版本号与次版本号,这样你会得到多个结果。 最后我们要关心的是这个 APP 怎么在手机上显示出来。回到工程的 www/index.html 文件,将下面的代码加入到 <ion-content> 标签中: <div class="list"> <div class="item" ng-repeat="(key, value) in beacons"> <div class="row"> <div class="col truncate"> </div> </div> <div class="row"> <div class="col"> major: </div> <div class="col"> minor: </div> </div> <div class="row"> <div class="col"> </div> </div> </div> </div> 我使用的 Ionic 类中没有 truncate 方法,我们需要将其加上。打开 www/css/style.css 文件添加下面的代码: .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } 因为我们使用 UUID 太长,不能完全的显示在屏幕上,过长的部分会被“...”代替。 ![image](https://yqfile.alicdn.com/27e544314546b7aa97e828756fbb79b0935f34b2.png) 当我们的程序启动后探测到 iBeacons 时就会如上图一样的显示。 ###结论 你可以使用 iBeacons 做很多有趣的事情,并且在 Ionic Framework 中的使用非常简单。你可以从Estimote下载开发工具,这里有很多兼容 Android 与 iOS 设备的版本。 可以通过下面的网址观看这个示例的视频: https://youtu.be/PlDNPeG8iJo

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

PhoneGap 1.8.1 发布,跨平台移动开发框架

PhoneGap官方今天发布了PhoneGap 1.8.1版本,主要修复了1.8版本中导致iOS平台上PhoneGap应用程序崩溃的bug。 该版本相对于之前的1.7版本,主要修复了iOS、Android、Windows Phone、黑莓和WebOS平台上的大量bug,此外还进行了大量的改进,部分如下: iOS:添加HTTP状态码到FileTransferError对象 iOS:升级地理位置功能,以和W3C规范一致 iOS:新增记录器插件 iOS:重写了加速器插件,简化了该插件的启动/停止行为 Android:当删除图像文件时查询Andoid content数据库 Android:在FileUtils.notifyDelete中使用stripFileProtocol协议 Android:修复了一些示例中出现的问题 WP:允许创建新的命令行界面项目 WP:重写了加速器插件 文章转载自 开源中国社区 [http://www.oschina.net]

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

Apache Storm 官方文档 —— Ack 框架的实现

Storm 的acker使用哈希校验和来跟踪每个 tuple 树的完成情况:每个 tuple 在被发送出的时候,它的值会与校验和进行异或运算,然后在 tuple 被 ack 的时候这个值又会再次与校验和进行异或运算。这样,一旦所有的 tuple 都被成功 ack,校验和就会变为 0(随机生成的校验和为 0 的概率极小,可以忽略不计)。 你可以在wiki中了解更多关于可靠性机制的信息。 ackerexecute() Acker 实际上也是一个 bolt,它的execute 方法是定义在mk-acker-bolt中的。在一个新的 tuple 树生成的时候,spout 为每个 tuple 发送一个用于异或的固有 id,acker 会将这些 id 记录在它的挂起队列中。每次 executor ack 一个 tuple 的时候,acker 会接收到一个部分校验和,这个校验和是 tuple 自身的 id(将其从挂起队列中清除)和 executor 发送的每个下游 tuple 的 id(放入挂起队列中)的异或值。 这个过程是这样的: 在接收到 tick tuple 信号的时候,将 tuple 树的校验值向超时方向移动并且返回。同时,在 tuple 树中更新或者创建一个记录。 初始化阶段:使用指定的校验和值进行初始化,并且记录 spout 的 id; ack 阶段:将部分校验和与当前的校验和进行异或运算; fail 阶段:仅仅将 tuple 标记为 failed 状态。 接下来,将记录存入RotatingMap(重新设置超时计数值)并且继续以下过程: 如果总校验和为 0, 表明 tuple 树已经完成:将记录从挂起队列中移除,并通知 spout 处理成功; 如果 tuple 树失败了,也会有一种完成状态:将记录从挂起队列中移除,并通知 spout 处理失败。 最后,发送一个我们自己的 ack 信号。 挂起 tuples 与RotatingMap Acker 将挂起树存放在一个RotatingMap中。RotatingMap是一个在 Storm 中多处使用的简单工具,它主要用于高效地处理过程的超时。 RotatingMap 与 HashMap 类似,支持 O(1) 时间的 get 操作。 在 RotatingMap 内部有多个 HashMap(称为槽,buckets),每个 HashMap 都保存有一群会在同一时间超时的记录。我们称存在时间最长的 bucket 为死亡牢房(death row),而访问最多的 bucket 称为苗圃(nursery)。一个新的值在被.put()到 RotatingMap 中,它都会被重定位到 nursery 中,并且从其他的它之前可能在的 bucket 中移除(这是一种高效的重新设置延时时间的方法)。 在 RotatingMap 的所有者调用.rotate()方法的时候,RotatingMap 会将每个 bucket 向着超时的方向移动一步(一般 Storm 对象会在收到一个系统 tick 流 tuple 的时候调用 rotate 方法)。如果此时在前面所说的 death row bucket 中有 key-value 键值对,RotatingMap 会为每个 key-value 键值对触发一个回调函数(在构造器中定义的),让他们的所有者选择一个合适的操作(例如,将 tuple 标记为处理 转载自并发编程网 - ifeve.com 失败)。

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

ionic入门之开始使用ionic框架

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/inforstack/article/details/71120744 安装ionic npm install -g cordova ionic 首先,安装 Node.js。然后,在你的终端安装最新的Cordova 和 Ionic的命令行工具。按照 Android和 iOS平台指南,安装所需的开发工具。 创建应用程序 ionic start myApp tabs 创建一个Ionic的应用程序使用一个我们现成的应用程序模板,或一张空白的重新开始。查阅更多设计 市场。 模板命令 ionic start myApp blank ionic start myApp tabs ionic start myApp sidemenu 运行应用程序 cd myApp ionic serve 很多应用程序可以建立在与浏览器中的权利。建议启动workflow。 ionic serve

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

全文检索:Apache Lucene框架入门实例

一 简介 Lucene属于Apache开源项目的一部分,是一个开源的全文检索引擎工具包,但它不是一个完整的全文检索引擎,而是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎,部分文本分析引擎(英文与德文两种西方语言) Lucene的目的是为软件开发人员提供一个简单易用的工具包,以方便在目标系统中实现全文检索的功能,或者是以此为基础建立起完整的全文检索引擎。在Java开发环境里Lucene是一个成熟的免费开源工具。就其本身而言,Lucene是当前以及最近几年最受欢迎的免费Java信息检索程序库。人们经常提到信息检索程序库,虽然与搜索引擎有关,但不应该将信息检索程序库与搜索引擎相混淆 注:以上介绍参考至百度百科 在使用Lucene建立索引时,可以选择将索引文件存储在内存中或者磁盘里。下面我将分别介绍基于这两种存储方式的全文索引的创建与检索 二 基于内存的索引创建与检索 首先需要做的是下载相关的jar包,下载地址是:http://lucene.apache.org/core/downloads.html 其次,在正式介绍下面的内容之前,至少需要导入以下三个jar包: lucene-analyzers-common-6.2.1.jar lucene-core-6.2.1.jar lucene-queryparser-6.2.1.jar 基于内存的全文索引示例代码如下: packagecn.zifangsky.lucene; importjava.io.IOException; importjava.util.HashMap; importjava.util.Map; importjava.util.Map.Entry; importorg.apache.lucene.analysis.Analyzer; importorg.apache.lucene.analysis.standard.StandardAnalyzer; importorg.apache.lucene.document.Document; importorg.apache.lucene.document.Field; importorg.apache.lucene.document.StringField; importorg.apache.lucene.document.TextField; importorg.apache.lucene.index.DirectoryReader; importorg.apache.lucene.index.IndexReader; importorg.apache.lucene.index.IndexWriter; importorg.apache.lucene.index.IndexWriterConfig; importorg.apache.lucene.queryparser.classic.ParseException; importorg.apache.lucene.queryparser.classic.QueryParser; importorg.apache.lucene.search.IndexSearcher; importorg.apache.lucene.search.Query; importorg.apache.lucene.search.ScoreDoc; importorg.apache.lucene.store.Directory; importorg.apache.lucene.store.RAMDirectory; publicclassDemo1{ /** *创建索引 * *@paramsourceMap *待索引的内容 *@return */ publicstaticDirectorycreateIndex(Map<String,String>sourceMap){ //1创建一个默认的词法分析器 Analyzeranalyzer=newStandardAnalyzer(); //2设置索引文件存储位置,可以存储到磁盘和内存中,这里设置为存储到内存 Directorydirectory=newRAMDirectory();//存储到内存 //3索引的写入 IndexWriterConfigconfig=newIndexWriterConfig(analyzer); try{ IndexWriterindexWriter=newIndexWriter(directory,config); //将内容添加到索引中,每本书表示一个“文档”,并将每个文档进行存储 if(!sourceMap.isEmpty()){ for(Entry<String,String>source:sourceMap.entrySet()){ Documentdocument=newDocument(); //标题需要分词,使用TextField document.add(newTextField("title",source.getKey(),Field.Store.YES)); //作者不需要分词,使用StringField document.add(newStringField("author",source.getValue(),Field.Store.YES)); indexWriter.addDocument(document); } } indexWriter.close(); }catch(IOExceptione){ e.printStackTrace(); } returndirectory; } /** *搜索 * *@paramdirectory *@paramsearchWord *搜索关键词 */ publicstaticvoidreadIndex(Directorydirectory,StringsearchWord){ intpreHits=10;//获取前面多少个结果 try{ //1打开一个文档 IndexReaderindexReader=DirectoryReader.open(directory); IndexSearcherindexSearcher=newIndexSearcher(indexReader); Analyzeranalyzer=newStandardAnalyzer(); //2设置使用关键字检索,这里是检索标题 QueryParserparser=newQueryParser("title",analyzer); Queryquery=parser.parse(searchWord); //3获取检索到的结果 System.out.println("总共有"+indexSearcher.count(query)+"个结果"); ScoreDoc[]hits=indexSearcher.search(query,preHits).scoreDocs; System.out.println("当前有"+hits.length+"个结果,内容分别如下:"); //遍历检索到的“文档” for(inti=0;i<hits.length;i++){ intdocId=hits[i].doc; DocumenthitDoc=indexSearcher.doc(docId); System.out.println("《"+hitDoc.get("title")+"》作者:"+hitDoc.get("author")); } indexReader.close(); }catch(IOException|ParseExceptione){ e.printStackTrace(); } } publicstaticvoidmain(String[]args){ Map<String,String>books=newHashMap<>(); books.put("Java编程思想","BruceEckel"); books.put("Java8实战","Raoul-GabrielUrma"); books.put("Spring入门经典","MertCaliskan"); books.put("Spring实战","CraigWalls"); books.put("SpringBoot实战","汪云飞"); books.put("Redis实战","JosiahL.Carlson"); Directorydirectory=Demo1.createIndex(books); Demo1.readIndex(directory,"Spring"); // Demo1.readIndex(directory,"实战"); } } 上面代码并不复杂,而且还有详细的注释,因此一些细节流程我就不多做介绍了。只是需要强调的一点是: 在创建索引时使用了这样的代码: document.add(newTextField("title",source.getKey(),Field.Store.YES)); 其中,上面的Field.Store.YES表示在创建索引的同时将内容的原文(也就是:source.getKey())也存储到内存中。如果我们选择了Field.Store.NO,在创建索引和检索的时候都是没问题的,但是在最后是没法提取检索关键字所在的原文内容的 最后的输出结果如下: 总共有3个结果 当前有3个结果,内容分别如下: 《SpringBoot实战》作者:汪云飞 《Spring实战》作者:CraigWalls 《Spring入门经典》作者:MertCaliskan 三基于磁盘的索引创建与检索 示例代码如下: packagecn.zifangsky.lucene; importjava.io.BufferedReader; importjava.io.File; importjava.io.FileReader; importjava.io.FilenameFilter; importjava.io.IOException; importjava.util.ArrayList; importjava.util.List; importorg.apache.lucene.analysis.Analyzer; importorg.apache.lucene.analysis.standard.StandardAnalyzer; importorg.apache.lucene.document.Document; importorg.apache.lucene.document.Field.Store; importorg.apache.lucene.document.StringField; importorg.apache.lucene.document.TextField; importorg.apache.lucene.index.DirectoryReader; importorg.apache.lucene.index.IndexWriter; importorg.apache.lucene.index.IndexWriterConfig; importorg.apache.lucene.queryparser.classic.QueryParser; importorg.apache.lucene.search.IndexSearcher; importorg.apache.lucene.search.Query; importorg.apache.lucene.search.ScoreDoc; importorg.apache.lucene.store.Directory; importorg.apache.lucene.store.FSDirectory; publicclassDemo2{ publicstaticvoidmain(String[]args){ Demo2.createIndex("D:/test/source","D:/test/index"); Demo2.searchIndex("D:/test/index","apache"); } /** *给一个目录下的所有文本文件创建索引 * *@paramsourceDir *待索引的文件目录 *@paramindexDir *索引文件存储目录 *@return */ publicstaticvoidcreateIndex(StringsourceDir,StringindexDir){ List<File>fileList=getFileList(sourceDir); if(fileList.size()>0){ //遍历文件并分别创建索引 for(Filefile:fileList){ StringBufferstringBuffer=newStringBuffer(); stringBuffer.append(getFileContent(file)); // System.out.println("fileName:"+file.getName()+"filePath:"+file.getPath()); Analyzeranalyzer=newStandardAnalyzer(); try{ FileindexFile=newFile(indexDir); if(!indexFile.exists()){ indexFile.mkdirs(); } //存储到文件中 Directorydirectory=FSDirectory.open(newFile(indexDir).toPath()); IndexWriterConfigconfig=newIndexWriterConfig(analyzer); IndexWriterindexWriter=newIndexWriter(directory,config); Documentdocument=newDocument(); document.add(newTextField("fileName",file.getName(),Store.YES)); document.add(newTextField("content",stringBuffer.toString(),Store.YES)); document.add(newStringField("path",file.getPath(),Store.YES)); indexWriter.addDocument(document); indexWriter.commit(); indexWriter.close(); }catch(IOExceptione){ e.printStackTrace(); } } } } /** *在索引目录下检索关键字 * *@paramindexDir *索引文件存储目录 *@paramsearchWord *搜索的关键字 */ publicstaticvoidsearchIndex(StringindexDir,StringsearchWord){ Analyzeranalyzer=newStandardAnalyzer(); try{ //从一个磁盘目录中检索 Directorydirectory=FSDirectory.open(newFile(indexDir).toPath()); DirectoryReaderdirectoryReader=DirectoryReader.open(directory); IndexSearcherindexSearcher=newIndexSearcher(directoryReader); //检索正文 QueryParserqueryParser=newQueryParser("content",analyzer); Queryquery=queryParser.parse(searchWord); //检索前1000个结果 System.out.println("总共有"+indexSearcher.count(query)+"个结果"); ScoreDoc[]hits=indexSearcher.search(query,1000).scoreDocs; System.out.println("当前有"+hits.length+"个结果,分别如下:"); for(inti=0;i<hits.length;i++){ intdocId=hits[i].doc; DocumenthitDoc=indexSearcher.doc(docId); System.out.println("文件名:"+hitDoc.get("fileName")+"路径:"+hitDoc.get("path")); //System.out.println(hitDoc.get("content")); } directoryReader.close(); directory.close(); }catch(Exceptione){ e.printStackTrace(); } } /*** *获取一个目录下的所有文件 * *@paramsourceDir *文件目录 *@return所有文件的集合 */ privatestaticList<File>getFileList(StringsourceDir){ Filedir=newFile(sourceDir); if(dir.isDirectory()){ //返回指定格式的文本文件 File[]files=dir.listFiles(newFilenameFilter(){ publicbooleanaccept(Filedir,Stringname){ returnname.endsWith(".txt")||name.endsWith(".log")||name.endsWith(".xml"); } }); List<File>fileList=newArrayList<File>(); if(files.length>0){ for(FiletmpFile:files){ fileList.add(tmpFile); } } returnfileList; } returnnull; } /** *获取一个文本文件的所有内容 * *@paramfile *@return */ privatestaticStringBuffergetFileContent(Filefile){ try{ // BufferedReaderreader=newBufferedReader(newInputStreamReader(newFileInputStream(file),"UTF-8")); BufferedReaderreader=newBufferedReader(newFileReader(file)); Stringline=null; StringBufferstringBuffer=newStringBuffer(); while((line=reader.readLine())!=null){ stringBuffer.append(line+"\n"); } reader.close(); returnstringBuffer; }catch(Exceptione){ e.printStackTrace(); } returnnull; } } 从上面的代码可以看出,索引存储到内存或者磁盘上,其基本步骤是差不多的,只是使用的类稍有区别。同时多了一些基本的IO操作代码,包括文件的读写等操作 运行上面的索引创建方法之后,打开磁盘上的“D:/test/index”,可以发现多了很多这样的文件: 最后,检索关键字“apache”,检索到的结果如下: 总共有3个结果 当前有3个结果,分别如下: 文件名:Lucene简介.txt路径:D:\test\source\Lucene简介.txt 文件名:H5_ws.log路径:D:\test\source\H5_ws.log 文件名:Shiro简介.txt路径:D:\test\source\Shiro简介.txt 可以发现,有三个文件包含“apache”这个关键字 至此,Lucene的入门介绍到此结束 参考文章: http://www.importnew.com/12715.html http://www.cnblogs.com/xing901022/p/3933675.html PS:上面图片中的水印是我个人博客的域名,因此还请管理员手下留情不要给我标为“转载文章”,谢谢!!!

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

MapReduce框架Mapper和Reducer类源码分析

一:Mapper类 在Hadoop的mapper类中,有4个主要的函数,分别是:setup,cleanup,map,run。代码如下: protected void setup(Context context) throws IOException, InterruptedException { // NOTHING } protected void map(KEYIN key, VALUEIN value, Context context) throws IOException, InterruptedException { context.write((KEYOUT) key, (VALUEOUT) value); } protected void cleanup(Context context) throws IOException, InterruptedException { // NOTHING } public void run(Context context) throws IOException, InterruptedException { setup(context); while (context.nextKeyValue()) { map(context.getCurrentKey(), context.getCurrentValue(), context); } cleanup(context); } } 由上面的代码,我们可以了解到,当调用到map时,通常会先执行一个setup函数,最后会执行一个cleanup函数。而默认情况下,这两个函数的内容都是nothing。因此,当map方法不符合应用要求时,可以试着通过增加setup和cleanup的内容来满足应用的需求。 二:Reducer类 在Hadoop的reducer类中,有3个主要的函数,分别是:setup,clearup,reduce。代码如下: /** * Called once at the start of the task. */ protected void setup(Context context ) throws IOException, InterruptedException { // NOTHING } /** * This method is called once for each key. Most applications will define * their reduce class by overriding this method. The default implementation * is an identity function. */ @SuppressWarnings("unchecked") protected void reduce(KEYIN key, Iterable<VALUEIN> values, Context context ) throws IOException, InterruptedException { for(VALUEIN value: values) { context.write((KEYOUT) key, (VALUEOUT) value); } } /** * Called once at the end of the task. */ protected void cleanup(Context context ) throws IOException, InterruptedException { // NOTHING } 在用户的应用程序中调用到reducer时,会直接调用reducer里面的run函数,其代码如下: /* * control how the reduce task works. */ @SuppressWarnings("unchecked") public void run(Context context) throws IOException, InterruptedException { setup(context); while (context.nextKey()) { reduce(context.getCurrentKey(), context.getValues(), context); // If a back up store is used, reset it ((ReduceContext.ValueIterator) (context.getValues().iterator())).resetBackupStore(); } cleanup(context); } } 由上面的代码,我们可以了解到,当调用到reduce时,通常会先执行一个setup函数,最后会执行一个cleanup函数。而默认情况下,这两个函数的内容都是nothing。因此,当reduce不符合应用要求时,可以试着通过增加setup和cleanup的内容来满足应用的需求。

资源下载

更多资源
腾讯云软件源

腾讯云软件源

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

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

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等操作系统。

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