小编eGl*_*Glu的帖子

Expo:无论如何将语音添加到文本中?

我想在我的 Expo 应用程序中包含语音转文本。有可用的 api,例如 google 的语音文本和 watson 等...

有没有人提出解决方案或对如何在他们的 Expo 或 React-Native 应用程序中包含 Speech-to-Text 有任何建议?

我查看了各种为 React-Native 应用程序提供 Speech-to-Text 的 github 存储库,但它们看起来并不适合生产,并且是严格的 React-Native 解决方案,因为您需要访问 Java/Swift 代码。

如果这是唯一的选择,我并不反对,但如果可能的话,我更喜欢世博会解决方案。

问候,埃米尔

react-native expo

7
推荐指数
1
解决办法
2149
查看次数

反应本机控制的模态冻结

免责声明:仅可以在iPhone模拟器atm上进行测试。React-Native 0.49 Mac OSX High Sierra

我想创建一个从父组件获取其道具的模式。如下:

const Modal = ({ showModal, closeModal }) => (
  <Modal
    animationType="slide"
    transparent={false}
    visible={showModal}
    onRequestClose={() => {alert("Modal has been closed.")}}
    >
   <View style={{marginTop: 22}}>
     <Text>Hello World!</Text>
     <TouchableHighlight onPress={() => closeModal() }>
        <Text>Hide Modal</Text>
     </TouchableHighlight>
   </View>
  </Modal>
);
Run Code Online (Sandbox Code Playgroud)

这是父示例:

<View>
  <Modal
    showModal={this.state.showModal}
    closeModal={() => this.setState({ showModal: false })}
  />
  <ScrollView>
      {elements.map(element => {
        return (
          <Card key={element.id}>  
            <Badge onPress={() => this.setState({ showModal: true })>
              <Text>Show</Text>
            </Badge>
          </Card>
        );
      })}
  </ScrollView>
</View>
Run Code Online (Sandbox Code Playgroud)

当我单击显示模态按钮时,模态会按预期方式弹出,但是当我单击closeModal时,模态会消失并再次出现,但是这次我无法与之交互,UI似乎冻结了,我必须重新启动仿真器。

如果我直接从React-Native文档中复制并粘贴代码,则:https : …

react-native

5
推荐指数
1
解决办法
2836
查看次数

Sequelize:如何在 3 个表之间建立关系

如果您有以下实体:用户、角色、组织。您希望设置关系,以便每个用户都有一个组织角色。

简单地说,每个用户可以属于多个组织,并且用户在每个组织中都有特定的角色。

您将如何使用 Sequelize 对此进行建模?

我尝试创建一个名为 organization_users 的连接表,然后在该表中添加一个 organizationUsers.belongsTo(role); 从我读过 Sequelize 不支持连接表上的关联,因此该解决方案不起作用。

问候,埃米尔

sequelize.js

5
推荐指数
1
解决办法
2952
查看次数

将 Sequelize.Instance 与 Sequelize v5 和 Typescript 结合使用

在大多数指南、聊天、教程等中……输入 Sequelize 模型的推荐方法是使用以下代码:

export interface IUserInstance extends Sequelize.Instance<IUserAttributes>, IUserAttributes {
  prototype: {
    verifyPassword: (password: string) => boolean;
  };
}
Run Code Online (Sandbox Code Playgroud)

这里的关键部分是Sequelize.Instance<,在 Sequelize v5+ 中,您会看到错误:

Namespace '".../node_modules/sequelize/types/index"' has no exported member 'Instance'.
Run Code Online (Sandbox Code Playgroud)

我环顾四周,但没有遇到解决方案。

** 查看本指南,“sequelize.define 的使用”部分 http://docs.sequelizejs.com/manual/typescript

在使用定义和打字稿时,似乎没有一种明确的方法来处理关联。

任何帮助/建议将不胜感激。

参考:

问候,埃米尔

sequelize.js typescript

5
推荐指数
1
解决办法
3435
查看次数

在链配置的命名空间XXX中找不到类"Doctrine\ORM\EntityManager"

我已经阅读了有关此问题的其他问题,但尚未找到解决方案.

我收到以下错误消息:

在链配置>命名空间ZfcUser\Entity,Common\Entity,Employment\Entity,Intern\Entity,> Team\Entity,PurchaseRequest\Entity中找不到类'Doctrine\ORM\EntityManager'.

我有一个HolidayEntity,HolidayController,HolidayService.

添加假期有效,但当我尝试删除假期时,会弹出错误.我将假日id从控制器传递给服务,然后服务取出相关对象并运行doctrine 2 removeEntity命令.

我不确定如何解决这个问题.

控制器代码:

public function deleteAction()
{
    $holidayId = $this->params()->fromRoute('id', 0);
    try {  
        $this->getServiceLocator()->get('holidayService')->removeHoliday($holidayId);
    } catch (Exception $e) {
        $this->flashMessenger()->addErrorMessage($e->getMessage() . '<br>' . $e->getTraceAsString());
    }
    return $this->redirect()->toRoute('holiday/list');
}
Run Code Online (Sandbox Code Playgroud)

服务代码:

public function removeHoliday($holidayId)
{
    try{
    $holiday = $this->findOneHolidayById($holidayId);
    $this->removeEntity($holiday);
    } catch (Exception $e) {
        var_dump($e);
    }
}

protected function removeEntity($entity)
{
    $this->getEntityManager()->remove($entity);
    $this->getEntityManager()->flush();
}
Run Code Online (Sandbox Code Playgroud)

代码在"$ this-> getEntityManager() - > remove($ entity)"方法中断.

php doctrine doctrine-orm zend-framework2

0
推荐指数
1
解决办法
2835
查看次数

jsDOM 和 Meteor 出现意外令牌错误

我正在尝试通过 jsDom 在服务器上呈现 chartsjs。我有一个使用 node.js 和 Express 的工作版本。每当我添加以下代码时,当前都在 Meteor 项目中

var jsdom = require('jsdom');
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

W20170615-20:30:17.440(2)? (STDERR) packages\modules.js:397
W20170615-20:30:17.456(2)? (STDERR) const { URL } = require("whatwg-url");
W20170615-20:30:17.460(2)? (STDERR)       ^
W20170615-20:30:17.461(2)? (STDERR)
W20170615-20:30:17.463(2)? (STDERR) SyntaxError: Unexpected token {
W20170615-20:30:17.465(2)? (STDERR)     at Object.exports.runInThisContext (vm.j
s:53:16)
W20170615-20:30:17.470(2)? (STDERR)     at C:\x\x\x\x\x
pp\.meteor\local\build\programs\server\boot.js:331:30
W20170615-20:30:17.472(2)? (STDERR)     at Array.forEach (native)
W20170615-20:30:17.473(2)? (STDERR)     at Function._.each._.forEach (C:\x\K
x\x\Local\.meteor\packages\meteor-tool\1.5.0\mt-os.windows.x86_32\dev
_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20170615-20:30:17.475(2)? (STDERR)     at C:\x\x\x\x\x
pp\.meteor\local\build\programs\server\boot.js:158:5
W20170615-20:30:17.476(2)? (STDERR)     at C:\x\x\x\x\x
pp\.meteor\local\build\programs\server\boot.js:387:5
W20170615-20:30:17.478(2)? (STDERR)     at Function.run (C:\x\x\x
p\x\x\.meteor\local\build\programs\server\profile.js:510:12)
W20170615-20:30:17.479(2)? (STDERR)     at C:\x\x\x\x\x …
Run Code Online (Sandbox Code Playgroud)

node.js jsdom meteor

0
推荐指数
1
解决办法
660
查看次数