以下返回以微秒为单位的时间,例如4565212462.
alert( $.now() );
Run Code Online (Sandbox Code Playgroud)
如何将其转换为人类可读的时间格式,例如 (小时:分钟:秒)?
Q.1我想将此表单转换为ajax但似乎我的ajax代码缺少某些东西.提交时根本不做任何事情.
Q2.我还希望在选择文件时不要等待提交时触发更改.
这是JS.
$('#imageUploadForm').on('submit',(function(e) {
e.preventDefault()
$.ajax({
type:'POST',
url: $(this).attr('action'),
data:$(this).serialize(),
cache:false
});
}));
Run Code Online (Sandbox Code Playgroud)
和PHP的HTMl.
<form name="photo" id="imageUploadForm" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<input type="file" style="widows:0; height:0" id="ImageBrowse" hidden="hidden" name="image" size="30"/>
<input type="submit" name="upload" value="Upload" />
<img width="100" style="border:#000; z-index:1;position: relative; border-width:2px; float:left" height="100px" src="<?php echo $upload_path.$large_image_name.$_SESSION['user_file_ext'];?>" id="thumbnail"/>
</form>
Run Code Online (Sandbox Code Playgroud) 通过以下内容,第一次调用它时可以正常工作,但随后的"FirebaseApp名称[DEFAULT]已经存在!"的调用失败了.
public FirebaseDatabase conn(Context c) {
FirebaseOptions options = new FirebaseOptions.Builder()
.setApiKey("key")
.setDatabaseUrl("url")
.setApplicationId("ID")
.build();
/////I tried Try and Catch with no success//////
FirebaseApp app = FirebaseApp.initializeApp(c, options);
/// for this : FirebaseApp app = FirebaseApp.initializeApp(c, options, "some_app");
//// will fail with "FirebaseApp name some_app already exists!"
return FirebaseDatabase.getInstance(app);
}
Run Code Online (Sandbox Code Playgroud)
以上所有内容都是尝试连接到第二个Firebase应用程序.
使用Firebase,如何捕获特定异常并优雅地告诉用户?例如:
FirebaseAuthInvalidCredentialsException:电子邮件地址格式错误.
我正在使用下面的代码使用电子邮件和密码注册用户,但我不是那么高级的java.
mAuth.createUserWithEmailAndPassword(email, pwd)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
//H.toast(c, task.getException().getMessage());
Log.e("Signup Error", "onCancelled", task.getException());
} else {
FirebaseUser user = mAuth.getCurrentUser();
String uid = user.getUid();
}
}
});
Run Code Online (Sandbox Code Playgroud) 我有以下代码并收到错误:
Invalid collection reference. Collection references must have an odd number of segments
Run Code Online (Sandbox Code Playgroud)
和代码:
private void setAdapter() {
FirebaseFirestore db = FirebaseFirestore.getInstance();
db.collection("app/users/" + uid + "/notifications").get().addOnCompleteListener(task -> {
if (task.isSuccessful()) {
for (DocumentSnapshot document : task.getResult()) {
Log.d("FragmentNotifications", document.getId() + " => " + document.getData());
}
} else {
Log.w("FragmentNotifications", "Error getting notifications.", task.getException());
}
});
}
Run Code Online (Sandbox Code Playgroud) 我在ConstrainLayout中有一个视图如下.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="260dp"
android:textColor="#FFF"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="@+id/parent"
app:layout_constraintTop_toBottomOf="@id/message_date"
android:id="@+id/text_main"
/>
Run Code Online (Sandbox Code Playgroud)
我想根据某些条件将视图更改为app:layout_constraintLeft_toLeftOf="@+id/parent"或layout_constraintLeft_toRightOf="@+id/parent"在recycleViewHolder中以编程方式.
我以为我使用以下所有聊天对话数据的时间都可以随时离线使用.以某种方式不是,所有节点都从服务器加载.
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
Run Code Online (Sandbox Code Playgroud)
然后,根据DOCS:
持久性行为:通过启用持久性,我们在线同步的任何数据都将持久保存到磁盘并可脱机使用,即使我们重新启动应用程序也是如此.这意味着我们的应用程序将使用存储在缓存中的本地数据在线工作.
如果数据已经脱机可用 setPersistenceEnabled(true);,我为什么需要keepSynced(true)?
DatabaseReference r = FirebaseDatabase.getInstance().getReference("chat/roomid");
r.keepSynced(true);
Run Code Online (Sandbox Code Playgroud) 我在这里尝试按照这个示例https://www.youtube.com/watch?v=gxCu5TEmxXE,但在做的时候tsc -p,我收到了一个错误.我需要导入一些东西吗?
错误:
node_modules/@angular/common/src/location/location.d.ts(1,10): error TS2305: Module '"...functions/node_modules/rxjs/Rx"' has no exported member 'SubscriptionLike'.
TS文件
import "zone.js/dist/zone-node";
import * as functions from "firebase-functions";
import * as express from "express"
import { renderModuleFactory } from "@angular/platform-server"
import * as fs from "fs"
const document = fs.readFileSync(__dirname + "/dist-server/index.html", "utf8");
const AppServerModuleNgFactory = require(__dirname + "/dist-server/main.bundle");
const app = express();
app.get("**", (req, res) => {
const url = req.path;
renderModuleFactory(AppServerModuleNgFactory, { document, url }).then(html => {
res.send(html);
});
}); …Run Code Online (Sandbox Code Playgroud) javascript firebase typescript google-cloud-functions angular
我的意见如下:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/global_legal_gap"
android:clipToPadding="true"
android:clipChildren="true"
android:baselineAligned="false"
android:background="@drawable/post_sound_bg"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="@dimen/post_sound_card_height"
android:layout_height="@dimen/post_sound_card_height">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/album_art"
android:layout_width="@dimen/post_sound_card_height"
android:layout_height="@dimen/post_sound_card_height"
fresco:backgroundImage="@drawable/music_placeholder" />
<RelativeLayout
android:id="@+id/play_icon_control"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_margin="3dp" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout>
Run Code Online (Sandbox Code Playgroud)
作为家长表示RelativeLayout,我使用的是android:clipToPadding="true"和
android:clipChildren="true",但这个父视图的孩子还在外面突出.
或者我是这样做的吗?我如何实现像CSS这样的东西overflow:hidden?
正如我所看到的,在android上显示默认表情符号的方法是在输入文本上使用以下内容.
android:inputType="textMultiLine|textShortMessage"
Run Code Online (Sandbox Code Playgroud)
当我搜索时,我无法通过Java找到一种方法.我想要做的是,当软键盘打开时,让用户选项卡按钮在表情符号视图和普通键盘视图之间切换.
自定义表情符号键盘.
我已经实现了这一点,但是使用Emojis已经在设备上发布kik-kat会更好更轻.
谷歌确实在这些观点之间切换.
在Google Allo上,按下editText切换视图中的表情符号图标.
android ×7
firebase ×5
java ×5
jquery ×2
ajax ×1
android-view ×1
angular ×1
css ×1
datetime ×1
emoji ×1
exception ×1
google-api ×1
html ×1
javascript ×1
keyboard ×1
microtime ×1
persistence ×1
php ×1
time ×1
typescript ×1
xml ×1