小编ste*_*zer的帖子

capistrano-env文件权限

我使用gem capistrano-env并发现了一个小问题.我的部署脚本是:

Capistrano::Env.use do |env|
  env.add 'DB_DSN', 'mysql:host=localhost;dbname=dbname'
  env.add 'DB_USER', 'user'
  env.add 'DB_PASS', 'pass'
end
Run Code Online (Sandbox Code Playgroud)

此代码.env在部署后在服务器上创建文件.但!.env文件权限是640,我的PHP脚本无法读取它.我可以chmod在每次部署后运行命令,但可能存在其他不错的解决方案?

编辑

我创建了pull请求filemode在此gem中添加了新选项.那么,现在的解决方案是:

Capistrano::Env.use do |env|
  env.add 'DB_DSN', 'mysql:host=localhost;dbname=dbname'
  env.add 'DB_USER', 'user'
  env.add 'DB_PASS', 'pass'
  env.filemode = 0644
end
Run Code Online (Sandbox Code Playgroud)

php ruby capistrano web-deployment capistrano3

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

自M71以来,不再允许未经用户激活的JavaScript speechSynthesis.speak()

我以这种方式使用了SpeechSynthesis API:

speechSynthesis.speak(new SpeechSynthesisUtterance("hello world"));
Run Code Online (Sandbox Code Playgroud)

但是现在更新Google Chrome后出现错误:

自2018年12月左右以来,自M71开始,不再允许未经用户激活的[Deprecation] speechSynthesis.speak()。有关更多详细信息,请参见 https://www.chromestatus.com/feature/5687444770914304

如何解决此问题并寻求许可?

javascript google-chrome speech-synthesis

6
推荐指数
3
解决办法
4053
查看次数

如何删除特定标签但保留允许的标签

在某些 HTML 中,我想删除一些特定的标签,但保留标签的内容/HTML。例如,在下面的行中,我想删除<strong><div>列入黑名单的标签,但保留标签的内容,并保留白名单标签中的<p>,<img>和其他标签:

原来的:

<div>
    some text
    <strong>text</strong>
    <p>other text</p>
    <img src="http://example.com" />
</div>
Run Code Online (Sandbox Code Playgroud)

结果:

some text
text
<p>other text</p>
<img src="http://example.com" />
Run Code Online (Sandbox Code Playgroud)

我想剥离特定标签,某些标签不得剥离。它必须像strip_tags在 PHP 中一样工作。所以inner_html帮不了我。

html ruby parsing nokogiri

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

地理区域代码列表

我需要格式为County-> Region-> City的地理数据库。我使用这个数据库:

https://www.maxmind.com/cn/worldcities

据我了解,国家/地区代码使用ISO:https : //en.wikipedia.org/wiki/ISO_3166-1_alpha-2。例如以下行:

us,sand point,Sand Point,AK,,55.3397222,-160.4972222
Run Code Online (Sandbox Code Playgroud)

意思:

US         - County United States
Sand Point - City name
AK         - Region Alaska
Run Code Online (Sandbox Code Playgroud)

但是我在哪里可以获得地区代码列表?

谢谢。

php csv geo

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

如何在 rutime 上获取 c# 版本

如何在运行时从我的代码中获取 c# 版本?我使用.net核心。例如,我可以使用以下代码获取框架版本:

FrameworkName = Assembly
    .GetEntryAssembly()?
    .GetCustomAttribute<TargetFrameworkAttribute>()?
    .FrameworkName
Run Code Online (Sandbox Code Playgroud)

我需要类似 C# 版本的东西。

c# .net-core

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