经过5个小时的研究和阅读过时的paypal文档,我终于放弃了!
我需要使用paypal沙箱测试一个简单的paypal订阅按钮.
按钮代码:
<form action="https://www.sandbox.paypal.com/us/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="34CXHXVU2J8BY">
<input type="image"
src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_subscribeCC_LG.gif"
border="0" name="submit"
alt="PayPal — The safer, easier way to pay online."
style="border:none;padding:0;height:auto;width:auto">
<img alt="" border="0"
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
width="1" height="1">
</form>
Run Code Online (Sandbox Code Playgroud)
但是当我尝试发送表单时,我在paypal网站上收到此错误:
先谢谢,菲利普
html paypal subscription paypal-subscriptions paypal-sandbox
private function find($needle, $haystack) {
foreach ($haystack as $name => $file) {
if ($needle == $name) {
return $file;
} else if(is_array($file)) { //is folder
return $this->find($needle, $file); //file is the new haystack
}
}
return "did not find";
}
Run Code Online (Sandbox Code Playgroud)
嘿,此方法在关联数组中搜索特定键并返回与其关联的值.递归有一些问题.任何线索?
谷歌只是改变如何Chrome会预先载入audio
和video
; 请参阅:https://googlechrome.github.io/samples/media/preload-metadata
我的理解是简单地设置preload
属性auto
应该解决问题,但是,我无法这样做:
let mp3 = 'https://s3-staging.read2me.online/audio/5a745d88483d86.76121223.mp3';
let audio = new Audio(mp3);
audio.preload = 'auto';
audio.play();
Run Code Online (Sandbox Code Playgroud)
<audio src="https://s3-staging.read2me.online/audio/5a745d88483d86.76121223.mp3" preload="auto" autoplay></audio>
Run Code Online (Sandbox Code Playgroud)
这两个都将在Chrome 64和Chrome 65-dev上停止播放一分钟(其他浏览器和较旧的Chromes不受影响).我在Mac,Windows和Android上复制了这个问题.
在我的调试过程中,我已将所有可能的媒体事件附加到JS对象(即audio.addEventListener('timeupdate', () => { console.log('timeupdate') })
),并且最初事件是这样触发的:
progress
timeupdate
progress
timeupdate
[...]
后来这样:
timeupdate
timeupdate
timeupdate
[...]
当音频播放停止时,我收到了一些error
事件,并且转储audio.error
返回:PIPELINE_ERROR_DECODE: Failed to send audio packet for decoding: timestamp=81763265 duration=26122 size=201 side_data_size=0 is_key_frame=1 encrypted=0 discard_padding (ms)=(0, 0)
我该如何解决?这是Chrome错误吗?
更新: …
这是我的脚本:
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.7.13.min.js"></script>
<script>
AWS.config.region = 'eu-west-1';
AWS.config.accessKeyId = 'FOO';
AWS.config.secretAccessKey = 'BAR';
var polly = new AWS.Polly({apiVersion: '2016-06-10'});
var params = {
OutputFormat: 'mp3', /* required */
Text: 'Hello world', /* required */
VoiceId: 'Joanna', /* required */
SampleRate: '22050',
TextType: 'text'
};
polly.synthesizeSpeech(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
</script>
Run Code Online (Sandbox Code Playgroud)
请求成功,我得到了这样的回复:
我该如何使用这种回复?我知道响应是反序列化的音频,但我如何实际播放它,比如说,在HTML5音频元素中?
此外,这个答案解释了为什么这种类型的阵列适合音频数据:https://stackoverflow.com/a/26320913/1325575
Google推出了Trips产品:https://get.google.com/trips/(Android应用)
它有API吗?我想获得城市的日常旅游指南.我找到了飞行旅行(这里),但这不是我想要的.
通过更进一步的谷歌搜索,我能够找到这个,但这似乎是一个导航API,而不是Trips.
谢谢
最近,由于我们的一个Memcached节点死亡(我们使用Memcachier作为Memcached提供程序),我们的PHP Web应用程序几分钟后就不可用了.
这是我们的user.ini
配置(Heroku user.ini
用作定义配置的地方),这有效,但显然不支持故障转移:
session.save_handler=memcached
session.save_path=${MEMCACHIER_SERVERS} # I understand this is redundant, but I just kept it as-is because I didn't write the original user.ini
session.save_path="PERSISTENT=SFSESSID ${MEMCACHIER_SERVERS}"
session.gc_maxlifetime=1209600
session.gc_probability=1
memcached.sess_binary=1
memcached.sess_sasl_username=${MEMCACHIER_USERNAME}
memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}
Run Code Online (Sandbox Code Playgroud)
我们的新user.ini
配置旨在提供故障转移功能
session.save_handler=memcached
session.save_path="PERSISTENT=SFSESSID ${MEMCACHIER_SERVERS}"
session.gc_maxlifetime=1209600
session.gc_probability=1
memcached.sess_sasl_username=${MEMCACHIER_USERNAME}
memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}
memcached.sess_binary=1
memcached.sess_number_of_replicas=1
# I also tried memcached.sess_consistent_hash=1, to no avail
Run Code Online (Sandbox Code Playgroud)
在MEMCACHIER_SERVERS
的环境变量如下:123.45678.us-east-1.heroku.prod.memcachier.com:11211,123.45678.us-east-1.heroku.prod.memcachier.com:11211
.我认为这意味着我们有2个节点.
我们在新配置中遇到的问题是超时,以及关于PHP会话功能的许多错误(session_start()
,session_write_close()
).
为什么会这样?
请记住,我们根本不在PHP代码中使用Memcached,而只是作为会话存储引擎.
我确实尝试过联系Memcachier支持,但客户代表只能提供推荐的PHP代码(我们不需要).
什么,以及多少,更快 - 手动迭代数组foreach
并检查needle
出现in_array()
或使用array_intersect()
?
测试脚本
$i = 0;
array_uintersect(['foo', 'bar'], ['baz', 'qux'], function($a, $b) use (&$i) {
print_r([$a, $b, $i++]);
});
Run Code Online (Sandbox Code Playgroud)
实际结果
Array
(
[0] => bar
[1] => foo
[2] => 0
)
Array
(
[0] => qux
[1] => baz
[2] => 1
)
Array
(
[0] => bar
[1] => qux
[2] => 2
)
Array
(
[0] => bar
[1] => foo
[2] => 3
)
Run Code Online (Sandbox Code Playgroud)
预期结果
Array
(
[0] => foo
[1] => baz
[2] => 0
)
Array …
Run Code Online (Sandbox Code Playgroud) 我正在为之工作的组织正在从Heroku迁移到AWS,我们错过了最后一块拼图 - 在AWS上复制Heroku Pipelines.
Heroku管道很棒,它们让我们:
composer.json
文件执行CLI脚本,该脚本使用Browserstack并将结果发送给我们到目前为止,我已经找到了这些替代方案,但我认为其中任何一个都不符合上述所有要求:
列表中的最后一项,Harrow,似乎与我们所需要的一样接近,而且我很好奇是否有任何与我有相同(或非常相似)要求的人使用它并对此感到满意.我有一种感觉,这就是Heroku在幕后使用的.
对于生产,我们将在负载平衡器后面使用几个EC2.对于测试和暂存,我们可以使用一个带有多个虚拟环境的EC2(即Docker),也可以为每个测试和暂存应用使用t2.nano.
总结一下我的问题:什么是可以复制Heroku Pipelines的最佳工具,开源或商业?
我正在使用Closure::call
(http://php.net/manual/en/closure.call.php)在类上下文中调用外部闭包.
这是一个简单的复制品:
class Foo {
private $bar = 'baz';
/**
* Executes a closure in $this context and returns whatever the closure returns.
*
* @param \Closure $closure
* @return mixed
*/
public function callClosureInThisContext(\Closure $closure) {
return $closure->call($this);
}
}
class Closures {
/**
* @return \Closure
*/
public function getClosureForFoo() : \Closure {
return function () {
// how do I tell my IDE that in this context $this is actually class Foo,
// …
Run Code Online (Sandbox Code Playgroud) 我们的平台将用户的日历发布为 .ics 供稿,用户可以订阅该供稿 - 该供稿是使用 PHP 在运行时生成的,并且使用以下格式发布链接:webcal://domain.com/calendar/very-long-impossible-to-guess-filename.ics
直到最近,在 Macbook 上,这将打开 Apple 日历-> 预填充的新日历订阅Calendar URL
,如下所示:
现在情况已不再如此 - 现在它会打开 Google 日历(在浏览器内),它会尝试将日历添加到自身 - 这不是我们想要的。
MacOS Mojave 和 MacOS Catalina 的 Chrome 78 上的行为已得到确认。它仍然可以在 iOS 上正确添加日历。当单击 MacOS 版 Safari 时,它会要求切换到 Chrome,然后 Chrome 再次重定向到 Google 日历。
我们如何恢复之前的行为,即通过链接在 MacOS 上打开 Apple 日历?请记住,下载的 .ics 文件不适合我们,因为我们的目标是让用户通过 Apple 日历跟踪网站上不断变化的日程安排。
这是我的测试脚本:
\nbug.hr/homepage.js
\nconst puppeteer = require(\'puppeteer-extra\');\n\n(async () => {\n const eventPage = `https://www.bug.hr/`;\n const browser = await puppeteer.launch({\n headless: true,\n dumpio: true\n });\n const page = await browser.newPage();\n await page.goto(eventPage, {\n waitUntil: \'domcontentloaded\'\n });\n console.log("TITLE: ", await page.evaluate(() => document.title));\n await browser.close();\n})();\n
Run Code Online (Sandbox Code Playgroud)\n这应该启动 Puppeteer (并且在我重新启动服务器后启动),相反,我得到了这个:
\nubuntu@ip-123-45-67-89:/var/www/tests$ env DEBUG="puppeteer:*" node bug.hr/homepage.js \n puppeteer:launcher Calling /usr/bin/chromium-browser --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection …
Run Code Online (Sandbox Code Playgroud) php ×5
arrays ×3
audio ×2
heroku ×2
javascript ×2
amazon-ec2 ×1
amazon-polly ×1
benchmarking ×1
caldav ×1
calendar ×1
filtering ×1
git ×1
google-api ×1
google-maps ×1
html ×1
html5 ×1
icalendar ×1
ide ×1
linux ×1
macos ×1
memcached ×1
memcachier ×1
node.js ×1
paypal ×1
performance ×1
phpdoc ×1
phpstorm ×1
puppeteer ×1
recursion ×1
search ×1
seccomp ×1
session ×1
subscription ×1
ubuntu ×1