首页 文章 精选 留言 我的

精选列表

搜索[网站开发],共10000篇文章
优秀的个人博客,低调大师

Android开发教程 - 使用Data Binding(七)使用BindingAdapter简化图片加载

本系列目录 使用Data Binding(一)介绍 使用Data Binding(二)集成与配置 使用Data Binding(三)在Activity中的使用 使用Data Binding(四)在Fragment中的使用 使用Data Binding(五)数据绑定 使用Data Binding(六)RecyclerView Adapter中的使用 使用Data Binding(七)使用BindingAdapter简化图片加载 使用Data Binding(八)使用自定义Interface 使用Data Binding Android Studio不能正常生成相关类/方法的解决办法 什么是BindingAdapter BindingAdapter用来设置布局中View的自定义属性,当使用该属性时,可以自定义其行为。 下面是一个简单的例子: @BindingAdapter("android:bufferType") public static void setBufferType(TextView view, TextView.BufferType bufferType) { view.setText(view.getText(), bufferType); } 当一个方法加上@BindingAdapter注解后,就定义了一个BindingAdapter,注意方法的第一个参数是需要绑定到的View,第二个参数是绑定的属性值。 当定义完成后,此时我们就可以在布局的View中使用该属性,举例如下: <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:bufferType="normal" /> 当TextView中加入了android:bufferType=”normal”后,setBufferType()方法就会被调用。 当自定义其它一些属性时,也遵循一样的规则。 自定义图片加载的BindingAdapter 由于BindingAdapter的特性,我们就可以为ImageView自定义一个BindingAdapter,从而大幅简化图片加载的过程。 第一步,我们先新建一个ImageBindingAdapter的类,图片相关的BindingAdapter可以都定义在这个类里面: public class ImageBindingAdapter { @BindingAdapter("imageUrl") public static void bindImageUrl(ImageView view, String imageUrl){ RequestOptions options = new RequestOptions() .centerCrop() .dontAnimate(); Glide.with(view) .load(imageUrl) .apply(options) .into(view); } } 定义好后,我们就可以直接在布局中使用这个属性了: <ImageView android:layout_width="180dp" android:layout_height="180dp" app:imageUrl="@{user.photo}" /> 仅仅简单的一行代码,就可以进行网络图片的加载了,是不是感觉这个世界简单了很多? 除了这种单个参数的BindingAdapter,它也支持多个参数,这也是BindingAdapter强大的地方。 总结 使用BindingAdapter可以大大简化一些重复代码,本文主要介绍了加载图片上的使用,你可以举一反三,用在更多的场景中使用,比如加载列表的数据等,这样做以后也可以使您的代码更加清晰高效。

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

Android开发教程 - 使用Data Binding(四)在Fragment中的使用

本系列目录 使用Data Binding(一)介绍 使用Data Binding(二)集成与配置 使用Data Binding(三)在Activity中的使用 使用Data Binding(四)在Fragment中的使用 使用Data Binding(五)数据绑定 使用Data Binding(六)RecyclerView Adapter中的使用 使用Data Binding(七)使用BindingAdapter简化图片加载 使用Data Binding(八)使用自定义Interface 使用Data Binding Android Studio不能正常生成相关类/方法的解决办法 修改fragment的布局 同上一篇:在Activity中的使用中一样,在Fragment中使用Data Binding同样需要修改布局,修改方式也跟Activity一样,在最外层加上<layout>标签: <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <data> </data> <页面布局.../> </layout> 同样,为避免重复讲解, <data>中的数据绑定我们会在这一篇文章中讲到。 在Fragment中进行绑定 与在Activity中绑定中创建绑定的方式有些不同,但是目的都是获得绑定对象的引用。 比如我们Fragment的布局文件为:frag_main.xml,具体的方式如下: 定义成员变量 private FragMainBinding mBinding; 在onCreateView()中初始化mBinding,并返回View @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mBinding = FragMainBinding.inflate(inflater); mBinding.tvExample.setText("Binding Text"); return mBinding.getRoot(); } 此时就可以正常操作Binding对象了。 总结 与Activity中获取Data Binding对象类似,只是方法稍微不同。 除了在Activity和Fragment中使用Data Binding之外,另一个常用的场景是在列表的Adapter中使用Data Binding,这一篇我们将讲到。 下一篇我们将先讲解一下布局中<data>标签的作用,即如何将数据绑定到布局文件中。

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

Android开发教程 - 使用Data Binding(三)在Activity中的使用

本系列目录 使用Data Binding(一)介绍 使用Data Binding(二)集成与配置 使用Data Binding(三)在Activity中的使用 使用Data Binding(四)在Fragment中的使用 使用Data Binding(五)数据绑定 使用Data Binding(六)RecyclerView Adapter中的使用 使用Data Binding(七)使用BindingAdapter简化图片加载 使用Data Binding(八)使用自定义Interface 使用Data Binding Android Studio不能正常生成相关类/方法的解决办法 修改activity布局 如果使Activity支持Data Binding,在布局的最外层加入”<layout>”标签即可,由于是加在最外层,所以即使重构现有工程,所做的修改也非常简单,并不会影响现有的布局结构。 以下以MainActivity进行举例。 修改前activty_main.xml的布局: <?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" android:gravity="center" > <TextView android:id="@+id/tv_example" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="16sp" /> </LinearLayout> 修改后activty_main.xml的布局: <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <data> </data> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" > <TextView android:id="@+id/tv_example" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="16sp" /> </LinearLayout> </layout> 这里的<data>标签中的元素放的是页面所需的数据,后面的文章我们会讲到,也可以直接点击这里查看,这里我们暂且放一下,重点讲Activity中Data Binding的使用。 在Activity中进行绑定 上面我们修改了布局后,下面我们就可以在代码中进行数据绑定了。此时工程中会自动生成该布局对应的java绑定文件:ActivityMainBinding。仔细观察就会发现,这个文件名就是将布局的下划线形式转换成java规范的驼峰形式,后面加上Binding。 下面进入MainActivity.java中下面我们进行数据绑定操作。 如果写代码过程中发现IDE并没有自动正确生成对应的Binding类,则参考这篇文章:Android Studio不能正常生成相关类/方法的解决办法,仅需几步操作即可使IDE正常生成: 定义成员变量: private ActivityMainBinding mBinding; 在onCreate()中初始化mBinding @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main); mBinding.tvExample.setText("Binding Text"); } 此时就可以从mBinding中获取到布局中的所有View了,比如上面的mBinding.tvExample。 总结 Activity中使用Data Binding很简单,省去了模版化的代码findViewById(),也避免了使用ButterKnife等第三方库,省时省力。 除了获取布局中的元素,后续的文章我们会讲到如何设置布局中的数据,可以点击这里查看。

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

区块链的技术特征 区块链开发公司哪家好

区块链是近几年最具革命性的创新技术,同时也成为各大投资机构疯狂追逐的风口。 目前国内外区块链技术大多处于发展初期,将与往后成熟期的区块链技术千差万别。简单介绍一下当前区块链的主流分支形态,即按照链式处理“去中心化”程度可将区块链技术进一步划分为以下三类: 区块链具有去中心化、时序数据、集体维护、可编程和安全可信等特点。 去中心化:区块链数据的验证、记账、存储、维护和传输等过程均是基于分布式系统结构,采用纯数学方法而不是中心机构来建立分布式节点间的信任关系,从而形成去中心化的可信任的分布式系统; 时序数据:区块链采用带有时间戳的链式区块结构存储数据,从而为数据增加了时间维度,具有极强的可验证性和可追溯性; 集体维护:区块链系统采用特定的经济激励机制来保证分布式系统中所有节点均可参与数据区块的验证过程,并通过共识算法来选择特定的节点将新区块添加到区块链; 可编程:区块链技术可提供灵活的脚本代码系统,支持用户创建高级的智能合约、货币或其它去中心化应用; 安全可信:区块链技术采用非对称密码学原理对数据进行加密,同时借助分布式系统各节点的工作量证明等共识算法形成的强大算力来抵御外部攻击、保证区块链数据不可篡改和不可伪造,因而具有较高的安全性。 智能合约技术是区块链应用中最主要的特征,也是区块链被称为颠覆性技术的主要原因 。智能合约可以帮助实现可编程货币和金融功能,提高自动化交易水平和交易效率,降低金融交易及合约执行成本,便于交易行为的管理,因此得到国内外金融机构和央行的关注。 未来,区块链的应用可能更多是向智能合约的方向发展,并对数字货币和其他金融领域产生重大影响 。但需要指出的是,区块链是技术手段,尽管它对比T币的形成和发展发挥了重要作用,但技术本身是中性的,并不构成对比T币正当性和科技创新性的背书。

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

[雪峰磁针石博客]python机器学习、web开发等书籍汇总

Learning Python Web Penetration - Christian Martorella - 2018.pdf 下载地址 Leverage the simplicity of Python and available libraries to build web security testing tools for your application Key Features Understand the web application penetration testing methodology and toolkit using Python Write a web crawler/spider with the Scrapy library Detect and exploit SQL injection vulnerabilities by creating a script all by yourself Book Description Web penetration testing is the use of tools and code to attack a website or web app in order to assess its vulnerability to external threats. While there are an increasing number of sophisticated, ready-made tools to scan systems for vulnerabilities, the use of Python allows you to write system-specific scripts, or alter and extend existing testing tools to find, exploit, and record as many security weaknesses as possible. Learning Python Web Penetration Testing will walk you through the web application penetration testing methodology, showing you how to write your own tools with Python for each activity throughout the process. The book begins by emphasizing the importance of knowing how to write your own tools with Python for web application penetration testing. You will then learn to interact with a web application using Python, understand the anatomy of an HTTP request, URL, headers and message body, and later create a script to perform a request, and interpret the response and its headers. As you make your way through the book, you will write a web crawler using Python and the Scrappy library. The book will also help you to develop a tool to perform brute force attacks in different parts of the web application. You will then discover more on detecting and exploiting SQL injection vulnerabilities. By the end of this book, you will have successfully created an HTTP proxy based on the mitmproxy tool. What you will learn Interact with a web application using the Python and Requests libraries Create a basic web application crawler and make it recursive Develop a brute force tool to discover and enumerate resources such as files and directories Explore different authentication methods commonly used in web applications Enumerate table names from a database using SQL injection Understand the web application penetration testing methodology and toolkit Who this book is for Learning Python Web Penetration Testing is for web developers who want to step into the world of web application security testing. Basic knowledge of Python is necessary. Table of Contents Introduction to Web Application Penetration Testing Interacting with Web Applications Web Crawling with Scrapy – Mapping the Application Discovering resources Password Testing Detecting and Exploiting SQL Injection Vulnerabilities Intercepting HTTP Requests Python For Offensive PenTest(conv) - 2018.pdf 下载地址 Key Features Comprehensive information on building a web application penetration testing framework using Python Master web application penetration testing using the multi-paradigm programming language Python Detect vulnerabilities in a system or application by writing your own Python scripts Book Description Python is an easy-to-learn and cross-platform programming language that has unlimited third-party libraries. Plenty of open source hacking tools are written in Python, which can be easily integrated within your script. This book is packed with step-by-step instructions and working examples to make you a skilled penetration tester. It is divided into clear bite-sized chunks, so you can learn at your own pace and focus on the areas of most interest to you. This book will teach you how to code a reverse shell and build an anonymous shell. You will also learn how to hack passwords and perform a privilege escalation on Windows with practical examples. You will set up your own virtual hacking environment in VirtualBox, which will help you run multiple operating systems for your testing environment. By the end of this book, you will have learned how to code your own scripts and mastered ethical hacking from scratch. What you will learn Code your own reverse shell (TCP and HTTP) Create your own anonymous shell by interacting with Twitter, Google Forms, and SourceForge Replicate Metasploit features and build an advanced shell Hack passwords using multiple techniques (API hooking, keyloggers, and clipboard hijacking) Exfiltrate data from your target Add encryption (AES, RSA, and XOR) to your shell to learn how cryptography is being abused by malware Discover privilege escalation on Windows with practical examples Countermeasures against most attacks Who This Book Is For This book is for ethical hackers; penetration testers; students preparing for OSCP, OSCE, GPEN, GXPN, and CEH; information security professionals; cybersecurity consultants; system and network security administrators; and programmers who are keen on learning all about penetration testing. Table of Contents Warming up - Your First Anti-Virus Free Persistence Shell Advanced Scriptable Shell Passwords Hacking Catch Me If You Can! Miscellaneous Fun in Windows Abuse of cryptography by malware Cracking Codes with Python - 2018.epub 下载地址 Introduction Chapter 1 - Making Paper Cryptography Tools Chapter 2 -Programming in the Interactive Shell Chapter 3 - Strings and Writing Programs Chapter 4 - The Reverse Cipher Chapter 5 - The Caesar Cipher Chapter 6 - Hacking the Caesar Cipher with Brute-Force Chapter 7 - Encrypting with the Transposition Cipher Chapter 8 - Decrypting with the Transposition Cipher Chapter 9 - Programming a Program to Test Your Program Chapter 10 - Encrypting and Decrypting Files Chapter 11 - Detecting English Programmatically Chapter 12 - Hacking the Transposition Cipher Chapter 13 - A Modular Arithmetic Module for the Affine Cipher Chapter 14 - Programming the Affine Cipher Chapter 15 - Hacking the Affine Cipher Chapter 16 - Programming the Simple Substitution Cipher Chapter 17 - Hacking the Simple Substitution Cipher Chapter 18 - Programming the Vigenere Cipher Chapter 19 - Frequency Analysis Chapter 20 - Hacking the Vigenere Cipher Chapter 21 - The One-Time Pad Cipher Chapter 22 - Finding and Generating Prime Numbers Chapter 23 - Generating Keys for the Public Key Cipher Chapter 24 - Programming the Public Key Cipher Pandas for Everyone Python Data Analysis -2018.pdf 下载地址 Copyright 2018 Dimensions: 7" x 9-1/8" Pages: 416 Edition: 1st Book ISBN-10: 0-13-454693-8 ISBN-13: 978-0-13-454693-3 The Hands-On, Example-Rich Introduction to Pandas Data Analysis in Python Today, analysts must manage data characterized by extraordinary variety, velocity, and volume. Using the open source Pandas library, you can use Python to rapidly automate and perform virtually any data analysis task, no matter how large or complex. Pandas can help you ensure the veracity of your data, visualize it for effective decision-making, and reliably reproduce analyses across multiple datasets. Pandas for Everyone brings together practical knowledge and insight for solving real problems with Pandas, even if you’re new to Python data analysis. Daniel Y. Chen introduces key concepts through simple but practical examples, incrementally building on them to solve more difficult, real-world problems. Chen gives you a jumpstart on using Pandas with a realistic dataset and covers combining datasets, handling missing data, and structuring datasets for easier analysis and visualization. He demonstrates powerful data cleaning techniques, from basic string manipulation to applying functions simultaneously across dataframes. Once your data is ready, Chen guides you through fitting models for prediction, clustering, inference, and exploration. He provides tips on performance and scalability, and introduces you to the wider Python data analysis ecosystem. Work with DataFrames and Series, and import or export data Create plots with matplotlib, seaborn, and pandas Combine datasets and handle missing data Reshape, tidy, and clean datasets so they’re easier to work with Convert data types and manipulate text strings Apply functions to scale data manipulations Aggregate, transform, and filter large datasets with groupby Leverage Pandas’ advanced date and time capabilities Fit linear models using statsmodels and scikit-learn libraries Use generalized linear modeling to fit models with different response variables Compare multiple models to select the “best” Regularize to overcome overfitting and improve performance Use clustering in unsupervised machine learning Building Machine Learning Systems with Python Third Edition - 2018.pdf 下载地址 Get more from your data by creating practical machine learning systems with Python Key Features Develop your own Python-based machine learning system Discover how Python offers multiple algorithms for modern machine learning systems Explore key Python machine learning libraries to implement in your projects Book Description Machine learning allows systems to learn things without being explicitly programmed to do so. Python is one of the most popular languages used to develop machine learning applications, which take advantage of its extensive library support. This third edition of Building Machine Learning Systems with Python addresses recent developments in the field by covering the most-used datasets and libraries to help you build practical machine learning systems. Using machine learning to gain deeper insights from data is a key skill required by modern application developers and analysts alike. Python, being a dynamic language, allows for fast exploration and experimentation. This book shows you exactly how to find patterns in your raw data. You will start by brushing up on your Python machine learning knowledge and being introduced to libraries. You'll quickly get to grips with serious, real-world projects on datasets, using modeling and creating recommendation systems. With Building Machine Learning Systems with Python, you'll gain the tools and understanding required to build your own systems, all tailored to solve real-world data analysis problems. By the end of this book, you will be able to build machine learning systems using techniques and methodologies such as classification, sentiment analysis, computer vision, reinforcement learning, and neural networks. What you will learn Build a classification system that can be applied to text, images, and sound Employ Amazon Web Services (AWS) to run analysis on the cloud Solve problems related to regression using scikit-learn and TensorFlow Recommend products to users based on their past purchases Understand different ways to apply deep neural networks on structured data Address recent developments in the field of computer vision and reinforcement learning Who this book is for Building Machine Learning Systems with Python is for data scientists, machine learning developers, and Python developers who want to learn how to build increasingly complex machine learning systems. You will use Python's machine learning capabilities to develop effective solutions. Prior knowledge of Python programming is expected. MicroPython for BBC micro:bit Technical Workshop - 2018 pdf 下载地址 BBC micro:bit is a development board to learn embedded system easily. This book is designed to help you to get started with BBC micro:bit development using MicroPython platform. The following is a list of highlight content in this book. * Development environment preparation * Set up MicroPython on BBC micro:bit Board * Display Programming * BBC micro:bit GPIO * Reading Analog Input and PWM * Working with SPI * Working with I2C * Working with Accelerator and Compass Sensors Django - The Easy Way pdf - 2017 PDF 下载地址 Django is a very powerful Python Web Framework. You can use it to build everything from simple websites to big high traffic systems. But starting with Django can be a daunting experience for beginners. The purpose of this book is to guide you through the essential concepts with pragmatic step-by-step examples. You will learn how to build a complete website and deploy it in a real world production environment. The focus is on Django basic concepts so covering other technologies is kept at minimum. It’s helpful to know some Python, HTML, and CSS but you don’t need to have any previous experience with those or web development in general to be able to follow the book. You will learn things like: How to setup PyCharm for Django (you can use any editor). How to organize the project and add a base app to hold common assets. How template inheritance works. How to reuse common template items like grids and pagination. How to work with models, views and urls. How to use GIT and Bitbucket to version control and deploy your code. How to style all features with SASS (or CSS) and Gulp. How to create a responsive design. How to generate thumbnails. How to use relationships (ManyToMany, OneToMany and Foreignkey) in practical contexts. How to create custom forms to add and edit content. How to create and extend class based views. How to create a custom search. How to create an authentication system (sign-in, login, logout and reset password). How to restrict access with groups, permissions and decorators. How to add a user profile page. How to add inline fields to the admin area. How to do test driven development (TDD). How to translate the website. How to create custom error pages. How to setup a production environment with Digitalocean, PostgreSQL, Nginx and Gunicorn. How to use fixtures to apply initial data. How to setup domain, HTTPS, Email and Caching with Memcached. … and a lot more.

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

区块链应用价值体现 区块链开发公司哪家好

区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。 如果说蒸汽机释放了人们的生产力,电力解决了人们基本的生活需求,互联网彻底改变了信息传递的方式,那么区块链作为构造信任的机器,将可能彻底改变整个人类社会价值传递的方式。 客户体验:区块链的真正生活化应用应该是定位在为谁服务、如何服务与生活如何交融?只有良好的客户体验,只有人人可参与的公有链,才能真正让区块链真正普及到千家万户,让每个人都能用得起,用得上。 经济价值:除了其多重加密逻辑,分叉逻辑,一定要有一定的经济价值,那就意味着通证的流通必定是限量的。通证也能真正赋予用户一些实时的权益。 服务实体经济:现今传播很广的波比全景区块链,走的就是区块链通证应用的方向,作为公有链,它不仅强调通证在区块链创新中的核心地位,让区块链发挥它最大的威力——运行通证。而且要求通证有内在价值,有明确的应用场景,能够快速流通 产权:区块链还可以应用于产权保护和产权交易。若利用区块链去中心化的账本记录,结合计算机视觉、自然语言等多领域人工智能技术,可以实现低成本的内容确权,利用智能合约技术,可以实现原创作者对作品进行定价和授权,自动跟踪、记录每次被使用和交易情况并自动分配收益,缩短回报周期。 物流供应链:区块链可以让参与供应链的各方机构记录商品日期、位置等信息,形成一个不可篡改的公共账本,生产方、监督方和公众都可以追踪查询到生产相关的信息,增加配料的透明度,打击仿冒伪造行为,在食品生产、奢侈品制造、跨境物流等对安全性要求高的场景尤为重要。企业还能通过上下游数据的打通与整合,改善供应链管理,提升生产流通效率。 所以,区块链可以称作当下最稳定最安全的技术。区块链当下的应用区块链不仅概念火爆,在当下已经有很多领域应用,相信不久的将来,我们可以切实体会到区块链带来的便利。虽说当下区块链技术还很不完善,对区块链的评价也是褒贬不一,这和每一次新兴技术革命的早期境况都非常类似。

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

Skyline桌面二次开发之路径漫游(C#)

所谓路径漫游:即创建一个动态对象和一条由多点组成的线,然后让动态对象沿着线飞行 首先绘制一条线,实际上路径漫游是不需要绘制线的,我这里只是为了确认动态对象是否沿着线路在飞行,代码如下: //绘制路径 double[] cVerticesArray = null; cVerticesArray = new double[] { 116.35, 27.98, 0, 116.45, 28.98, 0, 116.45, 28.11, 0, 116.65, 28.45, 0, }; ILineString pILineString = sgWorld.Creator.GeometryCreator.CreateLineStringGeometry(cVerticesArray); IColor66 color = sgWorld.Creator.CreateColor(255, 0, 0, 125); var polyline = sgWorld.Creator.CreatePolyline(pILineString, color); 接下来创建动态对象,代码如下: var dynamicObject = this.sgWorld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_GROUND_VEHICLE, DynamicObjectType.DYNAMIC_IMAGE_LABEL, @"F:\项目管理\智慧抚州\使用的Fly\data11\汽车图标\整车.png", 50, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, "", "动态对象"); 参数说明: 第一个参数0:一组IRouteWaypoint66对象,后续向动态对象中添加 第二个参数DynamicMotionStyle:移动方式,是一个枚举类型,具体的效果大家可以去试一下 第三个参数DynamicObjectType:动态对象类型,是一个枚举类型,该参数也决定了你第四个参数的文件类型 第四个参数:由于第三个参数选择的Image_label,这里我选择了一张图片 第五个参数50:文件缩放大小 第六个参数AltitudeTypeCode:高度模式 动态对象创建完成之后就是创建路径的拐点,代码如下: var wayPoint1 = this.sgWorld.Creator.CreateRouteWaypoint(116.35, 27.98, 0, 2000); var wayPoint2 = this.sgWorld.Creator.CreateRouteWaypoint(116.45, 28.98, 0, 2000); var wayPoint3 = this.sgWorld.Creator.CreateRouteWaypoint(116.55, 28.11, 0, 800); var wayPoint4 = this.sgWorld.Creator.CreateRouteWaypoint(116.65, 28.45, 0, 800); 然后将拐点添加到动态对象中: dynamicObject.Waypoints.AddWaypoint(wayPoint1); dynamicObject.Waypoints.AddWaypoint(wayPoint2); dynamicObject.Waypoints.AddWaypoint(wayPoint3); dynamicObject.Waypoints.AddWaypoint(wayPoint4); dynamicObject.CircularRoute = false; dynamicObject.RestartRoute(0); 最后调用飞行到对象,就可以实现路径漫游效果: sgWorld.Navigate.FlyTo(dynamicObject.ID, ActionCode.AC_JUMP);

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

安卓日常开发记录-键盘的相关处理方式

点击EditText之外隐藏键盘的实现方式 重写事件分发dispatchTouchEvent,注意不要在onTouchEvent中操作,因为onTouchEvent并非任何情况下都会被调用。通过计算EditText在布局中的位置,进行键盘的显示和隐藏处理 /** * 点击区域在输入框之外都隐藏掉键盘 * @param ev * @return */ @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { View v = getCurrentFocus(); if (isShouldHideInput(v, ev)) { hideSoftKeyboard(v); } return super.dispatchTouchEvent(ev); } // 必不可少,否则所有的组件都不会有TouchEvent了 if (getWindow().superDispatchTouchEvent(ev)) { return true; } return onTouchEvent(ev); } public boolean isShouldHideInput(View v, MotionEvent event) { if (v != null && (v instanceof EditText)) { int[] leftTop = { 0, 0 }; //获取输入框当前的location位置 v.getLocationInWindow(leftTop); int left = leftTop[0]; int top = leftTop[1]; int bottom = top + v.getHeight(); int right = left + v.getWidth(); if (event.getX() > left && event.getX() < right && event.getY() > top && event.getY() < bottom) { // 点击的是输入框区域,保留点击EditText的事件 return false; } else { return true; } } return false; } 监听键盘弹起和隐藏的方式 自定义一个view,因为项目中用的LinearLayout,所以以这个布局为例,将其作为根布局,通过布局的高度判断键盘的隐藏和显示,通过接口将结果回调出去 需要在AndroidManifest中配置键盘属性 android:windowSoftInputMode="adjustUnspecified|stateHidden" android:windowSoftInputMode="adjustResize|stateHidden" 经过测试上边两种配置都可以实现,但是下边这种不行,具体原因,你可以去看看 adjustUnspecified adjustResize adjustPan的区别 android:windowSoftInputMode="adjustPan|stateHidden" package com.anjuke.library.uicomponent.view; import android.content.Context; import android.util.AttributeSet; import android.widget.LinearLayout; /** * Author: renzhenming * Time: 2018/8/11 16:58 * Email: renzhenming@58ganji.com * Version:12.3 * Description: 用于监听键盘的隐藏和出现 */ public class AjkAdjustSizeLinearLayout extends LinearLayout { public AjkAdjustSizeLinearLayout(Context context) { super(context); } public AjkAdjustSizeLinearLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public AjkAdjustSizeLinearLayout(Context context, AttributeSet attrs) { super(context, attrs); } private int mChangeSize = 200; /** * 键盘弹起时,布局的高度因为受到挤压,会变小,所以新的高度h减去旧的高度oldh会得到一个负数 * 这个负数的绝对值等于键盘的高度,而且基本可以确定的是键盘的高度一定是大于200的,所以满足 * (oldw != 0 && h - oldh < -mChangeSize)就可以当做键盘弹起 * * 键盘收起时,布局高度恢复到最初,新的高度h减去oldh得到一个正数,这个数值正好就是键盘的高度 * 所以满足(oldw != 0 && h - oldh > mChangeSize)时,可以看做是键盘收起 * @param w * @param h * @param oldw * @param oldh */ @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (oldw == 0 || oldh == 0) return; if (boardListener != null) { if (oldw != 0 && h - oldh < -mChangeSize) { boardListener.keyBoardVisible(Math.abs(h - oldh)); } if (oldw != 0 && h - oldh > mChangeSize) { boardListener.keyBoardInvisible(Math.abs(h - oldh)); } } } public interface SoftKeyBoardListener { void keyBoardVisible(int move); void keyBoardInvisible(int move); } SoftKeyBoardListener boardListener; public void setSoftKeyBoardListener(SoftKeyBoardListener boardListener) { this.boardListener = boardListener; } }

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

区块链开发公司谈区块链的主要特征

近年来,随着应用的逐渐铺开,区块链技术愈发引人关注。虽然距离大规模应用仍有距离,但关于区块链的讨论日渐深入并逐步趋向理性。基于分布式记账、集体合约和智能共识等机制,区块链技术最初呈现出的去中心化、开放共享、真实可靠等信息特性一度引发高度关注,其中去中心化的特征尤为受追捧,对去中心化的关注自区块链诞生以来就一直存在。 区块链技术是一种不依赖第三方、通过自身分布式节点进行网络数据的存储、验证、传递和交流的一种技术方案。因此,有人从金融会计的角度,把区块链技术看成是一种分布式开放性去中心化的大型网络记账薄,任何人任何时间都可以采用相同的技术标准加入自己的信息,延伸区块链,持续满足各种需求带来的数据录入需要。 1、开放、共识,任何人都可以参与到区块链网络,每一台设备都能作为一个节点,每个节点都允许获得一份完整的数据库拷贝。节点间基于一套共识机制,通过竞争计算共同维护整个区块链。任一节点失效,其余节点仍能正常工作。 2、交易透明、双方匿名,区块链的运行规则是公开透明的,所有数据信息也是公开的,因此每一笔交易都是对所有节点可见。由于节点与节点之间是去信任的,因此节点之间无需公开身份,每个参与节点都是匿名的。 3、去中心、去信任,区块链由众多节点共同组成一个端到端的网络,不存在中心化的设备和管理机构。节点之间数据交换通过数字签名技术进行验证,无需互相信任,只要按照系统既定的规则进行,节点之间不能也无法欺骗其他节点。 4、不可篡改、可追溯,单个甚至多个节点对数据库的修改无法影响其他节点的数据库,除非能控制整个网络中超过51%的节点同时修改,这几乎不可能发生。区块链中的每一笔交易都通过密码学方法与相邻两个区块串联,因此可以追溯到任何一笔交易的前世今生。 区块链能够构建去中心化信用底基,超越时间与空间,将数据信息永久性、去中心化记录,避免时间延误及人为错误等问题,在全球物联网打造出高效率价值链。诸如贷款申请问题,区块链能够凭借程序算法自动记录与其相关的海量信息,存储在区块链网络任何一个电脑中,构建难以篡改可信任数据库,实现信息共享。

资源下载

更多资源
Mario

Mario

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

Nacos

Nacos

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

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

用户登录
用户注册