小编cet*_*ver的帖子

Apple推送通知服务

我试图使用本地mac机器运行,但出现以下错误

Warning: stream_socket_client() [function.stream-socket-client]: Unable to set private key file `/Applications/XAMPP/xamppfiles/htdocs/apns/apns-dev.pem’ in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: failed to create an SSL handle in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9

Warning: socket_close() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 11

Warning: fclose() expects parameter 1 to be resource, …
Run Code Online (Sandbox Code Playgroud)

php macos openssl apple-push-notifications

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

Jquery文件上传插件:如何在添加时验证文件?

$('#fileupload')
    .fileupload({
        acceptFileTypes: /(\.|\/)(jpg)$/i
    })
    .on('fileuploadadd', function (e, data) {
        console.log(data.files.valid); //undefined
        setTimeout(function () {
            console.log(data.files.valid); //true or false
        }, 500);
    })
;
Run Code Online (Sandbox Code Playgroud)

jsFiddle

如何在data.files.valid没有超时的情况下获取属性的布尔值?

jquery blueimp jquery-file-upload

12
推荐指数
2
解决办法
4万
查看次数

从stdin的php postgresql pdo副本

COPY table_name ( field1, field2, field3) FROM STDIN CSV;
1,2,"q w"
3,4,"a s"
5,6,d
\.
Run Code Online (Sandbox Code Playgroud)

如何通过PDO执行此查询?

更新:

问题是PDO驱动程序将此查询作为语句执行.
例如,如果将其粘贴到pgAdmin中,则会引发错误.
我需要执行它psql:

C:\Users\User>psql -e -h localhost -U postgres db_name
psql (9.1.2)
db_name=# COPY table_name ( field1, field2, field3) FROM STDIN CSV;
COPY table_name ( field1, field2, field3) FROM STDIN CSV;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> 1,2,"q w"
>> 3,4,"a s"
>> 5,6,d
>> …
Run Code Online (Sandbox Code Playgroud)

php postgresql pdo sqlbulkcopy

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

django StackedInline tinyMCE问题

当我单击Add another {{ verbose_name }}内联块时,显示tinymce-textatea,但禁用所有控件和编辑(控制台中没有错误).在3第一个textarea的tinymce正常工作.Imho是初始问题.
码:

#templates\admin\base.html
<script type="text/javascript" src="{% admin_media_prefix %}tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
    window.__admin_media_prefix__ = "{% filter escapejs %}{% admin_media_prefix %}{% endfilter %}";

    var tMCE = tinyMCE.init({
        //General otptions
        mode : 'textareas',
        theme: 'advanced',
        readonly : false,
        plugins : 'autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template',

        // Theme options
        theme_advanced_buttons1 : 'save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontsizeselect,|,forecolor,backcolor',
        theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,link,unlink,anchor,|,image,media,|,fullscreen,code',
        theme_advanced_buttons3 : '',
        theme_advanced_toolbar_location : 'top',
        theme_advanced_toolbar_align : 'left',
        theme_advanced_statusbar_location : 'bottom',
        theme_advanced_resizing : true,

        file_browser_callback : function(field_name, url, type, win) {
            var w = window.open('/elfinder', null, 'width=1000,height=800'); …
Run Code Online (Sandbox Code Playgroud)

django tinymce

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

psycopg2奇怪的行为

from django.db import connection

q = 'some value'

sql1 = 'SELECT * FROM table WHERE field LIKE %%%s%%' % q
sql2 = 'SELECT * FROM table WHERE field LIKE %%'+ q +'%%'

cursor = connection.cursor()
cursor.execute( sql1 ) #why exception: IndexError: tuple index out of range ?
cursor.execute( sql2 ) #works ok
Run Code Online (Sandbox Code Playgroud)

django postgresql psycopg

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

俄语的php问题

我使用curl以俄语填写utf-8页面.如果我回复文本它显示良好.然后我使用这样的代码

$dom = new domDocument; 

        /*** load the html into the object ***/ 
        @$dom->loadHTML($html); 

        /*** discard white space ***/ 
        $dom->preserveWhiteSpace = false; 

        /*** the table by its tag name ***/ 
        $tables = $dom->getElementsByTagName('table'); 

        /*** get all rows from the table ***/ 
        $rows = $tables->item(0)->getElementsByTagName('tr'); 

        /*** loop over the table rows ***/ 
        for ($i = 0; $i <= 5; $i++)
        { 
            /*** get each column by tag name ***/ 
            $cols = $rows->item($i)->getElementsByTagName('td'); 

            echo $cols->item(2)->nodeValue; 

            echo '<hr />'; 
        } 
Run Code Online (Sandbox Code Playgroud)

$ html包含俄语文本.在它行echo …

php encoding curl iconv domdocument

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

可以从 clickhouse 中的查询结果创建平面数组吗?

询问

select *
from (
    select [1] a
    union all
    select [1,2] a
    union all
    select [2] a
) q;
Run Code Online (Sandbox Code Playgroud)

结果(3 行)

[1]
[1,2]
[2]
Run Code Online (Sandbox Code Playgroud)

预期结果(1 行)

[1,1,2,2]
Run Code Online (Sandbox Code Playgroud)

有可能的 ?

clickhouse

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

utf8表示为普通文本

$text = "\xd0\xa2\xd0\xb0\xd0\xb9\xd0\xbd\xd0\xb0";
$text = iconv('UTF-8', 'UTF-8//IGNORE', $text);
var_dump($text); //????? - good
$text = file_get_contents('log.txt');
$text = iconv('UTF-8', 'UTF-8//IGNORE', trim($text));
var_dump($text); // \xd0\xa2\xd0\xb0\xd0\xb9\xd0\xbd\xd0\xb0 - bad
Run Code Online (Sandbox Code Playgroud)

为什么如果\xd0\xa2\xd0\xb0\xd0\xb9\xd0\xbd\xd0\xb0从文件中读取字符串iconv不起作用以及如何解决它?

php utf-8 utf

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

递归数据输出

$dirs = array(
    'root_dir' => array(
        'sub_dir_1' => array(
            0 => 'file'
        ),
        'sub_dir_2' => array(
            0 => 'file'
        ),
        'sub_dir_3' => array(
            0 => 'file_1',
            1 => 'file_2',
            2 => 'file_3'
        )
    ),
);


$render = function($dirs) use (&$render) {
    echo "<ul>";
    foreach ($dirs as $parent => $children) {
        if (is_string($parent) === true) {
            echo "<li>$parent</li>";
            $render($children);
        }  else {
            echo "<li>$children</li>";           
        }
    }
    echo "</ul>";
};

$render($dirs);
Run Code Online (Sandbox Code Playgroud)

产量

<ul>
    <li>root_dir</li>
    <ul>
        <li>sub_dir_1</li>
        <ul>
            <li>file</li>
        </ul>
        <li>sub_dir_2</li>
        <ul>
            <li>file</li> …
Run Code Online (Sandbox Code Playgroud)

php

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

javascript:object属性是数组,但是append不起作用

var objs = {
   'prop': []
}
objs['prop'].append('q');
Run Code Online (Sandbox Code Playgroud)

错误: TypeError: objs.prop.append is not a function

为什么这段代码不起作用?
为什么console.log(typeof(objs['prop']));object不是array

javascript

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

regexp匹配slug

请帮助slug regexp.
如果代码将在python中给出,我将不胜感激.
条件:

1 #valid 
1-1 #valid
1-1-1 #valid (infinite \d-\d)

1- #invalid
-1 #invalid
-1- #invalid

*NOTE 1 = \d
Run Code Online (Sandbox Code Playgroud)

python regex

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