谁能告诉我为什么在DJB哈希函数中使用数字5381?
DJB Hash功能是
h(0)= 5381
h(i)= 33*h(i-1)^ str [i]
一个c程序:
unsigned int DJBHash(char* str, unsigned int len)
{
unsigned int hash = 5381;
unsigned int i = 0;
for(i = 0; i < len; str++, i++)
{
hash = ((hash << 5) + hash) + (*str);
}
return hash;
}
Run Code Online (Sandbox Code Playgroud) 您能否根据其密钥和工作表ID(gid
)生成一个如何下载Google Docs电子表格的Python示例?我不能.
我已经搜索了API的第1版,第2版和第3版.我没有运气,我无法弄清楚他们编译的类似ATOM的API,gdata.docs.service.DocsService._DownloadFile
私有方法说我是未经授权的,而且我不想自己写一个完整的Google登录认证系统.由于沮丧,我准备将自己捅到脸上.
我有一些电子表格,我想这样访问它们:
username = 'mygooglelogin@gmail.com'
password = getpass.getpass()
def get_spreadsheet(key, gid=0):
... (help!) ...
for row in get_spreadsheet('5a3c7f7dcee4b4f'):
cell1, cell2, cell3 = row
...
Run Code Online (Sandbox Code Playgroud)
请保存我的脸.
更新1:我尝试了以下,但没有组合Download()
或Export()
似乎工作.(DocsService
这里的文件)
import gdata.docs.service
import getpass
import os
import tempfile
import csv
def get_csv(file_path):
return csv.reader(file(file_path).readlines())
def get_spreadsheet(key, gid=0):
gd_client = gdata.docs.service.DocsService()
gd_client.email = 'xxxxxxxxx@gmail.com'
gd_client.password = getpass.getpass()
gd_client.ssl = False
gd_client.source = "My Fancy Spreadsheet Downloader"
gd_client.ProgrammaticLogin()
file_path = tempfile.mktemp(suffix='.csv')
uri …
Run Code Online (Sandbox Code Playgroud) 好吧,我想连接一个马达,向左/向右上下移动激光指示器,在墙上画出图案,
我找不到任何人这样做的例子.
有没有人遇到过这个项目的任何帮助/将使用什么编程语言/这将使用什么计算机端口/我将需要制作电路还是我可以购买一个?
在Linux下,如何判断具体进程拥有/正在使用物理内存中的给定地址?
我知道这可能需要编写一个内核模块来访问一些内核数据结构并将结果返回给用户 - 我需要知道它是如何完成的,无论它有多复杂.
algorithm ×1
arduino ×1
google-docs ×1
hash ×1
kernel ×1
linux ×1
linux-kernel ×1
module ×1
primes ×1
python ×1