我使用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) 我以这种方式使用了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。
如何解决此问题并寻求许可?
在某些 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帮不了我。
我需要格式为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)
但是我在哪里可以获得地区代码列表?
谢谢。
如何在运行时从我的代码中获取 c# 版本?我使用.net核心。例如,我可以使用以下代码获取框架版本:
FrameworkName = Assembly
.GetEntryAssembly()?
.GetCustomAttribute<TargetFrameworkAttribute>()?
.FrameworkName
Run Code Online (Sandbox Code Playgroud)
我需要类似 C# 版本的东西。
php ×2
ruby ×2
.net-core ×1
c# ×1
capistrano ×1
capistrano3 ×1
csv ×1
geo ×1
html ×1
javascript ×1
nokogiri ×1
parsing ×1