Android Service unBind 为什么无效呢

客户端连接上服务端的后,AIDL通信之后,unBind操作,但是仍然可以操作AIDL接口,返回的也是服务器上的数据。。。 为什么啊

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
eclipse启动动态项目run on server,tomcat起不来
小白一枚,跪求大神解答,eclipse启动动态项目run on server,tomcat起不来,请问这个情况如何解决 控制台信息如下: 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server.服务器版本: Apache Tomcat/9.0.19 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server.构建: Apr 12 2019 14:22:48 UTC 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version number: 9.0.19.0 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 7 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS.版本: 6.1 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: 结.造: amd64 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java 环境变量: C:\Program Files\Java\jre1.8.0_73 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM 版本: 1.8.0_73-b02 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM.供应商: Oracle Corporation 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: E:\workspace\program\.metadata\.plugins\org.eclipse.wst.server.core\tmp1 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: D:\apache-tomcat-9.0.19 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=E:\workspace\program\.metadata\.plugins\org.eclipse.wst.server.core\tmp1 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=D:\apache-tomcat-9.0.19 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=E:\workspace\program\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=D:\apache-tomcat-9.0.19\endorsed 十二月 04, 2019 10:34:27 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=GBK 十二月 04, 2019 10:34:27 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5]. 十二月 04, 2019 10:34:27 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 十二月 04, 2019 10:34:27 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 十二月 04, 2019 10:34:27 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL 信息: OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018] 十二月 04, 2019 10:34:28 下午 org.apache.coyote.AbstractProtocol init 信息: 初始化协议处理器 ["http-nio-8080"] 十二月 04, 2019 10:35:10 下午 org.apache.catalina.util.LifecycleBase handleSubClassException 严重: 初始化组件[Connector[HTTP/1.1-8080]]失败。 org.apache.catalina.LifecycleException: Protocol handler initialization failed at org.apache.catalina.connector.Connector.initInternal(Connector.java:983) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.core.StandardService.initInternal(StandardService.java:535) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1059) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.startup.Catalina.load(Catalina.java:584) at org.apache.catalina.startup.Catalina.load(Catalina.java:607) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:306) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:491) Caused by: java.io.IOException: Unable to establish loopback connection at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source) at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.nio.ch.PipeImpl.<init>(Unknown Source) at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source) at java.nio.channels.Pipe.open(Unknown Source) at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source) at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source) at java.nio.channels.Selector.open(Unknown Source) at org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector(NioSelectorPool.java:54) at org.apache.tomcat.util.net.NioSelectorPool.close(NioSelectorPool.java:109) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:341) at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1121) at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1129) at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:557) at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:74) at org.apache.catalina.connector.Connector.initInternal(Connector.java:980) ... 13 more Caused by: java.net.ConnectException: Connection timed out: connect at sun.nio.ch.Net.connect0(Native Method) at sun.nio.ch.Net.connect(Unknown Source) at sun.nio.ch.Net.connect(Unknown Source) at sun.nio.ch.SocketChannelImpl.connect(Unknown Source) at java.nio.channels.SocketChannel.open(Unknown Source) at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(Unknown Source) ... 30 more 十二月 04, 2019 10:35:10 下午 org.apache.coyote.AbstractProtocol init 信息: 初始化协议处理器 ["ajp-nio-8009"] 十二月 04, 2019 10:35:52 下午 org.apache.catalina.util.LifecycleBase handleSubClassException 严重: 初始化组件[Connector[AJP/1.3-8009]]失败。 org.apache.catalina.LifecycleException: Protocol handler initialization failed at org.apache.catalina.connector.Connector.initInternal(Connector.java:983) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.core.StandardService.initInternal(StandardService.java:535) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1059) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) at org.apache.catalina.startup.Catalina.load(Catalina.java:584) at org.apache.catalina.startup.Catalina.load(Catalina.java:607) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:306) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:491) Caused by: java.io.IOException: Unable to establish loopback connection at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source) at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.nio.ch.PipeImpl.<init>(Unknown Source) at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source) at java.nio.channels.Pipe.open(Unknown Source) at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source) at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source) at java.nio.channels.Selector.open(Unknown Source) at org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector(NioSelectorPool.java:54) at org.apache.tomcat.util.net.NioSelectorPool.close(NioSelectorPool.java:109) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:341) at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1121) at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1129) at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:557) at org.apache.catalina.connector.Connector.initInternal(Connector.java:980) ... 13 more Caused by: java.net.ConnectException: Connection timed out: connect at sun.nio.ch.Net.connect0(Native Method) at sun.nio.ch.Net.connect(Unknown Source) at sun.nio.ch.Net.connect(Unknown Source) at sun.nio.ch.SocketChannelImpl.connect(Unknown Source) at java.nio.channels.SocketChannel.open(Unknown Source) at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(Unknown Source) ... 29 more 十二月 04, 2019 10:35:52 下午 org.apache.catalina.startup.Catalina load 信息: 服务器在[85,235]毫秒内初始化 十二月 04, 2019 10:35:52 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service [Catalina] 十二月 04, 2019 10:35:52 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet engine: [Apache Tomcat/9.0.19] 十二月 04, 2019 10:35:53 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom 警告: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [557] milliseconds. 十二月 04, 2019 10:35:53 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 十二月 04, 2019 10:35:53 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in [1,428] milliseconds
utgard在使用异步(Async20Access)读取数据时,总是出错,我的邮箱:sangjingrui@163.com
1. 在使用utgard访问OPC服务器,使用异步(Async20Access)读取数据时,总是出错,同步读取就可以,我想问一下,这是什么问题? 下面是console输出:Recieved FAULT 最后接到一个FAULT,不知道什么原因,请赐教! 2. 代码: public static void main ( final String[] args ) throws Throwable { // create connection information final ConnectionInformation ci = new ConnectionInformation (); ci.setHost("127.0.0.1"); // 电脑IP ci.setDomain(""); // 域,为空就行 ci.setUser("opcuser"); // 电脑上自己建好的用户名 ci.setPassword("123456"); //密码 // 使用KEPServer的配置 ci.setClsid("7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729"); final Set<String> items = new HashSet<String> (); if ( items.isEmpty () ) { items.add ("ch1.d1.tag1"); items.add ("ch1.d1.tag2"); } // create a new server final Server server = new Server ( ci, Executors.newSingleThreadScheduledExecutor () ); try { // connect to server server.connect (); // add sync access final AccessBase access = new Async20Access ( server, 100, false ); for ( final String itemId : items ) { access.addItem ( itemId, new DataCallbackDumper () ); } // start reading access.bind (); // wait a little bit _log.info ( "Sleep for some seconds to give events a chance..." ); Thread.sleep ( 10 * 1000 ); _log.info ( "Returned from sleep" ); // stop reading access.unbind (); } catch ( final JIException e ) { System.out.println ( String.format ( "%08X: %s", e.getErrorCode (), server.getErrorMessage ( e.getErrorCode () ) ) ); } } } 3. 我发现同样的代码,采用同步读取就没有问题,这是为什么?是不是对异步需要对环境进一步配置? 我的邮箱:sangjingrui@163.com
android library中的toolbar设置android:theme属性不生效
正在封装一个库,打算封装一个BaseToolbarActivity,打算用于以后的使用,但是我在库里面的xml中设置的属性,没有效果,求教 ``` java /** * Created by leo on 2017/6/16. * 在需要使用带有标题(Toolbar实现)的Activity时继承此activity。使用此activity,需要主题style配合。<br/> * 实现了对Toolbar的简单封装,以及沉浸式状态栏<br> * 沉浸式状态栏,当Android 版本 大于4.4小于5.0时,需要指定颜色,不然默认黑色,当Android版本大于5.0时,颜色默认为主题颜色<br> * toolbar的加载操作由BaseToolBarActivity完成,布局中不需要对其进行布局<br> * 在复写方法时,请调用super方法 */ public abstract class BaseToolBarActivity extends BaseActivity { private Toolbar mToolBar; private TextView mTextView; private RelativeLayout rootView; // private Unbinder mUnBinder; // @Override // protected void onDestroy() { // super.onDestroy(); // mUnBinder.unbind(); // } @Override protected final void initView() { // View baseView = LayoutInflater.from(this).inflate(R.layout.activity_base_title, null); // rootView = (RelativeLayout) baseView.findViewById(R.id.rl_rootView); // mToolBar = (Toolbar) baseView.findViewById(R.id.tb_baseToolbar); // // mToolBar.setBackgroundColor(getResources().getColor(R.color.colorPrimary)); // mTextView = (TextView) baseView.findViewById(R.id.tv_baseTitle); // mTextView.setText(getTitleBarText()); // View userView = LayoutInflater.from(this).inflate(getLayoutResource(), null); // if (userView != null) { // RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); // layoutParams.addRule(RelativeLayout.BELOW, R.id.tb_baseToolbar); // rootView.addView(userView, layoutParams); // mUnBinder = ButterKnife.bind(this, userView); // } setContentView(R.layout.activity_base_title); /******/ rootView = (RelativeLayout) findViewById(R.id.rl_rootView); mToolBar = (Toolbar)findViewById(R.id.tb_baseToolbar); mToolBar.setBackgroundColor(getResources().getColor(R.color.colorPrimary)); mTextView = (TextView) findViewById(R.id.tv_baseTitle); mTextView.setText(getTitleBarText()); View userView = LayoutInflater.from(this).inflate(getLayoutResource(), null); if (userView != null) { RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.BELOW, R.id.tb_baseToolbar); rootView.addView(userView, layoutParams); mUnBinder = ButterKnife.bind(this, userView); } /*****/ setSupportActionBar(mToolBar); getSupportActionBar().setDisplayShowTitleEnabled(false); StatusBarCompat.compat(this); } /** * 设置标题 * * @return title的标题 */ protected abstract String getTitleBarText(); /** * 设置是否显示返回按钮 * * @param show true表示设置返回按钮 */ protected void enableBackIcon(boolean show) { if (show) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); mToolBar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } else { getSupportActionBar().setDisplayHomeAsUpEnabled(false); mToolBar.setNavigationOnClickListener(null); } } /** * 设置标题栏颜色。状态栏会使用默认颜色 * * @param titleBarColor 颜色 */ protected void setTitleBarColor(@ColorInt int titleBarColor) { this.setTitleBarColor(titleBarColor, -1); } /** * 设置titleBar文字 * * @param title 标题文字 */ protected void setTitleBarText(String title) { mTextView.setText(title); } /** * 设置标题栏颜色,与状态栏颜色 * * @param titleBarColor 标题栏颜色 * @param statusBarColor 状态栏颜色 */ protected void setTitleBarColor(@ColorInt int titleBarColor, @ColorInt int statusBarColor) { mToolBar.setBackgroundColor(titleBarColor); StatusBarCompat.compat(this, statusBarColor); } /** * 设置标题文字大小 * * @param size 大小 */ protected void setTitleSize(float size) { mTextView.setTextSize(size); } /** * 取得Toolbar实例。 * 取得实例用于与drawerlayout等控件结合使用,请不要取得toolbar实例后直接操作。 * * @return toolbar */ protected Toolbar getToolbarInstance() { return mToolBar; } /** * 设置标题文字颜色 * * @param titleBarColor 颜色 */ protected void setTitleTextColor(@ColorInt int titleBarColor) { mTextView.setTextColor(titleBarColor); } } ``` ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rl_rootView" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar android:id="@+id/tb_baseToolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:theme="@style/MyToolbarStyle"> <TextView android:id="@+id/tv_baseTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:textColor="#ffffff" android:textSize="18sp" /> </android.support.v7.widget.Toolbar> </RelativeLayout> ``` ``` <style name="MyToolbarStyle" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">?actionBarSize</item> <item name="android:textColorPrimaryInverse">@color/white</item> <item name="android:textColorPrimary">@color/white</item> <item name="android:actionMenuTextColor">@android:color/holo_green_light</item> </style> ```
项目没有任何错误,但是有个按钮一点就闪退,LogCat不是很能看懂
04-28 02:47:38.811: E/ActivityThread(638): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d23c90 that was originally bound here 04-28 02:47:38.811: E/ActivityThread(638): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d23c90 that was originally bound here 04-28 02:47:38.811: E/ActivityThread(638): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 04-28 02:47:38.811: E/ActivityThread(638): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 04-28 02:47:38.811: E/ActivityThread(638): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 04-28 02:47:38.811: E/ActivityThread(638): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 04-28 02:47:38.811: E/ActivityThread(638): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 04-28 02:47:38.811: E/ActivityThread(638): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 04-28 02:47:38.811: E/ActivityThread(638): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 04-28 02:47:38.811: E/ActivityThread(638): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 04-28 02:47:38.811: E/ActivityThread(638): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 04-28 02:47:38.811: E/ActivityThread(638): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 04-28 02:47:38.811: E/ActivityThread(638): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 04-28 02:47:38.811: E/ActivityThread(638): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 04-28 02:47:38.811: E/ActivityThread(638): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-28 02:47:38.811: E/ActivityThread(638): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-28 02:47:38.811: E/ActivityThread(638): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-28 02:47:38.811: E/ActivityThread(638): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-28 02:47:38.811: E/ActivityThread(638): at java.lang.Thread.run(Thread.java:856) 04-28 02:47:38.911: E/StrictMode(638): null 04-28 02:47:38.911: E/StrictMode(638): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d23c90 that was originally bound here 04-28 02:47:38.911: E/StrictMode(638): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 04-28 02:47:38.911: E/StrictMode(638): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 04-28 02:47:38.911: E/StrictMode(638): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 04-28 02:47:38.911: E/StrictMode(638): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 04-28 02:47:38.911: E/StrictMode(638): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 04-28 02:47:38.911: E/StrictMode(638): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 04-28 02:47:38.911: E/StrictMode(638): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 04-28 02:47:38.911: E/StrictMode(638): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 04-28 02:47:38.911: E/StrictMode(638): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 04-28 02:47:38.911: E/StrictMode(638): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 04-28 02:47:38.911: E/StrictMode(638): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 04-28 02:47:38.911: E/StrictMode(638): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 04-28 02:47:38.911: E/StrictMode(638): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-28 02:47:38.911: E/StrictMode(638): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-28 02:47:38.911: E/StrictMode(638): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-28 02:47:38.911: E/StrictMode(638): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-28 02:47:38.911: E/StrictMode(638): at java.lang.Thread.run(Thread.java:856) 04-28 02:47:38.921: D/dalvikvm(638): GC_CONCURRENT freed 424K, 22% free 2443K/3100K, paused 69ms+4ms, total 99ms 04-28 02:47:38.931: W/ActivityManager(291): Unbind failed: could not find connection for android.os.BinderProxy@40e074e8 04-28 02:47:38.941: E/ActivityThread(638): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d238c8 that was originally bound here 04-28 02:47:38.941: E/ActivityThread(638): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d238c8 that was originally bound here 04-28 02:47:38.941: E/ActivityThread(638): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 04-28 02:47:38.941: E/ActivityThread(638): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 04-28 02:47:38.941: E/ActivityThread(638): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 04-28 02:47:38.941: E/ActivityThread(638): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 04-28 02:47:38.941: E/ActivityThread(638): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 04-28 02:47:38.941: E/ActivityThread(638): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 04-28 02:47:38.941: E/ActivityThread(638): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 04-28 02:47:38.941: E/ActivityThread(638): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 04-28 02:47:38.941: E/ActivityThread(638): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 04-28 02:47:38.941: E/ActivityThread(638): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 04-28 02:47:38.941: E/ActivityThread(638): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 04-28 02:47:38.941: E/ActivityThread(638): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-28 02:47:38.941: E/ActivityThread(638): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-28 02:47:38.941: E/ActivityThread(638): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-28 02:47:38.941: E/ActivityThread(638): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-28 02:47:38.941: E/ActivityThread(638): at java.lang.Thread.run(Thread.java:856) 04-28 02:47:38.951: E/StrictMode(638): null 04-28 02:47:38.951: E/StrictMode(638): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d238c8 that was originally bound here 04-28 02:47:38.951: E/StrictMode(638): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 04-28 02:47:38.951: E/StrictMode(638): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 04-28 02:47:38.951: E/StrictMode(638): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 04-28 02:47:38.951: E/StrictMode(638): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 04-28 02:47:38.951: E/StrictMode(638): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 04-28 02:47:38.951: E/StrictMode(638): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 04-28 02:47:38.951: E/StrictMode(638): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 04-28 02:47:38.951: E/StrictMode(638): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 04-28 02:47:38.951: E/StrictMode(638): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 04-28 02:47:38.951: E/StrictMode(638): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 04-28 02:47:38.951: E/StrictMode(638): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 04-28 02:47:38.951: E/StrictMode(638): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-28 02:47:38.951: E/StrictMode(638): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-28 02:47:38.951: E/StrictMode(638): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-28 02:47:38.951: E/StrictMode(638): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-28 02:47:38.951: E/StrictMode(638): at java.lang.Thread.run(Thread.java:856)
AccountSetupOptions has leaked ServiceConnection
12-14 15:57:59.940: E/ActivityThread(5339): Activity com.android.email.activity.setup.AccountSetupOptions has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@41c31a88 that was originally bound here 12-14 15:57:59.940: E/ActivityThread(5339): android.app.ServiceConnectionLeaked: Activity com.android.email.activity.setup.AccountSetupOptions has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@41c31a88 that was originally bound here 12-14 15:57:59.940: E/ActivityThread(5339): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:979) 12-14 15:57:59.940: E/ActivityThread(5339): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873) 12-14 15:57:59.940: E/ActivityThread(5339): at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1575) 12-14 15:57:59.940: E/ActivityThread(5339): at android.app.ContextImpl.bindService(ContextImpl.java:1558) 12-14 15:57:59.940: E/ActivityThread(5339): at android.content.ContextWrapper.bindService(ContextWrapper.java:517) 12-14 15:57:59.940: E/ActivityThread(5339): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:175) 12-14 15:57:59.940: E/ActivityThread(5339): at com.android.emailcommon.service.EmailServiceProxy.updateFolderList(EmailServiceProxy.java:254) 12-14 15:57:59.940: E/ActivityThread(5339): at com.android.email.activity.setup.AccountSetupOptions.optionsComplete(AccountSetupOptions.java:383) 12-14 15:57:59.940: E/ActivityThread(5339): at com.android.email.activity.setup.AccountSetupOptions.access$200(AccountSetupOptions.java:60) 12-14 15:57:59.940: E/ActivityThread(5339): at com.android.email.activity.setup.AccountSetupOptions$3$1.run(AccountSetupOptions.java:313) 12-14 15:57:59.940: E/ActivityThread(5339): at android.app.Activity.runOnUiThread(Activity.java:4727) 12-14 15:57:59.940: E/ActivityThread(5339): at com.android.email.activity.setup.AccountSetupOptions$3.run(AccountSetupOptions.java:310) 12-14 15:57:59.940: E/ActivityThread(5339): at android.accounts.AccountManager$11.run(AccountManager.java:1427) 12-14 15:57:59.940: E/ActivityThread(5339): at android.os.Handler.handleCallback(Handler.java:733) 12-14 15:57:59.940: E/ActivityThread(5339): at android.os.Handler.dispatchMessage(Handler.java:95) 12-14 15:57:59.940: E/ActivityThread(5339): at android.os.Looper.loop(Looper.java:136) 12-14 15:57:59.940: E/ActivityThread(5339): at android.app.ActivityThread.main(ActivityThread.java:5127) 12-14 15:57:59.940: E/ActivityThread(5339): at java.lang.reflect.Method.invokeNative(Native Method) 12-14 15:57:59.940: E/ActivityThread(5339): at java.lang.reflect.Method.invoke(Method.java:515) 12-14 15:57:59.940: E/ActivityThread(5339): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 12-14 15:57:59.940: E/ActivityThread(5339): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) 12-14 15:57:59.940: E/ActivityThread(5339): at dalvik.system.NativeStart.main(Native Method) 12-14 15:57:59.940: W/ActivityManager(1047): Unbind failed: could not find connection for android.os.BinderProxy@419ed618 12-14 15:57:59.950: I/monkey(5339): EmailContent
startService没反应,也没有报错,Logcat没任何信息,请大哥大姐们帮看看,呆马如下:
public class MainActivity extends Activity implements OnClickListener { private Button start; private Button stop; private Button bind; private Button unbind; private MyService.DownloadBinder downloadBinder; private ServiceConnection connection = new ServiceConnection() { public void onServiceDisconnected(ComponentName name) { } public void onServiceConnected(ComponentName name, IBinder service) { downloadBinder = (MyService.DownloadBinder) service; downloadBinder.startDownload(); downloadBinder.getProgress(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); start = (Button) findViewById(R.id.start_service); stop = (Button) findViewById(R.id.stop_service); bind = (Button) findViewById(R.id.bind); unbind = (Button) findViewById(R.id.unbind); start.setOnClickListener(this); stop.setOnClickListener(this); bind.setOnClickListener(this); unbind.setOnClickListener(this); } public void onClick(View v) { switch(v.getId()) { case R.id.start_service: Intent startIntent = new Intent(this, MyService.class); startService(startIntent); break; case R.id.stop_service: Intent stopIntent = new Intent(this, MyService.class); stopService(stopIntent); break; case R.id.bind: Intent bindIntent = new Intent(this, MyService.class); bindService(bindIntent, connection, BIND_AUTO_CREATE); break; case R.id.unbind: unbindService(connection); break; default: break; } } } public class MyService extends Service { private DownloadBinder db = new DownloadBinder(); class DownloadBinder extends Binder { public void startDownload() { Log.v("MyService", "download"); } public int getProgress() { return 0; } } @Override public IBinder onBind(Intent intent) { return db; } public void onCreate() { super.onCreate(); Log.d("MyService", "start"); } public int onStartCommand(Intent intent , int flags, int startId) { Log.d("MyService", "startedCommand"); return super.onStartCommand(intent, flags, startId); } public void onDestroy() { super.onDestroy(); Log.d("MyService", "destroyed"); } }
连续点击,unbind()后执行ajax ,成功后执行bind()重新绑定,数据出现多条重复
连续点击,unbind()后执行ajax ,成功后执行bind()重新绑定,数据出现多条重复
iframe 子页面无法unbind父页面按钮的click事件
iframe,父页面有个切换按钮,点击菜单按钮加载不同页面时候需要给切换按钮绑定click事件,为了避免重复绑定,需要在每次绑定前先解绑,但是在子页面解绑父页面的click事件无效
关于服务执行的顺序问题
这是服务里的代码 public class Myservice extends Service { private DownloadBinder mBinder= new DownloadBinder(); @Override public IBinder onBind(Intent intent){ return mBinder; } class DownloadBinder extends Binder{ public void startDownload(){ Log.d ( "MyService","startDownload excuted"); } public int getProgress(){ Log.d("MyService","getprogress"); return 0; } } @Override public void onCreate(){ super.onCreate(); Log.d ( "MyService","OnCreate excuted"); } @Override public int onStartCommand(Intent intent,int flags,int startId){ Log.d ( "MyService","start excuted"); return super.onStartCommand(intent, flags, startId); } @Override public void onDestroy(){ super.onDestroy(); Log.d ( "MyService","stop excuted"); } } 这是主活动的代码 public class MainActivity extends ActionBarActivity implements OnClickListener { private Button startService; private Button stopService; private Button bindService; private Button unbindService; private Myservice.DownloadBinder downloadBinder; private ServiceConnection connection = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { // TODO Auto-generated method stub } @Override public void onServiceConnected(ComponentName name, IBinder service) { downloadBinder = (Myservice.DownloadBinder) service; downloadBinder.startDownload(); downloadBinder.getProgress(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startService = (Button) findViewById(R.id.start_service); stopService = (Button) findViewById(R.id.stop_service); bindService = (Button) findViewById(R.id.bind_service); unbindService = (Button) findViewById(R.id.unbind_service); startService.setOnClickListener(this); stopService.setOnClickListener(this); bindService.setOnClickListener(this); unbindService.setOnClickListener(this); } @Override public void onClick(View v){ switch(v.getId()){ case R.id.start_service: Intent startIntent = new Intent(this,Myservice.class); startService(startIntent);break; case R.id.stop_service: Intent stopIntent = new Intent(this,Myservice.class); stopService(stopIntent);break; case R.id.bind_service: Intent bindIntent = new Intent (this,Myservice.class); bindService(bindIntent,connection,BIND_AUTO_CREATE); break; case R.id.unbind_service: unbindService(connection); break; default: break; } } } 为什么DownloadBinder放在onStartCommand()后面然后点击bing_service会执行oncreate() 方法,放在oncreate则不会执行
OSGi Service 和 Bundle扩展点 的区别,谢谢大家
我在看OSGi进阶的文章时一事不太明白,有一个留言板的实例。写一个HibernateModule模块,对外通过OSGi的DS方式对外提供commonDAO和SessionFactory的Service, <component name="CommonDaoComponent"> <implementation class="cn.org.osgi.module.hibernate.service.impl.CommonDaoComponent"/> <reference name="SessionService" interface="cn.org.osgi.module.hibernate.service.SessionService" bind="setSessionService" unbind="unsetSessionService" policy="dynamic"/> <service> <provide interface="cn.org.osgi.module.hibernate.service.CommonDaoService"/> </service> </component> 而HibernateModule还对外提供了一个扩展点是: <plugin> <extension-point id="HibernateExtension" name="cn.org.osgi.hibernate.extension" schema="schema/hibernateExtension.exsd"/> </plugin> 我想问一下,这OSGi对外提供的Service 和 这个bundle对外提供的扩展点性质一样么? 可不可以把这个扩展点写成Service的形式,对外提供服务呢? 十分感谢,大家~~:)
新手提问,十万火急:eclipse中启动服务器报错
以前运行好好的,现在不能启动了,不知道怎么回事,网上也找不到原因,求大神们帮忙解决一下,十分感谢!! <br><br><br> Server Tomcat v8.0 Server at localhost failed to start. ![图片说明](https://img-ask.csdn.net/upload/201909/21/1569074501_604160.png) <br><br><br> 有人说是配置文件问题,看一下。。 <br><br><br> ![图片说明](https://img-ask.csdn.net/upload/201909/21/1569074681_560506.png) <br><br><br> 报错信息比较多,我复制一下:<br><br><br> ``` 九月 21, 2019 10:06:36 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:testssm' did not find a matching property. 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/8.0.52 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server built: Apr 28 2018 16:24:29 UTC 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server number: 8.0.52.0 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 7 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Version: 6.1 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Architecture: x86 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java Home: C:\Java\jdk\jre 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Version: 1.8.0_65-b17 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Vendor: Oracle Corporation 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: C:\code\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: C:\tomcat\apache-tomcat-8.0.52 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=C:\code\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=C:\tomcat\apache-tomcat-8.0.52 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=C:\tomcat\apache-tomcat-8.0.52\webapps 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=C:\tomcat\apache-tomcat-8.0.52\endorsed 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=GBK 九月 21, 2019 10:06:36 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Java\jdk\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Java/jdk/bin/../jre/bin/client;C:/Java/jdk/bin/../jre/bin;C:/Java/jdk/bin/../jre/lib/i386;C:\Java\jdk\bin;C:\Java\apache-maven-3.5.3\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Git\cmd;C:\code\eclipse;;. 九月 21, 2019 10:06:36 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-nio-8080"] 九月 21, 2019 10:06:36 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 九月 21, 2019 10:06:36 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-nio-8009"] 九月 21, 2019 10:06:36 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 九月 21, 2019 10:06:36 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 680 ms 九月 21, 2019 10:06:36 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 九月 21, 2019 10:06:36 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/8.0.52 九月 21, 2019 10:06:37 下午 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom 警告: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [125] milliseconds. 九月 21, 2019 10:06:37 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testssm]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:945) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1400) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/testssm]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) ... 6 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@fdd2b1] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:5016) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5149) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 6 more Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@154fd45] at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:135) at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:722) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 9 more Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature) at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:142) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) ... 12 more Caused by: java.util.zip.ZipException: invalid LOC header (bad signature) at java.util.zip.ZipFile.read(Native Method) at java.util.zip.ZipFile.access$1400(ZipFile.java:60) at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:716) at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:419) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) at sun.misc.IOUtils.readFully(IOUtils.java:65) at java.util.jar.JarFile.getBytes(JarFile.java:425) at java.util.jar.JarFile.getManifestFromReference(JarFile.java:193) at java.util.jar.JarFile.getManifest(JarFile.java:180) at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:140) ... 13 more 九月 21, 2019 10:06:37 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:945) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:789) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.startup.Catalina.start(Catalina.java:641) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1400) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 6 more 九月 21, 2019 10:06:37 下午 org.apache.catalina.startup.Catalina start 严重: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.startup.Catalina.start(Catalina.java:641) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:789) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 9 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 11 more 九月 21, 2019 10:06:37 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["http-nio-8080"] 九月 21, 2019 10:06:37 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["ajp-nio-8009"] 九月 21, 2019 10:06:37 下午 org.apache.catalina.core.StandardService stopInternal 信息: Stopping service Catalina 九月 21, 2019 10:06:37 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["http-nio-8080"] 九月 21, 2019 10:06:37 下午 org.apache.coyote.AbstractProtocol destroy 严重: Failed to destroy end point associated with ProtocolHandler ["http-nio-8080"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:315) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:491) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:896) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.startup.Catalina.start(Catalina.java:645) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483) 九月 21, 2019 10:06:37 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["ajp-nio-8009"] 九月 21, 2019 10:06:37 下午 org.apache.coyote.AbstractProtocol destroy 严重: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:315) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:491) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:896) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.startup.Catalina.start(Catalina.java:645) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483) ```
jquery bind失效了???
$("#myText").click(function(){ console.log(1111); $(this).unbind("click"); $(this).bind("click"); }) ``` 为什么点按纽只能输出一次1111,再点就没反应了,虽然我unbind了,但我又bind啦?? ```
bootstraptable-edit使用问题
![图片说明](https://img-ask.csdn.net/upload/201908/06/1565077495_685813.png) 外部的表格无法获取数据,检查contentType属性配置问题。 ``` $(function() { //初始化Table var oTable = new TableInit(); oTable.Init(); }); var TableInit = function() { var oTableInit = new Object(); //初始化Table oTableInit.Init = function() { $('#table').bootstrapTable({ url : 'list',//请求后台的URL(*) method : 'post',//请求方式(*) toolbar : '#toolbar',//工具按钮用哪个容器 striped : true,//是否显示行间隔色 cache : false,//是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) pagination : true,//是否显示分页(*) sortable : false,//是否启用排序 sortOrder : "asc",//排序方式 queryParams : oTableInit.queryParams,//传递参数(*) sidePagination : "server",//分页方式:client客户端分页,server服务端分页(*) pageNumber : 1,//初始化加载第一页,默认第一页 pageSize : 10,//每页的记录行数(*) pageList : [ 10, 25, 50, 100 ],//可供选择的每页的行数(*) search : true,//是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大 contentType : "application/x-www-form-urlencoded", strictSearch : true, showColumns : true,//是否显示所有的列 showRefresh : true,//是否显示刷新按钮 minimumCountColumns : 2,//最少允许的列数 clickToSelect : true,//是否启用点击选中行 height : 700,//行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度 uniqueId : "id",//每一行的唯一标识,一般为主键列 showToggle : true,//是否显示详细视图和列表视图的切换按钮 cardView : false,//是否显示详细视图 detailView : false,//是否显示父子表 columns : [ { field : 'id', title : '编号' }, { field : 'name', title : '名字' }, { field : 'price', title : '价格' }, { field : 'operate', title : '操作', formatter : operateFormatter //自定义方法,添加操作按钮 }, ], rowStyle : function(row, index) { var classesArr = [ 'white', 'lightblue' ]; var strclass = ""; if (index % 2 === 0) {//偶数行 strclass = classesArr[0]; } else {//奇数行 strclass = classesArr[1]; } return { classes : strclass }; },//隔行变色 }); }; //得到查询的参数 oTableInit.queryParams = function(params) { var temp = {//这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的 limit : params.limit,//页面大小 //pageNumber: params.pageNumber,//页码 offset : params.offset }; return temp; }; return oTableInit; }; function operateFormatter(value, row, index) {//赋予的参数 return [ '<a href="#" style="color:blue;" οnclick="edit(' + row.id + ')">编辑</a>|', '<a href="#" style="color:red;" οnclick="del(' + row.id + ')">删除</a>', ].join(''); } ``` table-edit.js ``` (function($){ 'use strict'; $.extend($.fn.bootstrapTable.defaults, { editable: false }); var BootstrapTable = $.fn.bootstrapTable.Constructor, _init = BootstrapTable.prototype.init, _initBody = BootstrapTable.prototype.initBody, _onSort = BootstrapTable.prototype.onSort, _append = BootstrapTable.prototype.append, _initHeader = BootstrapTable.prototype.initHeader ; //添加编辑表格默认属性,如何edit设置为false时,表示该列不可编辑 $.extend(true,BootstrapTable.COLUMN_DEFAULTS,{ edit:{ type:'text'//目前只支持 文本:text 下拉:select 日期:date } }); BootstrapTable.prototype.init = function () { _init.apply(this, Array.prototype.slice.apply(arguments)); var that = this; that.prevEditRow = null;//上一次编辑的行 that.columns = {};//列配置信息 that.insertRowVal = {};//新插入行的默认值 that.enableAppend = true;//允许添加新行 if (that.options.editable) { var columnObj = this['getColumns'](); $.each(columnObj,function(i,obj){ $.each(obj,function(z,col){ if(!isNaN(col.fieldIndex) && col.fieldIndex >= 0){ if(col.checkbox)col.edit = false; that.columns['column'+col.fieldIndex] = col; that.insertRowVal[col.field] = ''; } }); }); //this.initEdit(); } }; /*BootstrapTable.prototype.initHeader = function(){ _initHeader.apply(this, Array.prototype.slice.apply(arguments)); this.$container.find('.fixed-table-header').addClass('success'); };*/ BootstrapTable.prototype.initBody = function () { var that = this; _initBody.apply(this, Array.prototype.slice.apply(arguments)); if (!that.options.editable) return; this.initEdit(); //如果列是下拉框,则转换值为对应的文本 $.each(that.columns,function(indx,col){ if(col.edit && col.edit.type == 'select'){ col.edit = $.extend({},$.fn.bootstrapSelect.defaults,col.edit); if(col.edit.data.length > 0){ that.$body.find('>tr').each(function(){ if(that.getData().length < 1)return true; var rowData = that.data[$(this).data('index')];//当前点击td所在行的数据 var $td = $(this).find('td').eq(col.fieldIndex); $.each(col.edit.data,function(i,data){ if(data[col.edit.valueField] == rowData[col.field]){ $td.html(data[col.edit.textField]); } }); }); } else if(col.edit.url){ $.ajax({ url:col.edit.url, type:'post', data:col.edit.paramsType == 'json' ? JSON.stringify(col.edit.params) : col.edit.params, dataType:'json', success: function(jsonLst) { col.edit.onLoadSuccess.call(this,jsonLst); that.$body.find('>tr').each(function(){ if(that.getData().length < 1)return true; var rowData = that.data[$(this).data('index')];//当前点击td所在行的数据 var $td = $(this).find('td').eq(col.fieldIndex); $.each(jsonLst,function(i,data){ if(data[col.edit.valueField] == rowData[col.field]){ $td.html(data[col.edit.textField]); } }); }); col.edit.data = jsonLst; col.edit.url = null; }, error: function(xhr, textStatus, errorThrown){ col.edit.onLoadError.call(this); col.edit.data = []; col.edit.url = null; throw col.field+' 列下拉框数据加载失败'; } }); } } }); }; //根据行号删除指定行 BootstrapTable.prototype.removeRow = function (rowNum) { var that = this; var len = that.options.data.length; if (isNaN(rowNum)){ return; } if(that.$body.find('.editable-select').data('index') != rowNum){ recover(that); } //删除数据 that.options.data.splice(rowNum,1); if (len === that.options.data.length){ return; } var oldClass = {};//保存被标记修改的样式 that.$body.find('>tr').each(function(indx){ if($(this).hasClass('editable-modify')){ if(indx > rowNum){ oldClass[indx-1] = 'editable-modify'; } else{ oldClass[indx] = 'editable-modify'; } } }); //this.prevEditRow = null; //this.$body.find('>tr').removeClass('editable-select'); that.initBody(); //将标记改变过行的样式从新设置回去 for(var key in oldClass){ that.$body.find('>tr').eq(key).addClass(oldClass[key]); } //this.initEdit(); //没有数据时给提示加上样式 if(that.getData().length < 1){ that.$body.find('>tr').addClass('no-records-found'); } }; BootstrapTable.prototype.append = function (){ var that = this; //if(!that.enableAppend)return; var oldClass = {};//保存被标记修改的样式 that.$body.find('>tr').each(function(indx){ if($(this).hasClass('editable-modify') || $(this).hasClass('editable-insert')){ oldClass[indx] = 'editable-modify'; } }); arguments[0] = $.extend({},that.insertRowVal,arguments[0]); _append.apply(this,Array.prototype.slice.apply(arguments)); if (that.options.editable){ //that.initEdit(); setTimeout(function (){ //将标记改变过行的样式从新设置回去 for(var key in oldClass){ that.$body.find('>tr').eq(key).addClass(oldClass[key]); } that.$body.find('>tr:last').addClass('editable-modify'); that.$body.find('>tr:last').addClass('editable-insert');//双重保险,防止在快速点击添加时,为给新增行设置editable-modify属性 that.$body.find('>tr:last').click(); },60); } }; BootstrapTable.prototype.onSort = function () { _onSort.apply(this, Array.prototype.slice.apply(arguments)); var that = this; if (that.options.editable) { this.initEdit(); } }; BootstrapTable.prototype.getData = function () { return (this.searchText || this.searchCallback) ? this.data : this.options.data; }; BootstrapTable.prototype.getColumns = function () { return this.options.columns; }; /** * 获取有被修改过行的值 */ BootstrapTable.prototype.getModiDatas = function (){ var that = this; var datas = []; that.$body.find('.editable-modify').each(function(){ if(that.data[$(this).data('index')]){ datas.push(that.data[$(this).data('index')]); } }); return datas; }; /** * 获取指定列的和,参数为列下标 */ BootstrapTable.prototype.getColTotal = function (num){ var retVal = 0; this.$body.find('>tr').each(function(){ var colNum = 0; if($(this).hasClass('editable-select')){ colNum = $(this).find('td').eq(num).find('input').val(); } else{ colNum = $(this).find('td').eq(num).html(); } if(!isNaN(colNum)){//是数字才做想加 retVal += Number(colNum); } }); return retVal; }; /** * 创建可编辑表格 */ BootstrapTable.prototype.initEdit = function(){ var that = this, data = this.getData(); //this.$body.find('> tr').unbind('click').on('click' //this.$body.delegate('>tr','click' this.$body.find('> tr').unbind('click').on('click',function(){ var $tr = $(this); if($tr.hasClass('editable-select') || data.length < 1 || $tr.hasClass('no-records-found')){ return; } $tr.removeClass('no-records-found'); recover(that); that.prevEditRow = $tr; $tr.addClass('editable-select');//给当前编辑行添加样式,目前样式为空只做标识使用 that.$body.find('> tr').not(this).removeClass('editable-select'); $tr.find('td').closest('td').siblings().html(function(i,html){ initTrClick(that,this); }); }); //鼠标点击事件 $(document).bind('mousedown',function(event){ var $target = $(event.target); if(!($target.parents().andSelf().is(that.$body)) && !($target.parents().andSelf().is($('.datetimepicker')))){ setTimeout(function () { recover(that); //that.prevEditRow = null; //that.$body.find('> tr').removeClass('editable-select'); },10); }; }); }; $.fn.bootstrapTable.methods.push('getColumns', 'getModiDatas','removeRow','getColTotal'); /** * 给tr添加点击事件 */ function initTrClick(that,_this){ that.enableAppend = true; var $td = $(_this); var $tr = $td.parent(); var rowData = that.data[$tr.data('index')];//当前点击td所在行的数据 var tdIndex = $tr.children().index($td);//当前点击的td下标 var tdOpt = that.columns['column'+tdIndex]; if(!tdOpt.edit || typeof tdOpt.edit != 'object'){ return ; } $td.data('field',tdOpt.field); if(!$td.data('oldVal')){ $td.data('oldVal',$.trim(rowData[tdOpt.field])); } var height = $td.innerHeight() - 3; var width = $td.innerWidth() - 2; $td.data('style',$td.attr('style'));//保存原来的样式 $td.attr('style','margin:0px;padding:1px!important;'); var placeholder = ''; if(tdOpt.edit.required == true){ placeholder = '必填项'; } var value = rowData[tdOpt.field] == null || rowData[tdOpt.field] == ''?'':rowData[tdOpt.field]; $td.html('<div style="margin:0;padding:0;overflow:hidden;border:solid 0px red;height:'+(height)+'px;width:'+(width)+'px;">' +'<input type="text" placeholder="'+placeholder+'" value="'+value+'" style="margin-left: 0px; margin-right: 0px; padding-top: 1px; padding-bottom: 1px; width:100%;height:100%">' +'</div>'); $td.width(width); var $input = $td.find('input'); if(!tdOpt.edit.type || tdOpt.edit.type == 'text'){ if(tdOpt.edit['click'] && typeof tdOpt.edit['click'] === 'function'){ $input.unbind('click').bind('click',function(event){ tdOpt.edit['click'].call(this,event); }); } if(tdOpt.edit['focus'] && typeof tdOpt.edit['focus'] === 'function'){ $input.unbind('focus').bind('focus',function(event){ tdOpt.edit['focus'].call(this,event); }); } $input.unbind('blur').on('blur',function(event){ if(tdOpt.edit['blur'] && typeof tdOpt.edit['blur'] === 'function'){ tdOpt.edit['blur'].call(this,event); } }); } else if(tdOpt.edit.type == 'select'){ $input.bootstrapSelect(tdOpt.edit); } else if(tdOpt.edit.type == 'date'){ $td.html('<div style="margin:0;padding:0;overflow:hidden;border:solid 0px red;height:'+(height)+'px;width:'+(width)+'px;" class="input-group date form_datetime" data-link-field="dtp_editable_input">' +'<input class="form-control" type="text" value="'+value+'">' +'<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>' +'</div>' +'<input type="hidden" id="dtp_editable_input" value="'+value+'"/>' ); that.$body.find('.form_datetime').datetimepicker({ weekStart: 1, todayBtn: 1, autoclose: 1, todayHighlight: 1, startView: 2, forceParse: 0, language:'zh-CN', format: 'yyyy-mm-dd hh:ii:ss', pickerPosition: 'bottom-left', showMeridian: 1 }); } } /** * 恢复tr,使之处于不可编辑状态 */ function recover(that){ var isModi = false;//判断行值是否变动过 if(that.prevEditRow != null){ that.prevEditRow.find('td').closest('td').siblings().html(function(i,html){ $(this).attr('style',$(this).data('style')); var textVal = $(this).find('input[type="text"]').val(); var hiddenVal = $(this).find('input[type="hidden"]').val(); if(typeof $(this).find('input[type="text"]').bootstrapSelect('getText') != 'object'){ $(this).find('input[type="text"]').bootstrapSelect('destroy'); } if(textVal != undefined){ if($(this).data('oldVal') != (hiddenVal?hiddenVal:$.trim(textVal)) && $(this).data('field')) { that.data[that.prevEditRow.data('index')][$(this).data('field')] = hiddenVal?hiddenVal:$.trim(textVal); isModi = true; } if(that.columns['column'+i].edit.required == true){ if(textVal == null || textVal == ''){ that.enableAppend = false; return '<span style="color:red;">必填项不能为空</span>'; } } return $.trim(textVal); } }); //新值跟旧值不匹配证明被改过 if(isModi || that.prevEditRow.hasClass('editable-insert')){ that.prevEditRow.addClass('editable-modify'); } else{ that.prevEditRow.removeClass('editable-modify'); } that.prevEditRow = null; that.$body.find('> tr').removeClass('editable-select'); } } })(jQuery); ``` 哪位大神能帮忙解决下
求教,,,jquery怎么移除scroll事件???
我只是想不滚动,但是触发scroll事件而已嘛----- 然后,就是滚动,就是滚动--- ``` $(".contain").scroll(function(event){ event.stopPropagation(); event.preventDefault(); $(this).unbind('scroll'); console.info("1"); return false; }) $(window).scroll(function(event){ event.stopPropagation(); event.preventDefault(); $(this).unbind('scroll'); console.info("1"); return false; }) $('body').scroll(function(event){ event.stopPropagation(); event.preventDefault(); $(this).unbind('scroll'); console.info("1"); return false; }) $(document).scroll(function(event){ event.stopPropagation(); event.preventDefault(); $(this).unbind('scroll'); console.info("1"); return false; }) ``` 我都这样了---为什么还是滚动?
关于控件的使用 button的定义
Button bind_button = (Button)this.findViewById(R.id.binded); bind_button = setOnclickListener(mbindLisetener); bind_button =(Button)this.findViewById(R.id.unbind); bind_button.setOnClickListener(mUnbindListener); 为什么这段代码中bind_button控件使用了两次 请哪位大神解释一下 谢谢啦 第一行和第三行的绑定控件。
ListView自动刷新多个Item
![图片说明](https://img-ask.csdn.net/upload/201601/04/1451909397_404376.png)ListView自定刷新Item中有改变的数据,并将此项 item背景闪烁一下。 ``` package master.modle.masterfinance.adapter; import android.graphics.Color; import android.os.Handler; import android.os.Message; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.LinearInterpolator; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import java.security.MessageDigest; import java.util.ArrayList; import java.util.List; import java.util.Objects; import master.modle.masterfinance.R; import master.modle.masterfinance.model.biz.MarketList; import master.modle.masterfinance.utils.LogUtils; import master.modle.masterfinance.utils.UIUtils; import master.modle.masterfinance.utils.ViewHolderUtils; /** * * @action: * @author: YangShao * @date: 2016/1/4 @time: 10:46 */ public class MarkItmeAapter extends BaseAdapter{ List<MarketList> listEntitys; ListView listView; public MarkItmeAapter(List<MarketList> listEntitys,ListView listView){ this.listEntitys=listEntitys; this.listView=listView; } @Override public int getCount() { return listEntitys.size(); } @Override public Object getItem(int i) { return listEntitys.get(i); } @Override public long getItemId(int i) { return i; } public static ViewHolder mviewHolder; @Override public View getView(int i, View view, ViewGroup viewGroup) { ViewHolder holder; if (view==null){ view = LayoutInflater.from(UIUtils.getContext()).inflate(R.layout.item_market, viewGroup, false); holder = new ViewHolder(); holder.tx_name = (TextView) view.findViewById(R.id.id_mr_name); holder.tx_new = (TextView) view.findViewById(R.id.id_mr_new); holder.tv_range = (TextView) view.findViewById(R.id.id_mr_range); view.setTag(holder); }else{ holder = (ViewHolder) view.getTag(); } setData(holder,i); return view; } private static class ViewHolder { private TextView tx_name; private TextView tx_new; private TextView tv_range; private MarketList market; } public List<MarketList> getListViewData(){ return listEntitys; } public void setListEntitys(List<MarketList> listEntitys) { this.listEntitys = listEntitys; } /** * 设置viewHolder的数据 * @param holder * @param itemIndex */ private void setData(ViewHolder holder, int itemIndex) { holder.tx_name.setText(listEntitys.get(itemIndex).getName()); holder.tx_new.setText(listEntitys.get(itemIndex).getLatestpri() + ""); holder.tv_range.setText(listEntitys.get(itemIndex).getMarkup() + ""); holder.market=listEntitys.get(itemIndex); //int markup=Integer.valueOf(String.valueOf(listEntitys.get(i).getMarkup())); // int markup = Integer.parseInt(new java.text.DecimalFormat("0").format(listEntitys.get(i).getMarkup())); int markup = (int)listEntitys.get(itemIndex).getMarkup(); if (markup>=0){ holder.tv_range.setTextColor(Color.RED); holder.tx_new.setTextColor(Color.RED); }else{ holder.tv_range.setTextColor(Color.GREEN); holder.tx_new.setTextColor(Color.GREEN); } } } ``` ``` package master.modle.masterfinance.frg; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import java.util.List; import java.util.Timer; import java.util.TimerTask; import butterknife.Bind; import butterknife.ButterKnife; import master.modle.masterfinance.R; import master.modle.masterfinance.adapter.MarkItmeAapter; import master.modle.masterfinance.adapter.PagerItmeAapter; import master.modle.masterfinance.base.BaseApplication; import master.modle.masterfinance.base.BaseFragment; import master.modle.masterfinance.model.biz.InformatTitle; import master.modle.masterfinance.model.biz.MarketList; import master.modle.masterfinance.mpresenter.IMarketListPresnter; import master.modle.masterfinance.mview.IMarketView; import master.modle.masterfinance.utils.LogUtils; import master.modle.masterfinance.utils.ToastUtils; /** * @action: * @author: YangShao VapagerFragment * @date: 2015/12/24 @time: 16:22 */ public class MarkItmeFrag extends BaseFragment implements IMarketView { @Bind(R.id.id_mr_list) ListView idMrList; private View rootView; InformatTitle categoryEntitie; //标签内容 IMarketListPresnter iMarketListPresnter = new IMarketListPresnter(this); private String actName; public static MarkItmeFrag informationItmeFrag; private PagerItmeAapter itmeFragAapter; Handler handler = new Handler(){ public void handleMessage(Message msg) { super.handleMessage(msg); if(msg.what == 1){ iMarketListPresnter.getMarkList(String.valueOf(categoryEntitie.getId())); } } }; private Timer timer = new Timer(true); //任务 private TimerTask task = new TimerTask() { public void run() { Message msg = new Message(); msg.what = 1; handler.sendMessage(msg); } }; public static MarkItmeFrag getFragment(InformatTitle categoryEntitie, String mactName) { LogUtils.e("InformationItmeFrag getFragment" + mactName); informationItmeFrag = new MarkItmeFrag(); informationItmeFrag.categoryEntitie = categoryEntitie; informationItmeFrag.actName = mactName; return informationItmeFrag; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = getRootView(); ButterKnife.bind(this, rootView); initView(); return rootView; } public void initView() { //启动定时器 timer.schedule(task, 0, 10 * 1000); // iMarketListPresnter.getMarkList(String.valueOf(categoryEntitie.getId())); } public View getRootView() { rootView = LayoutInflater.from(getActivity()).inflate( R.layout.frag_mark_home, null); return rootView; } /* 摧毁视图 */ @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.unbind(this); timer.cancel(); timer=null; } /* 摧毁该Fragment,一般是FragmentActivity 被摧毁的时候伴随着摧毁 */ @Override public void onDestroy() { super.onDestroy(); BaseApplication.requestQueue.cancelAll(this); if (timer!=null){ timer.cancel(); timer=null; } } @Override public void onResume() { super.onResume(); } @Override public void onPause() { super.onPause(); } MarkItmeAapter markItmeAapter; @Override public void setInfomatList(final List<MarketList> listEntitys) { if (listEntitys.size()==0){ return; }if (markItmeAapter==null){ markItmeAapter=new MarkItmeAapter(listEntitys,idMrList); idMrList.setAdapter(markItmeAapter); }else { setUpdateListView(listEntitys); } } public void setUpdateListView(List<MarketList> mlistEntitys){ //得到原有数据 List<MarketList> liste = markItmeAapter.getListViewData(); for (int i=0;i<liste.size();i++){ double markup1=liste.get(i).getLatestpri(); double markup2=mlistEntitys.get(i).getLatestpri(); if (!equal(markup1,markup2)){ ToastUtils.showToastReal(markup2 + ""); LogUtils.e("发生改变的数据id" + i); } } markItmeAapter.setListEntitys(mlistEntitys); markItmeAapter.notifyDataSetChanged(); } boolean equal(double num1,double num2) { if((num1-num2>-0.000001)&&(num1-num2)<0.000001) return true; else return false; } @Override public void noData() { } } ``` ``` package master.modle.masterfinance.model.biz; public class MarketList { private int id; private String name; private double latestpri; private double markup; public void setId(int id) { this.id = id; } public void setName(String name) { this.name = name; } public void setLatestpri(double latestpri) { this.latestpri = latestpri; } public void setMarkup(double markup) { this.markup = markup; } public int getId() { return id; } public String getName() { return name; } public double getLatestpri() { return latestpri; } public double getMarkup() { return markup; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof MarketList)) return false; MarketList that = (MarketList) o; return getId() == that.getId(); } @Override public int hashCode() { return getId(); } } ```
zTree的增加图标不显示?即为什么不显示绿色的图标“+”?
代码如下: 设置鼠标移到节点上,在后面显示一个按钮 var setting = { view: { addHoverDom: addHoverDom, removeHoverDom: removeHoverDom } }; function addHoverDom(treeId, treeNode) { var aObj = $("#" + treeNode.tId + "_a"); if ($("#diyBtn_"+treeNode.id).length>0) return; var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>" + "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id + "' title='"+treeNode.name+"' onfocus='this.blur();'></button>"; aObj.append(editStr); var btn = $("#diyBtn_"+treeNode.id); if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);}); }; function removeHoverDom(treeId, treeNode) { $("#diyBtn_"+treeNode.id).unbind().remove(); $("#diyBtn_space_" +treeNode.id).unbind().remove(); }; 我这是照搬的zTree的API的代码,当鼠标移到某个节点时,显示修改和删除的图标,就是不显示增加的图标?求大神搭救。搞了几个小时了。
JS中在html文本就绪后,对某个元素进行clone(true),事件消失.
``` JS中$(document).ready()紧接着对html中的<div>进行clone(true),事件消失. JS对div中的<input class="pkSeq" type="text" >绑定了一个点击事件. JS进行如下操作: $(document).ready(function() { window.contextPath = localhostPaht+projectName; /** * 维护信息窗口克隆 */ var applSeq=window.parent.applSeq; var WinId = 1; var divObj=$("#row_0").clone(true); $("#addDiv").unbind("click").on("click",function(){ divObj.attr("id","row_"+WinId); divObj.insertAfter($("#row_"+(WinId-1)));//将clone出的追加到上一个的div后面 WinId++; }); }); //这是点击事件:` $(".pkSeq").unbind("click").on("click", function () {}) 然后网页中原本的div中的点击事件还存在,而克隆出来的div中的点击事件直接没了.不是不触发,是没了.就像新克隆的div根本没有js一样.想知道为什么. ```
tomcat启动报错怎么解决
``` 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/bjyh_web]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/bjyh_web]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) ... 6 more Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2575) at java.lang.Class.getDeclaredFields(Class.java:1908) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:256) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:132) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:336) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:786) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5213) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 6 more Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167) ... 20 more 七月 02, 2019 2:02:59 上午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:789) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.startup.Catalina.start(Catalina.java:629) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:951) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 6 more 七月 02, 2019 2:02:59 上午 org.apache.catalina.startup.Catalina start 严重: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.startup.Catalina.start(Catalina.java:629) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:789) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 9 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:951) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ... 11 more 七月 02, 2019 2:02:59 上午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["http-nio-8080"] 七月 02, 2019 2:02:59 上午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["ajp-nio-8009"] 七月 02, 2019 2:02:59 上午 org.apache.catalina.core.StandardService stopInternal 信息: Stopping service Catalina 七月 02, 2019 2:02:59 上午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["http-nio-8080"] 七月 02, 2019 2:02:59 上午 org.apache.coyote.AbstractProtocol destroy 严重: Failed to destroy end point associated with ProtocolHandler ["http-nio-8080"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:316) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:492) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:883) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) 七月 02, 2019 2:02:59 上午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["ajp-nio-8009"] 七月 02, 2019 2:02:59 上午 org.apache.coyote.AbstractProtocol destroy 严重: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:316) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:492) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:883) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) ```
相见恨晚的超实用网站
搞学习 知乎:www.zhihu.com 简答题:http://www.jiandati.com/ 网易公开课:https://open.163.com/ted/ 网易云课堂:https://study.163.com/ 中国大学MOOC:www.icourse163.org 网易云课堂:study.163.com 哔哩哔哩弹幕网:www.bilibili.com 我要自学网:www.51zxw
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
字节跳动视频编解码面经
引言 本文主要是记录一下面试字节跳动的经历。 三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时
开源一个功能完整的SpringBoot项目框架
福利来了,给大家带来一个福利。 最近想了解一下有关Spring Boot的开源项目,看了很多开源的框架,大多是一些demo或者是一个未成形的项目,基本功能都不完整,尤其是用户权限和菜单方面几乎没有完整的。 想到我之前做的框架,里面通用模块有:用户模块,权限模块,菜单模块,功能模块也齐全了,每一个功能都是完整的。 打算把这个框架分享出来,供大家使用和学习。 为什么用框架? 框架可以学习整体
源码阅读(19):Java中主要的Map结构——HashMap容器(下1)
(接上文《源码阅读(18):Java中主要的Map结构——HashMap容器(中)》) 3.4.4、HashMap添加K-V键值对(红黑树方式) 上文我们介绍了在HashMap中table数组的某个索引位上,基于单向链表添加新的K-V键值对对象(HashMap.Node&lt;K, V&gt;类的实例),但是我们同时知道在某些的场景下,HashMap中table数据的某个索引位上,数据是按照红黑树
c++制作的植物大战僵尸,开源,一代二代结合游戏
    此游戏全部由本人自己制作完成。游戏大部分的素材来源于原版游戏素材,少部分搜集于网络,以及自己制作。 此游戏为同人游戏而且仅供学习交流使用,任何人未经授权,不得对本游戏进行更改、盗用等,否则后果自负。 目前有六种僵尸和六种植物,植物和僵尸的动画都是本人做的。qq:2117610943 开源代码下载 提取码:3vzm 点击下载--&gt; 11月28日 新增四种植物 统一植物画风,全部修
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成喔~) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Python 基础(一):入门必备知识
目录1 标识符2 关键字3 引号4 编码5 输入输出6 缩进7 多行8 注释9 数据类型10 运算符10.1 常用运算符10.2 运算符优先级 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供
深度学习图像算法在内容安全领域的应用
互联网给人们生活带来便利的同时也隐含了大量不良信息,防范互联网平台有害内容传播引起了多方面的高度关注。本次演讲从技术层面分享网易易盾在内容安全领域的算法实践经验,包括深度学习图
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Python 编程实用技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法,并会持续更新。
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
"狗屁不通文章生成器"登顶GitHub热榜,分分钟写出万字形式主义大作
GitHub 被誉为全球最大的同性交友网站,……,陪伴我们已经走过 10+ 年时间,它托管了大量的软件代码,同时也承载了程序员无尽的欢乐。 万字申请,废话报告,魔幻形式主义大作怎么写?兄dei,狗屁不通文章生成器了解一下。这个富有灵魂的项目名吸引了众人的目光。项目仅仅诞生一周,便冲上了GitHub趋势榜榜首(Js中文网 -前端进阶资源教程)、是榜首哦
推荐几款比较实用的工具,网站
1.盘百度PanDownload 这个云盘工具是免费的,可以进行资源搜索,提速(偶尔会抽风????) 不要去某站买付费的???? PanDownload下载地址 2.BeJSON 这是一款拥有各种在线工具的网站,推荐它的主要原因是网站简洁,功能齐全,广告相比其他广告好太多了 bejson网站 3.二维码美化 这个网站的二维码美化很好看,网站界面也很...
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
相关热词 如何提升c#开发能力 矩阵乘法c# c#调用谷歌浏览器 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天
立即提问