我真的遇到了Facebook哈希密钥问题.我在Eclipse中生成它..证明:
然后我去了https://developers.facebook.com/并注册了一个新的应用程序.
最后我将我的hashkey设置为Facebook开发人员的设置:
但不管我做什么我一直得到相同的错误日志:"密钥哈希B5dWUEYfZJL/........... jyA =与任何存储的密钥哈希值不匹配"
有人知道我做错了什么或如何解决这个问题?如果我在自己的应用程序中使用HelloFacebookSample中的id和名称,一切正常.所以它与我最有可能设置的密钥哈希,id或名称有关.
谢谢,Yenthe
我想尝试将EditText和Button彼此相邻.我目前的按钮位于右侧,编辑文本左对齐,但按钮显示它位于EditText的顶部.我希望Button从EditText结束的地方开始.
这就是我现在所拥有的:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#004D79">
<RelativeLayout android:id="@+id/relativeLayout1"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<EditText
android:layout_alignParentLeft="true"
android:text="EditText"
android:layout_marginTop="10dp"
android:id="@+id/editText"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
</EditText>
<Button android:text="Skip"
android:id="@+id/skipButton"
android:textSize="18sp"
android:layout_marginTop="10dp"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="80dp">
</Button>
</RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我试图通过使EditText宽度具有精确的dp量来设置它,但是当屏幕翻转水平时,EditText和Button之间存在很大的差距.
我正在查看 Github API,它允许您通过 API 端点获取所有存储库邀请(请参阅https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository)。这可以正常工作:
from requests.auth import HTTPBasicAuth
import requests
login = 'xxx'
password = 'yyy'
url = 'https://api.github.com/user/repository_invitations'
repository_invites = requests.get(
url, auth=HTTPBasicAuth(login, password)).json()
print('response: ' + str(repository_invites))
Run Code Online (Sandbox Code Playgroud)
然后我可以url
像这样取出每个请求:
for repository_invite in repository_invites:
print('url: ' + repository_invite.get('url'))
Run Code Online (Sandbox Code Playgroud)
这给出了一些东西:
url: https://api.github.com/user/repository_invitations/123456789
Run Code Online (Sandbox Code Playgroud)
Github 还提到你可以在https://developer.github.com/v3/repos/invitations/#accept-a-repository-invitation接受邀请,其中提到
PATCH /user/repository_invitations/:invitation_id
我不明白的是我如何告诉 Github 如何接受它。此端点似乎用于删除和接受邀请。GithubPATCH
在https://developer.github.com/v3/#http-verbs上谈到,其中提到您可以使用 aPOST
或发送PATCH
请求,但不是如何使用。所以问题是,我怎么知道我应该在PATCH
电话中发送什么?我试过这个例如:
result = requests.patch(repository_invite.get('url'), json.dumps({'accept': True}))
print('result: ' + str(result.json()))
Run Code Online (Sandbox Code Playgroud)
哪个回馈:
result: {'message': 'Invalid request.\n\n"accept" …
Run Code Online (Sandbox Code Playgroud) 我有一个相当难的问题,我无法修复.想法是循环一部分数据并找到任何缩进.(总是空格)每当一行有比前一个更大的缩进时,例如4个以上的空格,第一行应该是字典的键,并且应该追加下一个值.
如果有另一个缩进,这意味着应该创建一个带有键和值的新词典.这应该是递归的,直到通过数据.为了使事情更容易理解,我做了一个例子:
Chassis 1:
Servers:
Server 1/1:
Equipped Product Name: EEE UCS B200 M3
Equiped PID: e63-samp-33
Equipped VID: V01
Acknowledged Cores: 16
Acknowledged Adapters: 1
PSU 1:
Presence: Equipped
VID: V00
HW Revision: 0
Run Code Online (Sandbox Code Playgroud)
我们的想法是能够以字典形式返回任何数据部分.dictionary.get("Chassis 1:")应该返回所有数据,dictionary.get("Servers")应该返回比"Servers"行更深的缩进的所有内容.dictionary.get("PSU 1:")应该给{"PSU 1:":"Presence:Equipped","VID:100","HW Revision:0"}等等.我画了一个小方案来证明这一点,每种颜色都是另一种字典.
当缩进再次变深时,例如从8到4个空格,数据应该附加到具有较少缩进数据的字典.
我已尝试过代码,但它并没有出现在我想要的地方附近.
for item in Array:
regexpatt = re.search(":$", item)
if regexpatt:
keyFound = True
break
if not keyFound:
return Array
#Verify if we still have lines with spaces
spaceFound = False
for item in Array:
if item != item.lstrip(): …
Run Code Online (Sandbox Code Playgroud) 今天我遇到了一个大问题,因为我对Python很新,我真的需要寻求帮助.
我已设法连接到我的FTP并正确登录.
ftp = ftplib.FTP('ftp.lala.com', 'username', 'pass')
Run Code Online (Sandbox Code Playgroud)
作为第二步,我进入了我想要的目录:
ftp.cwd("dirName")
Run Code Online (Sandbox Code Playgroud)
但后来我卡住了..我现在需要以字符串/数组/列表/ ..格式获取所有文件名才能使用所有这些名称.我试过OS,glob,..但这似乎没有任何作用.有什么想法吗?我需要获取我想要的目录中的每个文件名以及所需目录中的任何目录/文件.
我不知何故需要改变这一点
for fileName in glob.glob("*.*"):
self.out(fileName)
Run Code Online (Sandbox Code Playgroud)
转到路径ftp.lala.com/myDir/然后取出所有文件名(如果myDir中有文件夹)
欢迎任何建议或想法!谢谢你
我构建了一个shell
脚本,用于inotifywait
自动检测特定目录上的文件更改。当一个新的 PDF 文件被放到目录中时,这个脚本应该关闭,然后它应该触发ocropus-parser
在它上面执行一些命令。编码:
#!/bin/sh
inotifywait -m ~/Desktop/PdfFolder -e create -e moved_to |
while read path action file; do
#echo "The file '$file' appeared in directory '$path' via '$action'"
# Check if the file is a PDF or another file type.
if [ $(head -c 4 "$file") = "%PDF" ]; then
echo "PDF found - filename: " + $file
python ocropus-parser.py $file
else
echo "NOT A PDF!"
fi
done
Run Code Online (Sandbox Code Playgroud)
当我通过终端运行此脚本时,这很有效,./filenotifier.sh
但是当我重新启动我的Linux
(Ubuntu 14.04)时,我的 …
我对Parse.com很新,似乎无法获取数据.我尝试了一个异步方法,它做了一个foreach,但似乎从来没有工作,所以我尝试了一个ParseQuery
但是也没有用.例如:
ParseQuery<ParseObject> query = ParseObject.GetQuery("Horse");
string name = query.Get<string>("Name");
Debug.WriteLine("Horse: " + name);
Run Code Online (Sandbox Code Playgroud)
理想情况下,我想从模型中获取所有记录Horse
,然后循环遍历它以填充列表视图.我现在有一个硬编码的样本,但由于我甚至没有从列表中的表中获取所有记录,我不知道如何继续.
var listView = new ListView
{
RowHeight = 40
};
listView.ItemsSource = new string[]
{
//This should be filled up with the field 'Name' from the model 'Horse' dynamically..
"Buy pears",
"Buy oranges",
"Buy mangos",
"Buy apples",
"Buy bananas"
};
Content = new StackLayout
{
VerticalOptions = LayoutOptions.FillAndExpand,
Children = { listView }
};
Run Code Online (Sandbox Code Playgroud)
请问有人帮我吗?我按照https://parse.com/docs/dotnet_guide#objects-retrieving的指南进行操作,但这些选项似乎不起作用.
更新: 到目前为止,由于har07的答案,我可以获取所有数据.现在,当我想要填充ListView时出现错误:
public …
Run Code Online (Sandbox Code Playgroud) android ×2
python ×2
c# ×1
dictionary ×1
facebook ×1
filenames ×1
ftp ×1
ftplib ×1
github-api ×1
indentation ×1
init ×1
inotify ×1
linux ×1
list ×1
python-2.7 ×1
python-3.x ×1
shell ×1
xamarin ×1