鸿蒙开发组件:【启动与访问DataAbility】

启动DataAbility

启动DataAbility会获取一个工具接口类对象(DataAbilityHelper)。启动DataAbility的示例代码如下:

import featureAbility from '@ohos.ability.featureAbility';
import ability from '@ohos.ability.ability';let uri: string = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';
let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper(uri);

访问DataAbility

访问DataAbility需导入基础依赖包,以及获取与DataAbility子模块通信的URI字符串。

其中,基础依赖包包括:

  • @ohos.ability.featureAbility
  • @ohos.data.dataAbility

访问DataAbility的示例代码如下:

  1. 创建工具接口类对象。

    import featureAbility from '@ohos.ability.featureAbility';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import ability from '@ohos.ability.ability';
    // 作为参数传递的URI,与config中定义的URI的区别是多了一个"/",有三个"/"
    let uri: string = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';
    let DAHelper: ability.DataAbilityHelper = featureAbility.acquireDataAbilityHelper(uri);
    
  2. 构建数据库相关的RDB数据。

    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    let valuesBucket_insert: rdb.ValuesBucket = { name: 'Rose', introduction: 'insert' };
    let valuesBucket_update: rdb.ValuesBucket = { name: 'Rose', introduction: 'update' };
    let crowd = new Array({ name: 'Rose', introduction: 'batchInsert_one' } as rdb.ValuesBucket,{ name: 'Rose', introduction: 'batchInsert_two' } as rdb.ValuesBucket);
    let columnArray = new Array('id', 'name', 'introduction');
    let predicates = new ohos_data_ability.DataAbilityPredicates();
    

    注:关于DataAbilityPredicates的详细内容,请参考[DataAbility谓词]。

  3. 调用insert方法向指定的DataAbility子模块插入数据。

    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';// callback方式调用:
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private valuesBucket_insert: rdb.ValuesBucket = { name: 'Rose', introduction: 'insert' };private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// callback方式调用:this.DAHelper.insert(this.uri, this.valuesBucket_insert, (error: BusinessError, data: number) => {if (error && error.code !== 0) {promptAction.showToast({message: $r('app.string.insert_failed_toast')});} else {promptAction.showToast({message: $r('app.string.insert_success_toast')});}hilog.info(domain, TAG, 'DAHelper insert result: ' + data + ', error: ' + JSON.stringify(error));});})}// ...}// ...}// ...}// ...}
    }
    
    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private valuesBucket_insert: rdb.ValuesBucket = { name: 'Rose', introduction: 'insert' };private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// promise方式调用(await需要在async方法中使用):this.DAHelper.insert(this.uri, this.valuesBucket_insert).then((datainsert) => {promptAction.showToast({message: $r('app.string.insert_success_toast')});hilog.info(domain, TAG, 'DAHelper insert result: ' + datainsert);}).catch((error: BusinessError) => {promptAction.showToast({message: $r('app.string.insert_failed_toast')});hilog.error(domain, TAG, `DAHelper insert failed. Cause: ${error.message}`);});})}// ...}// ...}// ...}// ...}
    }
    
  4. 调用delete方法删除DataAbility子模块中指定的数据。

    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private predicates = new ohos_data_ability.DataAbilityPredicates();private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// callback方式调用:this.DAHelper.delete(this.uri, this.predicates, (error, data) => {if (error && error.code !== 0) {promptAction.showToast({message: $r('app.string.delete_failed_toast')});} else {promptAction.showToast({message: $r('app.string.delete_success_toast')});}hilog.info(domain, TAG, 'DAHelper delete result: ' + data + ', error: ' + JSON.stringify(error));});})}// ...}// ...}// ...}// ...}
    }
    
    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private predicates = new ohos_data_ability.DataAbilityPredicates();private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// promise方式调用(await需要在async方法中使用):this.DAHelper.delete(this.uri, this.predicates).then((datadelete) => {promptAction.showToast({message: $r('app.string.delete_success_toast')});hilog.info(domain, TAG, 'DAHelper delete result: ' + datadelete);}).catch((error: BusinessError) => {promptAction.showToast({message: $r('app.string.delete_failed_toast')});hilog.error(domain, TAG, `DAHelper delete failed. Cause: ${error.message}`);});})}// ...}// ...}// ...}// ...}
    }
    
  5. 调用update方法更新指定DataAbility子模块中的数据。

    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private valuesBucket_update: rdb.ValuesBucket = { name: 'Rose', introduction: 'update' };private predicates = new ohos_data_ability.DataAbilityPredicates();private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// callback方式调用:this.predicates.equalTo('name', 'Rose');this.DAHelper.update(this.uri, this.valuesBucket_update, this.predicates, (error, data) => {if (error && error.code !== 0) {promptAction.showToast({message: $r('app.string.update_failed_toast')});} else {promptAction.showToast({message: $r('app.string.update_success_toast')});}hilog.info(domain, TAG, 'DAHelper update result: ' + data + ', error: ' + JSON.stringify(error));});})}// ...}// ...}// ...}// ...}
    }
    
    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private valuesBucket_update: rdb.ValuesBucket = { name: 'Rose', introduction: 'update' };private predicates = new ohos_data_ability.DataAbilityPredicates();private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// promise方式调用(await需要在async方法中使用):this.predicates.equalTo('name', 'Rose');this.DAHelper.update(this.uri, this.valuesBucket_update, this.predicates).then((dataupdate) => {promptAction.showToast({message: $r('app.string.update_success_toast')});hilog.info(domain, TAG, 'DAHelper update result: ' + dataupdate);}).catch((error: BusinessError) => {promptAction.showToast({message: $r('app.string.update_failed_toast')});hilog.error(domain, TAG, `DAHelper update failed. Cause: ${error.message}`);});})}// ...}// ...}// ...}// ...}
    }
    
  6. 调用query方法在指定的DataAbility子模块中查找数据。

    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private columnArray = new Array('id', 'name', 'introduction');private predicates = new ohos_data_ability.DataAbilityPredicates();private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// callback方式调用:this.predicates.equalTo('name', 'Rose');this.DAHelper.query(this.uri, this.columnArray, this.predicates, (error, data) => {if (error && error.code !== 0) {promptAction.showToast({message: $r('app.string.query_failed_toast')});hilog.error(domain, TAG, `DAHelper query failed. Cause: ${error.message}`);} else {promptAction.showToast({message: $r('app.string.query_success_toast')});}// ResultSet是一个数据集合的游标,默认指向第-1个记录,有效的数据从0开始。while (data.goToNextRow()) {const id = data.getLong(data.getColumnIndex('id'));const name = data.getString(data.getColumnIndex('name'));const introduction = data.getString(data.getColumnIndex('introduction'));hilog.info(domain, TAG, `DAHelper query result:id = [${id}], name = [${name}], introduction = [${introduction}]`);}// 释放数据集的内存data.close();});})}// ...}// ...}// ...}// ...}
    }
    
    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private columnArray = new Array('id', 'name', 'introduction');private predicates = new ohos_data_ability.DataAbilityPredicates();private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// promise方式调用(await需要在async方法中使用):this.predicates.equalTo('name', 'Rose');this.DAHelper.query(this.uri, this.columnArray, this.predicates).then((dataquery) => {promptAction.showToast({message: $r('app.string.query_success_toast')});// ResultSet是一个数据集合的游标,默认指向第-1个记录,有效的数据从0开始。while (dataquery.goToNextRow()) {const id = dataquery.getLong(dataquery.getColumnIndex('id'));const name = dataquery.getString(dataquery.getColumnIndex('name'));const introduction = dataquery.getString(dataquery.getColumnIndex('introduction'));hilog.info(domain, TAG, `DAHelper query result:id = [${id}], name = [${name}], introduction = [${introduction}]`);}// 释放数据集的内存dataquery.close();}).catch((error: BusinessError) => {promptAction.showToast({message: $r('app.string.query_failed_toast')});hilog.error(domain, TAG, `DAHelper query failed. Cause: ${error.message}`);});})}// ...}// ...}// ...}// ...}
    }
    
  7. 调用batchInsert方法向指定的DataAbility子模块批量插入数据。

    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private crowd = new Array({ name: 'Rose', introduction: 'batchInsert_one' } as rdb.ValuesBucket,{ name: 'Rose', introduction: 'batchInsert_two' } as rdb.ValuesBucket);private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// callback方式调用:this.DAHelper.batchInsert(this.uri, this.crowd, (error, data) => {if (error && error.code !== 0) {promptAction.showToast({message: $r('app.string.batchInsert_failed_toast')});} else {promptAction.showToast({message: $r('app.string.batchInsert_success_toast')});}hilog.info(domain, TAG, 'DAHelper batchInsert result: ' + data + ', error: ' + JSON.stringify(error));});})}// ...}// ...}// ...}// ...}
    }
    
    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private crowd = new Array({ name: 'Rose', introduction: 'batchInsert_one' } as rdb.ValuesBucket,{ name: 'Rose', introduction: 'batchInsert_two' } as rdb.ValuesBucket);private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// promise方式调用(await需要在async方法中使用):this.DAHelper.batchInsert(this.uri, this.crowd).then((databatchInsert) => {promptAction.showToast({message: $r('app.string.batchInsert_success_toast')});hilog.info(domain, TAG, 'DAHelper batchInsert result: ' + databatchInsert);}).catch((error: BusinessError) => {promptAction.showToast({message: $r('app.string.batchInsert_failed_toast')});hilog.error(domain, TAG, `DAHelper batchInsert failed. Cause: ${error.message}`);});})}// ...}// ...}// ...}// ...}
    }
    
  8. 调用executeBatch方法向指定的DataAbility子模块进行数据的批量处理。

    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private predicates = new ohos_data_ability.DataAbilityPredicates();private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// callback方式调用:let operations: Array<ability.DataAbilityOperation> = [{uri: this.uri,type: featureAbility.DataAbilityOperationType.TYPE_INSERT,valuesBucket: { name: 'Rose', introduction: 'executeBatch' },predicates: this.predicates,expectedCount: 0,predicatesBackReferences: undefined,interrupted: true,}];this.DAHelper.executeBatch(this.uri, operations, (error, data) => {if (error && error.code !== 0) {promptAction.showToast({message: $r('app.string.executeBatch_failed_toast')});} else {promptAction.showToast({message: $r('app.string.executeBatch_success_toast')});}hilog.info(domain, TAG, `DAHelper executeBatch, result: ` + JSON.stringify(data) + ', error: ' + JSON.stringify(error));});})}// ...}// ...}// ...}// ...}}
    
    import ability from '@ohos.ability.ability';
    import featureAbility from '@ohos.ability.featureAbility';
    import { BusinessError } from '@ohos.base';
    import ohos_data_ability from '@ohos.data.dataAbility';
    import rdb from '@ohos.data.rdb';
    import promptAction from '@ohos.promptAction';
    import hilog from '@ohos.hilog';const TAG: string = 'PageDataAbility';
    const domain: number = 0xFF00;@Entry
    @Component
    struct PageDataAbility {private predicates = new ohos_data_ability.DataAbilityPredicates();private uri = 'dataability:///com.samples.famodelabilitydevelop.DataAbility';private DAHelper = featureAbility.acquireDataAbilityHelper(this.uri);build() {Column() {// ...List({ initialIndex: 0 }) {// ...ListItemGroup() {ListItem() {Flex({ justifyContent: FlexAlign.SpaceBetween, alignContent: FlexAlign.Center }) {// ...}.onClick(() => {// promise方式调用(await需要在async方法中使用):let operations: Array<ability.DataAbilityOperation> = [{uri: this.uri,type: featureAbility.DataAbilityOperationType.TYPE_INSERT,valuesBucket: { name: 'Rose', introduction: 'executeBatch' },predicates: this.predicates,expectedCount: 0,predicatesBackReferences: undefined,interrupted: true,}];this.DAHelper.executeBatch(this.uri, operations).then((dataquery) => {promptAction.showToast({message: $r('app.string.executeBatch_success_toast')});hilog.info(domain, TAG, 'DAHelper executeBatch result: ' + JSON.stringify(dataquery));}).catch((error: BusinessError) => {promptAction.showToast({message: $r('app.string.executeBatch_failed_toast')});hilog.error(domain, TAG, `DAHelper executeBatch failed. Cause: ${error.message}`);});})}// ...}// ...}// ...}// ...}
    }
    

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/30659.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

轻量级的数据交换格式JSON (JavaScript Object Notation)介绍

什么是JSON&#xff1f; JSON (JavaScript Object Notation) 是一种轻量级的数据交换格式&#xff0c;它属于JavaScript的一个子集&#xff0c;采用完全独立于编程语言的文本格式来存储和表示数据。简洁和清晰的层次结构使得 JSON 成为理想的数据交换语言。 JSON具有易读性&…

Linux:配置本地yum源仓库

目录 一、挂载光盘到目录下 二、配置本地yum源仓库 一、挂载光盘到目录下 mount /dev/cdrom /mnt/ #把光盘挂载到/mnt目录下 挂载 设备 目录或文件夹 注&#xff1a;最好是空的 原来的数据将被隐藏一个挂载点同一时只能挂载一个设备。 mount /dev…

“2024国际数字能源展”推动绿色低碳发展,助力实现“双碳”目标

随着全球气候变化问题的日益严峻&#xff0c;构建现代能源体系、推动绿色低碳发展已成为各国共同的使命和追求。在这一背景下&#xff0c;我国提出了“四个革命、一个合作”的能源安全新战略&#xff0c;旨在推动能源生产消费革命&#xff0c;保障国家能源安全&#xff0c;助力…

js语音识别,语音转文字,speech recognition(需要翻墙才能识别)

先上代码 <!DOCTYPE html> <html><head><meta charset"utf-8"><meta name"viewport" content"widthdevice-width,initial-scale1.0"><title>test</title> </head><body><div id"…

Java 枚举的基本使用

一、枚举的概述 java 枚举&#xff08;Enum&#xff09;是一种特殊的数据类型&#xff0c;它允许你定义一组命名的常量。在 Java 中&#xff0c;枚举被实现为类&#xff0c;并且继承自 java.lang.Enum 类。枚举的使用可以提供类型安全、可读性强、易于理解的代码。 (1) 枚举的…

Linux 一键部署Nginx+ModSecurity

前言 ModSecurity 是 Apache 基金会的一个开源、高性能的 Web 应用程序防火墙(WAF),它提供了强大的安全规则引擎,用于检测和阻止各种攻击行为,如 SQL 注入、XSS 跨站点脚本攻击等。而 nginx 是一个高性能的 Web 服务器,常用于处理大量的并发请求,具有很高的负载均衡能力…

【Golang - 90天从新手到大师】Day09 - string

系列文章合集 Golang - 90天从新手到大师 String 一个字符串是一个不可改变的字节序列。字符串可以包含任意的数据&#xff0c;但是通常是用来包含人类可读的文本。 len()返回字符串字节数目&#xff08;不是rune数&#xff09;。 通过索引可以访问某个字节值&#xff0c;0…

MathType软件7.7最新永久激活码许可证秘钥2024最新

【种草神器&#xff01;】大家好啊&#xff0c;我刚刚发现了一个超级好用的工具&#xff0c;迫不及待地想跟大家分享——MathType软件的最新功能介绍。作为一个经常需要处理各种复杂数学公式和文档的科研狗&#x1f436;&#xff0c;找到一款好的数学编辑工具对我来说真的太重要…

GPT-4+Midjourney=顶级卖家!这个一天可做1000个图的Midjourney到底多离谱?

一、一天做1000个图的AI作画神器&#xff01; 兄弟们&#xff0c;最近AI作画刷遍了跨境圈&#xff0c;先给大家看三张图片&#xff0c;下面3张图&#xff0c;只有一张是设计师画的&#xff0c;其他都是Midjourney 画的&#xff0c;猜猜哪一张是真人画的&#xff1f;&#xff08…

摄像头劫持——保护自己免受窥探

今天为您带来当今科技界的最新趋势及探索方法。本周&#xff0c;我们将为您提供五个防止黑客在您不知情的情况下访问您的网络摄像头的建议。 网络摄像头 一、摄像头劫持 你是否曾经怀疑过&#xff0c;即使你没有主动使用网络摄像头&#xff0c;也可能有人正在通过它窥视你&am…

前端 CSS 经典:边框转圈动画效果

前言&#xff1a;首先我们要知道 css 动画只对数值类的 CSS 属性起作用。要实现边框转圈动画效果&#xff0c;实际就是渐变背景的旋转。但是在以前&#xff0c;渐变背景是不支持动画的。现在我们可以利用浏览器新出的 Houdini API 来实现这个动画效果。Houdini API 特别强大&am…

【golang学习之旅】Go程序快速开始 Go程序开发的基本注意事项

系列文章 【golang学习之旅】使用VScode安装配置Go开发环境 【golang学习之旅】报错&#xff1a;a declared but not used 【golang学习之旅】Go 的基本数据类型 【golang学习之旅】深入理解字符串string数据类型 【golang学习之旅】go mod tidy 【golang学习之旅】记录一次 p…

1台UG图形工作站实现5-7人共享使用

随着计算机辅助设计&#xff08;CAD&#xff09;和计算机辅助制造&#xff08;CAM&#xff09;技术的不断发展&#xff0c;UG图形工作站已成为许多行业不可或缺的重要工具。 对于许多中小型企业而言&#xff0c;购买多台高性能的UG图形工作站无疑是一笔巨大的开销&#xff0c;…

拼多多商品全流程自动化采集

拼多多商品-自动化采集 本文简单介绍拼多多商品-全流程自动化采集助手的部分功能。 项目交流—— &#x1f6f0;️威v-讯x-&#xff1a;chaohuo8080 一、产品概述 拼多多商品-全流程自动化采集助手采用自动化技术和智能算法&#xff0c;能够自动完成从商品搜索、信息抓取、数…

朝阳医院2018年销售数据 数据分析与可视化

代码及数据集下载传送门 数据分析与可视化-朝阳医院2018销售数据-ipynbcsv 实践内容 以朝阳医院2018年销售数据为例&#xff0c;目的是了解朝阳医院在2018年里的销售情况&#xff0c;这就需要知道几个业务指标&#xff0c;本次的分析目标是从销售数据中分析出以下业务指标&am…

国产口碑最佳的骨传导耳机有哪些?精选五大高人气骨传导耳机推荐!

作为一名音乐爱好者与耳机评测师&#xff0c;我对骨传导耳机这类独特的音频设备有着深入的了解&#xff0c;身边的朋友们也时常向我咨询关于骨传导耳机的各种问题。大部分都在问“骨传导耳机怎么选&#xff1f;有没有好用的骨传导耳机推荐”&#xff0c;随着骨传导耳机逐渐热门…

vxe-table 列表过滤踩坑_vxe-table筛选

但是这个过滤输入值必须是跟列表的值必须一致才能查到&#xff0c;没做到模糊查询的功能&#xff0c;根据关键字来过滤并没有实现。 下面提供一下具体实现方法&#xff1a;&#xff08;关键字来过滤&#xff09; filterNameMethod({ option, row }) {if (row.name.indexOf(op…

MATLAB直方图有关的函数

histogram Histogram plot画直方图 histcounts 直方图 bin 计数 histcounts是histogram的主要计算函数。 discretize 将数据划分为 bin 或类别 histogram2 画二元直方图 histcounts2 二元直方图 bin 计数 hist和histc过时了。替换不建议使用的 hist 和 histc 实例 hist → \r…

Representation RL:HarmonyDream: Task Harmonization Inside World Models

ICML2024 paper code Intro 基于状态表征的model-based强化学习方法一般需要学习状态转移模型以及奖励模型。现有方法都是将二者联合训练但普遍缺乏对如何平衡二者之间的比重进行研究。本文提出的HarmonyDream便是通过自动调整损失系数来维持任务间的和谐&#xff0c;即在世界…

低投入+高效率的求职招聘小程序源码系统平台版 带完整的安装代码包以及搭建教程部署教程

系统概述 在当今数字化时代&#xff0c;求职招聘领域的竞争日益激烈。传统的求职招聘方式逐渐显露出效率低下、成本高昂等问题。为了满足市场需求&#xff0c;提高求职招聘的效率和便捷性&#xff0c;同时降低企业和求职者的成本&#xff0c;“低投入高效率的求职招聘小程序源…