用Android Studio建立的项目,默认没有 assets目录,需要手动引入。
创建的方法如下图所示。
Crosswalk是一款开源的WEB引擎。目前Crosswalk正式支持的移动操作系统包括Android和Tizen,在Android 4.0及以上的系统中使用Crosswalk的Web应用程序在HTML5方面可以有一致的体验,同时和系统的整合交互方面(比如启动画面、权限管理、应用切换、社交分享等等)可以做到类似原生应用。现在Crosswalk已经成为众多知名HTML5平台和应用的推荐引擎,包括Google Mobile Chrome App、Intel XDK、Famo.us和Construct2等等,未来的Cordova 4.0也计划集成Crosswalk。
下载的时候有些小迷茫,不知道应该下载哪个,入门的话,还是使用下图的稳定版本好了。
1.下载zip包,然后参考 Android Studio如何Import Module 即项目依赖(针对非Gradle项目,以Crosswalk为例) 中的介绍,建立Android Studio工程,并且导入到项目中。
2.在AndroidManifest.xml中增加如下权限
1 2 3 4 5 6 7 8 9 |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
使用XWalkView必须开启硬件加速,修改AndroidManifest.xml
1 2 3 4 |
<application android:name="android.app.Application" android:label="XWalkUsers" android:hardwareAccelerated="true"> |
Crosswalk中用来替代WebView的控件叫XWalkView
1.layout文件写法
1 2 3 4 5 6 |
<org.xwalk.core.XWalkView android:id="@+id/activity_main" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> </org.xwalk.core.XWalkView> |
2.代码中使用
和其他Android的控件不同,这个类需要监听系统事件。例如:生命周期、intent、Activity result。
控件内置的Web引擎需要获取并处理这些信息。并且当XWalkView 不再需要使用的时候,在onDestroy方法中XWalkView必须显式的调用destroy方法,否则容易造成Web引擎的内存泄漏。
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 |
import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import org.xwalk.core.XWalkView; public class MainActivity extends ActionBarActivity { private XWalkView mXWalkView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mXWalkView = (XWalkView) findViewById(R.id.activity_main); mXWalkView.load("http://crosswalk-project.org/", null); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override protected void onPause() { super.onPause(); if (mXWalkView != null) { mXWalkView.pauseTimers(); mXWalkView.onHide(); } } @Override protected void onResume() { super.onResume(); if (mXWalkView != null) { mXWalkView.resumeTimers(); mXWalkView.onShow(); } } @Override protected void onDestroy() { super.onDestroy(); if (mXWalkView != null) { mXWalkView.onDestroy(); } } @Override protected void onActivityResult(int requestCode, int resultCode,Intent data) { if (mXWalkView != null) { mXWalkView.onActivityResult(requestCode, resultCode, data); } } @Override protected void onNewIntent(Intent intent) { if (mXWalkView != null) { mXWalkView.onNewIntent(intent); } } } |
3.loadUrl去哪了?
上面的代码中其实已经剧透了,使用load方法即可。
1 2 3 4 5 |
// url mXWalkView.load("http://crosswalk-project.org/", null); // this loads a file from the assets/ directory mXWalkView.load("file:///android_asset/index.html", null); |
4.WebViewClient?
对应WebView的WebViewClient,XWalkView中有XWalkResourceClient。
1 2 3 4 5 6 7 8 9 10 |
mXWalkView.setResourceClient(new XWalkResourceClient(mXWalkView){ @Override public void onLoadFinished(XWalkView view, String url) { super.onLoadFinished(view, url); } @Override public void onLoadStarted(XWalkView view, String url) { super.onLoadStarted(view, url); } }); |
不像WebView一样获取setting设置setJavaScriptEnabled为true才能执行。
Crosswalk可以直接执行js。
1 |
mXWalkView.load("javascript:document.body.contentEditable=true;", null); |
当然,按照Kitkat引入的方式,使用evaluateJavascript方法也是可以的。(大神们推荐)
1 2 3 4 5 6 7 8 |
public class JsInterface { public JsInterface() { } @JavascriptInterface public String sayHello() { return "Hello World!"; } } |
Caution: If you've set your targetSdkVersion to 17 or higher, you must add the @JavascriptInterface annotation to any method that you want available to your JavaScript (the method must also be public). If you do not provide the annotation, the method is not accessible by your web page when running on Android 4.2 or higher.
From developer.android.com
备注:这里的
1 |
@JavaScriptInterface |
所在的包是
1 |
import org.xwalk.core.JavascriptInterface; |
1 2 |
//绑定 mXWalkView.addJavascriptInterface(new JsInterface(), "NativeInterface"); |
1 |
mXWalkView.load("file:///android_asset/index.html", null); |
index.html源码:
1 2 3 4 5 |
<a href="#" onclick="clicked()">Say Hello</a> <script> function clicked() { alert(NativeInterface.sayHello()); } </script> |
Kitkat开始,Android提供了和Chrome联调功能。可以很方便的在Chrome中调试WebView中的代码。
Crosswalk使用Chromium内核当然也具备这个功能。
开启调试的语句如下:
1 2 |
// turn on debugging XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); |
对于Crosswalk来说,这个设置是全局的。
默认XWalkView不能使用动画,甚至setVisibility也不行。
XWalkView represents an Android view for web apps/pages. Thus most of attributes for Android view are valid for this class. Since it internally uses android.view.SurfaceView for rendering web pages by default, it can't be resized, rotated, transformed and animated due to the limitations of SurfaceView. Alternatively, if the preference key ANIMATABLE_XWALK_VIEW is set to True, XWalkView can be transformed and animated because TextureView is intentionally used to render web pages for animation support. Besides, XWalkView won't be rendered if it's invisible.
开启动画模式:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ANIMATABLE_XWALK_VIEW preference key MUST be set before XWalkView creation. XWalkPreferences.setValue(XWalkPreferences.ANIMATABLE_XWALK_VIEW, true); setContentView(R.layout.animatable_xwview_layout); } @Override public void onDestroy() { super.onDestroy(); // Reset the preference for animatable XWalkView. XWalkPreferences.setValue(XWalkPreferences.ANIMATABLE_XWALK_VIEW, false); } |
由于设置也像调试一样是全局的,在onDestroy时记得关闭。
html代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<!DOCTYPE html> <html> <body> <p>A script on this page starts this clock:</p> <p id="demo"></p> <script> var myVar = setInterval(function(){ myTimer(); }, 1000); function myTimer() { var d = new Date(); var t = d.toLocaleTimeString(); document.getElementById("demo").innerHTML = t; } </script> </body> </html> |
XWalkView对应方法:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
mButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mXWalkView != null) { if (!isPaused) { // Pause JS timer mXWalkView.pauseTimers(); isPaused = true; mButton.setImageResource(android.R.drawable.ic_media_play); } else { // Resume JS timer mXWalkView.resumeTimers(); isPaused = false; mButton.setImageResource(android.R.drawable.ic_media_pause); } } } }); |
这也在防止内存泄漏,监听系统事件示例代码中提到过:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
@Override protected void onPause() { super.onPause(); if (mXWalkView != null) { mXWalkView.pauseTimers(); mXWalkView.onHide(); } } @Override protected void onResume() { super.onResume(); if (mXWalkView != null) { mXWalkView.resumeTimers(); mXWalkView.onShow(); } } |
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 |
mPrevButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Go backward if (mXWalkView != null && mXWalkView.getNavigationHistory().canGoBack()) { mXWalkView.getNavigationHistory().navigate( XWalkNavigationHistory.Direction.BACKWARD, 1); } XWalkNavigationItem navigationItem = mXWalkView.getNavigationHistory().getCurrentItem(); showNavigationItemInfo(navigationItem); } }); mNextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Go forward if (mXWalkView != null && mXWalkView.getNavigationHistory().canGoForward()) { mXWalkView.getNavigationHistory().navigate( XWalkNavigationHistory.Direction.FORWARD, 1); } XWalkNavigationItem navigationItem = mXWalkView.getNavigationHistory().getCurrentItem(); showNavigationItemInfo(navigationItem); } }); private void showNavigationItemInfo(XWalkNavigationItem navigationItem){ url = navigationItem.getUrl();// Get the url of current navigation item. originalUrl = navigationItem.getOriginalUrl();// Get the original url of current navigation item title = navigationItem.getTitle(); text1.setText(title); text2.setText(url); text3.setText(originalUrl); } |
1 2 3 |
// The web page below will display a video. // When home button is pressed, the activity will be in background, and the video will be paused. mXWalkView.load("http://www.w3.org/2010/05/video/mediaevents.html", null); |
1 |
mXWalkView.loadAppFromManifest("file:///android_asset/manifest.json", null); |
manifest.json
1 2 3 4 5 6 |
{ "name": "ManifestTest", "start_url": "index.html", "description": "Manifest test", "version": "1.0.0" } |
rsync,remote synchronize顾名思意就知道它是一款实现远程同步功能的软件,它在同步文件的同时,可以保持原来文件的权限、时间、软硬链接等附加信息。
默认情况ubuntu安装了rsync服务,但在/etc下没有配置文件,一般情况可以copy示例文件到/etc下
1 |
$ sudo apt-get install rsync xinetd |
1 |
$ sudo cp /usr/share/doc/rsync/examples/rsyncd.conf /etc |
查看内容,可以看到如下内容
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 |
# sample rsyncd.conf configuration file # GLOBAL OPTIONS #motd file=/etc/motd #log file=/var/log/rsyncd # for pid file, do not use /var/run/rsync.pid if # you are going to run rsync out of the init.d script. # pid file=/var/run/rsyncd.pid #syslog facility=daemon #socket options= # MODULE OPTIONS [ftp] comment = public archive path = /var/www/pub use chroot = yes # max connections=10 lock file = /var/lock/rsyncd # the default for read only is yes... read only = yes list = yes uid = nobody gid = nogroup # exclude = # exclude from = # include = # include from = # auth users = # secrets file = /etc/rsyncd.secrets strict modes = yes # hosts allow = # hosts deny = ignore errors = no ignore nonreadable = yes transfer logging = no # log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes. timeout = 600 refuse options = checksum dry-run dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz |
1 |
$ sudo vim /etc/rsyncd.conf |
1.修改
1 |
path = /var/www/pub |
为需要同步的目录。
如果路径中存在空格,则要分两种情况处理,如果空格在路径中间,如"/nfs/Public/Shared Videos",则直接写
1 |
path = /nfs/Public/Shared Videos |
如果空格在路径的最后面,如"/nfs/Public/Shared Videos ",则需要如下形式设置,注意最后面的"\ ",是一个反斜杠加空格,否则最后的空格会被忽略。
1 |
path = /nfs/Public/Shared Videos\ |
2.设置可以登录的用户名,密码,修改
1 2 |
# auth users = # secrets file = /etc/rsyncd.secrets |
为
1 2 |
auth users = user secrets file = /etc/rsyncd.secrets |
配置用户名和密码
1 2 3 |
$ sudo vim /etc/rsyncd.secrets user:password |
赋予权限 rsyncd.secrets的权限必须为600
1 |
$ sudo chmod 600 /etc/rsyncd.secrets |
3.开启日志
1 |
#log file=/var/log/rsyncd |
为
1 |
log file=/var/log/rsyncd |
4.如果提示
1 |
rsync: change_dir "/" (in ftp) failed: Permission denied (13) |
则调整
1 2 |
uid = nobody gid = nogroup |
为
1 2 |
uid = root gid = root |
5.对于严格要求一致性的重要的文件,去掉"refuse options"中的"checksum",这样会导致同步变慢,但是会比较安全(已经有报告说当同步时候不校验MD5会出现文件大小一致但是MD5不正确的情况),这个需要客户端在同步的时候使用 "-c" 作为参数。
1 |
refuse options = dry-run |
1 |
$ sudo vim /etc/default/rsync |
修改
1 |
RSYNC_ENABLE=inetd |
创建 /etc/xinetd.d/rsync 通过xinetd使rsync开始工作
1 2 3 4 5 6 7 8 9 10 11 12 |
$ sudo vim /etc/xinetd.d/rsync service rsync { disable = no socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID } |
启动/重启 xinetd
1 |
$ sudo /etc/init.d/xinetd restart |
运行下面的命令检查,确认rsync配置成功。
1 2 3 4 |
$ sudo rsync user@www.mobibrw.com::ftp Password: drwxr-xr-x 4096 2006/12/13 09:41:59 . drwxr-xr-x 4096 2006/11/23 18:00:03 folders |
1 2 3 4 5 |
$ sudo rsync -cvazu --progress user@www.mobibrw.com::ftp /rsync Password: receiving incremental file list ./ ................................... |
c同步完成后校验文件MD5(慢,但是可靠)
v详细提示
a以archive模式操作,复制目录、符号连接
z压缩
u只进行更新,防止本地新文件被重写,注意两者机器的时钟的同步
--progress指显示进度
注意,如果需要为多个目录做独立的配置,可以参考如下配置(配置中设置了两个独立的同步目录"ftp"跟"movie")
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 |
# sample rsyncd.conf configuration file # GLOBAL OPTIONS #motd file=/etc/motd log file=/var/log/rsyncd # for pid file, do not use /var/run/rsync.pid if # you are going to run rsync out of the init.d script. # pid file=/var/run/rsyncd.pid #syslog facility=daemon #socket options= # MODULE OPTIONS [ftp] comment = public archive path=/nfs/MyCloud use chroot = yes # max connections=10 lock file = /var/lock/rsyncd # the default for read only is yes... read only = yes list = yes uid = root gid = root # exclude = # exclude from =# hosts allow = # hosts deny = # include = # include from = auth users = user secrets file = /etc/rsyncd.secrets strict modes = yes # hosts allow = # hosts deny = ignore errors = no ignore nonreadable = yes transfer logging = no # log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes. timeout = 600 refuse options = dry-run dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz [movie] comment = public archive path= /nfs/Public/Shared Videos use chroot = yes # max connections=10 lock file = /var/lock/rsyncd # the default for read only is yes... read only = yes list = yes uid = root gid = root # exclude = # exclude from = # include = # include from = auth users = user secrets file = /etc/rsyncd.secrets strict modes = yes # hosts allow = # hosts deny = ignore errors = no ignore nonreadable = yes transfer logging = no # log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes. timeout = 600 refuse options = dry-run dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz |
1.创建脚本文件,假定文件在/home目录
1 2 3 4 |
$ vim rsync_backup.sh #!/bin/sh rsync -auvz --password-file=/home/rsyncd.secrets user@www.mobibrw.com::ftp /rsync |
2.赋予执行权限
1 |
$ chmod +x rsync_backup.sh |
3.创建密码文件,自动填写密码
1 2 3 |
$ vim /home/rsyncd.secrects password |
4.创建定时任务,每半小时自动检查备份一次
1 2 3 |
$ vim cron_rsync_backup */30 * * * * /home/rsync_backup.sh > /var/log/cron_rsync_backup.log 2>&1 |
1 |
$ crontab /home/cron_rsync_backup |
1 |
$ /etc/init.d/cron restart |
1 |
$ crontab -l |
我们要写一个使用CrosswalkWebView的项目,就要依赖Crosswalk的工程,在Eclipse中存在Workspace的概念,对应到Android Studio 就变成了Module.
我们下载到的Crosswalk-WebView的工程是Eclipse建立的项目,此时项目是不能被Android Studio直接引用的,因此需要导入成Android Studio项目的一个Module。
1.选择"Import Module"菜单
2.选择项目的路径,并且重命名 Module Name
3.完成导入
4.查看导入完成后的项目中,出现了新导入的 "CrosswalkWebview",实质上是拷贝了所需要的文件到工程的目录中
JIRA是Atlassian公司出品的项目与事务跟踪工具,被广泛应用于缺陷跟踪、客户服务、需求收集、流程审批、任务跟踪、项目跟踪和敏捷管理等工作领域。
前些年CSDN搞了个99元买正版的活动,当时花钱买了个授权,然后束之高阁,这几天被翻出来了,捣鼓一下。
本文以 atlassian-jira-6.1.3-x64.bin 为例子。
下载地址 https://www.atlassian.com/software/jira/download
下载到用户当前目录 atlassian-jira-6.1.3-x64.bin
1 |
$sudo apt-get install openjdk-7-jre |
1 |
$sudo chmod +x atlassian-jira-6.1.3-x64.bin |
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 |
$ sudo ./atlassian-jira-6.1.3-x64.bin Unpacking JRE ... Starting Installer ... This will install JIRA 6.1.3 on your computer. OK [o, Enter], Cancel [c] o Choose the appropriate installation or upgrade option. Please choose one of the following: Express Install (use default settings) [1], Custom Install (recommended for advanced users) [2, Enter], Upgrade an existing JIRA installation [3] 2 Where should JIRA 6.1.3 be installed? [~/atlassian-jira-6.1.3-x64.bin.8800.dir] /usr/share/atlassian/jira Default location for JIRA data [/var/atlassian/application-data/jira] Configure which ports JIRA will use. JIRA requires two TCP ports that are not being used by any other applications on this machine. The HTTP port is where you will access JIRA through your browser. The Control port is used to Startup and Shutdown JIRA. Use default ports (HTTP: 8080, Control: 8005) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2] 2 HTTP Port Number [8080] 8888 Control Port Number [8005] 8885 JIRA can be run in the background. You may choose to run JIRA as a service, which means it will start automatically whenever the computer restarts. Install JIRA as Service? Yes [y, Enter], No [n] y Extracting files ... Please wait a few moments while JIRA starts up. Launching JIRA ... Installation of JIRA 6.1.3 is complete Your installation of JIRA 6.1.3 is now ready and can be accessed via your browser. JIRA 6.1.3 can be accessed at http://localhost:8888 Finishing installation ... |
安装完成后,访问 http://localhost:8888 就可以了。
主要是要注意,安装的第二步,选择目录的时候,一定要更改默认的目录,否则安装到最后会报告异常。
最近在学习Deep Learning
,参考一下经典的Caffe
,记录一下编译历程。
安装开发所需要的一些基本包
1 |
$ sudo apt-get install build-essential |
图片处理都算依赖OpenCV
,版本号要>=2.4版本,目前14.04
跟14.10
默认的版本都是2.4
1 |
$ sudo apt-get install libopencv-dev |
ATLAS
ATLAS
提供离散数学,线性代数的计算支持
1 |
$ sudo apt-get install libatlas-base-dev |
Boost
库Boost
提供了一系列的C++
算法支持,需要>=1.55版本,目前的14.04
跟14.10
默认的版本都是1.55
1 |
$ sudo apt-get install libboost-all-dev |
protobuf
,leveldb
,snappy
,hdf5
,gflags-devel
,glog-devel
,lmdb-devel
1 |
$ sudo apt-get install libprotobuf-dev protobuf-compiler libleveldb-dev libsnappy-dev libhdf5-serial-dev libgoogle-glog-dev libgflags-dev liblmdb-dev |
GIT
1 |
$ sudo apt-get install git |
1 |
$ git clone https://github.com/BVLC/caffe.git |
Caffe
1 2 3 |
$ cd caffe $ cp Makefile.config.example Makefile.config |
然后修改里面的内容,主要需要修改的参数包括
CPU_ONLY
是否只使用CPU
模式,没有GPU
没安装CUDA
的同学可以打开这个选项
BLAS
(使用intel mkl
还是OpenBLAS
)
完成设置后,开始编译
1 2 3 4 5 |
$ make all -j4 $ make test $ make runtest |
Ubuntu 16.04
下编译时候提示:
1 2 3 4 |
CXX src/caffe/solvers/sgd_solver.cpp In file included from src/caffe/solvers/sgd_solver.cpp:5:0: ./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory #include "hdf5.h" |
解决方法:
1. 编辑Makefile.config
,在文件最后,添加/usr/include/hdf5/serial
到INCLUDE_DIRS
1 |
INCLUDE_DIRS += /usr/include/hdf5/serial |
2.修改Makefile
文件,把hdf5_hl
和hdf5
修改为hdf5_serial_hl
和hdf5_serial
,也就是把下面第一行代码改为第二行代码。
原始内容:
1 |
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 |
修改后的内容:
1 |
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial |
1 2 3 4 5 6 7 8 9 10 11 |
$ sudo apt install python-pip $ pip install --upgrade pip $ sudo pip install -r python/requirements.txt $ sudo apt-get install python-numpy $ make pycaffe $ make distribute |
Sigmoid函数是一个S型函数. Sigmoid函数的数学公式为
它是常微分方程
的一个解.
Sigmoid函数具有如下基本性质:
由于Sigmoid函数所具有的性质, 它常和单位阶跃函数用于构造人工神经网络[1]; 另外心理学中的学习曲线[2]的形状也和Sigmoid函数比较类似.
最近更新Android SDK的时候奇慢无比,频繁失败,到了无法使用的地步,搜索了一下找到一个比较好用的国内镜像。
北京化工大学镜像站 http://ubuntu.buct.edu.cn/
2.代理服务器填写ubuntu.buct.edu.cn或ubuntu.buct.cn或ubuntu.buct6.edu.cn(IPv6),端口80,强制HTTP
注:该代理并非正向代理也不是反向代理,所有代理请求将被重定向至本站镜像。
一直在Eclipse中开发Android
,切换到Android Studio
中之后,各种不习惯。基本的创建keystore
文件的操作也是找了半天才找到。
1.点击Build ,在下拉框中选择 "Generate Signed APK"
2.选择 "Create new"
3.按照里面的内容填写即可,注意最后文件的扩展名变为".jks",而不是以前的".keystore".
注意:最新的Android Studio 4.x
版本已经没办法按照上面的办法创建证书了,创建证书会报告如下错误:
解决方法是在Android Studio
的命令行中执行证书创建命令,创建pkcs12
格式的证书,如下:
1 |
$ keytool -deststoretype pkcs12 -genkeypair -alias ka -keystore ks.p12 -keyalg RSA |
参考下图:
根据提示,补充内容即可。
Android Studio
中使用证书:
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 |
signingConfigs { release { File strFile = new File("ks.p12") storeFile file(strFile) keyAlias 'ka' keyPassword 'password' storePassword 'password' } debug { File strFile = new File("ks.p12") storeFile file(strFile) keyAlias 'ka' keyPassword 'password' storePassword 'password' } } buildTypes { release { signingConfig signingConfigs.release minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { signingConfig signingConfigs.debug } } |
最近买了个小米音箱,如下图所示。连接到手机,连接到 DELL笔记本的蓝牙上面都是正常的,但是一旦连接到 Intel Wireless Bluetooth 7260 上面,立即就会音质非常差了。纠结了好久终于找到原因。
首先看看音质非常差的原因,按照下图操作
可以看到下图的显示,此时,音频处于单声道的8000采样,这个音频质量太差,没办法听音乐的,失真严重。而且没办法选择。
怎么处理呢?如下操作
然后
关闭语音服务,连接音乐服务。
点击后的结果如下所示即可
此时再次观察合成器的属性
观察高级属性
此时大家听音乐的时候,就会效果非常好了。
总结一下原因:
Intel的蓝牙,默认连接了小米的语音电话功能,这个功能按理说在蓝牙通信的时候,音箱应该声明自身没有电话通信功能的,可是小米的音箱错误的声明自己支持语音通话,造成了蓝牙协议栈把音箱当成了电话,导致默认音频异常。