我使用此代码为Logandroid类添加扩展名
fun Log.i2(msg:String):Unit{
Log.i("Test",msg)
}
Run Code Online (Sandbox Code Playgroud)
在活动中使用时
class MainActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Log.i2("activity_main")
}
}
Run Code Online (Sandbox Code Playgroud)
找不到Log.i2。怎么了?
我正在开发一个音乐播放器应用程序并通过以下代码查询相册名称:
Cursor mediacur = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, null);
mediacur.moveToFirst();
do{
albumindex = mediacur.getColumnIndex(MediaStore.Audio.Media.ALBUM);
albumname = mediacur.getString(albumindex);
songs.add(albumname);
}while(mediacur.moveToNext());
Run Code Online (Sandbox Code Playgroud)
我正在获取所有专辑名称以及铃声和通知.如何从列表中排除铃声和通知?
我需要得到一个数字,敲掉最后一个数字,然后将其作为数字返回
即给出数字12345,返回1234
这是最好的方法:
let x = 12345
const y = x.toString().split('').slice(0, -1).join('')
const newNum = Number(y)
Run Code Online (Sandbox Code Playgroud)
还有没有办法不做const newNum然后只是将它转换回上面的字符串中的数字?
我需要从证书中获取公钥
我已经找到了一种在 iOS 12+ 和 iOS 10.3+ 上执行此操作的方法,但是如何在 iOS 10.0+ 上执行此操作?
func publicKey(for certificate: SecCertificate) -> SecKey? {
if #available(iOS 12.0, *) {
return SecCertificateCopyKey(certificate)
} else if #available(iOS 10.3, *) {
return SecCertificateCopyPublicKey(certificate)
} else {
// ???
return nil
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建音乐主要规模转换器.任何人都有信息如何做到这一点
到目前为止我有
root注意是像cMajor或gMajor注意的基本注释注意我想要转换成主刻度0-126如果我插入rootNote 60和注释60右边的返回将是0,如果我插入rootNote 60和注释61正确的返回将是2,如果我插入rootNote 60和注释62,则右边的返回值为4,如果我插入rootNote 60,则注释63右边的返回值为5,
如果我插入rootNote 61和注释60,则右返回将为0,如果我插入rootNote 61并且注释61右侧返回将为1,如果我插入rootNote 61并且注释62右侧返回将为3,如果我插入rootNote 61和注释63右边的回报是5,
好吧,我有这另一个,它似乎工作,我想把我的序列映射到大规模,但有一些公式我可以使用什么?
.
public int getINMajorScale(int note, int rootNote)
{
List<int> majorScale = new List<int>();
//int bNote = (int)_bNote.CurrentValue;
int bNoteMpl = bNote / 12;
bNote = 12 + (bNote - (12 * bNoteMpl)) - 7;
majorScale.Add(bNote + (12 * bNoteMpl));
int tBnote = bNote;
int res = 0;
for (int i = bNote; i < bNote + 6; i++)
{
//algorytm
res = tBnote + 7;
int mod …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Cloud Functions for Firebase实施购买验证。这是我的index.js
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.updateDbOnPurchase = functions.analytics.event('in_app_purchase').onLog(event => {
const uid = event.data.user.userId;
const famKey = getFamKey(uid)
console.log("UID: ${uid}, famKey: ${famKey}")
admin.database().ref('/users/${uid}/famKey').then(snap => {
if (snap.exists()) {
admin.database().ref('/families/${famKey}/paydata/expire').set(Math.round(new Date().getTime()/1000) + 2592000)
}
});
});
Run Code Online (Sandbox Code Playgroud)
在我的应用中,我实现了应用内订阅,将APK推送到Alpha跟踪并进行了测试购买。但是此代码从未触发过。
因此,我有以下问题:
应用内订阅是否可与in_app_purchase事件一起使用?
它适用于测试购买吗?还是我必须对真实购买进行测试?
续订会触发事件吗?
是否可以用此代码购买SKU?
如果使用Freedom / Lucky Patcher进行盗版,是否会触发此代码?Firebase是否通过Google Play执行购买验证,还是我必须自己实施验证?
我已经创建了具有3个处理器的Nifi工作流程.附件是详细信息.问题是,当我在Nifi中运行工作流程时,它运行正常,但是当我在Kylo中导入相同的模板并通过feed运行它时,它给出了错误.似乎Kylo模板有问题.你能帮帮我吗?同样在Nifi日志中,我无法看到任何错误.
谢谢,
Nifi log:
2017-08-30 10:11:49,764 INFO [pool-8-thread-1] org.wali.MinimalLockingWriteAheadLog org.wali.MinimalLockingWriteAheadLog@65b65bdb checkpointed with 1 Records and 0 Swap Files in 34 milliseconds (Stop-the-world time = 16 milliseconds, Clear Edit Logs time = 15 millis), max Transaction ID 37082
2017-08-30 10:11:49,764 INFO [pool-8-thread-1] o.a.n.c.r.WriteAheadFlowFileRepository Successfully checkpointed FlowFile Repository with 1 records in 34 milliseconds
2017-08-30 10:13:47,109 INFO [Write-Ahead Local State Provider Maintenance] org.wali.MinimalLockingWriteAheadLog org.wali.MinimalLockingWriteAheadLog@2efe3a02 checkpointed with 2326 Records and 0 Swap Files in 18 milliseconds (Stop-the-world time = 1 …Run Code Online (Sandbox Code Playgroud) android ×2
apache-nifi ×1
c# ×1
firebase ×1
ios ×1
javascript ×1
kotlin ×1
kylo ×1
mediastore ×1
pinning ×1
swift ×1