如果我有一个字符串列表,例如["A", "B", "1", "0", "C", "2"],如何让Python优雅地获取该2列表的"最高"值()?
例如,如果上面的列表要从最低到最高排序,那就是
[A, B, C, 0, 1, 2]
Run Code Online (Sandbox Code Playgroud)
我需要抓住2.
使用sorted(),按以下方式组织列表
[0, 1, 2, A, B, C]
Run Code Online (Sandbox Code Playgroud) 如何在我的cordova应用程序中创建链接按钮,该应用程序根据设备重定向到iOS/Android/Amazon App Store上的应用程序?
我尝试了下面的代码,它在iOS if子句中获得,但它没有重定向我,也没有给出错误:
if(window.cordova && window.device) {
if (device.platform.toUpperCase() === 'IOS') {
window.open("https://itunes.apple.com/gb/[OBFUSCATED]");
} else if (device.platform.toUpperCase() === 'ANDROID') {
window.open("https://play.google.com/store/apps/details?id=[OBFUSCATED]");
} else {
window.open("https://www.amazon.co.uk/[OBFUSCATED]");
}
}
Run Code Online (Sandbox Code Playgroud) 我已将以下代码添加到我的.htaccess中,但PageSpeed Insights仍显示Leverage Browser Caching建议.
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access 1 month"
ExpiresByType image/x-ico "access 1 year"
ExpiresByType image/jpg "access 14 days"
ExpiresByType image/jpeg "access 14 days"
ExpiresByType image/gif "access 14 days"
ExpiresByType text/html "access 2 day"
ExpiresByType text/css "access 2 days"
ExpiresByType image/png "access 1month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
</IfModule>
Run Code Online (Sandbox Code Playgroud)
尽管如此,PageSpeed Insights仍然声明我应该利用浏览器缓存来实现以下目标:
http://assets.pinterest.com/images/PinExt.png (60 seconds)
https://assets.pinterest.com/js/pinit.js (60 seconds)
http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=60 (5 minutes)
http://1.gravatar.com/avatar/572ef8c1916a898c441306a0f75f883e?s=60&d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D60&r=G (5 minutes)
http://1.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=60 (5 minutes)
http://cdn.api.twitter.com/1/urls/count.json?url=http%3A%2F%2Fwww.mbaadmissiongurus.com%2Fsample-mba-sop&callback=twttr.receiveCount …Run Code Online (Sandbox Code Playgroud) 我想在Intellij中为Jboss应用程序设置断点和远程调试。从这篇博客文章中,我相信第一步是在调试模式下运行jboss。我有Jboss5.1.0.GA。因此我没有与如何在调试模式下启动JBOSS 7中提到的文件(standalone.sh)相同?“>此Stack Overflow(涵盖了Jboss 7)。
对于Jboss-5.1.0.GA,我该怎么做?在run.conf中,我看到这两行:
# Sample JPDA settings for remote socket debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
# Sample JPDA settings for shared memory debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,address=jboss,server=y,suspend=n"
Run Code Online (Sandbox Code Playgroud)
我需要做的全部事情就是取消注释之一吗?那么在Intellij中,相应的设置是什么?这里:

我在 ggplot 中遇到问题,我想在同一图中绘制单独的数据集。第一个数据集创建地理热图并根据状态显示机会值。
setwd("~/R Work Example")
library(ggplot2)
library(maps)
states <- map_data("state")
tf=read.csv("Geographic Opprotunity.csv")
mydata<-read.csv("top 200 geographic heatmap.csv")
tfmerged <- merge(states, tf, sort = FALSE, by = "region")
tfmerged <- tfmerged[order(tfmerged$order), ]
Map<- ggplot(tfmerged, aes(long,lat, group=group,
fill=Total.Annual.Opportunity.In.Millions))+ geom_polygon()+ coord_equal()
Map + scale_fill_gradient(low="white", high="red")
Map<-Map + scale_fill_gradient(low="white", high="red")
Run Code Online (Sandbox Code Playgroud)
这非常有效,我非常兴奋。我的下一步是绘制这个图表,但这一次进一步细分机会,我不是按州细分,而是按州内的城市细分:
p<-ggplot()
p <- Map + geom_point( data=mydata, aes(x=long, y=lat, size = Opportunity
), color="gray6") + scale_size(name="Opportunity")
Run Code Online (Sandbox Code Playgroud)
当我运行脚本时,我收到此错误:
eval(expr, envir, enclos) 中的错误:未找到对象“组”。
我用谷歌搜索了它,并尝试了此页面上列出的一些解决方案,但仍然一无所获。我还为上面的脚本创建了另一个 ggplot 并让它正确绘制,我只是希望能够将第二个图中的实际数据点放在我在第一个脚本中创建的热图中。
您可以在这里找到我的数据集的片段:


我的数据如下:
dput(head(mydata))
structure(list(label = structure(c(79L, 51L, 138L, 161L, …Run Code Online (Sandbox Code Playgroud) 我将Firebase Auth用于网站,并选择了密码验证和Google登录。当我运行它时,我得到以下信息:
{"error":{"code":403,"message":"Requests to this API identitytoolkit method google.cloud.identitytoolkit.v1.AuthenticationService.SignUp are blocked.","errors":[{"message":"Requests to this API identitytoolkit method google.cloud.identitytoolkit.v1.AuthenticationService.SignUp are blocked.","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED"}}
我已经从Firebase控制台启用了密码和Google登录,并且还在Google Cloud Platform控制台中启用了Identity Toolkit API,但是仍然出现此错误。
有一个手册https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue ,我无法完成第四步,因为我找不到“链接的问题”。

我是Zend开发人员,我开发了一个没有管理面板的应用程序.现在我想为此开发一个管理面板,那么我该如何从一开始就开发它?
我需要写什么来重定向到管理面板,如" http:// localhost/zend/public "?
如何添加管理控制器或模块?
管理员的布局.
我在哪里放置一个管理文件夹或者我在Bootstrap中更改了什么?
这是前一个问题Applescript的扩展 :通过gui脚本单击菜单栏项
在f.lux菜单栏下方突出显示的菜单项上,如果单击它,将会有一个复选标记,表示已启用"禁用一小时"功能.我要做的是为f.lux编写一个GUI AppleScript,用户可以决定通过在Alfred中输入一个关键字然后输入1或0来切换复选标记,其中1用于启用"禁用一小时" "和0,用于保持不受控制.
这是f.lux菜单栏的屏幕截图
然而,我很难确定要为"禁用一小时"菜单项调整哪个属性以切换复选标记.这是代码,但是在通过applescript编辑器编译时会出现意外的令牌错误.到目前为止,我要做的是针对上面屏幕截图中箭头指示的"菜单项标记字符"属性,但我不确定这是否是切换"禁用一小时"项目的正确方法.有人可以给我建议吗?
on alfred_script(q)
set myOption to q as integer
ignoring application responses
tell application "System Events" to tell process "Flux"
click menu bar item 1 of menu bar 2
end tell
end ignoring
do shell script "killall System\\ Events"
delay 0.1
tell application "System Events" to tell process "Flux"
tell menu bar item 1 of menu bar 2
if myOption is 1 then
set ? to value of attribute "AXMenuItemMarkChar" of menu …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过运行以下代码在 Chrome 的开发人员控制台中手动提交表单:
$('form').submit();
Run Code Online (Sandbox Code Playgroud)
如何在此代码中指定表单的输入值?我知道输入 ID/名称。
javascript forms jquery google-chrome google-chrome-devtools
我正在尝试使用libsndfile.我对g ++也不是很好.安装libsndfile的方法似乎是使用"make install".我真的可以这样做,所以我在一个目录中编译它.
我试图在这里编译教程:http:
//parumi.wordpress.com/2007/12/16/how-to-write-wav-files-in-c-using-libsndfile/
当我尝试以下内容时:
g++ -Isrc/ test.c
Run Code Online (Sandbox Code Playgroud)
我明白了:
/tmp/ccq5fhbT.o: In function SndfileHandle::SndfileHandle(char const*, int, int, int, int)':
test.c:(.text._ZN13SndfileHandleC1EPKciiii[SndfileHandle::SndfileHandle(char const*, int, int, int, int)]+0xf4): undefined reference to sf_open'
/tmp/ccq5fhbT.o: In function SndfileHandle::write(float const*, long)':
test.c:(.text._ZN13SndfileHandle5writeEPKfl[SndfileHandle::write(float const*, long)]+0x27): undefined reference to sf_write_float'
/tmp/ccq5fhbT.o: In function SndfileHandle::SNDFILE_ref::~SNDFILE_ref()':
test.c:(.text._ZN13SndfileHandle11SNDFILE_refD1Ev[SndfileHandle::SNDFILE_ref::~SNDFILE_ref()]+0x20): undefined reference to sf_close'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
当我尝试执行以下操作时:
g++ -lsndfile -Isrc/ test.c
Run Code Online (Sandbox Code Playgroud)
我明白了
/usr/bin/ld: cannot find -lsndfile
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
我不确定我需要给g ++什么开关.
我目前的代码存在问题(用Javascript编写); 我有数组对象,随着时间的推移不断填充.对象的示例:
monster.push({
range: 200,
attackSpeed: 500,
lastFire: 100,
id: 'ogre',
speed : 50,
pos:[canvas.width*Math.random(), canvas.height*Math.random()],
sprite: new Sprite('images/sheet_characters.png',[508,224],64,64],6,[0])
Run Code Online (Sandbox Code Playgroud)
和
hero={
attackSpeed: 200,
lastGetHit: Date.now(),
lastFire: Date.now(),
health : 100,
speed: 256, //pixel/second
pos:[canvas.width/2,canvas.height/2],
sprite: new Sprite('images/sheet_characters.png',[256,0],[32,32],8,[0]) };
Run Code Online (Sandbox Code Playgroud)
对象的位置字段经常变化,我想添加一个确定怪物和英雄之间斜率的函数(我们希望怪物向英雄射击),然后攻击应该遵循线性运动.
我现在有什么
for(var i=0; i<monster.length; i++){
var mob = monster[i];
mob.sprite.update(delta); //animatie
var newPos = moveTowards(mob, hero, delta);
mob.pos[0] = newPos[0]
mob.pos[1] = newPos[1]
if(checkBounds(mob.pos,mob.sprite.size)){
monster.splice(i,1);
}
mobAttacks(mob);
var attack = enemyAttacks[i]; //atacks updaten
attack.sprite.update(delta);
attack.pos[0] = attack.speed * Math.cos(attack.direction)));
attack.pos[1] = …Run Code Online (Sandbox Code Playgroud) 我想通过 OS X 的命令行终端查找文件,然后将找到的文件复制到新目录。我要查找的文件的文件名在 listexample.txt 文件中,其中大约有 5000 个文件名。
文件 listexample.txt 如下所示:
1111 00001 55553.bmp
1113 11312 24125.bmp
…
Run Code Online (Sandbox Code Playgroud)
我试过这样的事情:
find /directory -type f "`cat listexample.txt`" -exec cp {} …
Run Code Online (Sandbox Code Playgroud)
但无法让它运行。
我现在有这个,但它不起作用:
cat listexample.txt | while read line; do grep "$line" listexample.txt -exec find /directorya "$line" -exec cp {} /directoryb \; done
Run Code Online (Sandbox Code Playgroud)
这个想法是读取列表 example.txt 的行,然后使用 grep 获取该行,在目录 a 中找到文件,然后将找到的文件复制到新目录 b。我认为由于我的文件名的性质,见上文,名称中也存在空格问题。
我也开始使用这种方法来查看发生了什么,但并没有走多远。
for line in `cat listexample.txt`; do grep $line -exec echo "Processing $line"; done
Run Code Online (Sandbox Code Playgroud) javascript ×2
macos ×2
.htaccess ×1
alphanumeric ×1
android ×1
applescript ×1
browser ×1
caching ×1
cordova ×1
find ×1
firebase ×1
forms ×1
g++ ×1
ggplot2 ×1
github ×1
ios ×1
iphone ×1
java ×1
jboss ×1
jquery ×1
libsndfile ×1
plot ×1
pull-request ×1
python ×1
r ×1
sorting ×1
string ×1
terminal ×1
web ×1