小编Atm*_*tma的帖子

在哪里可以找到 Google 协作平台的自定义主题

我正在尝试为 Google 协作平台网站创建自定义背景主题。不久前,我做了一些谷歌搜索,发现了一些带有背景图像的网站,以及如何更改表格尺寸以创建 google 网站 make shift 主题的说明。我再也找不到任何这些主题。有谁知道我在哪里可以找到这些模板或如何创建自己的主题的说明?

themes google-sites

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

如何从android http get访问本地端口8080 url

我有一个位于本地tomcat实例上的restful Web服务.

我正在尝试通过我的应用程序中的get访问该URL但是我收到错误:host未解析

我尝试从我的Android模拟器浏览器访问此URL以确认那里的连接,我也无法得到它们.屏幕上出现一条警告:"下载125562.bin需要一张SD卡"

我没有在我的网址中使用localhost,但看起来像:

http://192.168.1.2:8080/service/0/12345

它直接返回json

有谁知道为什么我无法在Android模拟器中访问它?我可以通过我的电脑浏览器和iPhone成功点击同一地址,它会带回json.

android是否处理其他端口与标准端口80不同?问题此网址没有扩展名吗?

port android tomcat get

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

在android中加载外部数据的最佳方法

在android中加载外部数据的最佳方法是什么?

目前,这就是我所做的:

  1. 创建RESTful Web服务,返回JSON对象数组(在服务器上)
  2. 在android中调用HTTPGet并使用服务
  3. 通过响应JSON解析
  4. 使用GSON将响应直接解析为对象数组
  5. 根据需要使用对象数组

这是Android文档方面的最佳方法吗?

android web-services

5
推荐指数
1
解决办法
4738
查看次数

使用简单的日期格式转换时Java日期不会保留毫秒数

我正在尝试将以下字符串"2012-04-13 04:08:42.794"转换为日期类型:

    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");

    Date convertedDate;
    try {
        convertedDate = dateFormat.parse(dateString);
        System.out.println(" in utils: "+convertedDate.toString());
    } catch (ParseException e) {
        e.printStackTrace();
        return null;
    }


  //----------------- i think this is the problem
java.sql.Date sqlDate = new java.sql.Date(convertedDate.getTime());
        System.out.println("sql: "+sqlDate.toString());
        return sqlDate;
Run Code Online (Sandbox Code Playgroud)

但这是打印以下内容:

in utils: Fri Apr 13 04:08:42 PDT 2012
Run Code Online (Sandbox Code Playgroud)

我怎样才能得到这个日期以保持毫秒?

java date simpledateformat

5
推荐指数
1
解决办法
6383
查看次数

启用allow_url_fopen时,php file_get_contents返回null

我收到警告消息:file_get_contents无法打开流权限被拒绝

我在php.ini文件中将all_url_open设置为on.

我的php文件在我的apache服务器中,它试图从同一台机器上的tomcat服务器访问一个url(返回JSON).

php文件中的代码如下所示:

  $srcURL = 'http://samemachine:8080/returnjson/';

  $results = file_get_contents($srcURL);
Run Code Online (Sandbox Code Playgroud)

我也尝试过curl,它什么都不返回,也没有打到tomcat服务器:

    function curl($url){
        $ch = curl_init();

        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: en-us'));
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        $data = curl_exec($ch);

        curl_close($ch);
        return $data;
    }
Run Code Online (Sandbox Code Playgroud)

为什么拒绝许可?

php apache tomcat file-get-contents

5
推荐指数
1
解决办法
4868
查看次数

如何在对 google place api 的单个请求中对多个位置进行附近搜索

我想使用 google place api 附近的搜索来获取多个特定位置。使用 NAME 参数查询多个位置的格式是什么?该 API 显示单个位置的以下内容:

     https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=AddYourOwnKeyHere
Run Code Online (Sandbox Code Playgroud)

我在文档中读到,您可以通过附加 | 来指定多种类型。。

如何在 google place api 附近搜索中指定多个名称参数?

google-maps google-places-api google-places

5
推荐指数
1
解决办法
4267
查看次数

如何在Django中使用主键对URL进行反向操作

我的应用程序具有以下网址条目:

url(r'^(?P<pk>\d+)/(?P<action>add|edit)/type/$', 'customer.views.edit', name='customer-edit'),
Run Code Online (Sandbox Code Playgroud)

我想反向发布到该网址。当我执行以下操作时,出现错误NoReverseMatch:

self.client.post(reverse('customer-edit'), {'something:'something'}, follow=True)
Run Code Online (Sandbox Code Playgroud)

这是完整的错误:NoReverseMatch:找不到带有参数“()”和关键字参数“ {}”的“ customer-edit”。

我需要反向传递args或kwargs吗?如果是这样,他们将如何匹配上面的网址?

python regex django http-post django-urls

5
推荐指数
1
解决办法
2439
查看次数

保存在 django 中后,对象的 id 为 None

我正在循环遍历对象列表并保存。我需要保存后新生成的 id 或指针 id,但它是 None。

这是我的代码:

for category in category_list:
      saved_category = category.save()
      print saved_category.parentCategory_ptr_id      
      print saved_category.id
Run Code Online (Sandbox Code Playgroud)

这会在例程运行后保存我的对象,但同样不会在这一行给我 id。

这是我的模型:

class ParentCategory(models.Model):
    name = models.CharField(max_length=255)

class Category(ParentCategory):
    description = models.CharField(max_length=255)
Run Code Online (Sandbox Code Playgroud)

类别列表的创建方式如下:

category_list = []
    for row in value_list:
        category = Category(description=row.description)
        category_list.append(category)


 return category_list
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

django django-models django-orm django-inheritance multi-table-inheritance

5
推荐指数
1
解决办法
5960
查看次数

将 http 转发到 https 在 iOS Safari 上不起作用

我使用 .htaccess 文件将我的 http 流量转发到 https,如下所示:

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Run Code Online (Sandbox Code Playgroud)

这适用于除 iOS Safari 之外的任何地方。我在iOS safari上访问http地址时,浏览器挂了,因为http无处可去。

如何在 iOS Safari 上将 http 转发到 https?

apache safari .htaccess https http-status-code-301

5
推荐指数
1
解决办法
3284
查看次数

如何从命令行运行django python文件

我有一个简单的python文件,我最终想从chron运行.

它看起来像这样:

from customers.models import Customer, NotificationLogEntry


def hello():
    customers =  Customer.objects.all()
    for c in customers:
        log_entry = NotificationLogEntry(
                                          customer=c,
                                          sent=True,
                                          notification_type=0,
                                          notification_media_type=0,
                                          )
        log_entry.save()


if __name__ == '__main__':
    hello()
Run Code Online (Sandbox Code Playgroud)

当我运行这个:

python notifications.py
Run Code Online (Sandbox Code Playgroud)

我收到导入错误:

Traceback (most recent call last):
  File "notifications.py", line 1, in <module>
    from customers.models import Customer, NotificationLogEntry
ImportError: No module named customers.models
Run Code Online (Sandbox Code Playgroud)

这个模块存在,我在我的django应用程序中没有任何问题地调用它.为什么我在应用程序之外收到此错误?

python django

4
推荐指数
2
解决办法
2331
查看次数