当我跑步时
$ flutter run
Run Code Online (Sandbox Code Playgroud)
我在移动设备上收到提示,询问是否要在设备上安装该应用程序。我同意,那么什么也没发生!
卡在这里
Launching lib/main.dart on POCO F1 in debug mode...
Initializing gradle... 1.5s
Resolving dependencies... 9.2s
Gradle task 'assembleDebug'... 22.9s
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk... 14.9s
Run Code Online (Sandbox Code Playgroud)
那什么都没有
我刚刚安装了vs code v1(最新版本)和typescript v1.8.10(最新版本).我遵循了vs代码网站的确切指令但是无法获得vs代码来构建最简单的typescript文件,尽管我可以通过在git bash中运行tsc命令来手动构建它.vs代码的输出是:
error TS5007: Cannot resolve referenced file: '.'.
error TS5023: Unknown option 'p'
Use the '--help' flag to see options.
Run Code Online (Sandbox Code Playgroud)
这是我的helloworld.ts文件,真的不能简单:
class Greet {
private _message : string;
constructor(message : string) {
this._message = message;
}
Say = () => console.log(this._message);
}
var g = new Greet('hello typescript!');
g.Say();
Run Code Online (Sandbox Code Playgroud)
这是我的tasks.json文件:
{
// See http://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "silent",
"problemMatcher": …Run Code Online (Sandbox Code Playgroud) 有人可以解释为什么用lambda表达式定义原型函数不起作用?我以为必须先问这个但是找不到它.
function Book(title, year) {
this.title = title;
this.year = year;
// define a function within the object, which works fine
this.printYear = () => console.log("instance function of an object: " + this.year);
}
Run Code Online (Sandbox Code Playgroud)
这不起作用
Book.prototype.printTitle2 = () => {
console.log(this.title);
}
Run Code Online (Sandbox Code Playgroud)
这当然很好:
Book.prototype.printTitle = function() {
console.log(this);
console.log(this.title);
}
Run Code Online (Sandbox Code Playgroud) 有人可以解释为什么这个算法O(n^2)?根据这个,它是O(n ^ 2).我认为它是O(n ^ 3)的原因是因为外部循环(对于x)运行n时间,内部循环(对于y)运行n-1时间,并且在最坏的情况下,例如A = [8, 100, 101, 102, 103, 104, 105, 106, 107],while循环(对于z)将运行n-2时间因此整体O(n^3).
为了完整性,A是一个带有正元素的排序数组,三元组(x,y,z)是一个三角形if A[x] + A[y] > A[z].找出可以从A构建多少个三角形.
int TrianglesCount(int[] A)
{
int result = 0;
for (int x = 0; x < A.Length; x++)
{
int z = x + 2;
for (int y = x + 1; y < A.Length; y++)
{
while (z < A.Length …Run Code Online (Sandbox Code Playgroud) 尝试在Windows 10上安装SQL Server 2016 Express Edition时从未想过会这么糟糕.我安装了SQL Server 2014和SQL Server 2012,并且主要使用SQL Server 2014.然后我认为我应该升级并尝试安装SQL Server 2016.然后我收到了这个错误:
试图执行未经授权的操作错误.
尝试搜索这个,并有关于修改注册表项权限的建议,所以我尝试修改一些SQL Server相关的注册表项的一些权限,但没有任何区别.
然后我继续搜索并发现人们建议它可能是版本冲突问题,所以我卸载了所有 SQL Server安装,包括2016版本(未成功安装)并重新开始.
现在两天多后我还是无法安装SQL Server.
下面是详细日志的一部分,其中时间轴与Windows事件日志错误中的时间轴匹配; 由于时间太长,无法粘贴整个详细日志.
编辑1:经过更多搜索后,这是抛出的实际执行:
Exception type: Microsoft.SqlServer.Configuration.Sco.ScoException
(01) 2016-10-23 10:36:52 Slp: Message:
(01) 2016-10-23 10:36:52 Slp: Attempted to perform an unauthorized operation.
(01) 2016-10-23 10:36:52 Slp: HResult : 0x84bb0001
(01) 2016-10-23 10:36:52 Slp: FacilityCode : 1211 (4bb)
(01) 2016-10-23 10:36:52 Slp: ErrorCode : 1 (0001)
(01) 2016-10-23 10:36:52 Slp: Data:
(01) 2016-10-23 10:36:52 Slp: WatsonData = HKEY_LOCAL_MACHINE@SYSTEM\CurrentControlSet\Services\FltMgr
(01) …Run Code Online (Sandbox Code Playgroud) 我正在使用firebase auth REST api进行身份验证;这部分工作正常,因为我可以登录/注册用户,并且我可以获得一个uid和身份验证token。
尝试写入 Cloud Firestore 时,如果我将 Cloud Firestore 数据库规则设置为(这是最基本的身份验证规则之一):
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth.uid != null;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是如何uid使用cloud_firestore包传递到云 Firestore 请求,例如我想写入一个集合:
Firestore.instance.collection('myCollection').document() .setData(myData);
Run Code Online (Sandbox Code Playgroud) firebase firebase-authentication flutter google-cloud-firestore
需要帮忙
我已经为我的应用程序中的用户注册编写了一个颤振小部件,还有一个带有 Django RESTFUL API 的 API。如何将 python Django 中的 API 路由/URL 与 flutter 小部件连接或集成?拜托,我需要一个示例代码。我将不胜感激任何帮助。
这是我的注册颤振小部件:
import 'package:flutter/material.dart';
class SignUpPage2 extends StatefulWidget {
@override
SignUpPage2State createState() => SignUpPage2State();
}
class SignUpPage2State extends State<SignUpPage2> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
leading: IconButton(
icon: new Icon(Icons.arrow_back,
color:Colors.orange.shade700),
onPressed: () {
Navigator.pop(context);
},
),
title: Text("Create acount", style: TextStyle(color:Colors.orange.shade700)),
backgroundColor: Colors.black,
),
backgroundColor: Colors.black45,
body: Center(
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 24.0, right: 24.0),
children: <Widget>[ …Run Code Online (Sandbox Code Playgroud) 如何编写通用 F# 函数来计算集合的平均值?我试过:
let inline mean x =
let length = x |> Seq.length
let sum = x |> Seq.sum
LanguagePrimitives.DivideByInt sum length
Run Code Online (Sandbox Code Playgroud)
这对于浮点数和小数似乎工作得很好,但令人惊讶的是,它不适用于int错误提示The type 'int' does not support the operator 'DivideByInt'.
这可能很简单,但有人可以解释为什么下面的模式匹配不合理吗?它说其他规则,例如1,0,_永远不会匹配.
let matchTest(n : int) =
let ran = new Random()
let i = ran.Next(0, 2)
match i with
| n -> printfn "%i" n
| 1 -> printfn "1"
| 0 -> printfn "0"
| _ -> printfn "impossible"
Run Code Online (Sandbox Code Playgroud)
同样的事情:
let matchTest(n : int) =
let ran = new Random()
let i = ran.Next(0, 2)
let m = n
match i with
| m -> printfn "%i" m
| 1 -> printfn "1"
| 0 -> printfn "0"
| …Run Code Online (Sandbox Code Playgroud) flutter ×3
dart ×2
f# ×2
algorithm ×1
android ×1
django ×1
firebase ×1
javascript ×1
lambda ×1
python ×1
sql-server ×1
typescript ×1
windows-10 ×1