小编jdo*_*dog的帖子

响应式图像映射

我在响应式html布局中有一个现有的图像映射.图像根据浏览器大小进行缩放,但图像坐标显然是固定的像素大小.我有什么选项来调整图像地图坐标的大小?

html css imagemap

131
推荐指数
9
解决办法
24万
查看次数

array_filter没有回调做什么?

我刚看到这段代码:

array_filter( array_map('intval', $array) );
Run Code Online (Sandbox Code Playgroud)

它似乎返回$ array转换为int的所有条目,其中数字> 0

但是我在手册页上看不到这是定义的.如果回调函数的计算结果为true,则应该返回数组值.但是这里没有定义回调函数.

令人困惑的是手动页面上的回调函数是可选的:http://php.net/manual/en/function.array-filter.php

php arrays

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

在IE浏览器关闭浏览器后,Edge无法正常工作

我有一个Web应用程序,它部分脱机支持.

我的appcache文件如下所示:

CACHE MANIFEST

# Datestamp 2015-10-07 GIT14a6ade78ef2ab6434871e90f7f1e70784bc1536

CACHE:

/offline/
/bundles/agrihealthahp/css/admin.css
/bundles/agrihealthahp/css/print.css
/bundles/agrihealthahp/css/offline-language-english.css
/bundles/agrihealthahp/css/offline-language-english-indicator.css
/bundles/agrihealthahp/css/offline-theme-default.css
//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css
//code.jquery.com/ui/1.11.2/themes/le-frog/jquery-ui.css
/bundles/bmatznerfoundation/css/foundation.min.css
//fonts.googleapis.com/css?family=Open+Sans+Condensed:300
/apple-touch-icon.png
/apple-touch-icon-57x57.png
/apple-touch-icon-72x72.png
/apple-touch-icon-76x76.png
/apple-touch-icon-114x114.png
/apple-touch-icon-120x120.png
/apple-touch-icon-144x144.png
/apple-touch-icon-152x152.png

/combine.c6f06a9f43e79d6d26af18e22b205cf4.js
/bundles/bmatznerfoundation/js/vendor/jquery.js
/bundles/bmatznerfoundation/js/foundation/foundation.js
/bundles/bmatznerfoundation/js/foundation/foundation.reveal.js
/bundles/agrihealthahp/js/offline-simulate-ui.min.js
//code.jquery.com/ui/1.11.2/jquery-ui.min.js
https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js
https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.4.0/moment-timezone.min.js
/bundles/agrihealthahp/images/dib-8d.png
/bundles/agrihealthahp/images/dib-9da.png
/bundles/agrihealthahp/images/dib-10d.png
/bundles/agrihealthahp/images/dib-10da.png
/bundles/agrihealthahp/images/dib-undefined.png

NETWORK:
*

FALLBACK:

/ /fallback.html
Run Code Online (Sandbox Code Playgroud)

一切都适用于Chrome,包括能够关闭浏览器,然后在离线时使用www.domain.com/anything再次打开它,这将返回到后备网址.此外,我可以访问/离线/并使用该应用程序.

关闭浏览器并重新打开不适用于Firefox,IE11和Edge浏览器.

这是我的设置中的错误还是应该有效?

javascript internet-explorer offline microsoft-edge

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

customer authenticator + form_login options打破所有csrf标记

我有一个Symfony 3.3.13系统,有各种形式.

以这些形式实现"深层联系",即.能够点击电子邮件链接,登录然后被重定向到我添加了以下更改的表单:

config.yml

framework:
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    ...
    more
    ...
Run Code Online (Sandbox Code Playgroud)

security.yml

security:
    providers:
        zog:
            id: app.zog_user_provider


    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: ~
            logout:
                path:   /logout
                target: /
            guard:
                authenticators:
                    - app.legacy_token_authenticator
                    - app.token_authenticator
                entry_point: app.legacy_token_authenticator
            form_login:                                         <--this line alone breaks CSRF 
                use_referer: true                               <--I tried partial combinations, none seems to make CSRF work
                login_path: /security/login
                use_forward: true
                success_handler: login_handler
                csrf_token_generator: security.csrf.token_manager   <--added based on answer, doesn't help
Run Code Online (Sandbox Code Playgroud)

SRC …

php symfony csrf-protection

13
推荐指数
1
解决办法
315
查看次数

Symfony自定义身份验证提供程序根据请求重叠注销

Symfony 3.3.17和3.4.9再现了这个问题

我有一个自定义身份验证提供程序,它将遗留应用程序和Symfony应用程序连接在一起:

应用程序/配置/ security.yml

security:
    providers:
        zog:
            id: app.zog_user_provider


    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:

            anonymous: ~
            logout:
                path:   /logout
                target: /
            guard:
                authenticators:
                    - app.legacy_token_authenticator
                    - app.token_authenticator
                entry_point: app.legacy_token_authenticator
Run Code Online (Sandbox Code Playgroud)

SRC /的appbundle /安全/ LegacyTokenAuthenticator:

class LegacyTokenAuthenticator extends AbstractGuardAuthenticator
{
    private $session;

    private $router;

    public function __construct(
        RouterInterface $router,
        SessionInterface $session,
        $environment
    ) {
        if (session_status() != PHP_SESSION_ACTIVE) {
            if ($environment != 'test'){
                session_start();
            }
            $session->start();
            $this->setSession($session);
        }
        //if (!$session->isStarted()) {

        //}


        $this->router = $router;
    }


    /**
     * @return …
Run Code Online (Sandbox Code Playgroud)

php authentication symfony

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

相当于Google Tag Manager PHP API中的dataLayer.push

我需要使用Google跟踪代码管理器PHP API记录虚拟页面事件.

到目前为止,我有这个代码:

    $client = new Google_Client();
    $client->setApplicationName("Partner Inquiry");
    $client->setDeveloperKey("xxxxxxxx");

    $service = new Google_Service_TagManager($client);

    $eventName = new Google_Service_TagManager_Parameter();
    $eventName->setList( array(
        'event' => 'VirtualPageview',
        'virtualPageURL' => '/partnerInquiry/partnerName',
        'virtualPageTitle' => 'Partner Inquiry - Partner Name'
    ));
Run Code Online (Sandbox Code Playgroud)

我现在打电话给什么

我的IDE自动完成找到了

    $service->accounts
Run Code Online (Sandbox Code Playgroud)

但是如何解雇事件集?

php api google-tag-manager

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

检查压缩文件的md5,而不完全解压缩

我想检查Ubuntu磁盘备份的完整性,用dd复制到Windows共享上.没有足够的空间来解压缩备份.是否有一个实用程序来计算压缩文件的md5而不完全解压缩?

compression md5

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

Symfony Twig覆盖特定的表格行

我有一个表单twig模板,我想用原始过滤器解析特定字段帮助文本(它包含html).该字段称为Clinic,形式为Clinic

根据http://symfony.com/doc/current/cookbook/form/form_customization.html#how-to-customize-an-individual-field

表格模板:

{% extends 'AgriHealthAhpBundle::admin.html.twig' %}
{% form_theme form 'AgriHealthAhpBundle:Form:fields.html.twig' %}

{% block _clinic_postcode_row %}
        <div class="row">
            test<div class="small-12 medium-3 columns label">{{ form_label(form) }}</div>
            <div class="small-12 medium-6 columns widget">
                {{ form_widget(form) }}
                <div class="error">
                    {{ form_errors(form) }}
                </div>
            </div>
            <div class="small-12 medium-3 columns help">
                {% if help is defined %}
                    {{ help|raw }}
                {% endif %}
            </div>
        </div>
{% endblock %}

{% block admin -%}
    <h1>New Clinic</h1>

    {{ form(form) }}

    <div class="row form_actions">
        <div class="small-12 medium-offset-3 medium-2 columns …
Run Code Online (Sandbox Code Playgroud)

php forms symfony twig

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

为Excel创建OData提供程序 - Power查询显示$ metadata xml

我正在创建一个OData提供程序,用于与PHP库一起使用Excel:https://github.com/Algo-Web/POData

我已经设法在我的本地网络上的浏览器中提供了一个Sample数据集:

http://dss.example.com/proto/odata.svc/Samples?$ format = json

{
  "value":[
    {
      "id":"1","firstName":"Rebbecca","lastName":"Didio","companyName":"Brandt, Jonathan F Esq","address":"171 E 24th St","city":"Leith","state":"TA","post":"7315","phone1":"03-8174-9123","phone2":"0458-665-290","email":"rebbecca.didio@didio.com.au","web":"http://www.brandtjonathanfesq.com.au"
    },{
      "id":"2","firstName":"Stevie","lastName":"Hallo","companyName":"Landrum Temporary Services","address":"22222 Acoma St","city":"Proston","state":"QL","post":"4613","phone1":"07-9997-3366","phone2":"0497-622-620","email":"stevie.hallo@hotmail.com","web":"http://www.landrumtemporaryservices.com.au"
    },{
      "id":"3","firstName":"Mariko","lastName":"Stayer","companyName":"Inabinet, Macre Esq","address":"534 Schoenborn St #51","city":"Hamel","state":"WA","post":"6215","phone1":"08-5558-9019","phone2":"0427-885-282","email":"mariko_stayer@hotmail.com","web":"http://www.inabinetmacreesq.com.au"
    },{
      "id":"4","firstName":"Gerardo","lastName":"Woodka","companyName":"Morris Downing & Sherred","address":"69206 Jackson Ave","city":"Talmalmo","state":"NS","post":"2640","phone1":"02-6044-4682","phone2":"0443-795-912","email":"gerardo_woodka@hotmail.com","web":"http://www.morrisdowningsherred.com.au"
    },{
      "id":"5","firstName":"Mayra","lastName":"Bena","companyName":"Buelt, David L Esq","address":"808 Glen Cove Ave","city":"Lane Cove","state":"NS","post":"1595","phone1":"02-1455-6085","phone2":"0453-666-885","email":"mayra.bena@gmail.com","web":"http://www.bueltdavidlesq.com.au"
    },{
      "id":"6","firstName":"Idella","lastName":"Scotland","companyName":"Artesian Ice & Cold Storage Co","address":"373 Lafayette St","city":"Cartmeticup","state":"WA","post":"6316","phone1":"08-7868-1355","phone2":"0451-966-921","email":"idella@hotmail.com","web":"http://www.artesianicecoldstorageco.com.au"
    },
    ...
}
Run Code Online (Sandbox Code Playgroud)

以及http://dss.example.com/proto/odata.svc/ $ metadata 上的相应元数据

<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns="http://schemas.microsoft.com/ado/2009/11/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" Version="3.0">
    <edmx:DataServices m:MaxDataServiceVersion="3.0" m:DataServiceVersion="3.0">
        <Schema Namespace="Proto"> …
Run Code Online (Sandbox Code Playgroud)

php excel odata

6
推荐指数
0
解决办法
249
查看次数

将安装脚本从Redhat更改为Ubuntu

已经为Redhat编写了一个安装脚本(适用于Microsoft®SQLServer®ODBCDriver 1.0 for Linux)

它使用此代码检查是否安装了某些软件包

req_libs=( glibc e2fsprogs krb5-libs openssl )

for lib in ${req_libs[@]}
do
    local present=$(rpm -q -a $lib) >> $log_file 2>&1
    if [ "$present" == "" ]; then
        log "The $lib library was not found installed in the RPM database."
        log "See README for which libraries are required for the $driver_name."
        return 1;
    fi
done
Run Code Online (Sandbox Code Playgroud)

我已经通过了解/信任库已安装并简单地删除测试来克服了这个问题,但我现在想整理一下.

  1. 如何在Ubuntu上找到要查找的库.是否有Redhat的命令或翻译网页 - > Ubuntu
  2. 用dpkg -s替换rpm -q -a是否正确?

ubuntu redhat rpm dpkg

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