归档 2015年4月

[LeetCode]Count Primes

题目描述:

Count the number of prime numbers less than a non-negative number, n

Hint: The number n could be in the order of 100,000 to 5,000,000.

References:

How Many Primes Are There? (https://primes.utm.edu/howmany.html)

Sieve of Eratosthenes (http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)

题目大意:

统计小于非负整数n的素数的个数

提示:n的范围是100,000到5,000,000 ...

继续阅读

SAE新浪微博Python SDK CERTIFICATE_VERIFY_FAILED解决方法

一个搭建在SAE上的Django应用,使用新浪微博提供的Python SDK已经稳定运行一年有余,但最近开始持续出现微博认证失败的状况。

摘录微博Python SDK的错误提示如下所示:

ERROR:django.request:Internal Server Error: /weibo/auth/
Traceback (most recent call last):
  File "/usr/local/sae/python/3rd/django-1.5/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/data1/www/htdocs/838/app/1/mysite/views.py", line 42, in auth
    res = weibo_util.keep_user(code,api,redirect_uri)
  File "/data1/www/htdocs/838/app/1/util/weibo_util.py", line 86, in keep_user
    r ...

继续阅读

每日归档

上个月

下个月

归档