flutter

flutter 报错 Could not resolve io.flutter:flutter_embedding_release

 我是升级flutter后,所有项目都报错,先贴解决办法:

flutter\packages\flutter_tools\gradle 目录下

aar_init_script.gradle
resolve_dependencies.gradle
flutter.gradle
以上三个文件中将
http://download.flutter.io
替换为:

https://storage.googleapis.com/download.flutter.io

 

报错如下:

flutter build apk
The plugin `flutter_forbidshot` is built using an older version of the Android plugin API which assumes that it’s
running in a full-Flutter environment. It may have undefined behaviors when Flutter is integrated into an existing app
as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it’s recommended to use app bundles or split the APK to reduce the APK
size.
To generate an app bundle, run:
flutter build appbundle –target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk –target-platform android-arm,android-arm64,android-x64 –split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
[!] Your app isn’t using AndroidX.
To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ‘:flutter_tencentplayer:compileReleaseRenderscript’.
> Could not resolve all task dependencies for configuration ‘:flutter_tencentplayer:releaseCompileClasspath’.
> Could not resolve io.flutter:flutter_embedding_release:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
Required by:
project :flutter_tencentplayer
> Could not resolve io.flutter:flutter_embedding_release:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
> Could not get resource ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> Could not GET ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> download.flutter.io:80 failed to respond
> Could not resolve io.flutter:flutter_embedding_release:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
> Could not get resource ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> Could not GET ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> download.flutter.io:80 failed to respond
> Could not resolve io.flutter:flutter_embedding_release:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
> Could not get resource ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> Could not GET ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> download.flutter.io:80 failed to respond

* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 26s

python

flask Jinja2 template 模板 ' 编码问题

flask Jinja2 template 模板 &#39 编码问题

解决办法:

 {{ errors|safe }}
或者
{{ errors | tojson | safe }}

推荐第一条

python

Cython编译 TypeError: func() takes no keyword arguments 深坑

 今天使用Flask写了个接口,本地测试正常,仿到服务器上就报错,而且是特定函数报错.TypeError: func() takes no keyword arguments

一直以为是关键词冲突了. 后来调试半天,最后定位到是cython的问题

下面的方法无效

setup (
name = ‘xxxx’,
ext_modules = cythonize(["src/*.py"], compiler_directives={"always_allow_keywords": True})
)

最终解决办法,给函数的参数一个默认值即可.

# 原来
def func(a,b): pass
# 修改后
def func(a=None, b=None): pass

HTML & DIV+CSS, java script

layui 表格 时间戳转换 报错NaN-NaN-NaN NaN:NaN:NaN

 可能是时间戳 秒 和 毫秒之间 计算出现问题.

{{layui.util.toDateString(d.site_up_time)}}
修改成:
{{layui.util.toDateString(d.site_up_time*1000)}}

字段完整实例
,{field:’site_up_time’, title: ‘更新时间’, templet : "<div>{{layui.util.toDateString(d.site_up_time*1000)}}</div>"}

HTML & DIV+CSS, java script

layui表格(Table)下添加可更新拉选择框select

 添加CSS 防止下拉框被遮挡

<style>
/* 防止下拉框下拉值被遮盖*/
.layui-table-cell {
overflow: visible;
}

.layui-table-box {
overflow: visible;
}

.layui-table-body {
overflow: visible;
}
/* 调整高度 */
td .layui-form-select{
margin-top: -10px;
margin-left: -15px;
margin-right: -15px;
}
</style>

表,

<table class="layui-hide" id="data" lay-filter="data"></table>

自定义模板:
<script type="text/html" id="rule_type_Tpl">
<select name="rule_type" lay-filter="select_rule_type">
<option value="1" {{" {{# if(d.rule_type == 1){}} selected{{# }}}"}}>选择了1</option>
<option value="2" {{" {{# if(d.rule_type == 2){}} selected{{# }}}"}}>选择了2</option>
</select>
</script>

添加监听事件

//规则类型下拉框监听事件
form.on(‘select(select_rule_type)’, function(data){
//这里是当选择一个下拉选项的时候 把选择的值赋值给表格的当前行的缓存数据 否则提交到后台的时候下拉框的值是空的
var elem = data.othis.parents(‘tr’);
var dataindex = elem.attr("data-index");
var tabledata = table.cache["data"];
$.each(tabledata,function(index,value){
if(value.LAY_TABLE_INDEX==dataindex){
tabledata[index]["rule_type"] = data.value;
table.reload("data", {
data: tabledata,
})
layer.msg(‘更新下拉框:’+data.value);
}
});
});

 

HTML & DIV+CSS, java script

layui表格(Table)动态添加行

直接上代码吧.在需要动态添加的事件里放如下代码

var tabledata = table.cache["data"]; //获取现有数据
tabledata.push({
"rule_type": "2"
,"rule_val": ""
,"time_type": "3"
,"time_val": "4"
,"expires_val": "7"
,"expires_type": "2"
})//添加数据,  字段名对应值.  不要初始值的话 留空即可.

#下面表格需要重载一下 才会刷新显示.
table.reload("data", {
data: tabledata,
})

HTML & DIV+CSS, flutter, java script

flask模板使用layui前端框架语法冲突

 大致报错如下吧. {{ 很容易冲突. 

File "D:\soft\Python27\lib\site-packages\jinja2\environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "D:\soft\Python27\lib\site-packages\jinja2\loaders.py", line 125, in load
code = environment.compile(source, name, filename)
File "D:\soft\Python27\lib\site-packages\jinja2\environment.py", line 591, in compile
self.handle_exception(exc_info, source_hint=source_hint)
File "D:\soft\Python27\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "d:\work\python\xycdn\templates\rule_add.html", line 58, in template
<option value="1" {{ # if(d.rule_type == 1){}} selected{{ #}}}>鏂囦欢绫诲瀷</option>
TemplateSyntaxError: unexpected char u’#’ at 1794

解决办法:

原始语句: {{# if(d.rule_type == 1){}} selected{{# }}}
修改后: {{" {{# if(d.rule_type == 1){}} selected{{# }}}"}}

其实就是在冲突的代码前后 增加 {{"冲突的代码"}}, 这样就会当作 字符串输出了.

服务常见问题, 站长工具

Let’s Encrypt 报错 ERR_SSL_PROTOCOL_ERROR

非常奇怪的一个问题,另外一台vps 正常试用的Let’s Encrypt 免费ssl证书,挪到另外一台机器上就报错 ERR_SSL_PROTOCOL_ERROR

listen 443;

修改为:

listen 443 ssl http2;

即可正常,

python

debian phantomjs error while loading shared libraries: libfontconfig.so.1: cannot open shared

 debian error while loading shared libraries: libfontconfig.so.1: cannot open shared

解决办法

apt-get install libfontconfig1

吐槽

海淘第一次光荣缴税,效率是真不高.

 海淘ns,目前已经在路上走了11天,走的ems,奇葩的是ems官网竟然查询不到动态,

包裹卡在 进口海关留存待验 状态六天,最后在 https://t.17track.net/zh-cn 查到是被税了.

微信钱包->城市服务->境外邮件申报缴税->邮件缴税->输入单号,可以直接支付 (额外收取50服务费).

两个包裹一共税了500块,完全不按照 完税金额来,按照包裹价值收的15%.比完税金额整整多了一倍.

 

买了以后,国行就发布了….  2200 + 300(运费) +500(税) 这波血亏.