小编naw*_*rus的帖子

Facebook SDK 3.0回调引发两次

我有以下活动,我正在使用Facebook的LoginButton.onSessionStateChange被多次调用.我有一个asynctask我想在成功登录后运行,一旦完成也会打开一个新活动.现在,这将启动多个异步任务.如何才能找到最终状态,以免发射两次?我查看了所有的例子,Facebook说session.isOpened()应该可以工作,但它仍然会多次触发.

更新:

从onResume中删除会话代码后,它只被调用一次,但是根据https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/#step3我需要OnResume中的代码用于某些情况.

public class LoginActivity extends SherlockActivity {

private static final String TAG = "LoginActivity";

private Context context;
private int statusCode;
private String emailAddress = null;
private String password = null;
private GraphUser fbUser;

private UiLifecycleHelper uiHelper;

private Session.StatusCallback callback = new Session.StatusCallback() {
    @Override
    public void call(Session session, SessionState state,
            Exception exception) {
        onSessionStateChange(session, state, exception);
    }
};

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    context …
Run Code Online (Sandbox Code Playgroud)

android facebook login facebook-android-sdk

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

SQL Server INNER JOIN具有多个关系的多个内部联接

我有以下查询.它工作正常但我需要从另一个名为FB的表中提取BUserName,该表具有与FU表中的UserID相关的UserID字段.这可能吗?

    SELECT TOP 100 
    FF.XID, 
    FF.YID, 
    FF.Title, 
    FF.FileName, 
    FF.FilePath, 
    FU.UserName as FUUserName, 
    FU.UserName as BUserName
    FROM FF 
    INNER JOIN FU ON FU.UserID = FF.UserID 
Run Code Online (Sandbox Code Playgroud)

只是为了澄清.我在FB表中没有UserName列.它确实有FB.UserID,它与FF.UserID有关,这是我想从中提取第二个UserName的地方.因此,在这种关系中,我试图从与FB表中的userID相关的FF.UserID表中拉下用户名.这有意义吗?

sql database sql-server-2008

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

UILabel的numberOfLines在单元格内不起作用

所有,

我是iphone编程的新手.在下面的代码中,我希望文本显示注释标签中的所有文本,但现在它正在截断它.numberofLines也不能正常工作.现在它正在这样做."我的名字是弗雷德,我不死了......"但是我希望它显示全文"我的名字是弗雷德,我还没死,所以让我活着",即使它必须在多行.

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80.0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = nil;

cell = [self.allCells objectForKey:[NSNumber numberWithInt:indexPath.row]];

if(!cell)
{
    cell = [[[NSBundle mainBundle] loadNibNamed:@"UserCell2" owner:nil options:nil] lastObject];
    cell.backgroundColor = [UIColor clearColor];
    cell.accessoryType = UITableViewCellAccessoryNone;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [self.allCells setObject:cell forKey:[NSNumber numberWithInt:indexPath.row]];
}

GSAsynImageView *imgView = (GSAsynImageView*)[cell viewWithTag:1000];
UILabel *lblTitle = (UILabel*)[cell viewWithTag:1001];
UILabel *lblComment = (UILabel*)[cell viewWithTag:1003];
UILabel *lbltime = (UILabel*)[cell viewWithTag:1004];

//lblComment setLineBreakMode:NSLineBreakByWordWrapping];
//lblComment.numberOfLines = 0;
//lblComment.lineBreakMode = UILineBreakModeCharacterWrap; …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview uilabel ios ios6

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

AWS S3 transferutility 上传从不上传,但显示完整且没有错误

我收到了很多没有上传到我的 AWS 存储桶的文件,但下面的代码总是显示完整。有谁知道这是怎么回事?如果上传总是完整的,我应该如何确定上传是否失败?我确实看到了一些有关使用 transferutility.EndUpload 的信息,但我不确定如何使用它。另外我将如何实现重试?将对象状态传递给 BeginUpload?有什么帮助吗?

public class S3Upload
{
    private string awsAccessKeyId = "XXXXXX";
    private string awsSecretAccessKey = "XXXXXX";
    private string bucketName = System.Configuration.ConfigurationManager.AppSettings.Get("BucketName");
    private Amazon.S3.Transfer.TransferUtility transferUtility;
    private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

    public S3Upload()
    {
        // Initialize log4net.
        log4net.Config.XmlConfigurator.Configure();
        this.transferUtility = new Amazon.S3.Transfer.TransferUtility(awsAccessKeyId, awsSecretAccessKey);
        log.Info("S3 instance initiated");

    }

    public void UploadFile(string filePath, string toPath)
    {

        try
        {
            AsyncCallback callback = new AsyncCallback(uploadComplete);

            log.Info("S3 upload started...");
            log.InfoFormat("S3 filePath: {0}", filePath);
            log.InfoFormat("S3 toPath: {0}", toPath);


            var uploadRequest = new Amazon.S3.Transfer.TransferUtilityUploadRequest(); …
Run Code Online (Sandbox Code Playgroud)

c# amazon-s3 amazon-web-services

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