我基本上在 Visual Studio 上使用 python(初学者),并坚持将 python 文件导入到另一个 python 文件中。我正在处理一个作业,它有 3 个文件 a 、 b 和 test_a ,同时在文件“a”中创建一个函数并导入将该文件放入 test_a 来测试函数,但没有得到答案
我尝试使用这一行在“test_a”中导入文件“a”,如下所示,但无法导入
from a import *
Run Code Online (Sandbox Code Playgroud)
知道如何将整个文件导入另一个文件吗?
我有这 3 个 prisma 模型,
model user {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
courses userOnCourse[]
}
model course {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
users userOnCourse[]
title String
description String
}
model userOnCourse {
createdAt DateTime @default(now())
user user @relation(fields: [userId], references: [id])
userId String
course Course @relation(fields: [courseId], references: [id])
courseId String
@@id([userId, courseId])
}
Run Code Online (Sandbox Code Playgroud)
这是一种多对多关系,一个用户可以拥有多个课程,一个课程可以拥有多个用户,为了引用显式 mm 关系,我创建了另一个模型名称userOnCourse。
我正在努力将 courseId 的引用传递到 userOnCourse 模型中,我想将课程与 userid 一起连接到该模型中,但由于它是在运行时创建的,因此似乎不可能在编译时传递 courseId 。 …
我是Angular的新手,正在使用angular 7,我正在做一些示例,其中的组件共享数据,“父级到子级”部分工作正常,但是当我尝试将任何值从子级发送到父级时,它不起作用。
app-component.html
<div>{{show}}</div>
<app-communicating-components [Parent]="message" (childEvent)="getMessage($event)"></app-communicating-components>
Run Code Online (Sandbox Code Playgroud)
app-component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'AngularLesson2';
public message = 'Hello my child, Parents here';
public show: string;
getMessage($event) {
this.show = $event;
}
}
Run Code Online (Sandbox Code Playgroud)
communication-components.component.html
<p>
{{Parent}}
</p>
<button (click)="fireEvent()">Fire from child</button>
Run Code Online (Sandbox Code Playgroud)
communication-components.component.ts
import { Component, OnInit, Input, Output } from '@angular/core';
import { EventEmitter } from 'events';
@Component({
selector: 'app-communicating-components',
templateUrl: './communicating-components.component.html',
styleUrls: ['./communicating-components.component.css']
}) …Run Code Online (Sandbox Code Playgroud) 我是Firebase的新手,我正在使用官方文档为我的应用进行注册活动,但是当我按下注册的注册按钮时,出现此错误
Failed to load module descriptor class: Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor" on path: DexPathList[[zip file "/data/app/com.example.farrukh.firebaseaccount-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.farrukh.firebaseaccount-1/lib/x86_64, /vendor/lib64, /system/lib64]]
W/GooglePlayServicesUtil: Google Play services is missing.
Run Code Online (Sandbox Code Playgroud)
我也指的是google,但是由于使用Firebase的用户数量很少,所以我没有得到我的答案,我也同时查看了这两个Link1 Link2答案,但无法解决我的问题。
我的项目中有google-service.json,我应用了firebase项目所需的所有依赖项并更新了android studio。
我能做什么?
注意:在我的Firebase身份验证面板中启用了电子邮件/密码
这是我的代码
public class MainActivity extends AppCompatActivity {
private FirebaseAuth mAuth;
private String mUserName, mUserEmail, mPassword;
private EditText mEmail, mPass;
Button signup;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAuth = FirebaseAuth.getInstance();
signup = (Button) findViewById(R.id.button);
mEmail = (EditText) findViewById(R.id.editText);
mPass = (EditText) findViewById(R.id.editText2);
signup.setOnClickListener(new View.OnClickListener() …Run Code Online (Sandbox Code Playgroud) 我正在做一些计算,但无法将字符串解析为int甚至在float.I搜索解决方案,我在某处读取它必须有一个空字符串,但我检查我的editText使用
log.v("Valuee",e1.getText().toString());
Run Code Online (Sandbox Code Playgroud)
并且它打印的值证明字符串不是空的..我缺少什么?
这是logcat
java.lang.RuntimeException:无法启动活动ComponentInfo {com.example.farrukh.bmi/com.example.farrukh.bmi.Main2Activity}:java.lang.NumberFormatException:无效的int:""在android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2195)在Android.app.ActivityThread.access $ 800(ActivityThread.java:135)的android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)android.app.ActivityThread $ H.handleMessage(ActivityThread) .java:1196)android.app.Handler.dispatchMessage(Handler.java:102)android.app.Looper.loop(Looper.java:136)android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java:515)at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java: 779)在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)at dalvik.system.NativeStart.main(Native Method)引起:java.lang.NumberFormatException:无效的int:""at java.lang.Integer.invalidInt(Integer.java:137)在java.lang.Integer.parseInt(Integer.java:358)java.lang.Integer.parseInt(Integer.java:331)at com.example.farrukh .bmi.Main2Activity.onCreate(Main2Activity.java:31)位于android.app.A活动中的android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)上的android.app.Activity.performCreate(Activity.java:5231).在Android.app.ActivityThread.access $ 800(ActivityThread.java:135)的android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)上的performLaunchActivity(ActivityThread.java:2159)在android.app.ActivityThread $ H.handleMessage( ActivityThread.java:1196)在Android.app.A.运行时,Android.A.Tharead.main上的android.os.Handler.dispatchMessage(Handler.java:102)android.os.Looper.loop(Looper.java:136)(ActivityThread.java:5017) )at java.lang.reflect.Method.invokeNative(Native Method)
这是MainActivity.java
public class Main2Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
final Button b = (Button) findViewById(R.id.button);
final EditText e1 = (EditText) findViewById(R.id.editText2);
final TextView text = (TextView) findViewById(R.id.textView4);
final String height = e1.getText().toString();
final int a = Integer.parseInt(height); //got error …Run Code Online (Sandbox Code Playgroud) android ×2
javascript ×2
angular ×1
firebase ×1
java ×1
parseint ×1
prisma ×1
prisma2 ×1
python ×1
relationship ×1
typescript ×1