小编Ani*_*nil的帖子

Tweety中转发Twitter状态的转发者

这是对这个问题的后续问题.我想获得转发特定推文的用户的ID.

我试过遵循相同的技术,但我收到一个错误.这是代码:

import tweepy

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)

api = tweepy.API(auth)

firstTweet = api.user_timeline("github")[0]
print firstTweet.text
print firstTweet.id
results = api.retweeted_by(firstTweet.id) 
print results
Run Code Online (Sandbox Code Playgroud)

这将返回第一条推文以及推文ID.然后它给我以下错误:

    Traceback (most recent call last):
  File "twitter_test.py", line 21, in <module>
    results = api.retweeted_by("357237988863913984") 
  File "/usr/local/lib/python2.7/dist-packages/tweepy-2.1-py2.7.egg/tweepy/binder.py", line 197, in _call
    return method.execute()
  File "/usr/local/lib/python2.7/dist-packages/tweepy-2.1-py2.7.egg/tweepy/binder.py", line 173, in execute
    raise TweepError(error_msg, resp)
tweepy.error.TweepError: [{u'message': u'Sorry, that page does not exist', u'code': 34}]
Run Code Online (Sandbox Code Playgroud)

python twitter tweepy

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

C#从套接字接收数据并将其放入字符串中?

我有一个套接字服务器,正在尝试从客户端接收一个字符串。

客户端是完美的,当我使用它时

Socket s = myList.AcceptSocket();
Console.WriteLine("Connection accepted from " + s.RemoteEndPoint);

byte[] b = new byte[100];
int k = s.Receive(b);
Console.WriteLine(k);
Console.WriteLine("Recieved...");
for (int i = 0; i < k; i++) {
    Console.Write(Convert.ToChar(b[i]));
    ASCIIEncoding asen = new ASCIIEncoding();
    s.Send(asen.GetBytes("The string was recieved by the server."));
}
Run Code Online (Sandbox Code Playgroud)

一切正常,我在控制台中得到了我的字符串。

但是我现在如何将我的接收放入一个字符串中,以便我可以在开关盒中使用它?

像这样:

string action = Convert.ToChar(b[i]);
Run Code Online (Sandbox Code Playgroud)

错误:

Name i 不在当前上下文中。这是我收到的唯一错误消息。

c# sockets

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

UICollectionView框架更改

我在SO上看到的答案似乎都没有回答这个问题.我正试图改变一个框架UICollectionView.记录时会显示帧更改,但它不会物理更改帧.我没有任何约束.只是改变框架.就这样.我正在创建一个不可滚动的UICollectionView.

    _testStringOne = @"Test String";
    _tagOne = [_testStringOne boundingRectWithSize:CGSizeMake(242.0f, 900.0f) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:15.0f]} context:nil];

    _testStringTwo = @"Another Test String";
    _tagTwo = [_testStringTwo boundingRectWithSize:CGSizeMake(242.0f, 900.0f) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:15.0f]} context:nil];

    CGRect collectionFrame = self.collectionView.frame;
    if (_tagOne.origin.x + _tagOne.size.width + _tagTwo.origin.x + _tagTwo.size.width > 242.0f)
    {
        collectionFrame.size.height = 62.0f;
        sectionCount = 2;
        itemCount = 1;
    }
    else
    {
        collectionFrame.size.height = 31.0f;
        sectionCount = 1;
        itemCount = 2;
    }
    self.collectionView.frame = collectionFrame;
    [self.collectionView reloadData];
Run Code Online (Sandbox Code Playgroud)

iphone ios uicollectionview

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

警告:错误的管道:没有元素"x264enc"

我过去几天一直试图让这个运行起来.我有一个需要x264enc的gstreamer命令.我正在运行Mac我似乎无法安装x264开发库.我安装gst-plugins-bad但没有帮助.我在论坛中读到我需要先安装x264库才能安装gst-plugins-bad

我也尝试了VideoLAN的http://www.videolan.org/developers/x264.html这也没有帮助.我不知道我错过了什么.如果是Linux,我可以安装x264-devel软件包.但我似乎无法在Mac El Capitan上找到替代方案.

我得到的错误是:

警告:错误的管道:没有元素"x264enc"

请帮忙.

macos gstreamer gstreamer-1.0

3
推荐指数
2
解决办法
2236
查看次数

NSMutableArray addOject重写数据

我知道基于同一主题有很多问题.但似乎没有人解决我的问题.

我有一个NSMutableArray _buttonArray和一个NSMutableDictionary _singleBtn.

当我按下按钮时,我将字典添加到数组中.但阵列正在被覆盖.

[_singleBtn setObject:scanBarCodeButton.titleLabel.text forKey:@"text"];
[_singleBtn setObject:NSStringFromCGRect(scanBarCodeButton.frame) forKey:@"frame"];
[_buttonArray addObject:_singleBtn];
Run Code Online (Sandbox Code Playgroud)

在第一次迭代中,我得到以下内容:

{
    frame = "{{20, 40}, {50, 40}}";
    text = abc;
}
Run Code Online (Sandbox Code Playgroud)

现在,如果我添加文本"xyz",它会给我:

{
    frame = "{{20, 90}, {80, 40}}";
    text = xyz;
},
    {
    frame = "{{20, 90}, {80, 40}}";
    text = xyz;
}
Run Code Online (Sandbox Code Playgroud)

我已经完成了数组和字典的分配 viewDidLoad

iphone objective-c ios

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