小编Sli*_*nTN的帖子

颤动:即使应用程序已关闭,也会推送通知

我已经构建了一个带有颤动的应用程序,就像提醒一样.
即使应用程序已关闭,如何向用户显示通知?

mobile-application push-notification apple-push-notifications android-notifications flutter

14
推荐指数
2
解决办法
1万
查看次数

调用未定义的函数Symfony\Polyfill\Mbstring\iconv_strlen()

我的项目在localhost上工作正常,但没有在线工作,这是错误:

Fatal error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strlen() in /home/stram/public_html/vendor/symfony/polyfill-mbstring/Mbstring.php on line 338
Run Code Online (Sandbox Code Playgroud)

我用谷歌搜索它,我发现我需要安装PHP扩展iconv.我正在使用VPS的问题,当我进入可用的PHP扩展列表时,我没有找到这个扩展!

在此输入图像描述
在此输入图像描述
在此输入图像描述

Thnx提前.

php vps iconv symfony

13
推荐指数
3
解决办法
2万
查看次数

无法在MacosX上安装php Intl扩展

我正在关注此链接以安装此PHP扩展,但我陷入了中间.
当我尝试运行此命令时,pecl install intl我收到以下消息:

Specify where ICU libraries and headers can be found [DEFAULT] :
Run Code Online (Sandbox Code Playgroud)

我不知道ICU库的位置.
如果我按Enter键我会收到此错误:

configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
ERROR: `/private/tmp/pear/install/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' failed
Run Code Online (Sandbox Code Playgroud)

如何找到ICU库的正确路径?我正在使用PHP版本7.1的High Sierra和MAMP

php terminal intl macos-high-sierra

9
推荐指数
2
解决办法
1万
查看次数

Postgresql函数:获取更新或插入行的id

我的 postgresql 数据库中有一个函数,如果存在则更新行,如果不存在则插入新行:

CREATE OR REPLACE FUNCTION insert_or_update(val1 integer, val2 integer) RETURNS VOID AS $$ 
DECLARE 
BEGIN 
    UPDATE my_table SET col2 = val2 WHERE col1 = val1; 
    IF NOT FOUND THEN 
    INSERT INTO my_table (col2) values ( val2 ); 
    END IF; 
END; 
$$ LANGUAGE 'plpgsql';
Run Code Online (Sandbox Code Playgroud)

目前它工作完美,但我想获取id行(如果更新或插入)。
我该怎么做?

postgresql function

6
推荐指数
1
解决办法
7231
查看次数

Symfony:从子表单获取数据(CollectionType)

我在两个实体之间有一个 ManyToOne 关系ParentChild因此在FormType我使用的关系中CollectionType,如下所述:

class ParentType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('childs', CollectionType::class, array(
                'entry_type' => ChildType::class,
            ));
    }
}
Run Code Online (Sandbox Code Playgroud)

在 ChildType 类中,我想使用 EventListener 获取嵌入对象:

class ChildType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('lastName');

        $builder->addEventListener(
            FormEvents::POST_SET_DATA,//---after setting data
            function (FormEvent $event) {
                die(var_dump($event->getData()));//---this gives me null
            }
        );
    }
}
Run Code Online (Sandbox Code Playgroud)

尽管我已将完整对象传递给控制器​​中的表单,但我得到的结果为 null: …

symfony-forms symfony

5
推荐指数
0
解决办法
1846
查看次数

Symfony 4-自动加载器预期的类[…]将在文件中定义

我试图将在Symfony 3. *上构建的旧捆绑软件添加到Symfony 4中,但出现此错误:

自动加载器的预期类“ App \ SBC \ TiersBundle \ Controller \ ChantierController”将在文件“ /Applications/MAMP/htdocs/Projects/HelloSymfony4/vendor/composer/../../src/SBC/TiersBundle/Controller/ ChantierController.php”。找到了文件,但没有类,文件名或名称空间可能在/Applications/MAMP/htdocs/Projects/HelloSymfony4/config/services.yaml中有错字(已加载到资源“ / Applications / MAMP / htdocs / Projects / HelloSymfony4 / config / services.yaml”)。

似乎框架无法识别捆绑软件的名称空间,因此我执行了以下步骤:
config/bundle.php我添加了第三行:

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
    \SBC\TiersBundle\TiersBundle::class => ['all' => true], // this one
    Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
];
Run Code Online (Sandbox Code Playgroud)

然后composer.jsonautoload部分中添加第一行:

"autoload": {
        "psr-4": {
            "SBC\\": "src/SBC/",
            "App\\": "src/" …
Run Code Online (Sandbox Code Playgroud)

php autoload symfony4

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

Java:在互联网可以中断时在线更新数据的最佳实践


我有2个申请:

  • 桌面(java)
  • 网络(symfony)

我在桌面应用程序中有一些数据必须与Web应用程序中的数据一致.
所以基本上我POST从桌面应用程序向Web应用程序发送请求以更新在线数据.

但问题是,当我发送请求时,互联网并不总是可用,同时我无法阻止用户更新桌面数据
到目前为止,这是我在考虑确保同步数据的时候互联网是可用的.

在此输入图像描述 我是否正确的方向?
如果没有,我希望你们让我走上正确的道路,以专业的方式实现我的目标.
任何关于此类主题的链接将不胜感激.

java data-synchronization

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

Symfony:动态更改数据库

假设我有3个数据库:

  • prefix_db1
  • prefix_db2
  • prefix_db3

而且我想像这样从url动态连接到它们,http://localhost/my-project/web/app_dev.php/db1/books所以我知道要从url连接到 哪个数据库(在这种情况下prefix_db1
,基本上的想法是准备一个将随每个http请求触发的侦听器,获取数据库从URL名称,然后覆盖doctrin的参数,可以是这样的:
services.yml

dynamic_connection:
        class: AppBundle\service\DynamicDBConnector
        arguments:  ['@request_stack']
        calls:
            - [ setDoctrineConnection, ['@doctrine.dbal.default_connection'] ]
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
Run Code Online (Sandbox Code Playgroud)

我的听众:

<?php    
namespace AppBundle\service;

use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\RequestStack;
use Exception;

class DynamicDBConnector
{
    /**
     * @var Connection
     */
    private $connection;

    /*
     * @var Request
     */
    private $request;


    public function __construct(RequestStack $requestStack)
    {
        $this->request = $requestStack->getCurrentRequest();

    }

    /**
     * Sets the DB Name prefix …
Run Code Online (Sandbox Code Playgroud)

php doctrine symfony

5
推荐指数
2
解决办法
1595
查看次数

颤振本地通知:频道 ID 是什么?

我正在使用flutter_local_notifications,要创建通知(让我们专注于 android ),请执行以下操作:

var androidPlatformChannelSpecifics =
        new AndroidNotificationDetails(
          'your other channel id',
          'your other channel name', 
          'your other channel description');
    var iOSPlatformChannelSpecifics =
        new IOSNotificationDetails();
    NotificationDetails platformChannelSpecifics = new NotificationDetails(
        androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
Run Code Online (Sandbox Code Playgroud)

正如您在 android 案例中看到的,您提供了 3 个与频道相关的参数
所以我的问题是这个频道的用途是什么,为什么在 android 中我们需要为它提供一个id、一个name和一个description

android dart flutter

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

如何从 jQuery LineControl 编辑器获取 textarea 值?

我正在使用这个jquery 插件 来创建一个所见即所得的文本编辑器,
我创建了一个文本区域,我想在其中显示文本编辑器:

<textarea class="editor" rows="3" name="textEditor" id="textEditor"></textarea>
Run Code Online (Sandbox Code Playgroud)

然后我调用了 jquery 函数:

<script type="text/javascript">
  $(document).ready( function() {
    $("#textEditor").Editor();                   
  });
</script>
Run Code Online (Sandbox Code Playgroud)

到目前为止,一切都运行良好,但是当我想知道使用此函数是否正确编写文本时:

function displayText(){
  alert($("#textEditor").val());
}
Run Code Online (Sandbox Code Playgroud)

它给了我一个空文本!
我错过了什么?

html jquery

4
推荐指数
1
解决办法
8865
查看次数

Angular4:Component.name 不适用于生产

所以我一直面临这个奇怪的问题,但我不确定这是一个错误还是我在这里遗漏了一些东西。
所以我有一个名为的组件TestComponent,在 AppComponent 中我有一个按钮,当我点击它时,我TestComponent通过这样做获得了名称TestComponent.name

应用组件

import { TestComponent } from './test/test.component';
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: '<button (click)="showName()">Show</button>'
})
export class AppComponent {    
  showName(){
    console.log('component name: "' + TestComponent.name + '"');
  }
}
Run Code Online (Sandbox Code Playgroud)

正如您通过单击按钮所看到的,我想获取 TestComponent 的名称,它基本上是“TestComponent”
问题是这在开发模式下运行良好,如果我调用ng build也可以正常工作,这就是我在控制台中得到的:

在此处输入图片说明

当我调用ng build --prod, 压缩文件并减小它们的大小时,我得到以下结果:

在此处输入图片说明

这正常吗?!

javascript ecmascript-6 angular

4
推荐指数
1
解决办法
3368
查看次数

"HTMLElement"类型中不存在属性"值"

一个内部directiveAngular我做了以下内容:

let input: HTMLElement = renderer.createElement('input');
renderer.appendChild(this.elem.nativeElement, input);
Run Code Online (Sandbox Code Playgroud)

当我尝试使用以下方法获取此输入中的值时:

console.log('value', input.value);
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Property 'value' does not exist on type 'HTMLElement'.
Run Code Online (Sandbox Code Playgroud)

虽然我们现在都是使用javascript从输入中获取价值,但我们执行以下操作:

document.getElementById("searchTxt").value;
Run Code Online (Sandbox Code Playgroud)

document.getElementById()返回null或HTMLElementobject:

/***返回对具有指定ID或NAME属性值的第一个对象的引用.*@param elementId指定ID值的字符串.不区分大小写.*/getElementById(elementId:string):HTMLElement | 空值;

为什么我得到这个错误?!!

javascript angular

3
推荐指数
1
解决办法
1327
查看次数