小编Ben*_*ler的帖子

Python AttributeError:'module'对象没有属性'SSL_ST_INIT'

我的Python脚本失败了:

Traceback (most recent call last):
  File "./inspect_sheet.py", line 21, in <module>
    main()
  File "./inspect_sheet.py", line 12, in main
    workbook_name=workbook_name,
  File "./google_sheets.py", line 56, in __init__
    self.login()
  File "./google_sheets.py", line 46, in login
    self.client = gspread.authorize(credentials)
  File "/usr/local/lib/python2.7/site-packages/gspread/client.py", line 335, in authorize
    client.login()
  File "/usr/local/lib/python2.7/site-packages/gspread/client.py", line 98, in login
    self.auth.refresh(http)
  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 598, in refresh
    self._refresh(http.request)
  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 769, in _refresh
    self._do_refresh_request(http_request)
  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 795, in _do_refresh_request
    body = self._generate_refresh_request_body()
  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 1425, in _generate_refresh_request_body
    assertion …
Run Code Online (Sandbox Code Playgroud)

python openssl pyopenssl

72
推荐指数
8
解决办法
7万
查看次数

离子闪屏隐藏而不褪色

在我的第一个Ionic项目上工作.

我对启动画面没有任何问题 - 我可以使用CordovaSplashscreen插件并告诉它隐藏()当相关的承诺解决; 我也可以注释掉隐藏,而只是依赖于在config.xml中使用AutoHideSplashScreen,并且在SplashScreenDelay之后让启动画面自动隐藏.

(我列出这些事情,工作,所以很显然,我的问题是不是几十离子和科尔多瓦/的重复PhoneGap的相关闪屏的问题.)

我的问题是,无论我尝试什么 - ios,android,模拟器,真实设备,使用CordovaSplashscreen隐藏()或不,AutoHideSplashScreen设置为true,AutoHideSplashScreen设置为false等 - 我无法得到启发屏幕在消失时消失.

无论config.xml设置,splash screen hide()调用或不调用,仿真或设备,ios或我使用的是什么组合,FadeSplashScreen似乎都没有任何影响.

我当前的config.xml设置,虽然这并没有提供我尝试过的十几个这些值的完整描述:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.yourkids381244" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
... other code at same level of hierarchy omitted ... 
  <preference name="SplashScreen" value="screen"/>
  <preference name="AutoHideSplashScreen" value="false"/>
  <preference name="auto-hide-splash-screen" value="false"/>
  <preference name="ShowSplashScreenSpinner" value="false"/>
  <preference name="SplashScreenDelay" value="10000"/>
  <preference name="FadeSplashScreen" value="true"/>
  <preference name="FadeSplashScreenDuration" value="3.0"/>
... other code at same level of hierarchy omitted ... 
</widget>
Run Code Online (Sandbox Code Playgroud)

来自我的app.js路由的代码执行hide(),但是,这似乎不是问题的一部分; 它工作,我通过注释hide()行并将AutoHideSplashScreen设置为false来确认,这成功地导致启动屏幕永远不会隐藏; 但是从那个状态,我无法隐藏淡出闪屏,无论是通过取消注释hide()行来隐藏使用CordovaSplashscreen,还是将AutoHideSplashScreen设置为true.

  .state('app.main', {
    url: "/main",
    views: {
      'menuContent': …
Run Code Online (Sandbox Code Playgroud)

splash-screen cordova ionic-framework cordova-plugins ionic

11
推荐指数
1
解决办法
6117
查看次数

模板文件不在Rails 4中呈现form_for的结果

我正在重新创建此rails教程中的步骤:http: //www.youtube.com/watch?v = tUH1hewXnC0

如果您寻求7:35,您将看到用户创建的form_for块.当我添加该代码并在浏览器中查看页面时,该页面渲染得很好,但是表单应该没有html - 甚至不是空标签.我已经确认这不是丢失迁移或浏览器缓存的问题.

我已经简化了问题,现在我的show.html.erb模板文件只是:

<% form_for @post do |f| %>
    testing
    <% debugger %>
<%  end %>

<% for i in 0..5 %>
    <%= i %>
<% end %>
Run Code Online (Sandbox Code Playgroud)

(第二个块只是为了确保渲染工作)

渲染的html是:

... bunch of header stuff here ...
<body>

0
1
2
3
4
5

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

"测试"不会作为HTML的一部分呈现.

我输入了调试器行,所以我可以使用调试器gem和rails server --debugger.使用它让我到了这一点:

[196, 205] in /Users/Ben/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/helpers/capture_helper.rb
   196            buf = ActionView::OutputBuffer.new
   197            buf.force_encoding(output_buffer.encoding) if output_buffer
   198          end
   199          self.output_buffer, old_buffer = buf, output_buffer
   200          yield
=> …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails form-for ruby-on-rails-4

7
推荐指数
1
解决办法
2557
查看次数

YouTube iFrame API行为不一致/不确定

我无法通过iframe/HTML5 API隔离我的JavaScript代码中的错误来控制Youtube视频.

我回到主要文档页面上的演示代码:

https://developers.google.com/youtube/iframe_api_reference

...令我惊讶的是,即使我从那里使用演示代码而且没有改变任何东西,我也会看到相同的不一致行为.

行为是在某些时候,当我加载此页面时,播放器自动播放(这是代码的意图),有时则不然.它总是在加载方面成功.此外,玩家似乎永远不会在6秒后停止,与评论所说的相反.

断点验证至少部分问题onPlayerReady()并不总是被调用.当我设置断点时onPlayerReady(),通常不会到达,并且只达到玩家继续成功进行自动播放的次数.

当然,这种行为可能取决于我的互联网连接的速度和可靠性,这是有线的,否则看起来相当快.我刚刚测试了它--24 Mbps,看起来非常一致.

如果我对html进行表面的更改,那么有时会提示页面加载到自动播放,但并非总是如此.有时我连续5次重新加载,没有自动播放或onPlayerReady断点被击中,然后第6次这样做,那时它会自动播放罚款.

我在Mac OS 10.8.4上使用Chrome v30.0.1599.101.

我知道代码处于测试阶段且处于不稳定状态,并且不应该是生产级别,但我希望有一些我可以尝试的东西.

这是我正在使用的代码,仅供参考,以防上面的api参考页面上发布的代码发生变化.再说一遍,我不会改变一个角色.

<!DOCTYPE html>
<html>
  <body>
    <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
    <div id="player"></div>

    <script>
      // 2. This code loads the IFrame Player API code asynchronously.
      var tag = document.createElement('script');

      tag.src = "https://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. This function creates an <iframe> (and YouTube player)
      //    after the API …
Run Code Online (Sandbox Code Playgroud)

javascript iframe jquery html5 youtube-api

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

Parse:Promise.When有许多承诺吗?

解析文档(https://www.parse.com/docs/js/symbols/Parse.Promise.html#.when)解释说,在使用Parse.Promise.when时,指定一个promises数组是犹太的:

var p1 = Parse.Promise.as(1);
var p2 = Parse.Promise.as(2);
var p3 = Parse.Promise.as(3);

var promises = [p1, p2, p3];
Parse.Promise.when(promises).then(function(r1, r2, r3) {
  console.log(r1);  // prints 1
  console.log(r2);  // prints 2
  console.log(r3);  // prints 3
});
Run Code Online (Sandbox Code Playgroud)

......很甜蜜!

但是,你真的必须在then()函数中列出每个promise响应吗?如果你有一系列未知大小的承诺,而且不是很干,那就不太可行了!

我可以这样做吗?

Parse.Promise.when(promises).then(function(responses) {
  console.log(responses[0]);  // prints 1
  console.log(responses[1]);  // prints 2
  console.log(responses[2]);  // prints 3
});
Run Code Online (Sandbox Code Playgroud)

javascript promise parse-platform

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

嵌套"触摸"块有什么作用?

制作一个Scratch平台游戏,我发现这不符合我的要求:

在此输入图像描述

...因为它似乎没有为我的节目以正确的节奏运行.

但是,这确实有效:

在此输入图像描述

......我注意到它被用于平台游戏,例如Sushi Platformer.

有谁知道这些嵌套触摸块实际上做了什么?

更新:

@towerofnix是对的...我做了一个实验项目,在https://scratch.mit.edu/projects/118349555/#player

...具有以下实验选项:

在此输入图像描述

结果:

控制:平台检测有效,但是上下抖动太多

Experiment1(@towerofnix):有效,没有抖动!

实验2:不起作用,企鹅有时会下楼

实验3:有效,因为它相当于Experiment1!

mit-scratch

3
推荐指数
1
解决办法
132
查看次数

如何使用 Sendgrid 搜索过去发送的电子邮件?

正如 Sendgrid 的文档所明确的那样,他们的 Web GUI 活动页面只能搜索过去 7 天的内容。

如何搜索更远的过去的活动?

Web API 文档在这里,但我找不到任何关于简单搜索已发送电子邮件信息的信息。我所看到的只是用于查看特定类别的电子邮件的各种命运的端点,例如阻止、退回、无效电子邮件和“过滤器”,它们看起来像操作而不是过滤器。

一定可以找到有关某些特定已发送电子邮件的信息,对吧?

sendgrid sendgrid-api-v2

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

我应该使用XIB或故事板吗?

我是一个非常新的iOS开发人员.我喜欢AutoLayout和程序化的UI元素.使用NSLayoutConstraints对我来说非常有意义,调整它们的值有意义的地方在代码中.

然而,我在线创建iOS UI元素的几乎所有信息都使用XIB或Storyboard.有很多关于何时使用其中一个的讨论,包括这里的SO,但我似乎无法找到任何关于为什么某人可能想要跳过它们而只是在代码中完成所有操作的内容.

我在这里缺少一些基本的东西吗?

例如,这是我的代码片段.如果没有XIB或故事板,我不能这样做吗?

    UIView *overlayView = [[UIView alloc] initWithFrame:[self getScreenFrameForCurrentOrientation]];
    overlayView.opaque = NO;
    mHighlightImagePicker.cameraOverlayView = overlayView;

    CGSize screenSize = [[UIScreen mainScreen] bounds].size;        
    float cameraAspectRatio = 4.0 / 3.0;
    float imageWidth = floorf(screenSize.width * cameraAspectRatio);
    float scale = ceilf(((screenSize.height - 90) / imageWidth) * 100.0) / 100.0;
    mHighlightImagePicker.cameraViewTransform = CGAffineTransformMakeScale(scale, scale);

    mCameraToolBar=[[UIImageView alloc] init];
    mCameraToolBar.image =[UIImage imageNamed:@"review_bottom_bar"];
    mCameraToolBar.userInteractionEnabled = YES;
    mCameraToolBar.hidden = NO;        
    [mCameraToolBar setTranslatesAutoresizingMaskIntoConstraints:NO];
    [overlayView addConstraint:
     [NSLayoutConstraint constraintWithItem:mCameraToolBar
                                  attribute:NSLayoutAttributeTop
                                  relatedBy:NSLayoutRelationEqual
                                     toItem:overlayView
                                  attribute:NSLayoutAttributeBottom
                                 multiplier:1
                                   constant:-70]];
    [overlayView addConstraint:
     [NSLayoutConstraint constraintWithItem:mCameraToolBar …
Run Code Online (Sandbox Code Playgroud)

ios ios6 nslayoutconstraint

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