
能力说明:
掌握封装、继承和多态设计Java类的方法,能够设计较复杂的Java类结构;能够使用泛型与集合的概念与方法,创建泛型类,使用ArrayList,TreeSet,TreeMap等对象掌握Java I/O原理从控制台读取和写入数据,能够使用BufferedReader,BufferedWriter文件创建输出、输入对象。
暂时未有相关云产品技术能力~
阿里云技能认证
详细说明File - Project Structure - Facets 然后选择自己新建的yml文件即可。
一、标识符 1、什么是标识符? Java语言中,对于变量,常量,函数,语句块也有名字,我们统统称之为Java标识符. 标识符是用来给类、对象、方法、变量、接口和自定义数据类型命名的。 2、标识符的构成 标识符是没有长度限制的由Java字母和数字构成的序列,其中首字母必须是Java字母 "Java字母" 是作为参数调用Character.isJavaIdentifierStart(int)方法时返回true的字符 "Java字母或数字" 是作为参数调用Character.isJavaIdentifierPart(int)方法时返回true的字符 "Java字母"包括大写和小写的ASCII拉丁字母A~Z ( \u0041 ~ \u005a )和 a~z (\u0061 ~ \u007a ),并且由于历史原因还包括下划线 (_ 或 \u005f) 和美元符号( $ 或 \u0024 )。$符号应该仅出现在机器生成的源代码中,或者用于另一种函件的情况,即访问遗留系统中已有的名字。 "Java数字"包括ASCII数字0~9(\u0030 ~ \u0039) 例子: package com.yy.test; /** * Created by anyang on 2018/1/4. */ public class Class_2018_01_04_01 { public static void 挖到(){ System.out.println("我是汉字"); } public static void Á(){ //注意:这是两个字符,是希腊字母A和一个无空格上提号 复制下来退格就能清楚的看到了(非空格标记) System.out.println("我是字母A和无空格间隙的上提号组合"); } public static void Á(){ System.out.println("我是希腊字母"); } public enum test{ 我是DJ, 我不是DJ, 我到底是不是DJ } public static void main(String[] args) { 挖到(); System.out.println(Character.isJavaIdentifierPart(97)); System.out.println("代码点值是: "+(int)'_'); } } 如上例,看似完全相同的Á和Á却有着天壤之别。 3、 使用标识符应该注意 标识符的拼写不能与关键字、布尔字面常量、空字面常量或编译时发生的错误的拼写相同 两个标识符只有在拼写完全相同,即每个对应的Unicode字母或者数字都相同的时候才会被认为是相同的标识符。具有相同外观的标识符仍旧有可能是不同的。 二、关键字 1、关键字都有哪些 Java保留了50个关键字,他们都是由ASCII字母构成的字符序列,并且不能当做标识符使用,他们包括: abstract continue for new switch assert default if package synchronized boolean do goto private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while 2、其他注意事项 尽管现在已经不再使用关键字const和goto了,但仍旧保留了。这使得当这些C++关键字在程序中使用不当时,Java编译器能够产生更有用的错误消息 尽管true和false看起来应该被当做关键字,但从技术上讲,他们仅仅只是布尔字面常量。与此类似null看起来也应该被当做关键字,但他也仅仅只是空字面常量。 三、关于Character.isJavaIdentifierPart(int) /** * Determines if the character (Unicode code point) may be part of a Java * identifier as other than the first character. * <p> * A character may be part of a Java identifier if any of the following * are true: * <ul> * <li> it is a letter 字母组合(单词) * <li> it is a currency symbol (such as {@code '$'}) 货币符号如:美元符号 * <li> it is a connecting punctuation character (such as {@code '_'}) 连接标点字符如:下划线 * <li> it is a digit 数字 * <li> it is a numeric letter (such as a Roman numeral character) 数字字母如:罗马数字等 * <li> it is a combining mark 结合字符(举例说明) * <li> it is a non-spacing mark 非空格标记(举例说明) * <li> {@link #isIdentifierIgnorable(int) * isIdentifierIgnorable(codePoint)} returns {@code true} for * the character * </ul> * * @param codePoint the character (Unicode code point) to be tested. * @return {@code true} if the character may be part of a * Java identifier; {@code false} otherwise. * @see Character#isIdentifierIgnorable(int) * @see Character#isJavaIdentifierStart(int) * @see Character#isLetterOrDigit(int) * @see Character#isUnicodeIdentifierPart(int) * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence) * @since 1.5 */ public static boolean isJavaIdentifierPart(int codePoint) { return CharacterData.of(codePoint).isJavaIdentifierPart(codePoint); } package java.lang; abstract class CharacterData { abstract int getProperties(int ch); abstract int getType(int ch); abstract boolean isWhitespace(int ch); abstract boolean isMirrored(int ch); abstract boolean isJavaIdentifierStart(int ch); abstract boolean isJavaIdentifierPart(int ch); abstract boolean isUnicodeIdentifierStart(int ch); abstract boolean isUnicodeIdentifierPart(int ch); abstract boolean isIdentifierIgnorable(int ch); abstract int toLowerCase(int ch); abstract int toUpperCase(int ch); abstract int toTitleCase(int ch); abstract int digit(int ch, int radix); abstract int getNumericValue(int ch); abstract byte getDirectionality(int ch); //need to implement for JSR204 int toUpperCaseEx(int ch) { return toUpperCase(ch); } char[] toUpperCaseCharArray(int ch) { return null; } boolean isOtherLowercase(int ch) { return false; } boolean isOtherUppercase(int ch) { return false; } boolean isOtherAlphabetic(int ch) { return false; } boolean isIdeographic(int ch) { return false; } // Character <= 0xff (basic latin) is handled by internal fast-path // to avoid initializing large tables. // Note: performance of this "fast-path" code may be sub-optimal // in negative cases for some accessors due to complicated ranges. // Should revisit after optimization of table initialization. static final CharacterData of(int ch) { if (ch >>> 8 == 0) { // fast-path return CharacterDataLatin1.instance; } else { switch(ch >>> 16) { //plane 00-16 case(0): return CharacterData00.instance; case(1): return CharacterData01.instance; case(2): return CharacterData02.instance; case(14): return CharacterData0E.instance; case(15): // Private Use case(16): // Private Use return CharacterDataPrivateUse.instance; default: return CharacterDataUndefined.instance; } } } } //假设传参获得的实例是 CharacterData00 的 那么接下来就有 boolean isJavaIdentifierPart(int ch) { int props = getProperties(ch); return ((props & 0x00003000) != 0); } int getProperties(int ch) { char offset = (char)ch; int props = A[Y[X[offset>>5]|((offset>>1)&0xF)]|(offset&0x1)]; return props; } 参考资料:http://blog.csdn.net/mazhimazh/article/details/17708001 https://www.zhihu.com/question/20552606 https://baike.baidu.com/item/java%E6%A0%87%E8%AF%86%E7%AC%A6/11010420?fr=aladdin http://utf8.supfree.net/ 说明:本文大部分引用自《Java语言规范-基于Java SE 8》
先上出现问题的代码:HTML: <div class="info_content txt-item" onclick="selectInfoById(this)"> JS: function selectInfoById(this_) { var uid = $(this_).siblings("input[name=uid]").val(); var url = "/mobile/queryInfoById?uid="+uid; var elementById = document.getElementById("jumphiddenDiv"); var aElement = document.createElement("a"); aElement.setAttribute("id","createa"); aElement.setAttribute("href",url); aElement.setAttribute("data-no-cache","true"); elementById.appendChild(aElement); jQuery("#createa")[0].click(); aElement.remove(); } 稍微解释下,这里在点击之后再remove可能有的人会有疑问,既然跳转了为啥还要remove。这是因为我这里使用了sui的路由功能,跳转之后缓存资源不刷新。 这段代码在ios端不能正常运行报一个这样的错误: 'undefined' is not a function evaluating XX.click() in Safari 这就尴尬了,赶紧上网查,查到这个东西: https://stackoverflow.com/questions/12744202/undefined-is-not-a-function-evaluating-el-click-in-safari# 虽然没有完全看懂,但是也明白个大概齐:他说:“ the click() function is only defined for HTMLInputElement” 并给出了改进意见,根据他的改进意见作出如下改动: JS: function selectInfoById(this_) { var uid = $(this_).siblings("input[name=uid]").val(); var url = "/mobile/queryInfoById?uid="+uid; var elementById = document.getElementById("jumphiddenDiv"); var aElement = document.createElement("a"); aElement.setAttribute("id","createa"); aElement.setAttribute("href",url); aElement.setAttribute("data-no-cache","true"); elementById.appendChild(aElement); //jQuery("#createa")[0].click(); // First create an event var click_ev = document.createEvent("MouseEvents"); // initialize the event click_ev.initEvent("click", true /* bubble */, true /* cancelable */); // trigger the event document.getElementById("createa").dispatchEvent(click_ev); aElement.remove(); }然而并不好使,起初我是怀疑这个改动不对,但是后来发现不是这样的,在IOS里click的鼠标事件应该有touchstart,touchmove、touchend等触摸事件或者他们的高级事件来触发点击屏幕这个事件。所以我又作出如下改动: HTML:改动 <div class="info_content txt-item" onclick="selectInfoById(this)" ontouchstart = "myTouchStart(this)" ontouchend = "myTouchEnd(this)" ontouchmove="myTouchMove(this)"> JS:添加 var xtarget = ""; function myTouchStart(this_) { var e = window.event; xtarget = e.clientX; } function myTouchEnd(this_) { var e = window.event; if(e.clientX ==xtarget){ selectInfoById(this_); xtarget=""; }else{ xtarget=""; } } function myTouchMove(this_) { xtarget=""; } 这些方法写的非常初级,仅供思路参考,表喷我哦。这里加三个方法在html上,主要是为了规避由于路由问题从别的界面切换过来的时候,事件绑定不上的问题。 引用资料(非常感谢): https://www.cnblogs.com/irelands/p/3433628.html http://www.cnblogs.com/dolphinX/archive/2012/10/09/2717119.html https://www.cnblogs.com/fengfan/p/4506555.html http://blog.csdn.net/jiangcs520/article/details/17564065
稍微出示一下我之前的代码 var global_width = ($(window).width()); var info_height = global_width/750*230; 之前需要用js实现的计算相对高度,现在要交给CSS来实现。 通过查阅网上的资料,对CSS3又有了新的认识,css对于数值的计算是使用的calc()然而这个方法有的浏览器不支持,需要稍微做一下适配。(Kiang一下资料:https://www.w3cplus.com/css3/how-to-use-css3-calc-function.html) .elm { /*Firefox*/ -moz-calc(expression); /*chrome safari*/ -webkit-calc(expression); /*Standard */ calc(); } 然后问题来了,如何获取屏幕宽度? 再一次Kiang一下资料:https://www.w3cplus.com/css/7-css-units-you-might-not-know-about.html .slide { width: 100vw; } 使用vh和vw单位即可 然后我的问题就得到了解决: .info_img{ height:calc(100vw / 750 * 230); } 好使! 感谢百度,感谢上面的两位程序员!
解决方式:替换jquery的$定义或者替换zepto.js的$定义 解决方法: jquery有一个方法叫noConflict() ,可以把jquery的$改掉。 var jq=$.noConflict(); 这个时候用jq来代替jquery的$吧。 zepto的符号改掉 window.$$=window.Zepto = Zepto 在zepto里加入这一行代码,就可以用$$来代替zepto里的$了。当然也可以选择其他符号来代替。 例如: <script th:src="@{../../../../mobileJs/jquery-2.1.1.min.js}" ></script> <script>$.noConflict();</script> <script type='text/javascript' th:src="@{//g.alicdn.com/sj/lib/zepto/zepto.js}" charset='utf-8'></script> <script>$.init</script> <script type='text/javascript' th:src="@{//g.alicdn.com/msui/sm/0.6.2/js/sm.js}" charset='utf-8'></script> <script type='text/javascript' th:src="@{//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.js}" charset='utf-8'></script> 因为这里直接去掉了jquery的$定义所以调用时应该是这样的 function confirm(){ var form = jQuery("form[name=fileUploadForm]"); //获取jquery对象 用 jQuery 这是jquery已经定义了的 var options = { url:'/yd111/mobileFileUpload', type:'post', data:form.serialize(), success:function(data){ //alert(data);//成功执行的方法 $.toast(data);//zepto对象还是用$ jQuery(".toast").css("margin-top","75%"); jQuery(".toast").css("margin-left","0px"); } }; form.ajaxSubmit(options); }
配置信息:个人电脑是win10 64位系统,服务器是阿里云CentOS 7.3 64位(小霸王学习机,1G内存60G硬盘)。 一、Redis服务器安装 因为在安装Redis的过程中会需要编译,所以服务器需要一个编译工具 1、安装gcc 在centos下面安装gcc,我们使用yum(包管理器)安装,因为gcc依赖了很多东西,而有些包系统可能已经安 装了,有些没有,所以下面的命令最后都执行一遍,在shell中执行下面的命令: yum install cpp yum install binutils yum install glibc-kernheaders yum install glibc-common yum install glibc-devel yum install gcc yum install make 但通过实践发现,我们的阿里云服务器貌似是有gcc的 2、安装Redis 在这一步中,我们可以跟随官网的节奏走官网的Redis步骤(在这里我继续啰嗦一下) $ wget http://download.redis.io/releases/redis-4.0.2.tar.gz $ tar xzf redis-4.0.2.tar.gz $ cd redis-4.0.2 $ make 素质四连 启动服务: 之前已经进入redis-4.0.2目录 //后台启动redis服务 src/redis-server & //查询redis进程 ps -ef | grep redis //结束进程 kill -9 pid 初步测试: 之前cd进redis-4.0.2 [root@izm5e4ame764563jemkbgaz redis-4.0.2]# src/redis-cli 127.0.0.1:6379> set foo bar OK 127.0.0.1:6379> get foo "bar" 初步测试完成。。。。。。。 3、修改配置文件 在安装完之后可能会稍微对配置上有点个性化需求,这里我只想改一下最大占用内存 redis.conf 在/root/redis-4.0.2 目录下 # limit for maxmemory so that there is some free RAM on the system for slave # output buffers (but this is not needed if the policy is 'noeviction'). # # maxmemory <bytes> 在这里的下面加上最大内存,我设定的是500M maxmemory 524288000 # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory 4、可能出现的问题 如果在安装过程中出现了You need tcl 8.5 or newer in order to run the Redis test make: *** [test] Error 1 类似错误,那么你可能需要安装一下子tcl https://www.cnblogs.com/hanyinglong/p/5036558.html 感谢这位帅哥。 5、参考资料 https://www.cnblogs.com/hanyinglong/p/5036558.html https://redis.io/download http://www.cnblogs.com/lq147760524/p/7010853.html http://blog.csdn.net/luyee2010/article/details/18766911 http://blog.csdn.net/happyrabbit456/article/details/54945667
最近由于个人学习(新手)需要,方便个人项目管理,想利用自己现有的阿里云服务器对项目进行管理,首先根据自己的需要,先使用svn作为目前暂时的管理方法(相对比较简单)。个人电脑是win10 64位系统,服务器是阿里云CentOS 7.3 64位。 一、服务器svn环境搭建(服务器使用的是centos7.3 64位系统) 1、安装svn yum install subversion 2、查看版本号 svnserve --version 3、创建SVN版本库 在这里我直接创建在var/svn 文件夹下。如果么这个目录,就新建这个目录 mkdir -p /var/svn/svnrepos 创建版本库 svnadmin create /var/svn/版本库名字 4、修改conf目录中的authz、passwd、svnserve.conf 修改authz: [\] admin = rw 用户名=rw 读写权限 修改passwd:[users] # harry = harryssecret # sally = sallyssecret admin=000000 用户名=密码 修改svnserve.conf: [general] ### The anon-access and auth-access options control access to the ### repository for unauthenticated (a.k.a. anonymous) users and ### authenticated users, respectively. ### Valid values are "write", "read", and "none". ### Setting the value to "none" prohibits both reading and writing; ### "read" allows read-only access, and "write" allows complete ### read/write access to the repository. ### The sample settings below are the defaults and specify that anonymous ### users have read-only access to the repository, while authenticated ### users have read and write access to the repository. anon-access = read auth-access = write ### The password-db option controls the location of the password ### database file. Unless you specify a path starting with a /, ### the file's location is relative to the directory containing ### this configuration file. ### If SASL is enabled (see below), this file will NOT be used. ### Uncomment the line below to use the default password file. password-db = passwd ### The authz-db option controls the location of the authorization ### rules for path-based access control. Unless you specify a path ### starting with a /, the file's location is relative to the the ### directory containing this file. If you don't specify an ### authz-db, no path-based access control is done. ### Uncomment the line below to use the default authorization file. # authz-db = authz ### This option specifies the authentication realm of the repository. ### If two repositories have the same authentication realm, they should ### have the same password database, and vice versa. The default realm ### is repository's uuid. realm = My First Repository ### The force-username-case option causes svnserve to case-normalize ### usernames before comparing them against the authorization rules in the ### authz-db file configured above. Valid values are "upper" (to upper- ### case the usernames), "lower" (to lowercase the usernames), and ### "none" (to compare usernames as-is without case conversion, which ### is the default behavior). # force-username-case = none 去掉anon-access = read、auth-access = write、password-db = passwd、realm = My First Repository 四句话前面的注释。 注意:以上修改全部顶格,不要留空格,会报错。 5、添加安全组规则(释放3690端口) 6、启动svn svnserve -d -r /var/svn/mystudy 7、客户端访问 svn://ip地址:3690/xxxx (iP地址为你linux的ip,xxxx为前文创建的版本库名称,3690为svn默认端口) 参考资料: http://www.cnblogs.com/mymelon/p/5483215.html http://www.linuxidc.com/Linux/2013-10/91903.htm http://www.linuxidc.com/Linux/2016-01/127679.htm