首页 文章 精选 留言 我的

精选列表

搜索[数据库相关],共10000篇文章
优秀的个人博客,低调大师

马云:想在未来拿高薪 就去做与数据分析相关的工作

据外媒报道,中国电商巨头阿里巴巴的创始人马云(微博)预计未来人类社会将发生巨大的变化,这位亿万富翁在接受CNBC采访时表示,在未来的30年里,人工智能将超越人类的知识,导致很多人失业。 他说:“新浪潮即将来临,很多就业机会将被夺走。有些人会赶上潮流,变得更加富有和成功。但是对于那些落后的人,未来将是痛苦的。” 马云说,在快速逼近的技术新时代,核心是数据。根据他对未来就业市场的预测,与数据和数据分析有关的技能将变得非常有价值。 马云说:“整个世界将变成数据,我认为这还只是数据时代的开始。” 阿里巴巴拥有客户的大量数据,它的很多客户每天都要访问阿里巴巴网站很多次。马云解释说,通过这些信息,他看到了世界将在未来几十年里变成什么样。 他说:“我们认为,数据将在未来变得对人们的生活非常重要。明天,一切事物都将通过物联网与网络相连。” 马云并非唯一一个强调分析技能重要性的商业领袖。特斯拉和SpaceX首席执行官埃隆-马斯克(Elon Musk)正在研究一个项目,打算将人脑与计算机相连,目的是为了提高人脑的数据处理速度。微软联合创始人、未来学家比尔-盖茨(Bill Gates)说,收集信息的能力将改变全球健康状况,避免疾病传播。 谷歌(微博)母公司Alphabet的执行董事长埃里克-施密特(Eric Schmidt)和公司首席执行官拉里-佩奇(Larry Page)的顾问乔纳森-罗森博格(Jonathan Rosenberg)均认为,数据分析是年轻人最应该学习的顶级职业技能。 施密特说:“我所说的数据分析指的是统计学的基本知识,是人们如何利用大数据来做决策的基本知识。” 他说:“我认为,对数据分析的基本理解对下一代年轻人来说非常重要,这就是你们要进入的世界。” 本文转自d1net(转载)

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

Android ThreadUtil 线程公共类,判断是否在主线程/ 子线程执行 相关操作

前言:通常,我们写的公共的模块给别人用,但是这个模块又必须在特定的线程中执行。 比如,一个加载网络图片的的方法,需要在子线程中执行。 /** * 加载网络图片 */ private void loadImage() { try { //用延时3秒操作来模拟网络操作 Thread.sleep( 3000 ); } catch (InterruptedException e) { e.printStackTrace(); } } 但是其他的同事在使用的时候,可能一不小心就在主线程中执行了 loadImage() 方法。这样就势必造成了界面卡顿。 为了避免这种情况,我们需要一个线程判断的工具 ThreadUtil 来帮助我们处理。 当前线程是主线程,抛出异常,不去加载 当前线程是子线程,继续执行,完成加载 package com.app; import android.os.Looper; /** * Created by ${zyj} on 2016/6/7. */ public class ThreadUtil { /** * Throws an {@link java.lang.IllegalArgumentException} if called on a thread other than the main thread. */ public static void assertMainThread() { if (!isOnMainThread()) { throw new IllegalArgumentException("You must call this method on the main thread"); } } /** * Throws an {@link java.lang.IllegalArgumentException} if called on the main thread. */ public static void assertBackgroundThread() { if (!isOnBackgroundThread()) { throw new IllegalArgumentException("YOu must call this method on a background thread"); } } /** * Returns {@code true} if called on the main thread, {@code false} otherwise. */ public static boolean isOnMainThread() { return Looper.myLooper() == Looper.getMainLooper(); } /** * Returns {@code true} if called on the main thread, {@code false} otherwise. */ public static boolean isOnBackgroundThread() { return !isOnMainThread(); } } 然后我们把 loadImage() 修改一下,就成了 /** * 加载网络图片 */ private void loadImage() { //判断是否在子线程。 子线程:继续执行 主线程:抛出异常 ThreadUtil.assertBackgroundThread(); try { //用延时3秒操作来模拟网络操作 Thread.sleep( 3000 ); } catch (InterruptedException e) { e.printStackTrace(); } } 可以看到在 loadImage() 方法中多了一句: ThreadUtil.assertBackgroundThread(); 在assertBackgroundThread() 方法里,判断如果不是子线程就直接抛出"YOu must call this method on a background thread" 正确的调用应该是:在子线程中调用 loadImage() ,比如: new Thread(new Runnable() { @Override public void run() { loadImage(); } }).start(); 总结: ThreadUitl 是参考图片加载框架Glide写的 . ThreadUtil.assertBackgroundThread(); 要求在子线程中执行 ThreadUtil.assertMainThread() ; 要求在主线程运行 代码示例已上传到 github:https://github.com/zyj1609wz/ZUtils

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

Gradle精选: 关于运行失败的单元测试CASE,显示更多相关信息

在Gradle中运行单元测试很简单。一般情况下,如果有一个单元测试CASE执行失败,也会导致构建失败。但是我们却不能立刻在控制台看到为什么这个单元测试失败。我们需要先打开生成的HTML格式的测试报告。现在我们还有其他办法。 首先,我们创建一个下面的Gradle build文件: // File: build.gradle apply plugin: 'java' repositories { mavenCentral() } dependencies { testCompile 'junit:junit:[4,)' } 然后,我们使用下面的Junit单元测试。注意,这个单元测试一直会失败,因为这就是我们想要的CASE场景。 // File: src/test/java/com/mrhaki/gradle/SampleTest.java package com.mrhaki.gradle; import org.junit.*; public class SampleTest { @Test public void sample() { Assert.assertEquals("Gradle is gr8", "Gradle is great"); } } 我们通过执行test任务,来运行单元测试。如果我们运行这个任务,我们发现控制台显示哪一行单元测试失败了,但是我们却看不到单元测试失败的具体原因: $ gradle test :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :compileTestJava :processTestResources UP-TO-DATE :testClasses :test com.mrhaki.gradle.SampleTest > sample FAILED org.junit.ComparisonFailure at SampleTest.java:8 1 test completed, 1 failed :test FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':test'. > There were failing tests. See the report at: file:///Users/mrhaki/Projects/mrhaki.com/blog/posts/samples/gradle/testlogging/build/reports/tests/index.html * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 4.904 secs 我们可以再次运行test任务,但是现在我们通过添加命令行选项-i 或者 --info来设置Gradle日志级别到info。现在我们可以在终端看到单元测试失败的具体原因了。 $ gradle test -i Starting Build Settings evaluated using empty settings script. Projects loaded. Root project using build file ... Successfully started process 'Gradle Worker 1' Gradle Worker 1 executing tests. Gradle Worker 1 finished executing tests. com.mrhaki.gradle.SampleTest > sample FAILED org.junit.ComparisonFailure: expected:<gradle is gr[8]> but was:<gradle is gr[eat]> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at com.mrhaki.gradle.SampleTest.sample(SampleTest.java:8) Process 'Gradle Worker 1' finished with exit value 0 (state: SUCCEEDED) 1 test completed, 1 failed Finished generating test XML results (0.025 secs) Generating HTML test report... Finished generating test html results (0.027 secs) :test FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':test'. > There were failing tests. See the report at: file:///Users/mrhaki/Projects/mrhaki.com/blog/posts/samples/gradle/testlogging/build/reports/tests/index.html * Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. BUILD FAILED Total time: 5.117 secs 但是这样做仍然会产生很多干扰的日志。最好的办法就是通过配置test任务来自定义单元测试日志级别。我们可以配置不同的日志级别。为了获取单元测试失败的具体原因我们可以仅仅将exceptionFormat设置为full。示例如下: // File: build.gradle apply plugin: 'java' repositories { mavenCentral() } dependencies { testCompile 'junit:junit:[4,)' } test { testLogging { exceptionFormat = 'full' } } 我们可以再次运行test任务,并且使用正常的日志级别,但是这次,我们依然能够看到单元测试失败的具体原因,而没有其他的干扰日志。 $ gradle test :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test com.mrhaki.gradle.SampleTest > sample FAILED org.junit.ComparisonFailure: expected:<gradle is gr[8]> but was:<gradle is gr[eat]> at org.junit.Assert.assertEquals(Assert.java:115) at org.junit.Assert.assertEquals(Assert.java:144) at com.mrhaki.gradle.SampleTest.sample(SampleTest.java:8) 1 test completed, 1 failed :test FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':test'. > There were failing tests. See the report at: file:///Users/mrhaki/Projects/mrhaki.com/blog/posts/samples/gradle/testlogging/build/reports/tests/index.html * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 5.906 secs 实例使用 Gradle 1.6 编写。 联系方式 Email:yanghui1986527#gmail.com Github: https://github.com/snowdream Blog: http://snowdream.github.io/blog/ 简书:http://www.jianshu.com/u/748f0f7e6432 云栖博客:https://yq.aliyun.com/u/snowdream86 QQ群: 529327615 微信公众号: sn0wdr1am

资源下载

更多资源
Mario

Mario

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

腾讯云软件源

腾讯云软件源

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

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部分的功能。

用户登录
用户注册