首页 文章 精选 留言 我的

精选列表

搜索[基础搭建],共10000篇文章
优秀的个人博客,低调大师

java基础学习_常用类02_Scanner类和String类_day12总结

==========================================================================================================================================================涉及到的知识点有: 1:Scanner类的概述和使用(了解) (1)Scanner类的概述 (2)Scanner类的构造方法 (3)Scanner类的成员方法 2:String类的概述和使用(掌握) (1)String类的概述 (2)String类的构造方法 (3)字符串的特点 (4)字符串的面试题(看程序写结果) (5)字符串的功能 (6)字符串的案例==========================================================================================================================================================1:Scanner类的概述和使用(了解) (1)Scanner类的概述 在JDK5以后出现的用于键盘录入数据的类。 是一个可以使用正则表达式来解析基本类型和字符串的简单文本扫描器。 --------------------------------------- (2)Scanner类的构造方法 A:讲解了System.in这个东西。 它其实是标准的输入流,对应于键盘录入 B:构造方法 InputStream is = System.in; public Scanner(InputStream is) C:常用的格式 Scanner sc = new Scanner(System.in);--------------------------------------- (3)Scanner类的成员方法 1.基本方法的格式: A:public boolean hasNextXxx() 即判断下一个输入项是否是某种类型的。 其中Xxx可以是Int,Double等。如果需要判断是否包含下一个字符串,则可以省略Xxx。 B:public Xxx nextXxx() 获取某种类型的元素,即返回某种类型的元素。 Xxx的含义和上个方法中的Xxx相同。--------------------------------------- 2.要掌握的两个常用方法: A:public int nextInt() 获取一个int类型的值 B:public String nextLine() 获取一个String类型的值--------------------------------------- 3.需要注意的小问题: 对于同一个扫描器对象,若先获取一个数值,再获取一个字符串,会出现问题。 即:先nextInt()然后nextLine()的问题。 主要原因:就是那个换行符号的问题。 如何解决呢? A:先用键盘录入对象获取一个数值后,再创建一个新的键盘录入对象用来获取字符串。 B:把所有的数据都先按照字符串获取,然后要什么,你就对应的转换成什么。----------------------------------------------------------------------------- 2:String类的概述和使用(掌握) (1)String类的概述 字符串是由多个字符组成的一串数据(字符序列)。 字符串可以看成是字符数组,即它可以和字符数组进行相互转换。 在实际开发中,字符串的操作是最常见的操作,没有之一。 而Java没有内置的字符串类型,所以,就在Java类库中提供了一个类String 供我们来使用。--------------------------------------- (2)String类的构造方法 A:public String() 无参构造,即创建一个空内容的字符串对象。 B:public String(byte[] bytes) 把字节数组转成字符串,即使用一个字节数组构建一个字符串对象。 C:public String(char[] value) 把字符数组转成字符串,即使用一个字符数组构建一个字符串对象。 D:public String(byte[] bytes, int offset, int length) 把字节数组的一部分转成字符串,即使用一个字节数组构建一个字符串对象,指定开始的索引值,与使用的字节个数。 E:public String(char[] value, int offset, int count) 把字符数组的一部分转成字符串,即使用一个字符数组构建一个字符串对象,指定开始的索引值,与使用的字符个数。 F:public String(String original) 把字符串常量值转成一个字符串对象。 String s = new String("hello"); 这种构造方法会创建两个或一个对象。 G:String s = "hello"; 虽然不是构造方法,但是结果也是一个字符串对象。这种直接赋值的方法会创建一个或零个对象。 String 类代表字符串。Java 程序中的所有字符串字面值(如 "abc" )都作为此类的实例实现。--------------------------------------- (3)字符串的特点 A:字符串是常量,字符串的内容一旦被赋值,就不能被改变。 注意:这里指的是字符串的内容不能改变,而不是引用不能改变,引用可以改变。 即:字符串的内容会在字符串常量池里。每一个字符串的内容会有一个地址值。 B:字面值作为字符串对象和通过构造方法创建对象的不同? String s1 = new String("hello"); String s2 = "hello"; System.out.println(s1 == s2); // false System.out.println(s1.equals(s2)); // true ==(等号的比较的是): 基本类型:比较的就是值是否相同。 引用类型:比较的就是地址值是否相同。 equals(该方法比较的是): 只能是引用类型:默认情况下,比较的是地址值。 不过,我们可以根据情况自己重写该方法。一般重写都是自动生成,比较的是对象的成员变量值是否相同。 equals: 比较引用类型默认也是比较地址值是否相同,而String类重写了equals()方法,比较的是内容是否相同。内存如下图所示01/02: --------------------------------------- (4)字符串的面试题(看程序写结果) A:==和equals() String s1 = new String("hello"); String s2 = new String("hello"); System.out.println(s1 == s2); // false System.out.println(s1.equals(s2)); // true String s3 = new String("hello"); String s4 = "hello"; System.out.println(s3 == s4); // false System.out.println(s3.equals(s4)); // true String s5 = "hello"; String s6 = "hello"; System.out.println(s5 == s6); // true System.out.println(s5.equals(s6)); // true B:字符串的拼接 String s1 = "hello"; String s2 = "world"; String s3 = "helloworld"; System.out.println(s3 == s1 + s2); // false 字符串为变量时 System.out.println(s3.equals((s1 + s2))); // true System.out.println(s3 == "hello" + "world"); // true 字符串为常量时 System.out.println(s3.equals("hello" + "world")); // true 注意: 字符串如果是变量相加,先开空间,再拼接。 字符串如果是常量相加,是先加,然后在常量池找,如果有就直接返回,否则,就创建。--------------------------------------- (5)字符串的功能 A:String类的判断功能 public boolean equals(Object obj) 比较字符串的内容是否相同,区分大小写 public boolean equalsIgnoreCase(String str) 比较字符串的内容是否相同,忽略大小写 public boolean contains(String str) 判断大字符串中是否包含小字符串 public boolean startsWith(String str) 判断字符串是否以某个指定的字符串开头 public boolean endsWith(String str) 判断字符串是否以某个指定的字符串结尾 public boolean isEmpty() 判断字符串是否为空 注意: String s = ""; //字符串内容为空。 String s = null; //字符串对象为空。对象都不存在,所以不能调用方法,如果去调用方法,会出现空指针异常。--------------------------------------- B:String类的获取功能 public int length() 获取字符串的长度(字符个数)。 public char charAt(int index) 获取指定索引位置的字符。 public int indexOf(int ch) 返回指定字符在此字符串中第一次出现处的索引。 注意:形参为什么这里是int类型,而不是char类型? 原因是:'a'和97其实都可以代表'a'。形参为int类型时写'a'和97都可以,而为char类型时则只能写'a'了。 public int indexOf(String str) 返回指定字符串在此字符串中第一次出现处的索引。 public int indexOf(int ch, int fromIndex) 返回指定字符在此字符串中从指定位置后第一次出现处的索引。 public int indexOf(String str, int fromIndex) 返回指定字符串在此字符串中从指定位置后第一次出现处的索引。 public String substring(int start) 从指定位置开始截取字符串,默认到末尾(包含start这个索引)。 public String substring(int start, int end) 从指定位置开始到指定位置结束截取字符串(包括start索引但是不包end索引)。--------------------------------------- C:String类的转换功能 public byte[] getBytes() 把字符串转换为字节数组。 public char[] toCharArray() 把字符串转换为字符数组。 public static String valueOf(char[] chs) 把字符数组转成字符串。(方法重载) public static String valueOf(int i) 把int类型的数据转成字符串。(方法重载) 注意:String类的valueOf方法可以把任意类型的数据转成字符串。 public String toLowerCase() 把字符串转成小写。(注意:原串不变,生成的新串变为小写的) public String toUpperCase() 把字符串转成大写。(注意:原串不变,生成的新串变为小写的) public String concat(String str) 把字符串进行拼接。--------------------------------------- D:String类的其他功能 a:替换功能 public String replace(char old, char new) public String replace(String old, String new) b:去除字符串两端空格功能 public String trim() c:按字典顺序比较两个字符串功能 public int compareTo(String str) public int compareToIgnoreCase(String str) 示例: String s1 = "hello"; String s2 = "hello"; String s3 = "abc"; String s4 = "xyz"; System.out.println(s1.compareTo(s2)); // 0 System.out.println(s1.compareTo(s3)); // 7 System.out.println(s1.compareTo(s4)); // -16 比较不一样的时候,就用前一个串的第一个字符的ASCII减去后一个串的第一个字符的ASCII,得到一个int值返回。 若第一个字符相同,则比较第二个字符,以此类推。若都相同,则返回int值0。 若如下这样,查看该方法源码可知,返回的是第一个串比第二个串多的字符个数。 String s5 = "hello"; String s6 = "hel"; System.out.println(s5.compareTo(s6)); // -2--------------------------------------- (6)字符串的案例 A:模拟用户登录 B:字符串的遍历 C:统计字符串中大写、小写及数字字符的个数 D:把字符串的首字母转成大写,其他转成小写 E:把int数组拼接成一个指定格式的字符串输出 F:字符串反转 G:统计大串中小串出现的次数=============================================================================我的GitHub地址: https://github.com/heizemingjun 我的博客园地址: http://www.cnblogs.com/chenmingjun 我的蚂蚁笔记博客地址: http://blog.leanote.com/chenmingjun Copyright ©2018 黑泽明军 【转载文章务必保留出处和署名,谢谢!】

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

阿里云大学创新人才赋能模式,助力贵州大数据基础人才建设

近年来,云计算与大数据持续火热,整个行业呈井喷式的快速发展。2014年3月,“大数据”首次写入《政府工作报告》,2017年两会,李克强总理更是指出“加快大数据、云计算、物联网应用,以新技术新业态新模式,推动传统产业生产、管理和营销模式变革。把发展智能制造作为主攻方向,完善制造强国建设政策体系。” 作为全国首个国家大数据综合试验区,贵州在资源、环境、政策、区位等方面积累了丰富的大数据产业发展优势。自2014年以来,贵州先后出台了系列政策措施,加快推进大数据产业发展,建设了首个国家大数据工程实验室、贵州·中国南方数据中心示范基地、贵阳·贵安国家级互联网骨干直联点等,实现了跨越式的发展。 大数据战略快速推进的背后,相关人才的培养就变得尤为重要。早在2016年5月份,贵阳市政府就出台了《贵阳市大数据“十百千万”人才培养计划实施方案》,2年内将

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

[零基础学JAVA]Java SE应用部分-34.Java常用API类库

本季目标 1、StringBuffer类 2、Runtime 类 3、包装类与JDK 1.5的新特性——泛型 4、日期的操作类 5、Math类 6、Random类 1、StringBuffer(重点) · String 类的时候说过:String 类的内容一旦声明则不可改变,改变的只是其地址。那么如果现在非要使用循环不断的修改String内容的时候,则就可以使用StringBuffer,也是一个字符串,但是可以修改。 · String类中的字符串连接使用的是“+”,而StringBuffer中的连接使用的是append()方法。 看下效果: 在内容会不断修改的时候使用StringBuffer比较合适。 现在再看下效果哈~ StringBuffer是不能直接转成String 类对象,必须调用toString()方法才可以把一个StringBuffer 的对象变为String类的对象。 2、Runtime表示运行时(了解) 在一个JVM中只有一个运行时,可以通过此类调用本机的一些程序。 此类中所有的构造方法对外部不可见,也就是说构造方法被私有化了,所以看不见。 单态 --> 在整个JVM中只能有一个运行时,所以其内部必然有一个方法可以取得Runtime对象。 public static Runtime getRuntime() 看下效果: Exec方法返回的是一个Process对象 看下效果:记事本打开三秒后自动关闭了哈~ 3、包装类 在JAVA 中提出了一种概念:一切皆对象,如果有此概念的话,则肯定有个矛盾点: 基本数据类型是对象吗?肯定不是,那么此时如果要符合之前的理论,则必须把基本数据类型进行包装。 看下效果:这就是典型包装类的使用哈~ 实际上包装类即可以把一个基本类型包装成对象,也可以把包装类变为基本数据类型。 Integer --> int: public int intValue()可以实现 看下效果: 以上的操作在 JDK 1.4之前都是这样做的,必须手工进行装箱或拆箱操作,而且包装类是不能直接进行++或—操作的。 在JDK 1.5之后提供了自动的装箱和拆箱操作,用户不用像之前那样必须直接调用方法完成了。 看下效果: 3、包装类与JDK 1.5的新特性——泛型 思考题: 现在要求实现一个坐标的操作类,有以下三种坐标: · 整数:x = 30 ; y = 50 · 小数:x = 30.3 ; y = 50.5 · 字符串:东经,北纬 考虑点: 对于用户而言,肯定只关心x和y的设置,你不能说让用户自己去选择设置整数或小数等。 以上问题我通过方法的重载做?我们验证一下使用方法的重载哈~ 此处就可以使用JDK 1.5提供的新功能 —— 泛型,在运行的时候由外部指定具体的操作类型。 4、日期的操作类 取得当前的日期 可以直接使用java.util.Date类完成。 打印的时间:Tue Mar 10 21:05:44 CST 2009 这样的时间看起来很别扭,不太符合我们中国人的习惯。一般直接使用此类的话,得到的时间不是很舒服,可以直接使用另外一个类——Calendar,此类可以把时间精确到毫秒。 Calendar是一个抽象类,如果是抽象类,则此处肯定使用其子类完成。 看下效果: 下面我们有选择滴进行删减哈~ (2)日期的格式化类 例如,现在有以下一个时间: 2009-3-10 21:18:30:345 将以上的时间格式显示为: 2009年3月10日 21点18分30 秒345毫秒 把之前的日期格式重新格式化了一下。 如果要完成上面的功能,则就可以使用SimpleDateFormart类,此类可以使用固定的模板把时间扣出来。 看下效果哈~ 5、Math类 数学操作类,但是在面试中里面有一个方法比较常见: round()方法 ,这个方法主要就是四舍五入哈~~~ 四舍五入的操作类 来看下效果哈~ 6、Random类,取得随机数 看下效果: #######################Michael分割线####################### 谨以此博文 庆祝一下今天成为〓博客之星〓 #######################Michael分割线####################### 本文转自redking51CTO博客,原文链接:http://blog.51cto.com/redking/137834 ,如需转载请自行联系原作者

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

Android基础:listview的item点击事件会使里面的Button也出现按压的效果

给listview里面的button设置selector后,当给listview设置listview.setOnitemClickedListener()的时候,里面的button会有press的效果,有两个方案 1:放弃listview的onItemClickedListener() listview.setOnItemClickedListener(null); 2:使用自定义的Button,判断他的父控件是否press,如果是就把这个事件消耗掉,不向下传递即可, 可用代码如下: package com.audiocn.kalaok.widget; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.Button; public class FixedListButton extends Button { public FixedListButton(Context context) { super (context); } public FixedListButton(Context context, AttributeSet attrs) { super (context, attrs); } public FixedListButton(Context context, AttributeSet attrs, int defStyle) { super (context, attrs, defStyle); } @Override public void setPressed( boolean pressed) { if (pressed && getParent() instanceof View && ((View) getParent()).isPressed()) { return ; } super .setPressed(pressed); } } 本文转自demoblog博客园博客,原文链接http://www.cnblogs.com/0616--ataozhijia/archive/2012/11/02/2751731.html如需转载请自行联系原作者 demoblog

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

《微软-统一沟通-UC 2013》-1-部署-基础架构-1-install AD DS

《微软-统一沟通-UC 2013》 实验环境-产品: 1. Windows Server 2012 2. Sql Server 2012 3. Office Web Apps Server 2013 4. Exchange Server 2013 5. SharePoint Server 2013 6. Lync Server 2013 7. Forefront Threat Management Gateway 2010 *************** 只有你想不到的! 没有你做不到的! *************** Installing AD DS by using Server Manager AD DS can be installed in Windows Server 2012 by using the Add Roles Wizard in Server Manager, followed by the Active Directory Domain Services Configuration Wizard, which is new beginning in Windows Server 2012. The Active Directory Domain Services Installation Wizard (dcpromo.exe) is deprecated beginning in Windows Server 2012. The following sections explain how to create server pools in order to install and manage AD DS on multiple servers, and how to use the wizards to install AD DS. Creating server pools Server Manager can pool other servers on the network as long as they are accessible from the computer running Server Manager. Once pooled, you choose those servers for remote installation of AD DS or any other configuration options possible within Server Manager. The computer running Server Manager automatically pools itself. For more information about server pools, see Add Servers to Server Manager . Note In order to manage a domain-joined computer using Server Manager on a workgroup server, or vice-versa, additional configuration steps are needed. For more information, see “Add and manage servers in workgroups” in Add Servers to Server Manager . Installing AD DS Administrative credentials The credential requirements to install AD DS vary depending on which deployment configuration you choose. For more information, see Credential requirements to run Adprep.exe and install Active Directory Domain Services . Use the following procedures to install AD DS using the GUI method. The steps can be performed locally or remotely. For more detailed explanation of these steps, see the following topics: Deploying a Forest with Server Manager Install a Replica Windows Server 2012 Domain Controller in an Existing Domain (Level 200) Install a New Windows Server 2012 Active Directory Child or Tree Domain (Level 200) Install a Windows Server 2012 Active Directory Read-Only Domain Controller (RODC) (Level 200) To install AD DS by using Server Manager 1. In Server Manager, clickManageand clickAdd Roles and Featuresto start the Add Roles Wizard. 2. On theBefore you beginpage, clickNext. 3. On theSelect installation typepage, clickRole-based or feature-based installationand then clickNext. 4. On theSelect destination serverpage, clickSelect a server from the server pool, click the name of the server where you want to install AD DS and then clickNext. To select remote servers, first create a server pool and add the remote servers to it. For more information about creating server pools, see Add Servers to Server Manager . 5. On theSelect server rolespage, clickActive Directory Domain Services, then on theAdd Roles and Features Wizarddialog box, clickAdd Features, and then clickNext. 6. On theSelect featurespage, select any additional features you want to install and clickNext. 7. On theActive Directory Domain Servicespage, review the information and then clickNext. 8. On theConfirm installation selectionspage, clickInstall. 9. On theResultspage, verify that the installation succeeded, and clickPromote this server to a domain controllerto start the Active Directory Domain Services Configuration Wizard. Important If you close Add Roles Wizard at this point without starting the Active Directory Domain Services Configuration Wizard, you can restart it by clicking Tasks in Server Manager. 10. On theDeployment Configurationpage, choose one of the following options: o If you are installing an additional domain controller in an existing domain, clickAdd a domain controller to an existing domain, and type the name of the domain (for example, emea.corp.contoso.com) or clickSelect…to choose a domain, and credentials (for example, specify an account that is a member of the Domain Admins group) and then clickNext. Note The name of the domain and current user credentials are supplied by default only if the machine is domain-joined and you are performing a local installation. If you are installing AD DS on a remote server, you need to specify the credentials, by design. If current user credentials are not sufficient to perform the installation, clickChange…in order to specify different credentials. o For more information, see Install a Replica Windows Server 2012 Domain Controller in an Existing Domain (Level 200) . o If you are installing a new child domain, clickAdd a new domain to an existing forest, forSelect domain type, selectChild Domain, type or browse to the name of the parent domain DNS name (for example, corp.contoso.com), type the relative name of the new child domain (for example emea), type credentials to use to create the new domain, and then clickNext. For more information, see Install a New Windows Server 2012 Active Directory Child or Tree Domain (Level 200) . o If you are installing a new domain tree, clickAdd new domain to an existing forest, forSelect domain type, chooseTree Domain, type the name of the root domain (for example, corp.contoso.com), type the DNS name of the new domain (for example, fabrikam.com), type credentials to use to create the new domain, and then clickNext. For more information, see Install a New Windows Server 2012 Active Directory Child or Tree Domain (Level 200) . o If you are installing a new forest, clickAdd a new forestand then type the name of the root domain (for example, corp.contoso.com). For more information, see Install a New Windows Server 2012 Active Directory Forest (Level 200) . 11. On theDomain Controller Optionspage, choose one of the following options: o If you are creating a new forest or domain, select the domain and forest functional levels, clickDomain Name System (DNS) server, specify the DSRM password, and then clickNext. o If you are adding a domain controller to an existing domain, clickDomain Name System (DNS) server,Global Catalog (GC), orRead Only Domain Controller (RODC)as needed, choose the site name, and type the DSRM password and then clickNext. For more information about which options on this page are available or not available under different conditions, see Domain Controller Options . 12. On theDNS Optionspage (which appears only if you install a DNS server), clickUpdate DNS delegationas needed. 13. If you do, provide credentials that have permission to create DNS delegation records in the parent DNS zone. If a DNS server that hosts the parent zone cannot be contacted, theUpdate DNS Delegationoption is not available. For more information about whether you need to update the DNS delegation, see Understanding Zone Delegation . If you attempt to update the DNS delegation and encounter an error, see DNS Options . 14. On theRODC Optionspage (which appears only if you install an RODC), specify the name of a group or user who will manage the RODC, add accounts to or remove accounts from the Allowed or Denied password replication groups, and then clickNext. For more information, see Password Replication Policy . 15. On theAdditional Optionspage, choose one of the following options: o If you are creating a new domain, type a new NetBIOS name or verify the default NetBIOS name of the domain, and then clickNext. o If you are adding a domain controller to an existing domain, select the domain controller that you want to replicate the AD DS installation data from (or allow the wizard to select any domain controller). If you are installing from media, clickInstall from media pathtype and verify the path to the installation source files, and then clickNext. You cannot use install from media (IFM) to install the first domain controller in a domain. IFM does not work across different operating system versions. In other words, in order to install an additional domain controller that runs Windows Server 2012 by using IFM, you must create the backup media on a Windows Server 2012 domain controller. For more information about IFM, see Installing an Additional Domain Controller by Using IFM . 16. On thePathspage, type the locations for the Active Directory database, log files, and SYSVOL folder (or accept default locations), and clickNext. Important Do not store the Active Directory database, log files, or SYSVOL folder on a data volume formatted with Resilient File System (ReFS). 17. On thePreparation Optionspage, type credentials that are sufficient to run adprep. For more information, see Credential requirements to run Adprep.exe and install Active Directory Domain Services . 18. On theReview Optionspage, confirm your selections, clickView scriptif you want to export the settings to a Windows PowerShell script, and then clickNext. 19. On thePrerequisites Checkpage, confirm that prerequisite validation completed and then clickInstall. Automatically Restart OS 20. On theResultspage, verify that the server was successfully configured as a domain controller. The server will be restarted automatically to complete the AD DS installation. 本文转自 CTO_LiuJinFeng 51CTO博客,原文链接:http://blog.51cto.com/dynamic/1155585,如需转载请自行联系原作者

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

《微软-统一沟通-UC 2013》-1-部署-基础架构-2-Add a domain controller

《微软-统一沟通-UC 2013》 实验环境-产品: 1. Windows Server 2012 2. Sql Server 2012 3. Office Web Apps Server 2013 4. Exchange Server 2013 5. SharePoint Server 2013 6. Lync Server 2013 7. Forefront Threat Management Gateway 2010 ***************** 只有你想不到的! 没有你做不到的! ***************** Installing AD DS by using Server Manager AD DS can be installed in Windows Server 2012 by using the Add Roles Wizard in Server Manager, followed by the Active Directory Domain Services Configuration Wizard, which is new beginning in Windows Server 2012. The Active Directory Domain Services Installation Wizard (dcpromo.exe) is deprecated beginning in Windows Server 2012. The following sections explain how to create server pools in order to install and manage AD DS on multiple servers, and how to use the wizards to install AD DS. Creating server pools Server Manager can pool other servers on the network as long as they are accessible from the computer running Server Manager. Once pooled, you choose those servers for remote installation of AD DS or any other configuration options possible within Server Manager. The computer running Server Manager automatically pools itself. For more information about server pools, see Add Servers to Server Manager . Note In order to manage a domain-joined computer using Server Manager on a workgroup server, or vice-versa, additional configuration steps are needed. For more information, see “Add and manage servers in workgroups” in Add Servers to Server Manager . Installing AD DS Administrative credentials The credential requirements to install AD DS vary depending on which deployment configuration you choose. For more information, see Credential requirements to run Adprep.exe and install Active Directory Domain Services . Use the following procedures to install AD DS using the GUI method. The steps can be performed locally or remotely. For more detailed explanation of these steps, see the following topics: Deploying a Forest with Server Manager Install a Replica Windows Server 2012 Domain Controller in an Existing Domain (Level 200) Install a New Windows Server 2012 Active Directory Child or Tree Domain (Level 200) Install a Windows Server 2012 Active Directory Read-Only Domain Controller (RODC) (Level 200) To install AD DS by using Server Manager 1. In Server Manager, clickManageand clickAdd Roles and Featuresto start the Add Roles Wizard. 2. On theBefore you beginpage, clickNext. 3. On theSelect installation typepage, clickRole-based or feature-based installationand then clickNext. 4. On theSelect destination serverpage, clickSelect a server from the server pool, click the name of the server where you want to install AD DS and then clickNext. To select remote servers, first create a server pool and add the remote servers to it. For more information about creating server pools, see Add Servers to Server Manager . 5. On theSelect server rolespage, clickActive Directory Domain Services, then on theAdd Roles and Features Wizarddialog box, clickAdd Features, and then clickNext. 6. On theSelect featurespage, select any additional features you want to install and clickNext. 7. On theActive Directory Domain Servicespage, review the information and then clickNext. 8. On theConfirm installation selectionspage, clickInstall. 9. On theResultspage, verify that the installation succeeded, and clickPromote this server to a domain controllerto start the Active Directory Domain Services Configuration Wizard. Important If you close Add Roles Wizard at this point without starting the Active Directory Domain Services Configuration Wizard, you can restart it by clicking Tasks in Server Manager. 10. On theDeployment Configurationpage, choose one of the following options: o If you are installing an additional domain controller in an existing domain, clickAdd a domain controller to an existing domain, and type the name of the domain (for example, emea.corp.contoso.com) or clickSelect…to choose a domain, and credentials (for example, specify an account that is a member of the Domain Admins group) and then clickNext. Note The name of the domain and current user credentials are supplied by default only if the machine is domain-joined and you are performing a local installation. If you are installing AD DS on a remote server, you need to specify the credentials, by design. If current user credentials are not sufficient to perform the installation, clickChange…in order to specify different credentials. o For more information, see Install a Replica Windows Server 2012 Domain Controller in an Existing Domain (Level 200) . o If you are installing a new child domain, clickAdd a new domain to an existing forest, forSelect domain type, selectChild Domain, type or browse to the name of the parent domain DNS name (for example, corp.contoso.com), type the relative name of the new child domain (for example emea), type credentials to use to create the new domain, and then clickNext. For more information, see Install a New Windows Server 2012 Active Directory Child or Tree Domain (Level 200) . o If you are installing a new domain tree, clickAdd new domain to an existing forest, forSelect domain type, chooseTree Domain, type the name of the root domain (for example, corp.contoso.com), type the DNS name of the new domain (for example, fabrikam.com), type credentials to use to create the new domain, and then clickNext. For more information, see Install a New Windows Server 2012 Active Directory Child or Tree Domain (Level 200) . o If you are installing a new forest, clickAdd a new forestand then type the name of the root domain (for example, corp.contoso.com). For more information, see Install a New Windows Server 2012 Active Directory Forest (Level 200) . 11. On theDomain Controller Optionspage, choose one of the following options: o If you are creating a new forest or domain, select the domain and forest functional levels, clickDomain Name System (DNS) server, specify the DSRM password, and then clickNext. o If you are adding a domain controller to an existing domain, clickDomain Name System (DNS) server,Global Catalog (GC), orRead Only Domain Controller (RODC)as needed, choose the site name, and type the DSRM password and then clickNext. For more information about which options on this page are available or not available under different conditions, see Domain Controller Options . 12. On theDNS Optionspage (which appears only if you install a DNS server), clickUpdate DNS delegationas needed. 13. If you do, provide credentials that have permission to create DNS delegation records in the parent DNS zone. If a DNS server that hosts the parent zone cannot be contacted, theUpdate DNS Delegationoption is not available. For more information about whether you need to update the DNS delegation, see Understanding Zone Delegation . If you attempt to update the DNS delegation and encounter an error, see DNS Options . 14. On theRODC Optionspage (which appears only if you install an RODC), specify the name of a group or user who will manage the RODC, add accounts to or remove accounts from the Allowed or Denied password replication groups, and then clickNext. For more information, see Password Replication Policy . 15. On theAdditional Optionspage, choose one of the following options: o If you are creating a new domain, type a new NetBIOS name or verify the default NetBIOS name of the domain, and then clickNext. o If you are adding a domain controller to an existing domain, select the domain controller that you want to replicate the AD DS installation data from (or allow the wizard to select any domain controller). If you are installing from media, clickInstall from media pathtype and verify the path to the installation source files, and then clickNext. You cannot use install from media (IFM) to install the first domain controller in a domain. IFM does not work across different operating system versions. In other words, in order to install an additional domain controller that runs Windows Server 2012 by using IFM, you must create the backup media on a Windows Server 2012 domain controller. For more information about IFM, see Installing an Additional Domain Controller by Using IFM . 16. On thePathspage, type the locations for the Active Directory database, log files, and SYSVOL folder (or accept default locations), and clickNext. Important Do not store the Active Directory database, log files, or SYSVOL folder on a data volume formatted with Resilient File System (ReFS). 17. On thePreparation Optionspage, type credentials that are sufficient to run adprep. For more information, see Credential requirements to run Adprep.exe and install Active Directory Domain Services . 18. On theReview Optionspage, confirm your selections, clickView scriptif you want to export the settings to a Windows PowerShell script, and then clickNext. 19. On thePrerequisites Checkpage, confirm that prerequisite validation completed and then clickInstall. Automatically Restart OS 20. On theResultspage, verify that the server was successfully configured as a domain controller. The server will be restarted automatically to complete the AD DS installation. 本文转自 CTO_LiuJinFeng 51CTO博客,原文链接:http://blog.51cto.com/dynamic/1156186,如需转载请自行联系原作者

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

App各种Icon及Launch image的尺寸和用途 移动端尺寸基础知识

IOS7,8 Asset iPhone 6 Plus (@3x) iPhone 6 and iPhone 5 (@2x) iPhone 4s (@2x) iPad and iPad mini (@2x) iPad 2 and iPad mini (@1x) App icon 180 x 180 120 x 120 120 x 120 152 x 152 76 x 76 App icon for the App Store 1024 x 1024 1024 x 1024 1024 x 1024 1024 x 1024 1024 x 1024 Launch image 1242 x 2208 (portrait) 2208 x 1242 (landscape) For iPhone 6, 750 x 1334 For iPhone 5, 640 x 1136 640 x 960 1536 x 2048 (portrait) 2048 x 1536 (landscape) 768 x 1024 (portrait) 1024 x 768 (landscape) Spotlight search results icon 120 x 120 80 x 80 80 x 80 80 x 80 40 x 40 Settings icon 87 x 87 58 x 58 58 x 58 58 x 58 29 x 29 IOS 5,6 Description Size for iPhone 5 and iPod touch (5th generation) Size for high-resolution iPhone and iPod touch Size for iPhone and iPod touch Size for high-resolution iPad Size for iPad App icon 114 x 114 114 x 114 57 x 57 144 x 144 72 x 72 App icon for the App Store 1024 x 1024 (recommended) 1024 x 1024 (recommended) 512 x 512 1024 x 1024 (recommended) 512 x 512 Launch image 640 x 1136 640 x 960 320 x 480 1536 x 2008 (portrait) 2048 x 1496 (landscape) 768 x 1004 (portrait) 1024 x 748 (landscape) Small icon for Spotlight search results and Settings 58 x 58 58 x 58 29 x 29 100 x 100 (Spotlight search results) 58 x 58 (Settings) 50 x 50 (Spotlight search results) 29 x 29 (Settings) 初涉移动端设计和开发的同学们,基本都会在尺寸问题上纠结好一阵子才能摸到头绪。我也花了很长时间才弄明白,感觉有必要写一篇足够通俗易懂的教程来帮助大家。从原理说起,理清关于尺寸的所有细节。由于是写给初学者的,所以不要嫌我啰嗦。 现象 首先说现象,大家都知道移动端设备屏幕尺寸非常多,碎片化严重。尤其是Android,你会听到很多种分辨率:480x800, 480x854, 540x960, 720x1280, 1080x1920,而且还有传说中的2K屏。近年来iPhone的碎片化也加剧了:640x960, 640x1136, 750x1334, 1242x2208。 不要被这些尺寸吓倒。实际上大部分的app和移动端网页,在各种尺寸的屏幕上都能正常显示。说明尺寸的问题一定有解决方法,而且有规律可循。 像素密度 要知道,屏幕是由很多像素点组成的。之前提到那么多种分辨率,都是手机屏幕的实际像素尺寸。比如480x800的屏幕,就是由800行、480列的像素点组成的。每个点发出不同颜色的光,构成我们所看到的画面。而手机屏幕的物理尺寸,和像素尺寸是不成比例的。最典型的例子,iPhone 3gs的屏幕像素是320x480,iPhone 4s的屏幕像素是640x960。刚好两倍,然而两款手机都是3.5英寸的。 所以,我们要引入最重要的一个概念:像素密度,也就是PPI(pixels per inch)。这项指标是连接数字世界与物理世界的桥梁。 Pixels per inch,准确的说是每英寸的长度上排列的像素点数量。1英寸是一个固定长度,等于2.54厘米,大约是食指最末端那根指节的长度。像素密度越高,代表屏幕显示效果越精细。Retina屏比普通屏清晰很多,就是因为它的像素密度翻了一倍。 倍率与逻辑像素 再用iPhone 3gs和4s来举例。假设有个邮件列表界面,我们不妨按照PC端网页设计的思维来想象。3gs上大概只能显示4-5行,4s就能显示9-10行,而且每行会变得特别宽。但两款手机其实是一样大的。如果照这种方式显示,3gs上刚刚好的效果,在4s上就会小到根本看不清字。 在现实中,这两者效果却是一样的。这是因为Retina屏幕把2x2个像素当1个像素使用。比如原本44像素高的顶部导航栏,在Retina屏上用了88个像素的高度来显示。导致界面元素都变成2倍大小,反而和3gs效果一样了。画质却更清晰。 在以前,iOS应用的资源图片中,同一张图通常有两个尺寸。你会看到文件名有的带@2x字样,有的不带。其中不带@2x的用在普通屏上,带@2x的用在Retina屏上。只要图片准备好,iOS会自己判断用哪张,Android道理也一样。 由此可以看出,苹果以普通屏为基准,给Retina屏定义了一个2倍的倍率(iPhone 6plus除外,它达到了3倍)。实际像素除以倍率,就得到逻辑像素尺寸。只要两个屏幕逻辑像素相同,它们的显示效果就是相同的。 Android的解决方法类似,但更复杂一些。因为Android屏幕尺寸实在太多,分辨率高低跨度非常大,不像苹果只有那么几款固定设备、固定尺寸。所以Android把各种设备的像素密度划成了好几个范围区间,给不同范围的设备定义了不同的倍率,来保证显示效果相近。像素密度概念虽然重要,但用不着我们自己算,iOS与Android都帮我们算好了。 如图所示,像素密度在120左右的屏幕归为ldpi,160左右的归为mdpi,以此类推。这样,所有的Android屏幕都找到了自己的位置,并赋予了相应的倍率: ldpi [0.75倍] mdpi [1倍] hdpi [1.5倍] xhdpi [2倍] xxhdpi [3倍] xxxhdpi [4倍] 各型号iPhone的倍率比较简单,我们后面会讲到。那么Android手机那么多,具体怎么分?哪些手机是几倍的倍率呢?我们先看一张表,这是友盟2014年10月到2015年03月的数据: 就目前市场状况而言,各种手机的分辨率可以这样粗略判断。虽然不全面,但至少在1年内都还有一定的参考意义: ldpi 如今已绝迹,不用考虑 mdpi [320x480](市场份额不足5%,新手机不会有这种倍率,屏幕通常都特别小) hdpi [480x800、480x854、540x960](早年的低端机,屏幕在3.5英寸档位;如今的低端机,屏幕在4.7-5.0英寸档位) xhdpi [720x1280](早年的中端机,屏幕在4.7-5.0英寸档位;如今的中低端机,屏幕在5.0-5.5英寸档位) xxhdpi [1080x1920](早年的高端机,如今的中高端机,屏幕通常都在5.0英寸以上) xxxhdpi [1440x2560](极少数2K屏手机,比如Google Nexus 6) 自然地,以1倍的mdpi作为基准。像素密度更高或者更低的设备,只需乘以相应的倍率,就能得到与基准倍率近似的显示效果。 不过需要注意的是,Android设备的逻辑像素尺寸并不统一。比如两种常见的屏幕480x800和1080x1920,它们分别属于hdpi和xxhdpi。除以各自倍率1.5倍和3倍,得到逻辑像素为320x533和360x640。很显然,后者更宽更高,能显示更多内容。所以,即使有倍率的存在,各种Android设备的显示效果仍然无法做到完全一致。 单位 不难发现,真正决定显示效果的,是逻辑像素尺寸。为此,iOS和Android平台都定义了各自的逻辑像素单位。iOS的尺寸单位为pt,Android的尺寸单位为dp。说实话,两者其实是一回事。 单位之间的换算关系随倍率变化: 1倍:1pt=1dp=1px(mdpi、iPhone 3gs) 1.5倍:1pt=1dp=1.5px(hdpi) 2倍:1pt=1dp=2px(xhdpi、iPhone 4s/5/6) 3倍:1pt=1dp=3px(xxhdpi、iPhone 6) 4倍:1pt=1dp=4px(xxxhdpi) 单位决定了我们的思考方式。在设计和开发过程中,应该尽量使用逻辑像素尺寸来思考界面。设计Android应用时,有的设计师喜欢把画布设为1080x1920,有的喜欢设成720x1280。给出的界面元素尺寸就不统一了。Android的最小点击区域尺寸是48x48dp,这就意味着在xhdpi的设备上,按钮尺寸至少是96x96px。而在xxhdpi设备上,则是144x144px。 无论画布设成多大,我们设计的是基准倍率的界面样式,而且开发人员需要的单位都是逻辑像素。所以为了保证准确高效的沟通,双方都需要以逻辑像素尺寸来描述和理解界面,无论是在标注图还是在日常沟通中。不要再说“底部标签栏的高度是96像素,我是按照xhdpi做的”这样的话了。 Web怎么办 移动端页面的绝对单位仍然是px,至少代码里这么写,但它的道理也和app一样。由于像素密度是设备本身的固有属性,它会影响到设备中的所有应用,包括浏览器。前端技术可以善加利用设备的像素密度,只需一行代码,浏览器便会使用app的显示方式来渲染页面。根据像素密度,按相应倍率缩放。 可以通过这个测试页面http://greenzorro.github.io/demo/basic/响应式断点.html来看看你的移动设备屏幕宽度,这是逻辑像素宽度。 以iPhone 5s为例,屏幕的分辨率是640x1136,倍率是2。浏览器会认为屏幕的分辨率是320x568,仍然是基准倍率的尺寸。所以在制作页面时,只需要按照基准倍率来就行了。无论什么样的屏幕,倍率是多少,都按逻辑像素尺寸来设计和开发页面。只不过在准备资源图的时候,需要准备2倍大小的图,通过代码把它缩成1倍大小显示,才能保证清晰。 实际应用 大家最关心的还是实际运用,画布该怎么设置。我们就iOS、Android、Web三个平台来分别梳理一下。不过在这之前,我要为使用PS进行设计的朋友介绍一个小技巧。 之前我说过,我们要以逻辑像素尺寸来思考界面。体现到设计过程中,就是要把单位设置成逻辑像素。打开PS的首选项——单位与标尺界面,把尺寸和文字单位都改成点(Point)。这里的点也就是pt,无论设计iOS、Android还是Web应用,单位都用它。当然,各平台单位名称还是要记住的。这里我们用的只是它的原理,不用在意名称。 要调节倍率,则通过图像大小里的DPI来控制。这个DPI,其实就是PPI,像素密度。有个常识大家都知道,屏幕上的设计DPI设成72,印刷品设计DPI设成300。为什么是这两个数字? 首先说300,这和人眼的分辨能力有关。由于1英寸是固定长度,每1英寸有多少个像素点决定了画质清晰程度。之前说过,这就是像素密度,也就是DPI。DPI达到300以上,其细腻程度就会给人真实感,像真实世界中的物件。相反,DPI只有10的话,在你一个食指指节大小的长度内只有10个像素,这明显就是马赛克了。所以印刷品要设成300,才能保证清晰。 再说72,这有一定的历史原因。最早的图形设计是在mac电脑上进行的,mac本身的显示器分辨率就是72。PS中把图像DPI也设成72,就能保证屏幕上显示的尺寸和打印尺寸相同,便于设计。72的PC显示器分辨率逐渐成为一种默认的行业标准,这套规则就这么沿用下来。 现在回到正题,我们怎么通过DPI来调节倍率?既然屏幕本身的分辨率是72,DPI设成72刚好是1倍尺寸,那设成72的两倍就是倍率为2的屏幕了,就这么简单。 下面来看看3个平台各自的画布设置: iPhone iPhone的屏幕尺寸各不相同,我说的是逻辑像素尺寸,这确实是让人很头疼的事情。如果想用一套设计涵盖所有iPhone,就要选择逻辑像素折中的机型。 从市场占有率数据来看,目前最多的是iPhone5/5s的屏幕。倍率为2,逻辑像素320x568。上升势头最猛,未来有望登上第一的是iPhone 6的屏幕。倍率为2,逻辑像素375x667。 按照这两种尺寸来设计,都是比较主流的做法。可以兼顾短一些的iPhone 4s,大一点的6 plus也不会过于空旷。 不过在切图的时候要注意,由于iPhone 6 plus的3倍图是由2倍图放大而来,所以位图要注意保证清晰。 Android 都说Android碎片化严重,但它现在反而比iOS好处理。因为如今的Android屏幕逻辑像素已经趋于统一了:360x640,就看你设成几倍了。想以xhdpi为准,就把DPI设成72x2=144。想以xxhdpi为准,就把DPI设成72x3=216。 对于那些比较老的低端机,宽度是480px的那批,画面确实会小一些,显示内容会更少。稍微留意一下,重要内容尽量保持在界面中上部分。 当然,这些机型不出一年就会被边缘化,基本淘汰。现在能运转的也是当作功能机在用,软件多了必卡无疑,用户体验无从谈起。不作考虑也是OK的。 Web 手机端网页就没有统一标准了,比较流行的做法是按照iPhone 5的尺寸来设计。倍率2,逻辑像素320x568。 这样的做法比较实在,倍率2的屏幕无论在iOS还是Android方面都是主流,而且又是2倍屏幕中逻辑像素最小的。所以图片的尺寸可以保持在较小的水平,页面加载速度快。当然,缺点就是在倍率3的设备上看,图片不是特别清晰。 如果追求图片质量,愿意牺牲加载速度,那么可以按照最大的屏幕来设计。也就是iPhone 6 plus的尺寸,倍率3,逻辑像素414x736。 总结 移动端的尺寸比PC端复杂,关键就在倍率。但也正因为倍率的存在,把大大小小的屏幕拉回到同一水平线,得以保证一套设计适应各种屏幕。站在这条水平线的角度看,会发现它很好理解。

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

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

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

用户登录
用户注册