我想从shapefile中获取经度和纬度.到现在为止,我只知道如何读取shapefile.
library(rgdal)
centroids.mp <- readOGR(".","35DSE250GC_SIR")
Run Code Online (Sandbox Code Playgroud)
但是如何从centroids.mp中提取纬度和经度?
我正在尝试使用 django-social-auth 从 Facebook 获取用户个人资料图片。
我在另一篇文章中看到,我应该从 Facebook 获取用户 uid 才能访问个人资料图片。我怎样才能得到uid?
从 django-social-auth 我刚刚安装了它并配置了基本的东西以使用 django-registrations 登录/注销。
这是我要登录的 html:使用 FB 登录
如何向 facebook 中的用户发出“主页”视图的请求并获取 uid?
我在 django-socail-auth 文档中找到了这个:
def social_associate_and_load_data(backend, details, response, uid, user,
social_user=None, *args, **kwargs):
"""
The combination of associate_user and load_extra_data functions
of django-social-auth. The reason for combining these two pipeline
functions is decreasing the number of database visits.
"""
extra_data = backend.extra_data(user, uid, response, details)
created = False
if not social_user and user:
social_user, created = UserSocialAuth.objects.get_or_create(
user_id=user.id, …Run Code Online (Sandbox Code Playgroud) 我收到此错误:
Could not parse 'event_date' as a timestamp. Required format is YYYY-MM-DD HH:MM[:SS[.SSSSSS]]
Run Code Online (Sandbox Code Playgroud)
尝试插入行时从BigQuery中获取。
这是我的代码:
bigquery_client = bigquery.Client.from_service_account_json(CREDENTIALS_BIGQUERY, 'roas-164016')
dataset = bigquery_client.dataset(BQ_LOGS_DATASET_NAME)
table = dataset.table(BQ_EMAIL_SENDS_TABLE_NAME)
data = {}
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
data['send_id'] = 'test'
data['uid'] = 'test'
data['account_id'] = 'test'
data['subaccount_id'] = 'test'
data['event_id'] = 'test'
data['event_date'] = now
data['html_content'] = 'test'
data['campaign_name'] = 'test'
data['subject'] = 'test'
data['send_type'] = 'test'
json_data = json.dumps(data)
data = json.loads(json_data)
table.reload()
rows = [data]
errors = table.insert_data(rows)
Run Code Online (Sandbox Code Playgroud)
如何修复日期格式?
我正在尝试使用boto3在AWS Athena中运行查询.但我收到这个错误:
Operation cannot be paginated: get_query_results
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
client = boto3.client(
'athena',
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY,
region_name='us-east-1'
)
query = """
select 1;
"""
response = client.start_query_execution(
QueryString=query,
# QueryExecutionContext={
# 'Database': 'Test45'
# },
ResultConfiguration={
'OutputLocation': 's3://dft-dwh-files/raw_data/google_analytics/dev-test/'
}
)
paginator = client.get_paginator('get_query_results')
response_iterator = paginator.paginate(
QueryExecutionId='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'bafe7afc-07b5-4622-9019-2e3c92853913'
}
)
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我正在尝试使用Django的HighCharts(使用Mac Maverick).我的HighCharts文件夹位于我的静态文件夹中.我正在使用以下模板:
{% load static %}
<div id="categoryPieChart"
style="min-width: 250px; height: 250px; margin: 0 auto"></div>
<script src="{% static 'js/highcharts/highcharts.js' %}"></script>
<script src="{% static 'js/modules/exporting.js' %}"></script>
Run Code Online (Sandbox Code Playgroud)
但在终端,我得到了这个错误.404 2716的意思是什么?我已经检查过,文件路径是正确的.模板只显示一个空白页面.我该怎么办?
[22/Dec/2013 03:00:54] "GET /Users/filipeferminiano/Documents/django/panorama/static/js/highcharts/highcharts.js HTTP/1.1" 404 2716
[22/Dec/2013 03:00:54] "GET /Users/filipeferminiano/Documents/django/panorama/static/js/modules/exporting.js HTTP/1.1" 404 2704
Run Code Online (Sandbox Code Playgroud) 我正在尝试在此链接中从 golang 运行 hello world 但是当我运行 go install 时,出现此错误:
hello.go:1:1: illegal character U+0023
Run Code Online (Sandbox Code Playgroud)
这是我的hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, world")
}
Run Code Online (Sandbox Code Playgroud)
我使用的是 Mac OS El Captain 有什么问题吗?
我正在尝试从python脚本在redshift中运行查询,但出现错误:
sqlalchemy.exc.InternalError: (psycopg2.InternalError) ALTER EXTERNAL TABLE cannot run inside a transaction block
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
engine = create_engine(SQL_ENGINE % urlquote(REDSHIFT_PASS))
partition_date = (date.today() - timedelta(day)).strftime("%Y%m%d")
query = """alter table {table_name} add partition (dt={date_partition}) location 's3://dft-dwh-files/raw_data/google_analytics/revenue_per_channel/{date_partition}/';""".format(date_partition=partition_date,table_name=table_name)
conn = engine.connect()
conn.execute(query).execution_options(autocommit=True)
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我正在尝试查询一个过滤过去24小时内的日期的查询:
select *
from tb
where created_at > DATEADD('hour', -24, now())
limit 100;
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
SYNTAX_ERROR: line 3:24: Function dateadd not registered
Run Code Online (Sandbox Code Playgroud) 我正在尝试运行 jenkins war 文件,但收到此错误:
: Container startup failed
java.io.IOException: Failed to start Jetty
Run Code Online (Sandbox Code Playgroud)
这是我正在运行的命令:
java -jar jenkins.war
Run Code Online (Sandbox Code Playgroud)
这是完整的错误:
Mar 25, 2018 1:55:50 AM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:154)
at winstone.Launcher.main(Launcher.java:352)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:246)
at Main.main(Main.java:91)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:321)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:366)
at …Run Code Online (Sandbox Code Playgroud) python ×4
django ×2
python-2.7 ×2
gdal ×1
go ×1
highcharts ×1
java ×1
jenkins ×1
presto ×1
r ×1
rgdal ×1
sql ×1
sqlalchemy ×1
ubuntu ×1