小编Chm*_*nah的帖子

获取两个地理点之间的距离

我想制作一个应用程序来检查用户所在的最近的地方.我可以很容易地获得用户的位置,我已经有了纬度和经度的地方列表.

知道列表最近的位置与当前用户位置的最佳方法是什么.

我在谷歌API中找不到任何东西.

maps android geolocation

107
推荐指数
4
解决办法
14万
查看次数

Eclipse跳转到Editor选项卡快捷方式

我想知道是否有任何方法可以使用选项卡的键盘快捷方式.例如Firefox有Alt+ 1/ Alt+ 2/ Alt+ 3去标签1/2/3等...

干杯,

eclipse keyboard-shortcuts

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

不要使用emacs显示^ M个字符

我想知道是否有办法暂时不在文件中显示^ M个字符.我不想删除它们我只是想不显示它们.

干杯,

unix windows emacs newline character-encoding

11
推荐指数
2
解决办法
2846
查看次数

序列扩展和bash中的变量

当seq数是变量时,我在Bash中遇到内置序列(即:不使用seq)的问题.例如,这工作并打印我1 2 3:

for i in {1..3};do echo $i;done
Run Code Online (Sandbox Code Playgroud)

但是这个 :

bash-3.2 $ a = 3;对于i在{1 .. $ a};做回声$ i;完成

失败并仅打印我{1..3}

这适用于ZSH,我知道我有一个替代方案来制作一个反制品,但想知道这是一个bug还是大括号扩展功能!

bash expansion

7
推荐指数
2
解决办法
3678
查看次数

if的Bash约定; 然后

从这个网页:

http://tldp.org/LDP/abs/html/abs-guide.html

它提到了if括号然后约定的用法,它在分号后需要一个空格:

;

Command separator [semicolon]. Permits putting two or more commands on the same line.

echo hello; echo there


if [ -x "$filename" ]; then    #  Note the space after the semicolon.
#+                   ^^
  echo "File $filename exists."; cp $filename $filename.bak
else   #                       ^^
  echo "File $filename not found."; touch $filename
fi; echo "File test complete."

Note that the ";" sometimes needs to be escaped.
Run Code Online (Sandbox Code Playgroud)

有谁知道这是从哪里来的,如果某些贝壳需要它?

bash shell coding-style

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

python-tz我错了还是个bug

有点奇怪的是,当我想通过pytz获得欧洲/巴黎的时区时,它会让我进入PMT时区而不是GMT + 1,这似乎适用于欧洲/柏林.

不清楚 ?那么看看这个片段:

#!/usr/bin/python
import os
import datetime
from pytz.tzfile import build_tzinfo

base='/usr/share/zoneinfo/'
tz = build_tzinfo('Europe/Paris',
                  open(os.path.join(base,'Europe','Paris'), 'rb'))
fmt = '%Y-%m-%d %H:%M:%S %Z%z'
print datetime.datetime(2009, 01, 30, 9, 00, tzinfo=tz).strftime(fmt)

tz = build_tzinfo('Europe/Berlin',
                  open(os.path.join(base,'Europe','Berlin'), 'rb'))

print datetime.datetime(2009, 01, 30, 9, 00, tzinfo=tz).strftime(fmt)
Run Code Online (Sandbox Code Playgroud)

输出是:

2009-01-30 09:00:00 PMT+0009
2009-01-30 09:00:00 CET+0100
Run Code Online (Sandbox Code Playgroud)

当真正的巴黎应该也是CET + 1.

从datetime.datetime.now(tz)构造无论如何都能得到正确的结果.

有人有想法吗?

python timezone

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