首页 文章 精选 留言 我的

精选列表

搜索[自动装配],共10000篇文章
优秀的个人博客,低调大师

Docker自动化双主MySQL-01:安装docker并使用docker 获取镜像

nstall with yum1.shell>sudo yum update2.添加dockeryum$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'[dockerrepo]name=Docker Repositorybaseurl=https://yum.dockerproject.org/repo/main/centos/7/enabled=1gpgcheck=1gpgkey=https://yum.dockerproject.org/gpgEOF 3.安装docker的包shell>sudo yum install docker-engine4.将docker加到服务里面$ sudo systemctl enable docker.service5.启动docker$ sudo systemctl start docker6.在容器中运行镜像看docker是否安装成功 $ sudo docker run --rm hello-world 二、使用docker 获取镜像:1.查看docker是否运行:[root@localhost ~]# ps aux | grep dockerroot 8229 1.6 0.6 944968 49924 ? Ssl 10:54 0:13 /usr/bin/dockerdroot 8235 0.0 0.1 367832 12216 ? Ssl 10:54 0:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runcroot 8827 0.0 0.0 112652 960 pts/1 S+ 11:07 0:00 grep --color=auto docker2.使用docker获取镜像: 可以使用 docker pull 命令来从仓库获取所需要的镜像 [root@localhost ~]#docker pull centos[root@localhost ~]# docker images 有哪些镜像REPOSITORY TAG IMAGE ID CREATED SIZEcentos latest 0584b3d2cf6d 6 weeks ago 196.5 MBhello-world latest c54a2cc56cbb 5 months ago 1.848 kB3.查看后台运行docker镜像[root@localhost ~]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe793eb3f32c2 centos "/bin/bash" 3 minutes ago Up 3 minutes alisql4.进入docker里面[root@localhost ~]# docker exec -it e793eb3f32c2 /bin/bash[root@e793eb3f32c2 /]# 查看容器:[root@localhost opt]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe793eb3f32c2 centos "/bin/bash" 6 hours ago Up 6 hours alisql将容器提交为镜像[root@localhost opt]# docker commit -m "install alisql" -a "wjj" e793eb3f32c2 alisql/m:5.6.32sha256:3dff1697293ac450627ce4d6283c215315dcef3256d00206be5cabb831314780 其中, -m 来指定提交的说明信息,跟我们使用的版本控制工具一样; -a 可以指定更新的用户信息;之后是用来创建镜像的容器的 ID;最后指定目标镜像的仓库名和 tag 信息。创建成功后会返回这个镜像的 ID 信息。使用 docker images 来查看新创建的镜像。 [root@localhost opt]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEalisql/m 5.6.32 3dff1697293a About a minute ago 2.181 GB 之后,可以使用新的镜像来启动容器 导出镜像:[root@localhost opt]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEalisql_m 5.6.32 e1b266255ad5 2 minutes ago 2.181 GB 3dff1697293a 8 minutes ago 2.181 GB 53c6ea2f5444 30 minutes ago 5.117 GBcentos latest 0584b3d2cf6d 6 weeks ago 196.5 MBhello-world latest c54a2cc56cbb 5 months ago 1.848 kB [root@localhost docker_images]# docker save -o alisql_m.tar alisql/m:5.6.32[root@localhost docker_images]# docker save -o alisql_s.tar alisql/s:5.6.32 save opt/alisql_m.tar的意思是把image 保存在opt目录里并命令为alisql_m.tar 使用新的镜像来启动容器:[root@localhost docker_images]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEalisql/s 5.6.32 f502d6c3c562 3 minutes ago 2.456 GBalisql/m 5.6.32 ee0aea15ad83 4 minutes ago 2.497 GB docker run 就是运行容器的命令,具体格式我们会在后面的章节讲解,我们这里简要的说明一下上面用到的参数-ti:这是两个参数,一个是 -i:交互式操作,一个是 -t 终端。我们这里打算进入 bash 执行一些命令并查看返回结果,因此我们需要交互式终端。使用新的镜像来启动容器:[root@localhost ~]# docker run -t -i alisql_s:5.6.32 /bin/bash 827 docker ps -a 828 docker rm -f 79cab3e7e30a 829 docker rmi bc9edf41d6b2docker exec -it 容器名 执行脚本或者获取脚本位置 docker build -t ma . [root@localhost docker_mysql_5.6]# docker ps -aq0de7852c69928e3134e3ed0c4cbd4c39e33267f51a8e755b56d33b2836ea88dd6a8cf960d38476a689b658bfe5f40850d5c9fbe08387[root@localhost docker_mysql_5.6]# docker ps -aq | xargs docker rm -f0de7852c69928e3134e3ed0c4cbd4c39e33267f51a8e755b56d33b2836ea88dd6a8cf960d38476a689b658bfe5f40850d5c9fbe08387

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

关于项目自动化测试架构的改良计划 - XML格式转为json格式

因为讨论下来,最终的DataProvider格式需要是一个json格式,所以我们还必须提供方法吧xml格式转为json格式,现在很多框架比如json-lib框架能很轻易的完成这个任务了。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 /** * This class will read the xml file and then change it to a json object *@author cwang58 *@created date: Jun 9, 2013 */ public class XMLJSONConverter { /** * This method will convert the xml to json object * @param xml the xml string * @return the json string */ public static String xml2JSON(String xml){ XMLSerializer xmlSerializer = new XMLSerializer(); JSON json = xmlSerializer.read(xml); return json.toString(); } .. } 就几行代码,很容易读懂。 本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/1221759,如需转载请自行联系原作者

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

[Android学习笔记八] 使用VideoView屏幕方向发生变化,视频方向自动切换

一个Activity主要用来做播放视频使用,并且是全屏播放的话,主要采用横屏(Landscape orientation 显示宽度大于高度)显示视频,那么可以指定Activity的属性android:screenOrientation="landscape"让Activity在设备上以横屏显示。 本文使用VideoView来显示视屏,Potrait(竖屏)时布局样式中宽匹配父布局,高匹配内容;Landscape(横屏)时布局样式中宽匹配内容,高匹配布局。视屏播放中,用户调正设备方向时,导致屏幕方向发生变化,视屏能够适应布局样式显示视频,并正常继续播放。 示例图: 1. 构建布局 Potrait: res/layout/activity_videoview.xml 1 2 3 4 5 6 7 8 9 10 11 <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:layout_width = "match_parent" android:layout_height = "match_parent" android:orientation = "vertical" > < VideoView android:id = "@+id/videoView" android:layout_width = "match_parent" android:layout_height = "wrap_content" android:layout_gravity = "center_horizontal" android:layout_margin = "5dp" /> </ LinearLayout > Landscape: res/layout-land/activity_videoview.xml 1 2 3 4 5 6 7 8 9 10 <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:orientation = "vertical" android:layout_width = "match_parent" android:layout_height = "match_parent" > < VideoView android:layout_width = "wrap_content" android:layout_height = "match_parent" android:id = "@+id/videoView" android:layout_gravity = "center_horizontal" android:layout_margin = "5dp" /> </ LinearLayout > 2.创建Activity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 package secondriver.sdk.activity; import android.app.Activity; import android.app.ProgressDialog; import android.content.res.Configuration; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.widget.MediaController; import android.widget.Toast; import android.widget.VideoView; import secondriver.sdk.R; /** *Author:secondriver *Created:2015/11/30 */ public class VideoViewActivity extends Activity implements MediaPlayer.OnPreparedListener,MediaPlayer.OnCompletionListener,MediaPlayer.OnErrorListener{ private final StringTAG=VideoViewActivity. class .getName(); public VideoViewvideoView; public MediaControllermediaController; public int videoPosition= 0 ; public ProgressDialogdialog; @Override protected void onCreate(BundlesavedInstanceState){ Log.d(TAG, "onCreate" ); super .onCreate(savedInstanceState); setContentView(R.layout.activity_videoview); dialog= new ProgressDialog( this ); dialog.setTitle( "视屏播放器" ); dialog.setMessage( "正在加载..." ); dialog.setCancelable( false ); mediaController= new MediaController( this ); videoView=(VideoView)findViewById(R.id.videoView); videoView.setMediaController(mediaController); videoView.setOnCompletionListener( this ); videoView.setOnPreparedListener( this ); videoView.setOnErrorListener( this ); } private void loadVideo(){ Log.d(TAG, "loadvideo" ); dialog.show(); try { videoView.setVideoURI(Uri.parse( "android.resource://" +getPackageName()+ "/" +R.raw.bsg)); } catch (Exceptione){ Log.e(TAG,e.getMessage()); } } @Override protected void onStart(){ Log.d(TAG, "onStart" ); super .onStart(); loadVideo(); } @Override public void onConfigurationChanged(ConfigurationnewConfig){ Log.d(TAG, "onConfigurationChanged" ); super .onConfigurationChanged(newConfig); } @Override public void onCompletion(MediaPlayermp){ Log.d(TAG, "MediaonCompletion" ); Toast.makeText(VideoViewActivity. this , "播放完成" ,Toast.LENGTH_LONG).show(); mp.release(); } @Override public void onPrepared(MediaPlayermp){ Log.d(TAG, "MediaonPrepared" ); if (dialog.isShowing()){ dialog.dismiss(); } mp.seekTo(videoPosition); if (videoPosition== 0 ){ mp.start(); } else { mp.pause(); } } @Override public boolean onError(MediaPlayermp, int what, int extra){ Log.d(TAG, "MediaonError" ); Stringerr= "未知错误" ; switch (what){ case MediaPlayer.MEDIA_ERROR_UNKNOWN: break ; case MediaPlayer.MEDIA_ERROR_SERVER_DIED: err= "媒体服务终止" ; break ; default : break ; } Toast.makeText(VideoViewActivity. this ,err,Toast.LENGTH_LONG).show(); return true ; } } 3. 设置Activity属性 1 2 3 <activityandroid:name= ".activity.VideoViewActivity" android:configChanges= "orientation|screenSize|keyboardHidden" /> 代码中重写了onConfigurationChanged,可以在此处做配置发生变化的处理。 在运行时发生配置更改,Activity被关闭,默认情况下重新启动,但在设置了Activity的configChanges属性的配置将防止活动被重新启动,Activity仍在运行并且onConfigurationChanged方法被调用。 需要注意的是如果应用程序的target API level是13+的话(声明了minSdkversion和targetSdkVersion属性),需要同时设置screensize, 因为设备的横竖方向发生变化的时候,当前屏幕的可用尺寸也将发生变化。 本文转自 secondriver 51CTO博客,原文链接:http://blog.51cto.com/aiilive/1718653,如需转载请自行联系原作者

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

关于项目自动化测试架构的改良计划 - 分离出动作指令信息

但是,我们这些动作指令信息毕竟是让测试用例数据的设计者告诉Engine怎样修改原始数据集合的,所以我们必须把这些信息分离出来,但是刚才一步骤,已经把这些片断移除了,那么怎么把这些信息拿到呢?很简单,不是我们有原始数据么,所以我们就可以对于原始数据的xml字符串,一个testcase,一个testcase的吧这些动作指令解析出来并且存放在相应的Value Object 列表中,以后我们只要根据这些列表中提供的信息就可以正确的对于原来的数据集合进行操作了。 分离信息的类叫XMLModifyInfoExtractor,它负责分离动作: 代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 /** * extract all the modification information and store to member fields. * @param filePath * @throws Exception */ public void extractModifyInfo(String filePath) throws Exception{ SAXReader reader = new SAXReader(); Document document = reader.read( new File(filePath)); Element rootElement = document.getRootElement(); String testcaseElementPathValue; Element addElements; Element addElementPath; String addElementPathValue; Element addElementValue; String addElementValueValue; Element updateElements; Element updateElementPath; String updateElementPathValue; Element updateElementValue; String updateElementValueValue; Element removeElements; Element removeElementPath; String removeElementPathValue; //first ,get all the <test_case> element List<Element> testcaseElementList = rootElement.elements( "test_case" ); for (Element testcaseElement : testcaseElementList){ testcaseElementPathValue = testcaseElement.getUniquePath(); //get <add_elements> part from the <test_case> addElements= testcaseElement.element( "add_elements" ); if (addElements!= null ){ //traverse the <add_elements> to get a seris of <add_element> List<Element> addElementList = addElements.elements( "add_element" ); for (Element addElement : addElementList){ //extract the <path> information from <add_element> addElementPath = addElement.element( "path" ); addElementPathValue = addElementPath.getTextTrim(); //extract the <value> information from <add_element> addElementValue = addElement.element( "value" ); String xmlValue=addElementValue.asXML(); //remove the <value> and </value> part from this xml addElementValueValue=xmlValue.replace( "<value>" , "" ).replace( "</value>" , "" ); addElementInfoList.add ( new AddElement(testcaseElementPathValue,addElementPathValue,addElementValueValue)); } } //get <update_elements> part from the <test_case> updateElements= testcaseElement.element( "update_elements" ); if (updateElements!= null ){ //traverse the <update_elements> to get a seris of <update_element> List<Element> updateElementList = updateElements.elements( "update_element" ); for (Element updateElement : updateElementList){ //extract the <path> information from <update_element> updateElementPath = updateElement.element( "path" ); updateElementPathValue = updateElementPath.getTextTrim(); //extract the <value> information from <update_element> updateElementValue = updateElement.element( "value" ); updateElementValueValue=updateElementValue.getTextTrim(); updateElementInfoList.add ( new UpdateElement(testcaseElementPathValue,updateElementPathValue,updateElementValueValue)); } } //get <remove_elements> part from the <test_case> removeElements= testcaseElement.element( "remove_elements" ); if (removeElements != null ){ //traverse the <remove_elements> to get a seris of <remove_element> List<Element> removeElementList = removeElements.elements( "remove_element" ); for (Element removeElement : removeElementList){ //extract the <path> information from <remove_element> removeElementPath = removeElement.element( "path" ); removeElementPathValue = removeElementPath.getTextTrim(); removeElementInfoList.add( new RemoveElement(testcaseElementPathValue,removeElementPathValue)); } } } } 现在经过上述3步骤之后,我们的代码中所有的动作序列的执行内容都被存放在相应变量中了。 本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/1221749,如需转载请自行联系原作者

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

Linux集群和自动化维1.2 IDC机房的选择及CDN的选型

1.2 IDC机房的选择及CDN的选型 如果自己的业务网站中含有大量的图片和视频类文件,为了加快客户端的访问速度,同时为了减缓对真正的核心机房的服务压力,并且提升用户体验,建议在前端最好采用CDN缓存加速方案。 CDN(Content Delivery Network),即内容分发网络。其目的是通过在现有的Internet中增加一层新的网络架构,将网站的内容发布到最接近用户的网络“边缘”,使用户可以就近取得所需的内容,提高用户访问网站的响应速度。CDN缓存加速方案一般有如下几种方式。 租赁CDN:中小型网站直接购买服务就好,现在CDN已经进入按需付费的云计算模式了,性价比是可以准确计算的。 自建CDN:这种方案的成本就有点大了,为了保证良好的缓存效果,必须在全国机房布点,还要自建智能Bind系统,搭建大型网站时推荐采用此种方案,专业的

资源下载

更多资源
腾讯云软件源

腾讯云软件源

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

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

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册