callback

method called after release() exception unable to resume with android camera

旧巷老猫 提交于 2020-01-08 19:40:24
问题 While developing a camera app I've encountered an exception that only happened when I switch to other app ( onPause() for my app). 01-15 17:22:15.017: E/AndroidRuntime(14336): FATAL EXCEPTION: main 01-15 17:22:15.017: E/AndroidRuntime(14336): java.lang.RuntimeException: Method called after release() 01-15 17:22:15.017: E/AndroidRuntime(14336): at android.hardware.Camera.setPreviewDisplay(Native Method) 01-15 17:22:15.017: E/AndroidRuntime(14336): at android.hardware.Camera.setPreviewDisplay

web安全

99封情书 提交于 2020-01-07 18:22:26
一、跨域安全限制(同源策略) 同源:协议+主机+端口相同 同源策略阻止从一个源加载的文档或脚本获取或设置从另一个源加载的文档的属性。 这种限制可以防止某些恶意攻击,但也会带来诸多不便。 解决方法: 1、document.domain + iframe (子域名代理) 1.1 知识点 (1)某一页面的domain默认等于window.location.hostname (2)主域名是不带有www前缀的,带前缀的通常都为二级域名或多级域名 (3)domain只能设置主域名 1.2 对于主域相同,子域相同的情况 父页面、子页面同时设置 document.domain = "parent.com" 1.3 对于主域相同,子域不相同的情况 Eg: A页面:http://www.a.com/a.html B页面:http://blog.a.com/b.html 1.4 问题 (1)安全性:如果一个站点被攻击(b.a.com),另一站点(c.a.com)也会引起安全漏洞; (2)安全性的连锁危机:如果一个页面引入多个iframe,要想操作所有iframe,必须得设置相同的domain。 2、JSOP 2.1 原理:浏览器对script标签跨域没有限制,它是一个无关标准,使用脚本标签来跨域获取数据的技术。 2.2 具体实现 (1)客户端通过script的src属性,实现不同域服务端接口请求; (2

Flutter应用启动流程分析(三)

亡梦爱人 提交于 2020-01-07 13:57:12
Flutter应用启动流程分析(三) 在创建FlutterView时首先创建了FlutterNativeView,这里先看看FlutterNativeView是怎么创建的; FlutterNativeView实现了BinaryMeeenger接口,下面看一下都有哪些属性 private final FlutterPluginRegistry mPluginRegistry ; private final DartExecutor dartExecutor ; private FlutterView mFlutterView ; private final FlutterJNI mFlutterJNI ; private final Context mContext ; private boolean applicationIsRunning ; FlutterPluginRegistry:实现了PluginRegistry的全部接口,管理Plugin的注册与注销的类。 DartExecutor:平台层与dart层交互执行类, 实现了平台向dart调用, dart向平台的响应功能. FlutterView:这里保存的引用,主要是将底层的渲染与执行周期状态通知给FlutterView。 FlutterJNI:这个类是调用底层本地方法的, JNI的调用都在这里。 接着看构造方法

Start an animation when the other one is finished/completed in jquery

徘徊边缘 提交于 2020-01-07 09:02:40
问题 This is not working for me: $(".button").click(function(){ $("#start").animate({ "opacity": ".3" }, "slow", function(){ $("#start").animate({"height": "0"}, "fast"); }); }); I want a div to animate and when it's done, animate again. Doesn't matter what I search on Google... on all the blogs and forums it says that this should be the only way to do it. 回答1: Looks like we'll need to see your html. Works fine for me: http://jsfiddle.net/LTHtb/ <div class="button">start</div> <div id="start"><

Start an animation when the other one is finished/completed in jquery

六眼飞鱼酱① 提交于 2020-01-07 09:02:09
问题 This is not working for me: $(".button").click(function(){ $("#start").animate({ "opacity": ".3" }, "slow", function(){ $("#start").animate({"height": "0"}, "fast"); }); }); I want a div to animate and when it's done, animate again. Doesn't matter what I search on Google... on all the blogs and forums it says that this should be the only way to do it. 回答1: Looks like we'll need to see your html. Works fine for me: http://jsfiddle.net/LTHtb/ <div class="button">start</div> <div id="start"><

How to access the correct `this` inside a callback?

☆樱花仙子☆ 提交于 2020-01-07 05:07:50
问题 I have a constructor function which registers an event handler: function MyConstructor(data, transport) { this.data = data; transport.on('data', function () { alert(this.data); }); } // Mock transport object var transport = { on: function(event, callback) { setTimeout(callback, 1000); } }; // called as var obj = new MyConstructor('foo', transport); However, I'm not able to access the data property of the created object inside the callback. It looks like this does not refer to the object that

How to open multiple socket connections and do callbacks in PHP

拜拜、爱过 提交于 2020-01-07 03:21:11
问题 I'm writing some code which processes a queue of items. The way it works is this: Get the next item flagged as needing to be processed from the mysql database row. Request some info from a google API using Curl, wait until the info is returned. Do the remainder of the processing based on the info returned. Flag the item as processed in the db, move onto the next item. The problem is that on step # 2. Google sometimes takes 10-15 seconds to return the requested info, during this time my script

Cython has “first class function objects” - how efficient are they? Do they have Python overhead?

爱⌒轻易说出口 提交于 2020-01-07 03:11:09
问题 I have an external library that computes the optima, say minima, of a given function. Say its headers give me a function double[] minimizer(ObjFun f) where the headers define typedef double (*ObjFun)(double x[]) I have generated Cython wrappers for this library. I now want to give user parameterized functions to it, specifically, I want to write a function def getFunction(double q11, double q12, double q22): cdef f(double x[]): return x[0]*x[0]*q11 + 2*x[0]*x[1]*q12 + x[1]*x[1]*q22 return f

Asynchronous Callback in NSOperation inside of NSOperationQueue is never called

旧时模样 提交于 2020-01-06 19:32:05
问题 I need to chain together several NSOperation s that do network calls in one NSOperationQueue and then wait for all to be completed. I'm adding all of the NSOperation s to my NSOperationQueue and then call operationQueue.waitUntilAllOperationsAreFinished() . This works, but it waits indefinitely, as the callbacks in the NSOperations , that set the operation's state to 'finished', get never called. I'm using the following NSOperation subclass: class ConcurrentOperation: NSOperation { enum State

getting a callback to finish before continuing a loop?

限于喜欢 提交于 2020-01-06 19:31:09
问题 so I have been stuck on this for a while. If someone could help me out with this i would really appreciate it! What i want is to have my function and its callback finish before continuing on in a loop. I call "translate_all" after a user has input a text in english in a textarea and has clicked the translate button. ("Method", "g_loop", "g_where" and "go" are global variables.) Ultimately what i want is to have the input english phrase translate to the next language in the array, then have